From de0ede905f6b641677111cae785e0917024a7d56 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 6 Mar 2011 17:25:32 +0100 Subject: [PATCH] Focus the view on key press if nothing's focussed --- midori/midori-browser.c | 3 +++ midori/midori-view.c | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) 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; }