logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 5d0681c28107c3a18b552f270743940da40808c8
parent: 47c494da006c5a034f2cf3b26299c0edf46a840b
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 26 Apr 2019 21:15:06 +0200

Hook browser->box to commonCb_key_press_event

Diffstat:

Mbadwolf.120++++++++++----------
Mbadwolf.c14++++++++++++++
2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/badwolf.1 b/badwolf.1 @@ -22,20 +22,20 @@ For now it only has the default Webkit/GTK keybindings, which notably are (C for .Bl -width Ds -tag .It any C-PageUp / C-PageDown Go to the previous/next tab -.It search C-g / C-S-g -When the search box is focused it goes to the Next/Previous search term. -.It webview C-F4 +.It any C-t +Creates a new tab (unrelated, similar as pressing the button) +.It browser C-F4 Closes the current tab -.It webview C-S-r / C-r -Reloads the current tab (with/without clearing cache) -.It webview C-f +.It browser C-f Focuses on the search entry -.It webview C-l +.It browser C-l Focuses on the location(URL) entry -.It window C-t, webview C-t -Creates a new tab (unrelated, similar as pressing the button) -.It webview C-[ / C-] +.It browser C-S-r / C-r +Reloads the current tab (with/without clearing cache) +.It browser C-[ / C-] Go back/forward in current tab’s history +.It search C-g / C-S-g +When the search box is focused it goes to the Next/Previous search term. .El .Sh BUGS You can submit contributions or tickets to diff --git a/badwolf.c b/badwolf.c @@ -40,6 +40,7 @@ static gboolean WebViewCb_key_press_event(WebKitWebView *webView, GdkEvent *event, gpointer user_data); static gboolean main_windowCb_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer user_data); +static gboolean boxCb_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer user_data); static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason, gpointer user_data); @@ -143,6 +144,17 @@ WebViewCb_key_press_event(WebKitWebView *webView, GdkEvent *event, gpointer user } static gboolean +boxCb_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + (void)widget; + struct Client *browser = (struct Client *)user_data; + + if(commonCb_key_press_event(browser->window, event, browser)) return TRUE; + + return FALSE; +} + +static gboolean main_windowCb_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { (void)widget; @@ -513,6 +525,8 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web browser->search, "search-changed", G_CALLBACK(SearchEntryCb_search__changed), browser); g_signal_connect(browser->search, "stop-search", G_CALLBACK(SearchEntryCb_stop__search), browser); + g_signal_connect(browser->box, "key-press-event", G_CALLBACK(boxCb_key_press_event), browser); + if(related_web_view == NULL) webkit_web_view_load_uri(browser->webView, target_url); return browser;