get shortcuts working again

This commit is contained in:
NunoSempere 2024-03-12 14:39:03 -03:00
parent 8907cbb063
commit bb9d791a62
4 changed files with 15 additions and 6 deletions

View File

@ -1,5 +1,7 @@
#include <gdk/gdkkeysyms.h>
#include <stdbool.h>
#include <gdk/gdk.h>
// Previously: #include <gdk/gdkkeysyms.h>
// But GTK now discourages including the individual headers
// Key user config
#define WIDTH 1920 // 960 for half-width, 1920 for full width
@ -82,8 +84,8 @@ static struct {
{ CTRL, KEY(h), goback },
{ CTRL, KEY(j), goforward },
{ CTRL, KEY(r), refresh },
{ CTRL | SFT, KEY(R), refresh_force },
{ CTRL | SFT, KEY(H), back_to_home },
{ CTRL, KEY(R), refresh_force },
{ CTRL, KEY(H), back_to_home },
{ CTRL, KEY(equal), zoomin },
{ CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset },
@ -96,7 +98,7 @@ static struct {
{ CTRL, KEY(semicolon), hide_bar },
{ CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next },
{ CTRL | SFT, KEY(N), finder_prev },
{ CTRL, KEY(N), finder_prev },
{ CTRL, KEY(p), prettify }
};
/* ^ For controls more akin to normal browsers */

View File

@ -64,7 +64,7 @@ fast: $(SRC) $(PLUGINS) $(CONFIG)
rm -f *.gcda
lint:
clang-tidy $(SRC) $(PLUGINS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.0'` -o rose `pkg-config --libs 'webkit2gtk-4.0'`
clang-tidy $(SRC) $(PLUGINS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.1'` -o rose `pkg-config --libs 'webkit2gtk-4.1'`
inspect: build
GTK_DEBUG=interactive ./rose

BIN
rose

Binary file not shown.

9
rose.c
View File

@ -381,8 +381,15 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook)
{
(void)self;
/*
printf("Keypress state: %d\n", event->key.state);
if(event->key.state & GDK_CONTROL_MASK){
printf("Keypress state is: CONTROL\n");
}
printf("Keypress value: %d\n", event->key.keyval);
*/
for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++)
if ((event->key.state == shortcut[i].mod || shortcut[i].mod == 0x0) && event->key.keyval == shortcut[i].key)
if ((event->key.state & shortcut[i].mod || shortcut[i].mod == 0x0) && event->key.keyval == shortcut[i].key)
return handle_shortcut(shortcut[i].id, notebook);
/*
If I wanted to bind button presses, like the extra button in the mouse,