[gnome-terminal/gnome-3-18] notebook: Don't let the keyboard focus enter from the tab label



commit bbd0b277163fddf734d88d8827c01eb7c35362a3
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Mar 24 15:44:43 2015 +0100

    notebook: Don't let the keyboard focus enter from the tab label
    
    Merely setting TerminalTabLabel:can-focus to FALSE is not enough to
    prevent the keyboard focus from entering the tab label. One can still
    click the current tab's label and have the keyboard focus move there.
    
    This solution was taken from gedit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746665
    (cherry picked from commit 9ce642509b67d8140641a8e99cde44979d2e676c)

 src/terminal-notebook.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/terminal-notebook.c b/src/terminal-notebook.c
index 34236f9..9d488fc 100644
--- a/src/terminal-notebook.c
+++ b/src/terminal-notebook.c
@@ -360,6 +360,15 @@ terminal_notebook_create_window (GtkNotebook       *notebook,
 
 /* GtkWidgetClass impl */
 
+static void
+terminal_notebook_grab_focus (GtkWidget *widget)
+{
+  TerminalScreen *screen;
+
+  screen = terminal_mdi_container_get_active_screen (TERMINAL_MDI_CONTAINER (widget));
+  gtk_widget_grab_focus (GTK_WIDGET (screen));
+}
+
 /* Tab scrolling was removed from GtkNotebook in gtk 3, so reimplement it here */
 static gboolean
 terminal_notebook_scroll_event (GtkWidget      *widget,
@@ -533,6 +542,7 @@ terminal_notebook_class_init (TerminalNotebookClass *klass)
 
   g_object_class_override_property (gobject_class, PROP_ACTIVE_SCREEN, "active-screen");
 
+  widget_class->grab_focus = terminal_notebook_grab_focus;
   widget_class->scroll_event = terminal_notebook_scroll_event;
 
   notebook_class->switch_page = terminal_notebook_switch_page;


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