mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Merge pull request #680 from tomaka/xsync
Call XSync before XSetInputFocus
This commit is contained in:
commit
0a598d7980
|
@ -615,14 +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 {
|
||||||
(display.xlib.XSetInputFocus)(
|
let ref x_window: &XWindow = window.x.borrow();
|
||||||
display.display,
|
|
||||||
x_window.window,
|
// XSetInputFocus generates an error if the window is not visible,
|
||||||
ffi::RevertToParent,
|
// therefore we call XSync before to make sure it's the case
|
||||||
ffi::CurrentTime
|
(display.xlib.XSync)(display.display, 0);
|
||||||
);
|
(display.xlib.XSetInputFocus)(
|
||||||
|
display.display,
|
||||||
|
x_window.window,
|
||||||
|
ffi::RevertToParent,
|
||||||
|
ffi::CurrentTime
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returning
|
// returning
|
||||||
|
|
Loading…
Reference in a new issue