logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 8806bcb782b2e3e415007441ee37858791dd2ad1
parent: 4e947ca306fa2e4ce84011fd79419adec9862b17
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 26 Apr 2019 20:11:00 +0200

Hook webView to commonCb_key_press_event

Diffstat:

Mbadwolf.118+++++++++++++++---
Mbadwolf.c15+++++++++++++++
2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/badwolf.1 b/badwolf.1 @@ -20,10 +20,22 @@ will probably get added at a later release. .Sh KEYBINDINGS For now it only has the default Webkit/GTK keybindings, which notably are (C for Control, S for Shift): .Bl -width Ds -tag -.It any C-PageUp, any C-PageDown, tabs arrows -When WebView isn't focused (bug to fix) this allows to move from one tab to another. -.It search C-g, search C-S-g +.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 +Closes the current tab +.It webview C-S-r / C-r +Reloads the current tab (with/without clearing cache) +.It webview C-f +Focuses on the search entry +.It webview C-l +Focuses on the location(URL) entry +.It webview C-t +Creates a new tab (unrelated, similar as pressing the button) +.It webview C-[ / C-] +Go back/forward in current tab’s history .El .Sh BUGS You can submit contributions or tickets to diff --git a/badwolf.c b/badwolf.c @@ -35,6 +35,8 @@ struct Client static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); static gboolean commonCb_key_press_event(struct Client *browser, GdkEvent *event); +static gboolean +WebViewCb_key_press_event(WebKitWebView *webView, GdkEvent *event, gpointer user_data); static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason, gpointer user_data); @@ -120,6 +122,17 @@ commonCb_key_press_event(struct Client *browser, GdkEvent *event) } static gboolean +WebViewCb_key_press_event(WebKitWebView *webView, GdkEvent *event, gpointer user_data) +{ + (void)webView; + struct Client *browser = (struct Client *)user_data; + + if(commonCb_key_press_event(browser, event)) return TRUE; + + return FALSE; +} + +static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason, gpointer user_data) @@ -470,6 +483,8 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web browser); g_signal_connect(browser->webView, "create", G_CALLBACK(WebViewCb_create), window); g_signal_connect(browser->webView, "close", G_CALLBACK(WebViewCb_close), browser); + g_signal_connect( + browser->webView, "key-press-event", G_CALLBACK(WebViewCb_key_press_event), browser); g_signal_connect(browser->search, "next-match", G_CALLBACK(SearchEntryCb_next__match), browser); g_signal_connect(