From ec8ae5f3711f6624018219beb7a17c0f7a74334c Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Mon, 9 Jun 2014 11:08:50 +0000 Subject: [PATCH] #589: avoid races when sending focus changes: delay sending the "lost focus" (focus=0) so that a new window can gain focus, which allows us to avoid doing a "reset_focus" on the server side git-svn-id: https://xpra.org/svn/Xpra/trunk@6688 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/client/ui_client_base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/xpra/client/ui_client_base.py b/src/xpra/client/ui_client_base.py index 35e469c8a9..20c0a50733 100644 --- a/src/xpra/client/ui_client_base.py +++ b/src/xpra/client/ui_client_base.py @@ -738,7 +738,13 @@ def update_focus(self, wid, gotit): if self.keyboard_helper: self.keyboard_helper.clear_repeat() if self._focused: - self.send_focus(0) + #send the lost-focus via a timer and re-check it + #(this allows a new window to gain focus without having to do a reset_focus) + def send_lost_focus(): + #check that a new window has not gained focus since: + if self._focused is None: + self.send_focus(0) + self.timeout_add(20, send_lost_focus) self._focused = None def do_force_ungrab(self, wid):