ryanmcgrath / cacao

Rust bindings for AppKit (macOS) and UIKit (iOS/tvOS). Experimental, but working!
MIT License
1.8k stars 65 forks source link

implement acceptsFirstMouse on webview? #66

Closed httnn closed 1 year ago

httnn commented 1 year ago

when cacao's webview is not in focus (e.g. the window containing the webview is partially behind another focused window), the first click on the webview will not go through to the view itself. this first click will only focus the window, after which any subsequent clicks will actually be registered on the webview.

the behaviour described above can be changed by implementing and returning YES from the acceptsFirstMouse method on the webview. now, from a quick test it seems like most apps allow the first click to go through to the view, so my question is whether you'd accept a PR where this method is implemented on the webview by default? another question is whether every other cacao view should implement this method too.

disclaimer: i'm no expert on macOS UI stuff so it's entirely possible that i've missed something and that there's another way to allow for the first click to go through to the view.

ryanmcgrath commented 1 year ago

Hmm... this is definitely worth exposing, but I'm not offhand sure how I'd want to go about it. If you want to explore a PR for it then I'm happy to see what we can land on though.

httnn commented 1 year ago

cool! already got some code for it, but it's on top of the change-objc-classdec branch, so i'll do it once that's merged

ryanmcgrath commented 1 year ago

I'll see if I can merge that branch in the morning~

ryanmcgrath commented 1 year ago

Merged into 0.4.0-beta1.