querying current mouse state

René J. V. Bertin rjvbertin at gmail.com
Sat Aug 5 15:23:38 UTC 2017


David Edmundson wrote:

> In wayland you never query anything, only track events.

There are applications for which this isn't good enough but I guess there must 
be other, low-level ways to query the current state of a given input device or 
sensor.

> What actually do you want to do?

I'm toying around with a click-and-hold-opens-the-contextmenu feature (ported 
from Mac where this makes a bit more sense), based on the TapAndHold gesture. It 
looks like that event is good demonstration why event tracking isn't 100% 
reliable. When I activate processing of that gesture on a QToolButton with a 
menu, it finishes (triggers) even when I am not holding any mouse button. The 
event filter in which I implement this feature also catches MouseRelease and 
MouseMove events (to turn off the gesture processing); I'm not getting those 
either when the QToolButton's menu is open.

IOW, when I click once on the button to open its menu, the contextmenu is opened 
too after the expected delay. The only reliable way I found to prevent this is 
to check if the mouse button is still pressed when the TapAndHold gesture claims 
to be finished.

R.



More information about the Plasma-devel mailing list