[evince/wip/gpoo/fix-evview-focus: 104/104] shell: allow EvView to correctly receive focus
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/gpoo/fix-evview-focus: 104/104] shell: allow EvView to correctly receive focus
- Date: Wed, 2 Mar 2022 20:17:09 +0000 (UTC)
commit 62ece0248028ce782ebc5e7938ea25ca6513813a
Author: Nelson Benítez León <nbenitezl gmail com>
Date: Sun Jan 16 14:45:30 2022 -0400
shell: allow EvView to correctly receive focus
This fixes bad behaviour described in following comment:
https://gitlab.gnome.org/GNOME/evince/-/issues/704#note_1350123
which is than when TAB key switching focus to the document view
it does not get it the first time, you have to play some UP and
DOWN arrow till it gets it (as described in previous comment).
The reason is that GTK does not pass the focus directly to EvView
but to the GtkScrolledWindow that contains it. But we really want
the focus to end up in the EvView, so we manually do that so the
focus TAB chain performs as expected.
Part of issue #704
shell/ev-window.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 701b3c7eb..b6ea5285e 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1054,6 +1054,15 @@ scroll_child_history_cb (GtkScrolledWindow *scrolled_window,
}
}
+static gboolean
+scrolled_window_focus_in_cb (GtkScrolledWindow *scrolled_window,
+ GdkEventFocus *event,
+ EvWindow *window)
+{
+ ev_window_focus_view (window);
+ return GDK_EVENT_STOP;
+}
+
static void
view_selection_changed_cb (EvView *view,
EvWindow *window)
@@ -7813,6 +7822,9 @@ ev_window_init (EvWindow *ev_window)
g_signal_connect_object (priv->scrolled_window, "scroll-child",
G_CALLBACK (scroll_child_history_cb),
ev_window, 0);
+ g_signal_connect_object (priv->scrolled_window, "focus-in-event",
+ G_CALLBACK (scrolled_window_focus_in_cb),
+ ev_window, 0);
g_signal_connect_object (priv->view, "annot-added",
G_CALLBACK (view_annot_added),
ev_window, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]