9fans / plan9port

Plan 9 from User Space
https://9fans.github.io/plan9port/
Other
1.64k stars 326 forks source link

devdraw: grab mouse focus while buttons are held down #405

Open rsc opened 4 years ago

rsc commented 4 years ago

On Mac, and possibly also X11, when you are dragging a selection and the mouse goes out of the window, the events stop being delivered to the window until the mouse goes back in. This is problematic for a scrolling selection because moving out of the window is one way to scroll faster. It is also problematic for acme chords.

It might be nice if, while buttons were held down, devdraw grabbed the mouse even outside the window. On X11 I think that's XGrabPointer. On Mac, I don't know how to do it - maybe create a transparent layer the size of the screen that's in front of everything else?

If it's easy, it might be worth doing. I don't really know.

/cc @jxy

jxy commented 4 years ago

Google gave me this for mac: https://stackoverflow.com/questions/23578381/how-can-i-detect-if-mouse-is-down-outside-of-window-in-cocoa/23578955

Not sure if it is what we need.

jxy commented 4 years ago

On mac, if you move the mouse outside the window, while holding down any mouse button, devdraw still receives the mouse events, though you have to move the mouse in order to generate the events. Is this not what you are seeing?