[webkit-gtk] Opening default context menu on mouse release

Andres Gomez tanty at igalia.com
Tue May 16 23:23:08 PDT 2017


Hi Peter,

On Sun, 2017-05-14 at 12:35 +0200, Peter Hofmann wrote:
> Hi all,
> 
> we're trying to implement mouse gestures[0] in a simple webkit2gtk
> browser. To make things a little easier, here's a minimal example:
> 
> https://gist.github.com/vain/e861bce9536410aa10d46948d6bd48c8
> 
> To invoke a gesture, press the right mouse button and drag the pointer
> left, right, up or down. The browser will then navigate backward,
> forward, reload the page or open a new tab.
> 
> The current implementation makes the context menu inaccessible. Problem
> is, the context menu always opens on mouse *down* events. At that point
> in time, we don't know yet if the user is going to perform a gesture.
> 
> So, my question is, is there a way to open webkit's default context menu
> on mouse *release* events?

Maybe I'm stating something too obvious that you have already checked
but, since I didn't see any mention to this in your code, I will point
to it.

GTK+ has gestures support:
https://developer.gnome.org/gtk3/stable/Gestures.html

Here some examples:
https://wiki.gnome.org/HowDoI/Gestures

I'm no expert on that but, as stated at:
https://developer.gnome.org/gtk3/stable/GtkGesture.html#GtkGesture.description

I would assume that if you would set GDK_TOUCHPAD_GESTURE_MASK on
the GdkWindows of your widgets, you will have direct control for the
gestures and the context window would only be triggered by a press and
hold gesture (?)

As said, I'm no expert so maybe this is not so straight forward and/or
needs some modifications on WebKitGtk+ in order to work.

-- 
Br,

Andres


More information about the webkit-gtk mailing list