qt: Clean up Linux keycode disambiguation code

This commit is contained in:
RichardG867
2023-04-06 22:09:42 -03:00
parent 6f1be15092
commit afc645460d

View File

@@ -1505,14 +1505,15 @@ x11_keycode_to_keysym(uint32_t keycode)
finalkeycode = be_to_xt[keycode]; finalkeycode = be_to_xt[keycode];
#else #else
static Display *x11display = nullptr; static Display *x11display = nullptr;
if (QApplication::platformName().contains("wayland")) { if (QApplication::platformName().contains("eglfs")) {
selected_keycode = x11_to_xt_2;
} else if (QApplication::platformName().contains("eglfs")) {
keycode -= 8; keycode -= 8;
if (keycode <= 88) if (keycode <= 88)
finalkeycode = keycode; finalkeycode = keycode;
else else
finalkeycode = evdev_to_xt[keycode]; finalkeycode = evdev_to_xt[keycode];
} else {
if (QApplication::platformName().contains("wayland")) {
selected_keycode = x11_to_xt_2;
} else if (!x11display) { } else if (!x11display) {
x11display = XOpenDisplay(nullptr); x11display = XOpenDisplay(nullptr);
if (XKeysymToKeycode(x11display, XK_Home) == 110) { if (XKeysymToKeycode(x11display, XK_Home) == 110) {
@@ -1521,12 +1522,11 @@ x11_keycode_to_keysym(uint32_t keycode)
selected_keycode = x11_to_xt_vnc; selected_keycode = x11_to_xt_vnc;
} }
} }
if (!QApplication::platformName().contains("eglfs"))
finalkeycode = selected_keycode[keycode]; finalkeycode = selected_keycode[keycode];
#endif
if (rctrl_is_lalt && finalkeycode == 0x11D) {
finalkeycode = 0x38;
} }
#endif
if (rctrl_is_lalt && finalkeycode == 0x11D)
finalkeycode = 0x38;
return finalkeycode; return finalkeycode;
} }