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,28 +1505,28 @@ 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 (!x11display) { } else {
x11display = XOpenDisplay(nullptr); if (QApplication::platformName().contains("wayland")) {
if (XKeysymToKeycode(x11display, XK_Home) == 110) {
selected_keycode = x11_to_xt_2; selected_keycode = x11_to_xt_2;
} else if (XKeysymToKeycode(x11display, XK_Home) == 69) { } else if (!x11display) {
selected_keycode = x11_to_xt_vnc; x11display = XOpenDisplay(nullptr);
if (XKeysymToKeycode(x11display, XK_Home) == 110) {
selected_keycode = x11_to_xt_2;
} else if (XKeysymToKeycode(x11display, XK_Home) == 69) {
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;
} }