Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-window.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2009-05-12 10:01:43 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2009-05-12 10:01:43 (GMT)
commitf81a810207898013bc1dba138f9ed50cb6d765d6 (patch)
tree638b6dc9182c451a0a98b32449d2a35965aea502 /shell/ev-window.c
parente2822c4d43b39aa535f923b4e0fb4af6537d056f (diff)
[shell] Propagate key events from EvWindow to EvView
EvAnnotationWindow is a GtkWindow that doesn't accept focus, but we manually grab the focus on the text view contained in it to be able to modify the annotation contents. We need to propagate the key events to the view even when the view is not the focused widget. The view will only handle these events when there's a popup window with the focus so that it's possible to type in window annotations.
Diffstat (limited to 'shell/ev-window.c')
-rw-r--r--shell/ev-window.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index bc7d151..16e10ca 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -4748,6 +4748,30 @@ ev_window_dispose (GObject *object)
G_OBJECT_CLASS (ev_window_parent_class)->dispose (object);
}
+static gboolean
+ev_window_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ EvWindow *ev_window = EV_WINDOW (widget);
+ gboolean handled = FALSE;
+
+ /* Propagate the event to the view first
+ * It's needed to be able to type in
+ * annot popups windows
+ */
+ if (ev_window->priv->view) {
+ g_object_ref (ev_window->priv->view);
+ if (GTK_WIDGET_IS_SENSITIVE (ev_window->priv->view))
+ handled = gtk_widget_event (ev_window->priv->view, (GdkEvent*) event);
+ g_object_unref (ev_window->priv->view);
+ }
+
+ if (!handled)
+ handled = GTK_WIDGET_CLASS (ev_window_parent_class)->key_press_event (widget, event);
+
+ return handled;
+}
+
static void
ev_window_class_init (EvWindowClass *ev_window_class)
{
@@ -4757,6 +4781,7 @@ ev_window_class_init (EvWindowClass *ev_window_class)
g_object_class->dispose = ev_window_dispose;
g_object_class->finalize = ev_window_finalize;
+ widget_class->key_press_event = ev_window_key_press_event;
widget_class->screen_changed = ev_window_screen_changed;
widget_class->window_state_event = ev_window_state_event;
widget_class->drag_data_received = ev_window_drag_data_received;