[webkit-gtk] Opening default context menu on mouse release
Carlos Garcia Campos
cgarcia at igalia.com
Wed May 17 00:03:58 PDT 2017
El mar, 16-05-2017 a las 23:19 +0300, Adrian Perez de Castro escribió:
> On Tue, 16 May 2017 18:11:32 +0200, Peter Hofmann <webkitlists at uninfo
> rmativ.de> wrote:
> > On Mon, 15 May 2017 11:15:20 -0500, Michael Catanzaro <mcatanzaro at i
> > galia.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.
Yes, it does. You can connect to context-menu signal, take a reference
of the given WebKitContextMenu, and return TRUE to ensure WebKit
doesn't show it. Then you can start your timer and then check threshold
(you could use the gtk dnd threshold, for example, with
gtk_drag_check_threshold). If not a gesture you can use the
WebKitContextMenu to build a gtk popup menu.
> I hope this helps :-)
>
> Br.
>
> --
> 💻 Adrián
> _______________________________________________
> webkit-gtk mailing list
> webkit-gtk at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-gtk
--
Carlos Garcia Campos
http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 224 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20170517/ca309c6c/attachment.bin>
More information about the webkit-gtk
mailing list