diff options
author | Josh Rickmar <jrick@devio.us> | 2012-08-06 15:04:33 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@devio.us> | 2012-08-06 15:04:33 -0400 |
commit | 69c102059fe76ad5a27d07a2081938a5c613b292 (patch) | |
tree | 9c557794b3db4cd22f4d5097444d14e0602a0c57 | |
parent | d397399c349d36f611a5aac6fa53528d2fe2eaea (diff) | |
download | xombrero-69c102059fe76ad5a27d07a2081938a5c613b292.tar.gz |
Attach t->cmd to the hide signal to focus t->wv
Whenever t->cmd is hidden we need to make a decision about what to focus (in most cases, the webview). Before this may not have always happened if t->cmd was hidden and no focus was explicitly set.
-rw-r--r-- | xombrero.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/xombrero.c b/xombrero.c index 214b104..6b40e49 100644 --- a/xombrero.c +++ b/xombrero.c @@ -6610,7 +6610,6 @@ cmd_keypress_cb(GtkEntry *w, GdkEventKey *e, struct tab *t) /* FALLTHROUGH */ case GDK_Escape: hide_cmd(t); - focus_webview(t); /* cancel search */ if (c != NULL && (c[0] == '/' || c[0] == '?')) @@ -6701,12 +6700,21 @@ cmd_focusout_cb(GtkWidget *w, GdkEventFocus *e, struct tab *t) hide_oops(t); disable_hints(t); + return (XT_CB_PASSTHROUGH); +} + +void +cmd_hide_cb(GtkWidget *w, struct tab *t) +{ + if (t == NULL) { + show_oops(NULL, "%s: invalid parameters", __func__); + return; + } + if (show_url == 0 || t->focus_wv) focus_webview(t); else gtk_widget_grab_focus(GTK_WIDGET(t->uri_entry)); - - return (XT_CB_PASSTHROUGH); } void @@ -7765,6 +7773,7 @@ create_new_tab(char *title, struct undo *u, int focus, int position) "signal::focus-out-event", G_CALLBACK(cmd_focusout_cb), t, "signal::activate", G_CALLBACK(cmd_activate_cb), t, "signal::populate-popup", G_CALLBACK(cmd_popup_cb), t, + "signal::hide", G_CALLBACK(cmd_hide_cb), t, (char *)NULL); /* reuse wv_button_cb to hide oops */ @@ -7883,10 +7892,6 @@ notebook_switchpage_cb(GtkNotebook *nb, GtkWidget *nbp, guint pn, hide_cmd(t); hide_oops(t); - if (t->focus_wv) { - /* can't use focus_webview here */ - gtk_widget_grab_focus(GTK_WIDGET(t->wv)); - } update_statusbar_tabs(t); break; } |