[epiphany] Revert "window: Use signal for forwarding keys to webkit"
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Revert "window: Use signal for forwarding keys to webkit"
- Date: Thu, 29 Apr 2021 08:30:51 +0000 (UTC)
commit 00e1b20a3d19070c498604155aa9929d055d4704
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Thu Apr 29 10:28:55 2021 +0200
Revert "window: Use signal for forwarding keys to webkit"
This reverts commit a5bc4bd7bca8148d596f650d79676dde321c7372.
Fixes #1519
src/ephy-window.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index d8b93b1cd..c08d3d20d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -657,15 +657,14 @@ ephy_window_should_view_receive_key_press_event (EphyWindow *window,
}
static gboolean
-key_press_event_cb (EphyWindow *window,
- GdkEventKey *event)
+ephy_window_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
{
EphyWebView *view;
- view = ephy_embed_get_web_view (window->active_embed);
-
- if (gtk_window_get_focus (GTK_WINDOW (window)) != GTK_WIDGET (view))
- return GDK_EVENT_PROPAGATE;
+ view = ephy_embed_get_web_view (EPHY_WINDOW (widget)->active_embed);
+ if (gtk_window_get_focus (GTK_WINDOW (widget)) != GTK_WIDGET (view))
+ return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event);
/* GtkWindow's key press handler first calls gtk_window_activate_key,
* then gtk_window_propagate_key_event. We want to do the opposite,
@@ -677,8 +676,12 @@ key_press_event_cb (EphyWindow *window,
* short-circuit the event propagation if it's a special keybinding
* that is reserved for Epiphany not allowed to be seen by webpages.
*/
- if (ephy_window_should_view_receive_key_press_event (window, event))
- return gtk_widget_event (GTK_WIDGET (view), (GdkEvent *)event);
+ if (!ephy_window_should_view_receive_key_press_event (EPHY_WINDOW (widget), event) ||
+ !gtk_window_propagate_key_event (GTK_WINDOW (widget), event)) {
+ gtk_window_activate_key (GTK_WINDOW (widget), event);
+
+ return GDK_EVENT_STOP;
+ }
return GDK_EVENT_PROPAGATE;
}
@@ -3824,6 +3827,7 @@ ephy_window_class_init (EphyWindowClass *klass)
object_class->get_property = ephy_window_get_property;
object_class->set_property = ephy_window_set_property;
+ widget_class->key_press_event = ephy_window_key_press_event;
widget_class->window_state_event = ephy_window_state_event;
widget_class->show = ephy_window_show;
widget_class->destroy = ephy_window_destroy;
@@ -3865,8 +3869,6 @@ static void
ephy_window_init (EphyWindow *window)
{
LOG ("EphyWindow initialising %p", window);
-
- g_signal_connect (window, "key-press-event", G_CALLBACK (key_press_event_cb), NULL);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]