Skip to content

Commit

Permalink
#812 / #2338: all servers that use the new x11 clipboard code need to…
Browse files Browse the repository at this point in the history
… initialize the x11 filters, so move that code to X11ServerCore and make sure we only run the cleanup once (as shadow servers may call cleanup twice since they inherit from ServerBase twice..)

git-svn-id: https://xpra.org/svn/Xpra/trunk@23005 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 20, 2019
1 parent 9bc7070 commit d11a6e6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 0 additions & 6 deletions src/xpra/x11/desktop_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
from xpra.x11.gtk_x11.gdk_bindings import (
add_catchall_receiver, remove_catchall_receiver,
add_event_receiver, #@UnresolvedImport
init_x11_filter, cleanup_x11_filter, #@UnresolvedImport
cleanup_all_event_receivers #@UnresolvedImport
)
from xpra.x11.bindings.window_bindings import X11WindowBindings #@UnresolvedImport
from xpra.x11.xroot_props import XRootPropWatcher
Expand Down Expand Up @@ -314,7 +312,6 @@ def server_init(self):

def x11_init(self):
X11ServerBase.x11_init(self)
assert init_x11_filter() is True
display = display_get_default()
screens = display.get_n_screens()
for n in range(screens):
Expand All @@ -328,9 +325,6 @@ def x11_init(self):
def do_cleanup(self):
self.cancel_resize_timer()
remove_catchall_receiver("xpra-motion-event", self)
cleanup_x11_filter()
with xswallow:
cleanup_all_event_receivers()
X11ServerBase.do_cleanup(self)


Expand Down
6 changes: 1 addition & 5 deletions src/xpra/x11/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
from xpra.x11.gtk_x11.prop import prop_set
from xpra.x11.gtk_x11.tray import get_tray_window, SystemTray
from xpra.x11.gtk_x11.gdk_bindings import (
add_event_receiver, cleanup_all_event_receivers,
add_event_receiver,
get_children,
init_x11_filter, cleanup_x11_filter,
)
from xpra.x11.bindings.window_bindings import X11WindowBindings #@UnresolvedImport
from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings #@UnresolvedImport
Expand Down Expand Up @@ -244,7 +243,6 @@ def setup(self):

def x11_init(self):
X11ServerBase.x11_init(self)
assert init_x11_filter() is True

self._focus_history = deque(maxlen=100)
# Do this before creating the Wm object, to avoid clobbering its
Expand Down Expand Up @@ -295,8 +293,6 @@ def do_cleanup(self):
X11Window.XCompositeReleaseOverlayWindow(self.root_overlay)
self.root_overlay = None
self.cancel_all_configure_damage()
cleanup_x11_filter()
cleanup_all_event_receivers()
if self._wm:
self._wm.cleanup()
self._wm = None
Expand Down
8 changes: 8 additions & 0 deletions src/xpra/x11/x11_server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from xpra.x11.fakeXinerama import find_libfakeXinerama, save_fakeXinerama_config, cleanup_fakeXinerama
from xpra.x11.gtk_x11.prop import prop_get, prop_set
from xpra.x11.gtk_x11.gdk_display_source import close_gdk_display_source
from xpra.x11.gtk_x11.gdk_bindings import init_x11_filter, cleanup_x11_filter, cleanup_all_event_receivers
from xpra.x11.common import MAX_WINDOW_SIZE
from xpra.os_util import monotonic_time, strtobytes, bytestostr, PYTHON3
from xpra.util import engs, csv, typedict, iround, envbool, XPRA_DPI_NOTIFICATION_ID
Expand Down Expand Up @@ -90,6 +91,7 @@ def __init__(self):
self.pointer_device_map = {}
self.keys_pressed = {}
self.last_mouse_user = None
self.x11_filter = False
GTKServerBase.__init__(self)
log("XShape=%s", X11Window.displayHasXShape())

Expand Down Expand Up @@ -132,6 +134,8 @@ def x11_init(self):
self.init_randr()
self.init_cursor()
self.query_opengl()
self.x11_filter = init_x11_filter()
assert self.x11_filter


def init_randr(self):
Expand Down Expand Up @@ -295,6 +299,10 @@ def get_child_env(self):
return env

def do_cleanup(self):
if self.x11_filter:
self.x11_filter = False
cleanup_x11_filter()
cleanup_all_event_receivers()
if self.fake_xinerama:
cleanup_fakeXinerama()
with xswallow:
Expand Down

0 comments on commit d11a6e6

Please sign in to comment.