xpra icon
Bug tracker and wiki

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


Ticket #589: delay-focus.patch

File delay-focus.patch, 1.5 KB (added by Antoine Martin, 7 years ago)

avoids the problem by delaying the focus event

  • xpra/client/ui_client_base.py

     
    203203
    204204        #state:
    205205        self._focused = None
     206        self._pending_focus = None
    206207        self._window_with_grab = None
    207208        self._last_screen_settings = None
    208209        self._suspended_at = 0
     
    715716
    716717    def send_focus(self, wid):
    717718        focuslog("send_focus(%s)", wid)
     719        if self._pending_focus==wid:
     720            return
     721        pf = self._pending_focus
     722        self._pending_focus = wid
     723        if pf is None:
     724            #no delayed sending is pending, schedule one:
     725            def do_send_focus():
     726                f = self._pending_focus
     727                if f is not None:
     728                    self._pending_focus = None
     729                    self.do_send_focus(f)
     730            self.timeout_add(20, do_send_focus)
     731
     732    def do_send_focus(self, wid):
    718733        self.send("focus", wid, self.get_current_modifiers())
    719734
    720735    def update_focus(self, wid, gotit):
     
    734749                #(catch up - makes things like OR windows work:
    735750                # their parent receives the focus-out event)
    736751                focuslog("window %s lost a focus it did not have!? (simulating focus before losing it)", wid)
    737                 self.send_focus(wid)
     752                self.do_send_focus(wid)
    738753            if self.keyboard_helper:
    739754                self.keyboard_helper.clear_repeat()
    740755            if self._focused: