[vinagre/gnome-3-18] Give focus to new RDP tab



commit 71db2c7ff24b242b1e299d7092a1aa675d1e53df
Author: Marek Kasik <mkasik redhat com>
Date:   Tue Feb 23 12:02:29 2016 +0100

    Give focus to new RDP tab
    
    Previously RDP tab didn't get focus once it was created
    and hence typing did not work initially.
    RDP tab is a focusable widget now and grabs focus once
    it is realized.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752957

 plugins/rdp/vinagre-rdp-tab.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/plugins/rdp/vinagre-rdp-tab.c b/plugins/rdp/vinagre-rdp-tab.c
index 6110f75..01db3a7 100644
--- a/plugins/rdp/vinagre-rdp-tab.c
+++ b/plugins/rdp/vinagre-rdp-tab.c
@@ -1220,11 +1220,21 @@ open_freerdp (VinagreRdpTab *rdp_tab)
 }
 
 static void
+tab_realized (GtkWidget     *widget,
+              gpointer       user_data)
+{
+  gtk_widget_grab_focus (widget);
+  g_signal_handlers_disconnect_by_func (widget, tab_realized, user_data);
+}
+
+static void
 vinagre_rdp_tab_init (VinagreRdpTab *rdp_tab)
 {
   rdp_tab->priv = VINAGRE_RDP_TAB_GET_PRIVATE (rdp_tab);
 
   rdp_tab->priv->connected_actions = create_connected_actions (rdp_tab);
+
+  g_signal_connect (rdp_tab, "realize", G_CALLBACK (tab_realized), NULL);
 }
 
 GtkWidget *
@@ -1234,6 +1244,7 @@ vinagre_rdp_tab_new (VinagreConnection *conn,
   return GTK_WIDGET (g_object_new (VINAGRE_TYPE_RDP_TAB,
                                   "conn", conn,
                                   "window", window,
+                                  "can-focus", TRUE,
                                   NULL));
 }
 


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