[evince] libview: Make Esc close annotation window



commit 231ac085825939e25e994b7f598280ca518f3ba6
Author: Christian Gogolin <register cgogolin de>
Date:   Sat Jul 16 10:47:00 2016 +0200

    libview: Make Esc close annotation window
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768448

 libview/ev-annotation-window.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c
index 9d66ec9..fcdaa98 100644
--- a/libview/ev-annotation-window.c
+++ b/libview/ev-annotation-window.c
@@ -539,6 +539,18 @@ ev_annotation_window_focus_out_event (GtkWidget     *widget,
        return FALSE;
 }
 
+static gboolean
+ev_annotation_window_key_press_event (GtkWidget   *widget,
+                                      GdkEventKey *event)
+{
+        if (event->keyval == GDK_KEY_Escape) {
+                ev_annotation_window_close (EV_ANNOTATION_WINDOW (widget));
+                return TRUE;
+        }
+
+        return GTK_WIDGET_CLASS (ev_annotation_window_parent_class)->key_press_event (widget, event);
+}
+
 static void
 ev_annotation_window_class_init (EvAnnotationWindowClass *klass)
 {
@@ -552,6 +564,7 @@ ev_annotation_window_class_init (EvAnnotationWindowClass *klass)
        gtk_widget_class->configure_event = ev_annotation_window_configure_event;
        gtk_widget_class->focus_in_event = ev_annotation_window_focus_in_event;
        gtk_widget_class->focus_out_event = ev_annotation_window_focus_out_event;
+        gtk_widget_class->key_press_event = ev_annotation_window_key_press_event;
 
        g_object_class_install_property (g_object_class,
                                         PROP_ANNOTATION,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]