diff --git a/src/xpra/platform/win32/gl_context.py b/src/xpra/platform/win32/gl_context.py index d005715f57..3f6b034e5e 100644 --- a/src/xpra/platform/win32/gl_context.py +++ b/src/xpra/platform/win32/gl_context.py @@ -7,7 +7,7 @@ log = Logger("opengl") from ctypes import sizeof, byref, FormatError -from xpra.os_util import PYTHON2 +from xpra.os_util import PYTHON2, PYTHON3 from xpra.client.gl.gl_check import check_PyOpenGL_support from xpra.platform.win32.constants import CS_OWNDC, CS_HREDRAW, CS_VREDRAW, COLOR_WINDOW, WS_OVERLAPPED, WS_SYSMENU, CW_USEDEFAULT from xpra.platform.win32.common import ( @@ -18,6 +18,16 @@ DOUBLE_BUFFERED = True +if PYTHON3: + from ctypes import CDLL, pythonapi, c_void_p, py_object + PyCapsule_GetPointer = pythonapi.PyCapsule_GetPointer + PyCapsule_GetPointer.restype = c_void_p + PyCapsule_GetPointer.argtypes = [py_object] + log("PyCapsute_GetPointer=%s", PyCapsule_GetPointer) + gdkdll = CDLL("libgdk-3-0.dll") + log("gdkdll=%s", gdkdll) + + def DefWndProc(hwnd, msg, wParam, lParam): return DefWindowProcA(hwnd, msg, wParam, lParam) @@ -94,7 +104,9 @@ def check_support(self, force_enable=False): try: self.context = self.create_wgl_context(self.hwnd) with WGLWindowContext(self.hwnd, self.hdc, self.context): - return check_PyOpenGL_support(force_enable) + props = check_PyOpenGL_support(force_enable) + props["display_mode"] = [["SINGLE","DOUBLE"][int(DOUBLE_BUFFERED)], ] #, "ALPHA"] + return props finally: hwnd = self.hwnd self.destroy() @@ -114,13 +126,6 @@ def get_paint_context(self, gdk_window): 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)