From: Christian Dywan Date: Sun, 6 Mar 2011 16:25:32 +0000 (+0100) Subject: Focus the view on key press if nothing's focussed X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de0ede905f6b641677111cae785e0917024a7d56;p=midori Focus the view on key press if nothing's focussed --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 325aef93..584ca481 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -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; diff --git a/midori/midori-view.c b/midori/midori-view.c index d0cb178e..a193a97d 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -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; }