[webkit-gtk] WebView avoiding propagation of some GtkWidget signals

Carlos Garcia Campos cgarcia at igalia.com
Wed Jan 6 23:19:50 PST 2016

El mié, 06-01-2016 a las 13:04 +0000, Mario Sanchez Prada escribió:
> Hi there,
> I just realized that the WebKitWebView widget is not propagating some
> GtkWidget's signals on purpose due to a fairly old changeset (see
> [1]), and
> I can't work out what the rationale behind that change is since
> there's no
> bug linked from the ChangeLog, and there's not an explanation there
> either.
> Carlos, Gustavo or anyone else... could you drop some light on this,
> please?

The thing is that in the GTK+ events model, everything is synchronous,
so the event handlers return TRUE/FALSE dependening on whether the
event was handled by that handler or not. In WebKit2 that happens
asynchronously, we need to send the events to the web process that will
handled them, so when we return the events handler in the UI process we
still don't know if the web process will handle the event or not. In
the case of key events we save the event, and when the web process
replies we re-emit the event if it was not handled by the web process.
This is also problematic, because you could see the events twice. The
easiest solution would be to make all event handlers use sync messages,
but that would affect the performance I'm afraid.

> For the record, this is a problem in an app we have as we need to
> handle the
> "motion-notify-event" signal from the webview's parent GtkWidget,
> which is
> not possible atm due to [1], and not sure a workaround would make
> sense.

Are you using a widget derived from WebKitWebView and handling the
event using the default handler? Because if you connect with
g_signal_connect you should get the events, since in that case the
callback is called before the default handler (motion-notify-event is

> Thanks,
> Mario
> [1] http://trac.webkit.org/changeset/117594
> _______________________________________________
> webkit-gtk mailing list
> webkit-gtk at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-gtk
Carlos Garcia Campos

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20160107/d1d5b7de/attachment.sig>

More information about the webkit-gtk mailing list