Skip to content

Commit bb63025

Browse files
authored
Fix: Prevent crash on Wayland when using Qt 6 (#97)
1 parent b519155 commit bb63025

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

QHotkey/qhotkey_x11.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,16 @@ quint32 QHotkeyPrivateX11::nativeKeycode(Qt::Key keycode, bool &ok)
132132

133133
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
134134
const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
135-
Display *display = x11Interface->display();
136135
#else
137136
const bool x11Interface = QX11Info::isPlatformX11();
138-
Display *display = QX11Info::display();
139137
#endif
140138

141139
if(x11Interface) {
140+
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
141+
Display *display = x11Interface->display();
142+
#else
143+
Display *display = QX11Info::display();
144+
#endif
142145
auto res = XKeysymToKeycode(display, keysym);
143146
if(res != 0)
144147
ok = true;

0 commit comments

Comments
 (0)