Skip to content

Commit

Permalink
ugly workaround to get the window handle on win32 with GTK3
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@16993 3bb7dfac-3a0b-4e04-842a-767bc560f471
totaam committed Sep 29, 2017
1 parent 7808d14 commit eed27ba
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/xpra/platform/win32/gl_context.py
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
log = Logger("opengl")

from ctypes import sizeof, byref
from xpra.os_util import PYTHON2
from xpra.client.gl.gl_check import check_PyOpenGL_support
from xpra.platform.win32.common import GetDC, SwapBuffers, ChoosePixelFormat, DescribePixelFormat, SetPixelFormat, BeginPaint, EndPaint, GetDesktopWindow
from xpra.platform.win32.glwin32 import wglCreateContext, wglMakeCurrent, wglDeleteContext , PIXELFORMATDESCRIPTOR, PFD_TYPE_RGBA, PFD_DRAW_TO_WINDOW, PFD_SUPPORT_OPENGL, PFD_DOUBLEBUFFER, PFD_DEPTH_DONTCARE, PFD_MAIN_PLANE, PAINTSTRUCT
@@ -72,7 +73,20 @@ def is_double_buffered(self):
return DOUBLE_BUFFERED #self.pixel_format_props.get("double-buffered", False)

def get_paint_context(self, gdk_window):
hwnd = gdk_window.handle
if PYTHON2:
hwnd = gdk_window.handle
else:
from ctypes import CDLL, pythonapi, c_void_p, py_object
gdkdll = CDLL("libgdk-3-0.dll")
log("gdkdll=%s", gdkdll)
PyCapsule_GetPointer = pythonapi.PyCapsule_GetPointer
PyCapsule_GetPointer.restype = c_void_p
PyCapsule_GetPointer.argtypes = [py_object]
log("PyCapsute_GetPointer=%s", PyCapsule_GetPointer)
gpointer = PyCapsule_GetPointer(gdk_window.__gpointer__, None)
log("gpointer=%s", gpointer)
hwnd = gdkdll.gdk_win32_window_get_handle(gpointer)
log("hwnd=%s", hwnd)
if self.hwnd!=hwnd:
#(this shouldn't happen)
#just make sure we don't keep using a context for a different handle:

0 comments on commit eed27ba

Please sign in to comment.