use group(?)-agnostic keyval for paste shortcut (fixes #228)

This commit is contained in:
ouwou
2023-10-02 23:05:34 -04:00
parent e68a086bca
commit bddf22ef87
3 changed files with 27 additions and 2 deletions

15
src/misc/events.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include "events.hpp"
namespace EventsUtil {
unsigned shortcut_key(GdkEventKey *event) {
// thanks inkscape
unsigned shortcut_key = 0;
gdk_keymap_translate_keyboard_state(
gdk_keymap_get_for_display(gdk_display_get_default()),
event->hardware_keycode,
static_cast<GdkModifierType>(event->state),
0,
&shortcut_key, nullptr, nullptr, nullptr);
return shortcut_key;
}
} // namespace EventsUtil

7
src/misc/events.hpp Normal file
View File

@@ -0,0 +1,7 @@
#pragma once
#include <gdk/gdkkeys.h>
// idk it wont let me forward declare
namespace EventsUtil {
unsigned shortcut_key(GdkEventKey *event);
}