fix pageup/pagedown shortcuts

This commit is contained in:
NunoSempere 2024-03-22 09:38:13 -03:00
parent 5c56652e87
commit e98f5e9b29
4 changed files with 30 additions and 26 deletions

View File

@ -1,12 +1,9 @@
# To do # To do
## Quality of life:
- [ ] Document creating new applications, e.g., as in [Asana for Linux](https://git.nunosempere.com/NunoSempere/asana-for-linux) - [ ] 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>)? - [ ] 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 - 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. - [ ] 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 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) - Instructions for GTK-4 [here](https://docs.gtk.org/gtk4/migrating-3to4.html)
@ -17,6 +14,7 @@
# Previously done # 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. - ~~[ ] 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] Update to webkit2gtk-4.1
- [x] Change README and point to last Ubuntu 20.04 commit - [x] Change README and point to last Ubuntu 20.04 commit

View File

@ -53,6 +53,13 @@ To remove plugins completely;
// GTK // GTK
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false #define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
#define KEY(x) GDK_KEY_##x #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 // Shortcuts
typedef enum { typedef enum {
@ -95,8 +102,8 @@ static struct {
{ CTRL, KEY(equal), zoomin }, { CTRL, KEY(equal), zoomin },
{ CTRL, KEY(minus), zoomout }, { CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset }, { CTRL, KEY(0), zoom_reset },
{ CTRL, KEY(Page_Up), prev_tab }, { CTRL, KEY(KP_Page_Up), prev_tab }, /* also try KEY(Page_Up) if this doesn't work on your machine */
{ CTRL, KEY(Page_Down), next_tab }, { CTRL, KEY(KP_Page_Down), next_tab }, /* ditto for KEY(Page_Down) */
{ CTRL, KEY(t), new_tab }, { CTRL, KEY(t), new_tab },
{ CTRL, KEY(w), close_tab }, { CTRL, KEY(w), close_tab },
{ 0x0, KEY(F11), toggle_fullscreen }, { 0x0, KEY(F11), toggle_fullscreen },

BIN
rosenrot

Binary file not shown.

View File

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