aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/x11
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-12-24 11:58:50 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-12-24 11:58:50 +0100
commit033d92aae528d0d7d7590361c231aaf89afca103 (patch)
treec3b5e24b62213ce790377aaf9f7f77980026a254 /src/api/x11
parent360d2bf45259970965190a0993db317a67ed729a (diff)
downloadglutin-033d92aae528d0d7d7590361c231aaf89afca103.tar.gz
glutin-033d92aae528d0d7d7590361c231aaf89afca103.zip
Only call XSetInputFocus if the window is visible
Diffstat (limited to 'src/api/x11')
-rw-r--r--src/api/x11/window.rs26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs
index 1ad5888..223c2ba 100644
--- a/src/api/x11/window.rs
+++ b/src/api/x11/window.rs
@@ -615,18 +615,20 @@ impl Window {
input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs))
};
- 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
- );
+ 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