Merge pull request #680 from tomaka/xsync

Call XSync before XSetInputFocus
This commit is contained in:
tomaka 2015-12-29 21:21:15 +01:00
commit 0a598d7980

View file

@ -615,8 +615,13 @@ impl Window {
input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs))
};
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,
@ -624,6 +629,7 @@ impl Window {
ffi::CurrentTime
);
}
}
// returning
Ok(window)