Skip to content
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

macOS: Closing window doesn't happen until the mouse cursor has moved #1117

Closed
Tracked by #13
pftbest opened this issue Aug 22, 2019 · 12 comments · Fixed by #1234
Closed
Tracked by #13

macOS: Closing window doesn't happen until the mouse cursor has moved #1117

pftbest opened this issue Aug 22, 2019 · 12 comments · Fixed by #1234
Labels
B - bug Dang, that shouldn't have happened C - needs investigation Issue must be confirmed and researched D - average Likely as difficult as most tasks here DS - macos

Comments

@pftbest
Copy link

pftbest commented Aug 22, 2019

Version: 0.20.0-alpha3
OS: Mojave 10.14.6
Code: window example

Clicking on the red button in tile bar doesn't close the window until mouse cursor has moved.

Video: http://88.99.85.67:1337/bug264.mp4

@goddessfreya goddessfreya added D - average Likely as difficult as most tasks here H - good first issue Ideal for new contributors DS - windows C - needs investigation Issue must be confirmed and researched B - bug Dang, that shouldn't have happened DS - macos and removed DS - windows labels Aug 23, 2019
@chrisduerr
Copy link
Contributor

chrisduerr commented Aug 23, 2019

I've tested this myself and I cannot reproduce it with the latest master.

I'm also running 10.14.6 on a macbook pro.

Edit: An important note, I've tested this both with and without yabai (custom WM) running, though I haven't restarted in between (I don't think it should matter). I've also used the touchpad and not a mouse so accidental motion is possible (I didn't see any events though).

@pftbest
Copy link
Author

pftbest commented Aug 23, 2019

@chrisduerr Did you test with or without commit 7b707e7?
It was added to master after I posted this issue.

@chrisduerr
Copy link
Contributor

chrisduerr commented Aug 23, 2019

It was tested with it. That's precisely the commit I ran.

@pftbest
Copy link
Author

pftbest commented Aug 23, 2019

I've just pulled latest master and I still have this issue.

@chrisduerr Which model do you have? I've got 15'' 2015. Maybe yours is different and that's why it works fine for you?

PS I didn't make any modifications to my WM so it should be stock.

@chrisduerr
Copy link
Contributor

I'm pretty sure I've got the 2018 model, the big one.

@kchibisov
Copy link
Member

kchibisov commented Aug 24, 2019

I also can't repro this one on default macOS 10.14.6 using the latest master. I've got MacBook Pro (Retina, 13-inch, Early 2015).

@pftbest
Copy link
Author

pftbest commented Aug 24, 2019

Ok, so how can I debug this? It's 100% reproducible on my side, so maybe you can suggest where to insert logs or other changes to figure out what is going wrong?

@syrel
Copy link

syrel commented Aug 25, 2019

I am able to reproduce this.

Winit: 7b707e7
OS: OSX 10.15 Beta (19A501i)
Mac: MacBook Pro (15-inch, 2016)
Example: cargo run --example window_run_return
Video: https://youtu.be/KS52dLAoWXQ
Rust:

$ rustc --version
rustc 1.34.1 (fc50f328b 2019-04-24)

I have the same behaviour with
rustc 1.37.0 (eae3437df 2019-08-13)

@Osspial Osspial removed the H - good first issue Ideal for new contributors label Aug 26, 2019
@parasyte
Copy link

parasyte commented Sep 12, 2019

This is also reproducible for me. When pressing the close button, the following log lines are emitted immediately, followed by the event loop callback receiving the CloseRequested event:

[2019-09-12T07:33:05Z TRACE winit::platform_impl::platform::window_delegate] Triggered `windowShouldClose:`
[2019-09-12T07:33:05Z TRACE winit::platform_impl::platform::window_delegate] Completed `windowShouldClose:`

Setting ControlFlow::Exit at this point doesn't exit the event loop until it receives another event like moving the cursor or pressing any key.

Using a key to exit the event loop (instead of the close button) only seems to work because the event loop just so happens to receive a keyUp or repeated keyDown event after ControlFlow::Exit is set.

@lordnoriyuki
Copy link

I can also reproduce reliably. macOS 10.14.6.

@bschwind
Copy link

Also able to reproduce.

OS: macOS 10.14.5
Model: MacBook Pro Retina 13", Mid-2014
Winit Version: 0.20.0-alpha3 (checksum is 27c947714bd09779bb28fb7ac85685d5b68ab60d17349ed0ea7ae9484726024d, sorry I don't know how to get the git sha1 by looking at Cargo.lock)

@vbogaevsky
Copy link
Contributor

vbogaevsky commented Oct 19, 2019

This happens because we use (void)stop:(id)sender; on NSApp instead of (void)terminate:(id)sender;
I'm oppening a PR with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened C - needs investigation Issue must be confirmed and researched D - average Likely as difficult as most tasks here DS - macos
Development

Successfully merging a pull request may close this issue.

10 participants