From 360d2bf45259970965190a0993db317a67ed729a Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 24 Dec 2015 11:55:39 +0100 Subject: Call XSync before XSetInputFocus --- src/api/x11/window.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs index 297a4f3..1ad5888 100644 --- a/src/api/x11/window.rs +++ b/src/api/x11/window.rs @@ -617,6 +617,10 @@ impl Window { unsafe { let ref x_window: &XWindow = window.x.borrow(); + + // XSetInputFocus generates an error if the window is not visible, + // therefore we call XSync before to make sure it's the case + (display.xlib.XSync)(display.display, 0); (display.xlib.XSetInputFocus)( display.display, x_window.window, -- cgit v1.2.3