Fix: Prevent crash on Wayland when using Qt 6 (#97)

This commit is contained in:
Javier O. Cordero Pérez
2024-05-20 22:13:12 +03:00
committed by GitHub
parent b519155479
commit bb63025268
+5 -2
View File
@@ -132,13 +132,16 @@ quint32 QHotkeyPrivateX11::nativeKeycode(Qt::Key keycode, bool &ok)
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>(); const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
Display *display = x11Interface->display();
#else #else
const bool x11Interface = QX11Info::isPlatformX11(); const bool x11Interface = QX11Info::isPlatformX11();
Display *display = QX11Info::display();
#endif #endif
if(x11Interface) { if(x11Interface) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
Display *display = x11Interface->display();
#else
Display *display = QX11Info::display();
#endif
auto res = XKeysymToKeycode(display, keysym); auto res = XKeysymToKeycode(display, keysym);
if(res != 0) if(res != 0)
ok = true; ok = true;