mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 21:30:03 -04:00
Only call XSetInputFocus if the window is visible
This commit is contained in:
@@ -615,18 +615,20 @@ impl Window {
|
|||||||
input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs))
|
input_handler: Mutex::new(XInputEventHandler::new(display, window, ic, window_attrs))
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
if window_attrs.visible {
|
||||||
let ref x_window: &XWindow = window.x.borrow();
|
unsafe {
|
||||||
|
let ref x_window: &XWindow = window.x.borrow();
|
||||||
|
|
||||||
// XSetInputFocus generates an error if the window is not visible,
|
// XSetInputFocus generates an error if the window is not visible,
|
||||||
// therefore we call XSync before to make sure it's the case
|
// therefore we call XSync before to make sure it's the case
|
||||||
(display.xlib.XSync)(display.display, 0);
|
(display.xlib.XSync)(display.display, 0);
|
||||||
(display.xlib.XSetInputFocus)(
|
(display.xlib.XSetInputFocus)(
|
||||||
display.display,
|
display.display,
|
||||||
x_window.window,
|
x_window.window,
|
||||||
ffi::RevertToParent,
|
ffi::RevertToParent,
|
||||||
ffi::CurrentTime
|
ffi::CurrentTime
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returning
|
// returning
|
||||||
|
|||||||
Reference in New Issue
Block a user