summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-10 01:51:45 +0100
committerinfirit <[email protected]>2014-12-10 01:51:45 +0100
commitdb3f169a3b9aaced264a5cec39e41430e4b8040f (patch)
tree28638e99866a22c9cb7d9d9930538f423c0a4b8d /libview
parent3b65cb19ec88d6263c5d20f5332bedf102ce77ef (diff)
downloadatril-db3f169a3b9aaced264a5cec39e41430e4b8040f.tar.bz2
atril-db3f169a3b9aaced264a5cec39e41430e4b8040f.tar.xz
libview: Only accept focus on annot windows when pointer is on the window
It prevents focus stealing when scrolling with keyboard. Taken from evince commit: 8a635b0b7d54cecc864299c8decbcc51b3c068a9 From: Carlos Garcia Campos <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=623829
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-annotation-window.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c
index 91b0a7b0..643341fa 100644
--- a/libview/ev-annotation-window.c
+++ b/libview/ev-annotation-window.c
@@ -411,7 +411,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);
@@ -544,6 +544,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)
{
@@ -558,6 +576,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,