xpra icon
Bug tracker and wiki

Ticket #139: grab-fix-watch.patch

File grab-fix-watch.patch, 2.3 KB (added by Antoine Martin, 5 years ago)

watch all the client windows and use the correct event mask

  • xpra/x11/gtk_x11/pointer_grab.py

     
    1313log = Logger("x11", "window", "grab")
    1414
    1515
    16 StructureNotifyMask = constants["StructureNotifyMask"]
    17 EnterWindowMask = constants["EnterWindowMask"]
    18 LeaveWindowMask = constants["LeaveWindowMask"]
     16# other event types we may use here:
     17# StructureNotifyMask | EnterWindowMask | LeaveWindowMask
     18GRAB_EVENT_MASK = constants["FocusChangeMask"]
    1919
     20
    2021NotifyNormal        = constants["NotifyNormal"]
    2122NotifyGrab          = constants["NotifyGrab"]
    2223NotifyUngrab        = constants["NotifyUngrab"]
     
    5960        super(PointerGrabHelper, self).__init__()
    6061        log("PointerGrabHelper.__init__(%s)", window)
    6162        self._window = window
    62         add_event_receiver(self._window, self)
     63        #add_event_receiver(self._window, self)
    6364        #do we also need enter/leave?
    64         X11Window.addXSelectInput(self._window.xid, StructureNotifyMask | EnterWindowMask | LeaveWindowMask)
     65        #X11Window.addXSelectInput(self._window.xid, GRAB_EVENT_MASK)
    6566
    6667    def __repr__(self):
    6768        return "PointerGrabHelper(%s)" % self._window
     
    7374        else:
    7475            log.warn("pointer grab helper %s already destroyed!", self)
    7576
     77    def add_window(self, model, win):
     78        log("grab adding window %s: %#x", model, win.xid)
     79        add_event_receiver(win, self)
     80        X11Window.addXSelectInput(win.xid, GRAB_EVENT_MASK)
    7681
     82
    7783    def do_xpra_focus_in_event(self, event):
    7884        log("focus_in_event(%s) mode=%s, detail=%s",
    7985            event, GRAB_CONSTANTS.get(event.mode), DETAIL_CONSTANTS.get(event.detail, event.detail))
  • xpra/x11/server.py

     
    392392            self._add_new_or_window(event.window)
    393393
    394394    def _add_new_window_common(self, window):
     395        self._grab_helper.add_window(window, window.client_window)
    395396        windowlog("adding window %s", window)
    396397        wid = X11ServerBase._add_new_window_common(self, window)
    397398        window.managed_connect("client-contents-changed", self._contents_changed)