From 8b409aba3ae71f4c596d5383ee976f9e0bd69e50 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Mon, 22 Feb 2010 00:03:18 +0000 Subject: [PATCH] Add f5 for reload and f6 to focus on uri entry --- xxxterm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xxxterm.c b/xxxterm.c index 6991afa..e7769da 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -146,6 +146,10 @@ struct karg { #define XT_NAV_INVALID (0) #define XT_NAV_BACK (1) #define XT_NAV_FORWARD (2) +#define XT_NAV_RELOAD (3) + +#define XT_FOCUS_INVALID (0) +#define XT_FOCUS_URI (1) /* globals */ extern char *__progname; @@ -306,6 +310,18 @@ quit(struct tab *t, struct karg *args) } int +focus(struct tab *t, struct karg *args) +{ + if (t == NULL) + errx(1, "focus"); + + if (args->i == XT_FOCUS_URI) + gtk_widget_grab_focus(GTK_WIDGET(t->uri_entry)); + + return (0); +} + +int help(struct tab *t, struct karg *args) { if (t == NULL) @@ -333,6 +349,9 @@ navaction(struct tab *t, struct karg *args) case XT_NAV_FORWARD: webkit_web_view_go_forward(t->wv); break; + case XT_NAV_RELOAD: + webkit_web_view_reload(t->wv); + break; } return (XT_CB_PASSTHROUGH); } @@ -553,11 +572,15 @@ struct key { { GDK_SHIFT_MASK, 0, GDK_colon, command, {0} }, { GDK_CONTROL_MASK, 0, GDK_q, quit, {0} }, + /* focus */ + { 0, 0, GDK_F6, focus, {.i = XT_FOCUS_URI} }, + /* navigation */ { 0, 0, GDK_BackSpace, navaction, {.i = XT_NAV_BACK} }, { GDK_MOD1_MASK, 0, GDK_Left, navaction, {.i = XT_NAV_BACK} }, { GDK_SHIFT_MASK, 0, GDK_BackSpace, navaction, {.i = XT_NAV_FORWARD} }, { GDK_MOD1_MASK, 0, GDK_Right, navaction, {.i = XT_NAV_FORWARD} }, + { 0, 0, GDK_F5, navaction, {.i = XT_NAV_RELOAD} }, /* vertical movement */ { 0, 0, GDK_j, move, {.i = XT_MOVE_DOWN} }, -- 2.11.4.GIT