-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add gtk3 display source so we can use the X11 bindings with gtk3 code
git-svn-id: https://xpra.org/svn/Xpra/trunk@6201 3bb7dfac-3a0b-4e04-842a-767bc560f471
- Loading branch information
Showing
4 changed files
with
81 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2013 Antoine Martin <[email protected]> | ||
# Copyright (C) 2013, 2014 Antoine Martin <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
||
from xpra.log import Logger | ||
log = Logger("gtk", "client") | ||
|
||
try: | ||
from xpra.x11.gtk3_x11 import gdk_display_source | ||
except Exception, e: | ||
log.warn("cannot import gtk3_x11 display source", exc_info=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2014 Antoine Martin <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This file is part of Xpra. | ||
# Copyright (C) 2014 Antoine Martin <[email protected]> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
||
|
||
# This class simply hooks the current GDK display into | ||
# the core X11 bindings. | ||
|
||
from xpra.x11.bindings.display_source cimport set_display | ||
from xpra.x11.bindings.display_source import set_display_name | ||
|
||
|
||
################################### | ||
# Headers, python magic | ||
################################### | ||
cdef extern from "X11/Xlib.h": | ||
ctypedef struct Display: | ||
pass | ||
|
||
cdef extern from "gtk-3.0/gdk/gdk.h": | ||
pass | ||
|
||
cdef extern from "gtk-3.0/gdk/gdktypes.h": | ||
ctypedef struct GdkDisplay: | ||
pass | ||
|
||
cdef extern from "gtk-3.0/gdk/gdkdisplay.h": | ||
GdkDisplay *gdk_display_get_default() | ||
|
||
cdef extern from "gtk-3.0/gdk/gdkx.h": | ||
Display *gdk_x11_display_get_xdisplay(GdkDisplay *display) | ||
const char *gdk_display_get_name(GdkDisplay *display) | ||
|
||
|
||
def init_gdk_display_source(): | ||
cdef GdkDisplay* gdk_display | ||
cdef Display * x11_display | ||
from gi.repository import Gdk | ||
#this next line actually ensures Gdk is initialized, somehow | ||
root = Gdk.get_default_root_window() | ||
assert root is not None, "could not get the default root window" | ||
#now we can get a display: | ||
gdk_display = gdk_display_get_default() | ||
x11_display = gdk_x11_display_get_xdisplay(gdk_display) | ||
set_display(x11_display) | ||
set_display_name(gdk_display_get_name(gdk_display)) | ||
|
||
init_gdk_display_source() |