linebender / druid

A data-first Rust-native UI design toolkit.
https://linebender.org/druid/
Apache License 2.0
9.53k stars 568 forks source link

Mouse move events do not work properly on macOS13. #2280

Closed Cupnfish closed 1 year ago

Cupnfish commented 1 year ago

Mouse move events do not work properly on macOS13

Cupnfish commented 1 year ago

In addition, the mouse dragging event works properly.

liias commented 1 year ago

Same for me. E.g HotChanged lifecycle event is not fired at all.

liias commented 1 year ago

I think I found a fix. You need to move view.addTrackingArea from make_view after view.initWithFrame_ is called. macOS docs does not specify it as mandatory, but says:

You can create an NSTrackingArea instance and add it to a view at any point because successful creation does not depend on the view being added to a window. Listing 6-1 shows the creation and addition of an NSTrackingArea instance in a custom view’s [initWithFrame:] method;

I have example hotfix at https://github.com/Browsers-software/druid/commit/c248c63aabd7339ea77ab004e6e7d681a1ed9695

raphlinus commented 1 year ago

Sounds good. I don't have access to a 13 box here. @liias would you be willing to PR that?

liias commented 1 year ago

Sure! Will do a PR, and some discussion can happen there.

liias commented 1 year ago

PR at https://github.com/linebender/druid/pull/2282