You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click counting for double and triple clicks is a common need, and on some platforms is hard to address if they aren't determined in winit. In particular the Mac doesn't have a readily accessible API for getting the double click interval or detection rectangle separate from an individual event.
Some notes on implementation:
on Mac, NSEvent has clickCount; easy. (there is also a doubleClickInterval attached to the NSEvent)
Windows has an easy way to query the double click interval (GetDoubleClickTime) and a standard double click rectangle (SM_CXDOUBLECLICK/SM_CYDOUBLECLICK accessible with GetSystemMetrics), which is widely interpreted as extending to multiple clicks (e.g. in the WPF implementation and some browsers).
Neither X11 and Wayland themselves bother to expose an interval setting, nor is there a count on mouse button events; it's left up to toolkits to decide where to look for a click interval setting, if there even is one (some toolkits don't bother exposing the option). Chromium just hardcodes a 500ms interval and a 4px rectangle on platforms that don't handle it specifically, these are the Windows defaults.
Android doesn't specify any standard way to store this preference (and doesn't encode count on MotionEvent), which could be an issue for the minority of people who use mice with Android apps (on ChromeOS and DeX); could again just go with some well-known values (like Chromium and others do, when they need to synthesize a click count on a platform that doesn't have readily accessible settings)
On the web, click count is exposed in the detail property of mousedown/mouseup events, and browsers generally expose the best available platform behavior.
Overall, I think this would be not terribly hard to implement in a useful way; and even on platforms where there are shortcomings, it's better than not having it at all.
Click counting for double and triple clicks is a common need, and on some platforms is hard to address if they aren't determined in winit. In particular the Mac doesn't have a readily accessible API for getting the double click interval or detection rectangle separate from an individual event.
Some notes on implementation:
NSEvent
hasclickCount
; easy. (there is also adoubleClickInterval
attached to theNSEvent
)GetDoubleClickTime
) and a standard double click rectangle (SM_CXDOUBLECLICK
/SM_CYDOUBLECLICK
accessible withGetSystemMetrics
), which is widely interpreted as extending to multiple clicks (e.g. in the WPF implementation and some browsers).MotionEvent
), which could be an issue for the minority of people who use mice with Android apps (on ChromeOS and DeX); could again just go with some well-known values (like Chromium and others do, when they need to synthesize a click count on a platform that doesn't have readily accessible settings)detail
property of mousedown/mouseup events, and browsers generally expose the best available platform behavior.Overall, I think this would be not terribly hard to implement in a useful way; and even on platforms where there are shortcomings, it's better than not having it at all.
Blocked on #3833.
The text was updated successfully, but these errors were encountered: