aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNunoSempere <nuno.semperelh@protonmail.com>2024-03-22 09:38:13 -0300
committerNunoSempere <nuno.semperelh@protonmail.com>2024-03-22 09:38:13 -0300
commite98f5e9b2914e50e4dac374a62abb4d60c015dc1 (patch)
tree951d580e85415037110ba432fb2dd53189f2c5aa
parent5c56652e871a435aa22a297d6d443e6f32cfdff0 (diff)
fix pageup/pagedown shortcuts
-rw-r--r--TODO.md6
-rw-r--r--config.h45
-rwxr-xr-xrosenrotbin40120 -> 40120 bytes
-rw-r--r--rosenrot.c5
4 files changed, 30 insertions, 26 deletions
diff --git a/TODO.md b/TODO.md
index 79f4283..5c270b5 100644
--- a/TODO.md
+++ b/TODO.md
@@ -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
diff --git a/config.h b/config.h
index 1409d18..e2a13ed 100644
--- a/config.h
+++ b/config.h
@@ -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:
diff --git a/rosenrot b/rosenrot
index a72527c..20fac11 100755
--- a/rosenrot
+++ b/rosenrot
Binary files differ
diff --git a/rosenrot.c b/rosenrot.c
index 5e44390..b98cb1d 100644
--- a/rosenrot.c
+++ b/rosenrot.c
@@ -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++)