Time based threshold for mouse drag

No, there is no special handling of “long clicks”.

Take a look at ‘wm_event_system.c’. You need:

    case GHOST_kEventButtonDown:
    case GHOST_kEventButtonUp: {
    ...

There is event and evt – current and previous event, so you can compare the time between PRESS and RELEASE.

See also wm_event_is_double_click().


Although you probably want something different; not the distinction between a “long click” and “short click”, but a long press (hold).

Thanks for the hint. I didn’t see that ghost events were handled there
Yeah I think a long press is what I would need. The way I understand is that I would need to register a timer on mouseDown and unregister (or disable) on mouseUp. That’s because no event fires when holding down a mouse while not moving.
However I just realized that there is already a long press functionality implemented in Blender. It’s when you press an item with sub options in the toolbar for a longer time. Does anybody know how it works there?

It’s when you press an item with sub options in the toolbar for a longer time. Does anybody know how it works there?

https://developer.blender.org/rB3ec4d0b51bf3a76725e39a57b0f30bec3edc6882