Skip to content

Commit

Permalink
add xid support to gtk3:
Browse files Browse the repository at this point in the history
* import magic in gdk_display_source
* abstract xid calls via gobject_compat wrapper

git-svn-id: https://xpra.org/svn/Xpra/trunk@6207 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 27, 2014
1 parent c2d9eb1 commit 09de0f6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/xpra/client/gtk_base/gtk_client_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ def set_workspace(self):
event_mask = SubstructureNotifyMask | SubstructureRedirectMask

def send():
root_xid = root.xid
xwin = self.gdk_window().xid
from xpra.gtk_common.gobject_compat import get_xid
root_xid = get_xid(root)
xwin = get_xid(self.gdk_window())
X11Window.sendClientMessage(root_xid, xwin, False, event_mask, "_NET_WM_DESKTOP",
workspace, CurrentTime, 0, 0, 0)
trap.call_synced(send)
Expand Down
6 changes: 6 additions & 0 deletions src/xpra/gtk_common/gobject_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def _try_import(import_method_gtk3, import_method_gtk2):
return import_method_gtk2()


def get_xid(window):
if is_gtk3():
return window.get_xid()
else:
return window.xid


def import_gobject2():
import gobject #@UnusedImport
Expand Down
3 changes: 2 additions & 1 deletion src/xpra/gtk_common/gtk_view_clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from xpra.platform.paths import get_icon
from xpra.platform import init
from xpra.platform.features import CLIPBOARDS
from xpra.gtk_common.gobject_compat import get_xid


class ClipboardInstance(object):
Expand Down Expand Up @@ -207,7 +208,7 @@ def __init__(self):
if icon:
self.window.set_icon(icon)
try:
self.add_event("ALL", "window=%s, xid=%#x" % (self.window, self.window.get_window().xid))
self.add_event("ALL", "window=%s, xid=%#x" % (self.window, get_xid(self.window.get_window())))
except:
self.add_event("ALL", "window=%s" % self.window)

Expand Down
3 changes: 2 additions & 1 deletion src/xpra/platform/xposix/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
log = Logger("posix")
eventlog = Logger("events", "posix")

from xpra.gtk_common.gobject_compat import get_xid
try:
from xpra.gtk_common.error import trap, XError
from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings #@UnresolvedImport
Expand Down Expand Up @@ -49,7 +50,7 @@ def system_bell(window, device, percent, pitch, duration, bell_class, bell_id, b
if device_bell is None:
return False
try:
trap.call_synced(device_bell, window.xid, device, bell_class, bell_id, percent, bell_name)
trap.call_synced(device_bell, get_xid(window), device, bell_class, bell_id, percent, bell_name)
return True
except XError, e:
log.error("error using device_bell: %s, switching native X11 bell support off", e)
Expand Down
3 changes: 3 additions & 0 deletions src/xpra/x11/gtk3_x11/gdk_display_source.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ cdef extern from "gtk-3.0/gdk/gdkx.h":
const char *gdk_display_get_name(GdkDisplay *display)


#this import magic will make the window.get_xid() available!
from gi.repository import GdkX11

def init_gdk_display_source():
cdef GdkDisplay* gdk_display
cdef Display * x11_display
Expand Down

0 comments on commit 09de0f6

Please sign in to comment.