-
Notifications
You must be signed in to change notification settings - Fork 878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to avoid focus stealing on X11. #1160
Comments
I've run a quick test, changing both instances of Also, I'm a bit confused about the use case for this. Why would one want to create a window that does not steal focus? |
It looks like there's more than one culprit. This code seems to focus the window again after mapping it: winit/src/platform_impl/linux/x11/window.rs Lines 436 to 441 in d35ee0d
When I comment that code out, it allows the window to be mapped without stealing focus. (for testing, try Actually, I can't find a difference in behaviour between The problem is that the code I linked above seems to focus the window regardless of window type.
Some examples include notification windows and tooltips. It's pretty annoying for a notification to steal focus and stop you from being able to type, and similarly tooltip windows could stop you from using shortcuts (not to mention the jankiness of the window getting greyed out every time a tooltip pops up). |
Oh, I didn't realize a tooltip was its own window. It seems so obvious now. Anyway, I tracked down the commit that introduced the code you referenced and I ended up at this issue: rust-windowing/glutin#509 It seems that the I'll get started on a PR for this tomorrow. |
As per the docs:
So yes, of the group of windows in the stack it also raises it to the top. |
There seems to be no way to map a window without focusing it. I've only tested this on X11, but it may be present on other platforms as well given there is no
WindowBuilder
option to disable the behaviour.On X11, this code is the culprit:
winit/src/platform_impl/linux/x11/window.rs
Lines 353 to 358 in b03e589
XMapRaised
pushes the window to the top of the stack as well as maps the window.There should be an option to disable this behaviour and map the window normally with
XMapWindow()
.The text was updated successfully, but these errors were encountered: