Changeset View
Changeset View
Standalone View
Standalone View
globalshortcuts.cpp
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Line(s) | 234 | { | |||
---|---|---|---|---|---|
242 | } | 242 | } | ||
243 | it2.value()->invoke(); | 243 | it2.value()->invoke(); | ||
244 | return true; | 244 | return true; | ||
245 | } | 245 | } | ||
246 | 246 | | |||
247 | bool GlobalShortcutsManager::processKey(Qt::KeyboardModifiers mods, uint32_t key) | 247 | bool GlobalShortcutsManager::processKey(Qt::KeyboardModifiers mods, uint32_t key) | ||
248 | { | 248 | { | ||
249 | if (m_kglobalAccelInterface) { | 249 | if (m_kglobalAccelInterface) { | ||
250 | bool retVal = false; | | |||
251 | int keyQt = 0; | 250 | int keyQt = 0; | ||
252 | if (KKeyServer::symXToKeyQt(key, &keyQt)) { | 251 | if (KKeyServer::symXToKeyQt(key, &keyQt)) { | ||
252 | auto check = [this] (Qt::KeyboardModifiers mods, int keyQt) { | ||||
253 | bool retVal = false; | ||||
253 | QMetaObject::invokeMethod(m_kglobalAccelInterface, | 254 | QMetaObject::invokeMethod(m_kglobalAccelInterface, | ||
254 | "checkKeyPressed", | 255 | "checkKeyPressed", | ||
255 | Qt::DirectConnection, | 256 | Qt::DirectConnection, | ||
256 | Q_RETURN_ARG(bool, retVal), | 257 | Q_RETURN_ARG(bool, retVal), | ||
257 | Q_ARG(int, int(mods) | keyQt)); | 258 | Q_ARG(int, int(mods) | keyQt)); | ||
258 | if (retVal) { | 259 | return retVal; | ||
260 | }; | ||||
261 | if (check(mods, keyQt)) { | ||||
262 | return true; | ||||
263 | } else if (keyQt == Qt::Key_Backtab) { | ||||
264 | // KGlobalAccel on X11 has some workaround for Backtab | ||||
265 | // see kglobalaccel/src/runtime/plugins/xcb/kglobalccel_x11.cpp method x11KeyPress | ||||
266 | // Apparently KKeySequenceWidget captures Shift+Tab instead of Backtab | ||||
267 | // thus if the key is backtab we should adjust to add shift again and use tab | ||||
268 | // in addition KWin registers the shortcut incorrectly as Alt+Shift+Backtab | ||||
269 | // this should be changed to either Alt+Backtab or Alt+Shift+Tab to match KKeySequenceWidget | ||||
270 | // trying the variants | ||||
271 | if (check(mods | Qt::ShiftModifier, keyQt)) { | ||||
259 | return true; | 272 | return true; | ||
260 | } | 273 | } | ||
274 | if (check(mods | Qt::ShiftModifier, Qt::Key_Tab)) { | ||||
275 | return true; | ||||
276 | } | ||||
277 | } | ||||
261 | } | 278 | } | ||
262 | } | 279 | } | ||
263 | if (processShortcut(mods, key, m_shortcuts)) { | 280 | if (processShortcut(mods, key, m_shortcuts)) { | ||
264 | return true; | 281 | return true; | ||
265 | } | 282 | } | ||
266 | return false; | 283 | return false; | ||
267 | } | 284 | } | ||
268 | 285 | | |||
Show All 11 Lines |