diff --git a/src/xpra/sound/pulseaudio/pulseaudio_common_util.py b/src/xpra/sound/pulseaudio/pulseaudio_common_util.py index f73bbacc62..753426b79e 100755 --- a/src/xpra/sound/pulseaudio/pulseaudio_common_util.py +++ b/src/xpra/sound/pulseaudio/pulseaudio_common_util.py @@ -21,7 +21,7 @@ def get_x11_property(atom_name): try: from xpra.gtk_common.error import xswallow from xpra.x11.bindings.posix_display_source import X11DisplayContext #@UnresolvedImport - from xpra.x11.bindings.window_bindings import X11WindowBindings + from xpra.x11.bindings.window_bindings import X11WindowBindingsInstance except ImportError as e: log("get_x11_property(%s)", atom_name, exc_info=True) log.error("Error: unable to query X11 property '%s':", atom_name) @@ -30,7 +30,7 @@ def get_x11_property(atom_name): try: with X11DisplayContext(display) as dc: with xswallow: - X11Window = X11WindowBindings() + X11Window = X11WindowBindingsInstance() root = X11Window.getDefaultRootWindow() log("getDefaultRootWindow()=%#x", root) try: diff --git a/src/xpra/x11/bindings/core_bindings.pxd b/src/xpra/x11/bindings/core_bindings.pxd index 78baa1dd67..83548a1a1b 100644 --- a/src/xpra/x11/bindings/core_bindings.pxd +++ b/src/xpra/x11/bindings/core_bindings.pxd @@ -12,7 +12,7 @@ cdef extern from "X11/Xlib.h": pass ctypedef CARD32 Atom -cdef class _X11CoreBindings: +cdef class X11CoreBindingsInstance: cdef Display * display cdef char * display_name cdef Atom xatom(self, str_or_int) diff --git a/src/xpra/x11/bindings/core_bindings.pyx b/src/xpra/x11/bindings/core_bindings.pyx index 913fa462c7..d3dfa74302 100644 --- a/src/xpra/x11/bindings/core_bindings.pyx +++ b/src/xpra/x11/bindings/core_bindings.pyx @@ -54,11 +54,11 @@ cdef extern from "X11/Xlib.h": from xpra.x11.bindings.display_source cimport get_display from xpra.x11.bindings.display_source import get_display_name -cdef _X11CoreBindings singleton = None +cdef X11CoreBindingsInstance singleton = None def X11CoreBindings(): global singleton if singleton is None: - singleton = _X11CoreBindings() + singleton = X11CoreBindingsInstance() return singleton #for debugging, we can hook this function which will log the caller: @@ -77,7 +77,7 @@ def set_context_check(fn): context_check = fn -cdef class _X11CoreBindings: +cdef class X11CoreBindingsInstance: def __cinit__(self): assert is_X11(), "cannot load X11 bindings with wayland under python3 / GTK3" diff --git a/src/xpra/x11/bindings/keyboard_bindings.pyx b/src/xpra/x11/bindings/keyboard_bindings.pyx index 0f54313142..2fe27be2ac 100644 --- a/src/xpra/x11/bindings/keyboard_bindings.pyx +++ b/src/xpra/x11/bindings/keyboard_bindings.pyx @@ -241,16 +241,16 @@ cdef s(const char *v): # to the original C xmodmap code -from xpra.x11.bindings.core_bindings cimport _X11CoreBindings +from xpra.x11.bindings.core_bindings cimport X11CoreBindingsInstance -cdef _X11KeyboardBindings singleton = None +cdef X11KeyboardBindingsInstance singleton = None def X11KeyboardBindings(): global singleton if singleton is None: - singleton = _X11KeyboardBindings() + singleton = X11KeyboardBindingsInstance() return singleton -cdef class _X11KeyboardBindings(_X11CoreBindings): +cdef class X11KeyboardBindingsInstance(X11CoreBindingsInstance): cdef XModifierKeymap* work_keymap cdef int min_keycode diff --git a/src/xpra/x11/bindings/posix_display_source.pyx b/src/xpra/x11/bindings/posix_display_source.pyx index bbadd11c4a..2740a55584 100644 --- a/src/xpra/x11/bindings/posix_display_source.pyx +++ b/src/xpra/x11/bindings/posix_display_source.pyx @@ -1,6 +1,6 @@ # This file is part of Xpra. # Copyright (C) 2008, 2009 Nathaniel Smith -# Copyright (C) 2010-2018 Antoine Martin +# Copyright (C) 2010-2019 Antoine Martin # Xpra is released under the terms of the GNU GPL v2, or, at your option, any # later version. See the file COPYING for details. @@ -15,6 +15,7 @@ from xpra.x11.bindings.display_source cimport set_display, get_display from xpra.x11.bindings.display_source import set_display_name from libc.stdint cimport uintptr_t + cdef extern from "X11/Xlib.h": ctypedef struct Display: pass @@ -40,9 +41,9 @@ cdef do_init_posix_display_source(display_name): def close_display_source(uintptr_t ptr): assert ptr!=0, "invalid NULL display pointer" cdef Display * display = ptr - cdef int v = XCloseDisplay(display) set_display(NULL) set_display_name("CLOSED") + cdef int v = XCloseDisplay(display) return v diff --git a/src/xpra/x11/bindings/randr_bindings.pyx b/src/xpra/x11/bindings/randr_bindings.pyx index d518cc7199..9570546e38 100644 --- a/src/xpra/x11/bindings/randr_bindings.pyx +++ b/src/xpra/x11/bindings/randr_bindings.pyx @@ -124,16 +124,16 @@ cdef extern from "X11/extensions/Xrandr.h": short XRRConfigCurrentRate(XRRScreenConfiguration *config) -from xpra.x11.bindings.core_bindings cimport _X11CoreBindings +from xpra.x11.bindings.core_bindings cimport X11CoreBindingsInstance -cdef _RandRBindings singleton = None +cdef RandRBindingsInstance singleton = None def RandRBindings(): global singleton if singleton is None: - singleton = _RandRBindings() + singleton = RandRBindingsInstance() return singleton -cdef class _RandRBindings(_X11CoreBindings): +cdef class RandRBindingsInstance(X11CoreBindingsInstance): cdef int _has_randr cdef object _added_modes diff --git a/src/xpra/x11/bindings/window_bindings.pyx b/src/xpra/x11/bindings/window_bindings.pyx index d1581c6621..31f0b2096a 100644 --- a/src/xpra/x11/bindings/window_bindings.pyx +++ b/src/xpra/x11/bindings/window_bindings.pyx @@ -10,6 +10,8 @@ from __future__ import absolute_import import struct +from libc.stdint cimport uintptr_t + from xpra.gtk_common.error import XError from xpra.os_util import strtobytes @@ -387,18 +389,18 @@ class PropertyOverflow(PropertyError): pass -from xpra.x11.bindings.core_bindings cimport _X11CoreBindings +from xpra.x11.bindings.core_bindings cimport X11CoreBindingsInstance cdef int CONFIGURE_GEOMETRY_MASK = CWX | CWY | CWWidth | CWHeight -cdef _X11WindowBindings singleton = None +cdef X11WindowBindingsInstance singleton = None def X11WindowBindings(): global singleton if singleton is None: - singleton = _X11WindowBindings() + singleton = X11WindowBindingsInstance() return singleton -cdef class _X11WindowBindings(_X11CoreBindings): +cdef class X11WindowBindingsInstance(X11CoreBindingsInstance): cdef object has_xshape @@ -435,6 +437,7 @@ cdef class _X11WindowBindings(_X11CoreBindings): % (extension, cmajor, cminor, major, minor)) def getDefaultRootWindow(self): + assert self.display return XDefaultRootWindow(self.display) diff --git a/src/xpra/x11/bindings/xi2_bindings.pyx b/src/xpra/x11/bindings/xi2_bindings.pyx index 533ddb22a3..9c0037459e 100644 --- a/src/xpra/x11/bindings/xi2_bindings.pyx +++ b/src/xpra/x11/bindings/xi2_bindings.pyx @@ -315,16 +315,16 @@ CLASS_INFO = { } -from xpra.x11.bindings.core_bindings cimport _X11CoreBindings +from xpra.x11.bindings.core_bindings cimport X11CoreBindingsInstance -cdef _X11XI2Bindings singleton = None +cdef X11CoreBindingsInstance singleton = None def X11XI2Bindings(): global singleton if singleton is None: - singleton = _X11XI2Bindings() + singleton = X11XI2BindingsInstance() return singleton -cdef class _X11XI2Bindings(_X11CoreBindings): +cdef class X11XI2BindingsInstance(X11CoreBindingsInstance): cdef int opcode cdef object events diff --git a/src/xpra/x11/bindings/ximage.pyx b/src/xpra/x11/bindings/ximage.pyx index d899e70a11..501016cfca 100644 --- a/src/xpra/x11/bindings/ximage.pyx +++ b/src/xpra/x11/bindings/ximage.pyx @@ -890,16 +890,16 @@ cdef window_pixmap_wrapper(Display *xdisplay, Window xwindow): pw.init(xdisplay, xwindow, width, height) return pw -from xpra.x11.bindings.core_bindings cimport _X11CoreBindings +from xpra.x11.bindings.core_bindings cimport X11CoreBindingsInstance -cdef _XImageBindings singleton = None +cdef XImageBindingsInstance singleton = None def XImageBindings(): global singleton if singleton is None: - singleton = _XImageBindings() + singleton = XImageBindingsInstance() return singleton -cdef class _XImageBindings(_X11CoreBindings): +cdef class XImageBindingsInstance(X11CoreBindingsInstance): cdef int has_xshm def __cinit__(self):