[webkit-gtk] Opening default context menu on mouse release
Adrian Perez de Castro
aperez at igalia.com
Tue May 16 13:19:12 PDT 2017
On Tue, 16 May 2017 18:11:32 +0200, Peter Hofmann <webkitlists at uninformativ.de> wrote:
> On Mon, 15 May 2017 11:15:20 -0500, Michael Catanzaro <mcatanzaro at igalia.com> wrote:
> > I don't think so, not currently. [...]
> Alright, thank you!
> On Mon, May 15, 2017 at 11:39:50PM +0300, Adrian Perez de Castro wrote:
> > The reason why GTK+ opens the menu on mousedown is to allow activating a
> > menu item by moving over to it (while still pressing the button after the
> > mouse down), and then releasing the button [...]
> Ah, yes. I use this functionality on a regular basis. :-) It's pretty
> handy, even with a regular mouse.
Here's an idea that may work... Mouse gestures imply that:
1. A mouse button is pressed.
2. The gesture is “drawn” (while the button is pressed).
3. The mouse button is released.
4. If the drawn gesture is recognized some action is taken.
The important point above is (2). To be able to make a distinction between
“context menu requested” and “mouse gesture started” you could do the
following: When the mouse button is pressed, a (short) timer is started, and
if the movement of the pointer is less than a certain amount, the context menu
is shown. Otherwise, if the amount of movement is above the threshold, assume
that a gesture has been started — because the pointer moved away from the
initial click position in a short time, which very likely indicates that a
gesture is being drawn.
Right from the top of my head I am not sure whether our current API in
WebKitGTK+ would allow you to do that. If not, let us know what would be
needed and then we can discuss how to support it.
I hope this helps :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 195 bytes
Desc: not available
More information about the webkit-gtk