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

Created on 22 Aug 2019  路  12Comments  路  Source: rust-windowing/winit

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

average macOS needs investigation bug

All 12 comments

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).

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

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

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.

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

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).

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?

I am able to reproduce this.

Winit: https://github.com/rust-windowing/winit/commit/7b707e7d758266fec28dd77ef8042be918e89f37
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)

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.

I can also reproduce reliably. macOS 10.14.6.

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)

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhardy picture dhardy  路  3Comments

hobogenized picture hobogenized  路  3Comments

rukai picture rukai  路  4Comments

chrisduerr picture chrisduerr  路  3Comments

swiftcoder picture swiftcoder  路  3Comments