-
Notifications
You must be signed in to change notification settings - Fork 903
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
Doesn't return focus to i3 when closing #516
Comments
Have you tried on the latest version of winit? I used to get that but it stopped happening and I dont remember if that was because of something I changed in my own program or an update to winit. |
It looks like conrod is still on winit 0.12.0, so to test the latest winit there, you'd have to make some modifications to account for the breaking changes in winit 0.13.0. It would be a good opportunity to make an easy PR to conrod, since all you generally have to do is replace The quickest thing would be try with the winit example programs, though. With some luck, @rukai is right (thanks for helping out here!).
If the problem is still present, I'll gladly take you on winit's wild ride. Just be warned that direct exposure to X11 has been known to cause deep-seated cynicism about Linux as a desktop platform, and in later stages, may also result in you believing that implementing protocols using clipboard mechanisms is a beautifully flexible and economical design choice. |
To try and reproduce the issue I did:
Then I would close the window by either ctrl-c in the terminal I was using or It might have been an issue with i3 that was fixed there. |
This issue is still present with i3 version 4.15 and the current winit master, although after this giant commit of improvements c4b92eb it has gotten way harder to reproduce. I used this program: extern crate winit;
fn main() {
let mut events_loop = winit::EventsLoop::new();
let _window = winit::WindowBuilder::new()
.with_title("A fantastic window!")
.build(&events_loop)
.unwrap();
events_loop.run_forever(|event| {
println!("{:?}", event);
match event {
winit::Event::WindowEvent {
event: winit::WindowEvent::CloseRequested,
..
} => winit::ControlFlow::Break,
winit::Event::WindowEvent {
event: winit::WindowEvent::KeyboardInput {
input: winit::KeyboardInput {
state: winit::ElementState::Pressed,
virtual_keycode: Some(winit::VirtualKeyCode::Escape),
.. },
.. },
..
} => {
winit::ControlFlow::Break
},
_ => winit::ControlFlow::Continue,
}
});
} With older commits (before c4b92eb) I could reproduce this nearly every time by delaying the execution |
Here is an even shorter version that works now and then (just running it without delay and workspace switching): extern crate winit;
fn main() {
let mut events_loop = winit::EventsLoop::new();
let _window = winit::WindowBuilder::new()
.build(&events_loop)
.unwrap();
} |
Thanks for the code @b-r-u! I can confirm that your last example reproduces my exact problem with both winit 0.12 and 0.13. I've uploaded a quick video to show how the problem looks on my system, to make sure we're all on the same page. Thanks for the offer @francesca64. While becoming familiar with the internals of X11 isn't exactly on my bucket list, I'd really like to help out with winit if I can. Whatever you think the best step forward is I can allocate a few hours to it this week. |
Tested the second example posted by b-r-u
|
Oops I didn't even realize 0.13 wasn't the latest. 0.14 is definitely a huge improvement, but I'm still able to reproduce it non-deterministically. New video. |
@rukai can you try running it ~50 times? At one point I did about 30 in a row without it triggering. Then sometimes there will be a couple pretty close to each other. |
I did: When I do this with winit 0.13 there are no But this doesnt mean much, only that whatever race condition etc. is causing this doesnt line up the same on my machine. One approach to figuring out what is going on, would be to try changing things in the current winit master to be like 0.13 until you can reproduce the issue consistently like in 0.13. (Or go from 0.13 to master) |
@anderspitman thanks! That frees me up to work on fixing all the other problems. I'd recommend following @rukai's recommendation:
Since I don't really have any ideas for what could be happening here, this seems like the most reliable way to narrow it down. I'll also explain any code (or general X11 stuff) you ask about. |
Thanks @rukai. @francesca64 sounds good. That approach is a bit brute force but it will probably also be a great way to start getting familiar with the codebase. I'll spend some time poking at it the next few days. Is this thread a good place to ask questions? Is there a dedicated chat for smaller issues that require more real-time interaction? |
Asking questions here is fine, though I'll gladly create a gitter if you think it would be useful. |
@francesca64 I've identified commit c4b92eb (#491) as the commit that greatly reduces the frequency of this bug appearing. Any idea what you changed in there that might have done it? |
Also it might be a good idea to verify that I've identified the proper commit before you spend too much time thinking about it. |
@anderspitman I guess we arrived at the same conclusion :) #516 (comment) |
@anderspitman I can't say I know which of those 2kLOC of changes did this. I can go into detail on any individual changes though. |
@b-r-u ha! Somehow I completely missed that comment. Would have saved me a few minutes. I guess it's good we picked the same commit though. I'll start working through the commit and see what I can find. |
Also @francesca64 is it normal to have commits as large as c4b92eb in winit? I know some codebases like to squash their commits for various reasons. |
All PRs merged are automatically squashed. Most commits are fortunately smaller than that, or at the very least, of a more normal scope. |
Isn't the issue likely caused by the call to |
I'm using winit with conrod on the i3 window manager. I've noticed that often when I close my app with another i3 window open (usually the terminal I launched the app from), i3 stops responding until I move the mouse to the top of the other window. I'd be happy to look into fixing this myself if anyone has suggestions on where to start. I don't have any experience with X11 and I'm still rather new to Rust.
The text was updated successfully, but these errors were encountered: