MCPcopy Create free account
hub / github.com/Skycoder42/QHotkey / nativeKeycode

Method nativeKeycode

QHotkey/qhotkey_x11.cpp:120–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120quint32 QHotkeyPrivateX11::nativeKeycode(Qt::Key keycode, bool &ok)
121{
122 QString keyString = getX11String(keycode);
123
124 KeySym keysym = XStringToKeysym(keyString.toLatin1().constData());
125 if (keysym == NoSymbol) {
126 //not found -> just use the key
127 if(keycode <= 0xFFFF)
128 keysym = keycode;
129 else
130 return 0;
131 }
132
133#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
134 const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
135 Display *display = x11Interface->display();
136#else
137 const bool x11Interface = QX11Info::isPlatformX11();
138 Display *display = QX11Info::display();
139#endif
140
141 if(x11Interface) {
142 auto res = XKeysymToKeycode(display, keysym);
143 if(res != 0)
144 ok = true;
145 return res;
146 }
147 return 0;
148}
149
150quint32 QHotkeyPrivateX11::nativeModifiers(Qt::KeyboardModifiers modifiers, bool &ok)
151{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected