mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
Fix: Prevent crash on Wayland when using Qt 6 (#97)
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user