[evince] [shell] Propagate key events from EvWindow to EvView
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: svn-commits-list gnome org
- Subject: [evince] [shell] Propagate key events from EvWindow to EvView
- Date: Tue, 12 May 2009 06:24:37 -0400 (EDT)
commit f81a810207898013bc1dba138f9ed50cb6d765d6
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Tue May 12 12:01:43 2009 +0200
[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.
---
shell/ev-window.c | 25 +++++++++++++++++++++++++
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]