Browse Source

set the focus on the global entry only if the terminal closed has it

Héctor García 9 years ago
parent
commit
f0b5ae68e2
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/mssh-window.c

+ 5 - 2
src/mssh-window.c

@@ -269,6 +269,11 @@ static gboolean mssh_window_session_close(gpointer data)
     }
     else
     {
+        /* set the focus on the entry only if the terminal closed has it */
+        if ( gtk_window_get_focus(GTK_WINDOW(data_pair->window)) == GTK_WIDGET(data_pair->terminal) ) {
+            gtk_window_set_focus(GTK_WINDOW(data_pair->window), GTK_WIDGET(data_pair->window->global_entry));
+        }
+
         gtk_widget_destroy(data_pair->terminal->menu_item);
 
         gtk_container_remove(GTK_CONTAINER(data_pair->window->grid),
@@ -278,8 +283,6 @@ static gboolean mssh_window_session_close(gpointer data)
 
         mssh_window_relayout(data_pair->window);
 
-        /* set the focus on the entry */
-        gtk_window_set_focus(GTK_WINDOW(data_pair->window), GTK_WIDGET(data_pair->window->global_entry));
     }
 
     if(data_pair->window->terminals->len == 0 &&