fix pageup/pagedown shortcuts

min
NunoSempere 2 months ago
parent 5c56652e87
commit e98f5e9b29

@ -1,12 +1,9 @@
# To do
## Quality of life:
- [ ] Document creating new applications, e.g., as in [Asana for Linux](https://git.nunosempere.com/NunoSempere/asana-for-linux)
- [ ] Use something other than Whatsapp as an example syslink.
- [ ] This time, use something other than Whatsapp as an example syslink.
- [ ] Fix bug about distorted audio. Maybe related to [this pipewire issue](<https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1547>)?
- See whether it even exists at all
- [ ] Fix PageUp/PageDown shortcuts.
- [ ] Upgrade to GTK-4 / Webkitgtk 6.0? Will take a fair amount of time, since GTK4 redesigns the application model somewhat.
- Instructions for webkit-6.0 [here](https://github.com/WebKit/WebKit/blob/ed1422596dce5ff012e64a38faf402ac1674fc7e/Source/WebKit/gtk/migrating-to-webkitgtk-6.0.md)
- Instructions for GTK-4 [here](https://docs.gtk.org/gtk4/migrating-3to4.html)
@ -17,6 +14,7 @@
# Previously done
- [x] Fix PageUp/PageDown shortcuts.
- ~~[ ] Set [`webkit_web_context_set_sandbox_enabled`](<https://webkitgtk.org/reference/webkit2gtk/2.36.8/WebKitWebContext.html#webkit-web-context-set-sandbox-enabled>), as recommended [here](<https://blogs.gnome.org/mcatanzaro/2022/11/04/stop-using-qtwebkit/>)~~. Irrelevant with upgrade to libsoup3.
- [x] Update to webkit2gtk-4.1
- [x] Change README and point to last Ubuntu 20.04 commit

@ -53,6 +53,13 @@ To remove plugins completely;
// GTK
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
#define KEY(x) GDK_KEY_##x
/*
There are two different constants for Page_Up/Page_Down:
This could possibly have something to so with having Page_Down/Page_Up
as part of a keypad with/without NumLock
See: https://docs.gtk.org/gdk3/?q=Page_Up
See: https://docs.gtk.org/gdk3/?q=GDK_KEY_KP
*/
// Shortcuts
typedef enum {
@ -87,25 +94,25 @@ static struct {
unsigned key;
func id;
} shortcut[] = {
{ CTRL, KEY(h), goback },
{ CTRL, KEY(j), goforward },
{ CTRL, KEY(r), refresh },
{ CTRL, KEY(R), refresh_force },
{ CTRL, KEY(H), back_to_home },
{ CTRL, KEY(equal), zoomin },
{ CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset },
{ CTRL, KEY(Page_Up), prev_tab },
{ CTRL, KEY(Page_Down), next_tab },
{ CTRL, KEY(t), new_tab },
{ CTRL, KEY(w), close_tab },
{ 0x0, KEY(F11), toggle_fullscreen },
{ CTRL, KEY(l), show_searchbar },
{ CTRL, KEY(semicolon), hide_bar },
{ CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next },
{ CTRL, KEY(N), finder_prev },
{ CTRL, KEY(p), prettify }
{ CTRL, KEY(h), goback },
{ CTRL, KEY(j), goforward },
{ CTRL, KEY(r), refresh },
{ CTRL, KEY(R), refresh_force },
{ CTRL, KEY(H), back_to_home },
{ CTRL, KEY(equal), zoomin },
{ CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset },
{ CTRL, KEY(KP_Page_Up), prev_tab }, /* also try KEY(Page_Up) if this doesn't work on your machine */
{ CTRL, KEY(KP_Page_Down), next_tab }, /* ditto for KEY(Page_Down) */
{ CTRL, KEY(t), new_tab },
{ CTRL, KEY(w), close_tab },
{ 0x0, KEY(F11), toggle_fullscreen },
{ CTRL, KEY(l), show_searchbar },
{ CTRL, KEY(semicolon), hide_bar },
{ CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next },
{ CTRL, KEY(N), finder_prev },
{ CTRL, KEY(p), prettify }
};
/* ^ For controls more akin to normal browsers */
/* Reference for the key shorthand:

Binary file not shown.

@ -35,7 +35,6 @@ void load_uri(WebKitWebView* view, const char* uri)
webkit_web_view_load_uri(view, "");
bar.entry_mode = _SEARCH;
toggle_bar(notebook);
} else if (g_str_has_prefix(uri, "http://") || g_str_has_prefix(uri, "https://") || g_str_has_prefix(uri, "file://") || g_str_has_prefix(uri, "about:")) {
webkit_web_view_load_uri(view, uri);
} else {
@ -398,8 +397,8 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook)
printf("Keypress state is: CONTROL\n");
}
printf("Keypress value: %d\n", event_keyval);
printf("PageUp: %d\n", KEY(Page_Up));
printf("PageDown: %d\n", KEY(Page_Down));
printf("PageUp: %d %d\n", KEY(Page_Up), GDK_KEY_KP_Page_Up);
printf("PageDown: %d %d\n", KEY(Page_Down),GDK_KEY_KP_Page_Down);
}
for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++)

Loading…
Cancel
Save