Skip to content

Commit

Permalink
Fix: Prevent crash on Wayland when using Qt 6 (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuperino committed May 20, 2024
1 parent b519155 commit bb63025
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions QHotkey/qhotkey_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,16 @@ quint32 QHotkeyPrivateX11::nativeKeycode(Qt::Key keycode, bool &ok)

#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
Display *display = x11Interface->display();
#else
const bool x11Interface = QX11Info::isPlatformX11();
Display *display = QX11Info::display();
#endif

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);
if(res != 0)
ok = true;
Expand Down

0 comments on commit bb63025

Please sign in to comment.