]> spindle.queued.net Git - midori/commitdiff
Be sure to focus the web view rather than the scrolled widget
authorChristian Dywan <christian@twotoasts.de>
Mon, 12 Oct 2009 11:05:43 +0000 (13:05 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 12 Oct 2009 11:05:43 +0000 (13:05 +0200)
midori/midori-browser.c

index 164cc50d62c159ecb6aaae8c2f33ee5904f64dea..790cb20a16ac3b2541b5ebb23b31fac745256f28 100644 (file)
@@ -6424,12 +6424,15 @@ midori_browser_set_current_page (MidoriBrowser* browser,
                                  gint           n)
 {
     GtkWidget* view;
+    GtkWidget* web_view;
 
     gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
     view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n);
     if (view && midori_view_is_blank (MIDORI_VIEW (view)))
         gtk_action_activate (_action_by_name (browser, "Location"));
-    else if (view)
+    else if ((web_view = gtk_bin_get_child (GTK_BIN (view))))
+        gtk_widget_grab_focus (web_view);
+    else
         gtk_widget_grab_focus (view);
 }
 
@@ -6487,6 +6490,7 @@ midori_browser_set_current_tab (MidoriBrowser* browser,
                                 GtkWidget*     view)
 {
     gint n;
+    GtkWidget* web_view;
 
     g_return_if_fail (MIDORI_IS_BROWSER (browser));
     g_return_if_fail (GTK_IS_WIDGET (view));
@@ -6495,6 +6499,8 @@ midori_browser_set_current_tab (MidoriBrowser* browser,
     gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
     if (view && midori_view_is_blank (MIDORI_VIEW (view)))
         gtk_action_activate (_action_by_name (browser, "Location"));
+    else if ((web_view = gtk_bin_get_child (GTK_BIN (view))))
+        gtk_widget_grab_focus (web_view);
     else
         gtk_widget_grab_focus (view);
 }