]> spindle.queued.net Git - midori/commitdiff
Focus the view on key press if nothing's focussed
authorChristian Dywan <christian@twotoasts.de>
Sun, 6 Mar 2011 16:25:32 +0000 (17:25 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sun, 6 Mar 2011 16:26:41 +0000 (17:26 +0100)
midori/midori-browser.c
midori/midori-view.c

index 325aef93770ac1da8782f485da1ce4055edb9bae..584ca481a55d12083fb750a4cdb958064fc77397 100644 (file)
@@ -1671,6 +1671,9 @@ midori_browser_key_press_event (GtkWidget*   widget,
     GtkWidgetClass* widget_class;
     guint clean_state;
 
+    if (gtk_window_get_focus (GTK_WINDOW (widget)) == NULL)
+        gtk_widget_grab_focus (midori_browser_get_current_tab (MIDORI_BROWSER (widget)));
+
     if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
         if (sokoke_window_activate_key (window, event))
             return TRUE;
index d0cb178efc1e6b6ad5b2952ba38fcc45122c0840..a193a97dcd2c8c6ba45fb5e17c2437520ce46697 100644 (file)
@@ -3285,10 +3285,8 @@ static gboolean
 midori_view_focus_in_event (GtkWidget*     widget,
                             GdkEventFocus* event)
 {
-    MidoriView* view = MIDORI_VIEW (widget);
-
     /* Always propagate focus to the child web view */
-    gtk_widget_grab_focus (view->web_view);
+    gtk_widget_grab_focus (midori_view_get_web_view (MIDORI_VIEW (widget)));
     return TRUE;
 }