Closed lunabunn closed 3 years ago
One naive implementation we could use for Windows is to have 4 AtomicBool
s for each button type, set them to true when they're double clicked, then in the mouse up callbacks check for the values to fire DoubleClickUp
. Windows doesn't seem to provide a direct way to fire events on double click up.
However, I'm not sure with this approach what will happen if the user double clicks in the window, drags the mouse outside the window without releasing the double click, releases the double click, comes back into the window, then presses & releases the button again. If (BUTTONDOWN
events are guaranteed to fire before BUTTONDBLCLICK
events,BUTTONDOWN
isn't fired on double clicks) we could set the bools to false in BUTTONDOWN
?
Implemented "naive" approach described above, seems to work well. If a better method were to be found, that could be its own PR, but for now this should be "good enough".
Should be ready for merge, if you're okay with the API changes! 🎉
Lots of great stuff. Thanks!
I'll merge this now, but I think we should also add a comment somewhere to the Windows code about why we're using the atomic bools. I'm very bad about forgetting why things like that are necessary when I'm reviewing code in the future.
Fixes https://github.com/kettle11/kapp/issues/21 EXCEPT implementing
DoubleClickUp
for Windows. Thedetail
property is always 0 forpointerdown
(https://github.com/w3c/pointerevents/issues/98), so I had to addmousedown
just for the double clicks.