xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #372: trap-all-X11errors-from-packets.txt

File trap-all-X11errors-from-packets.txt, 1.3 KB (added by Antoine Martin, 8 years ago)

ensures we synchronize and trap all X11 calls right out of the packet handler

Line 
1### Eclipse Workspace Patch 1.0
2#P Xpra
3Index: src/xpra/client/gtk2/client.py
4===================================================================
5--- src/xpra/client/gtk2/client.py      (revision 4022)
6+++ src/xpra/client/gtk2/client.py      (working copy)
7@@ -35,6 +35,8 @@
8 FAKE_UI_LOCKUPS = int(os.environ.get("XPRA_FAKE_UI_LOCKUPS", "0"))
9 
10 
11+from xpra.x11.gtk_x11.error import trap
12+
13 class XpraClient(GTKXpraClient):
14 
15     WINDOW_TOPLEVEL = gdk.WINDOW_TOPLEVEL
16@@ -61,6 +63,22 @@
17             self.ClientWindowClass = ClientWindow
18         log("init(..) ClientWindowClass=%s", self.ClientWindowClass)
19 
20+    def init_packet_handlers(self):
21+        #force all packets to UI mode:
22+        GTKXpraClient.init_packet_handlers(self)
23+        self._ui_packet_handlers.update(self._packet_handlers)
24+        self._packet_handlers = {}
25+
26+    def process_packet(self, proto, packet):
27+        log.info("process_packet: %s", self._aliases.get(packet[0], packet[0]))
28+        def UI_Call():
29+            try:
30+                trap.call_synced(GTKXpraClient.process_packet, self, proto, packet)
31+            except:
32+                log.error("process_packet: %s", self._aliases.get(packet[0], packet[0]), exc_info=True)
33+        gobject.idle_add(UI_Call)
34+       
35+
36     def client_type(self):
37         return "Python/Gtk2"
38