]> www.fi.muni.cz Git - evince.git/commitdiff
libview: Only accept focus on annot windows when pointer is on the window
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 20 Feb 2011 11:11:19 +0000 (12:11 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 20 Feb 2011 11:11:19 +0000 (12:11 +0100)
It prevents focus stealing when scrolling with keyboard. See bug #623829.

libview/ev-annotation-window.c

index f47d9f6da10f48d84e1c63e204e5b47be0af3f6c..8776dd4cf4cfd520a110690d14fbffb199a25fc3 100644 (file)
@@ -378,7 +378,7 @@ ev_annotation_window_init (EvAnnotationWindow *window)
 
        gtk_container_set_border_width (GTK_CONTAINER (window), 2);
 
-       gtk_window_set_accept_focus (GTK_WINDOW (window), TRUE);
+       gtk_window_set_accept_focus (GTK_WINDOW (window), FALSE);
        gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
        gtk_window_set_skip_taskbar_hint (GTK_WINDOW (window), TRUE);
        gtk_window_set_skip_pager_hint (GTK_WINDOW (window), TRUE);
@@ -511,6 +511,24 @@ ev_annotation_window_focus_out_event (GtkWidget     *widget,
        return FALSE;
 }
 
+static gboolean
+ev_annotation_window_enter_notify_event (GtkWidget        *widget,
+                                         GdkEventCrossing *event)
+{
+        gtk_window_set_accept_focus (GTK_WINDOW (widget), TRUE);
+
+        return FALSE;
+}
+
+static gboolean
+ev_annotation_window_leave_notify_event (GtkWidget        *widget,
+                                         GdkEventCrossing *event)
+{
+        gtk_window_set_accept_focus (GTK_WINDOW (widget), FALSE);
+
+        return FALSE;
+}
+
 static void
 ev_annotation_window_class_init (EvAnnotationWindowClass *klass)
 {
@@ -525,6 +543,8 @@ 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->enter_notify_event = ev_annotation_window_enter_notify_event;
+        gtk_widget_class->leave_notify_event = ev_annotation_window_leave_notify_event;
 
        g_object_class_install_property (g_object_class,
                                         PROP_ANNOTATION,