Focus the view on key press if nothing's focussed

This commit is contained in:
Christian Dywan 2011-03-06 17:25:32 +01:00
parent 663e7e9285
commit de0ede905f
2 changed files with 4 additions and 3 deletions

View file

@ -1671,6 +1671,9 @@ midori_browser_key_press_event (GtkWidget* widget,
GtkWidgetClass* widget_class; GtkWidgetClass* widget_class;
guint clean_state; 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 (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
if (sokoke_window_activate_key (window, event)) if (sokoke_window_activate_key (window, event))
return TRUE; return TRUE;

View file

@ -3285,10 +3285,8 @@ static gboolean
midori_view_focus_in_event (GtkWidget* widget, midori_view_focus_in_event (GtkWidget* widget,
GdkEventFocus* event) GdkEventFocus* event)
{ {
MidoriView* view = MIDORI_VIEW (widget);
/* Always propagate focus to the child web view */ /* 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; return TRUE;
} }