aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-12-29 21:21:15 +0100
committertomaka <pierre.krieger1708@gmail.com>2015-12-29 21:21:15 +0100
commit0a598d79803d456933619ef0fe385a38c9284ff6 (patch)
tree1d0b2b459d729db915ba82c90e7d9eec1a3e5682 /src
parent92ae05d6ce7d44be31cafe67a4ff3bb39e6cb11a (diff)
parent033d92aae528d0d7d7590361c231aaf89afca103 (diff)
downloadglutin-0a598d79803d456933619ef0fe385a38c9284ff6.tar.gz
glutin-0a598d79803d456933619ef0fe385a38c9284ff6.zip
Merge pull request #680 from tomaka/xsync
Call XSync before XSetInputFocus
Diffstat (limited to 'src')
-rw-r--r--src/api/x11/window.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs
index 297a4f3..223c2ba 100644
--- a/src/api/x11/window.rs
+++ b/src/api/x11/window.rs
@@ -615,14 +615,20 @@ impl Window {
input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs))
};
- unsafe {
- let ref x_window: &XWindow = window.x.borrow();
- (display.xlib.XSetInputFocus)(
- display.display,
- x_window.window,
- ffi::RevertToParent,
- ffi::CurrentTime
- );
+ if window_attrs.visible {
+ 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,
+ ffi::RevertToParent,
+ ffi::CurrentTime
+ );
+ }
}
// returning