From 8a7f3aa1fa33994c63946d8e57e99a89064e8878 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 5 Feb 2018 20:57:00 -0600 Subject: [PATCH] Add super key binding support. --- debian/changelog | 3 + .../add-super-key-binding-support.patch | 145 ++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 149 insertions(+) create mode 100644 debian/patches/add-super-key-binding-support.patch diff --git a/debian/changelog b/debian/changelog index b7ab29b..46a40ff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,9 @@ lxqt-globalkeys (0.12.0-3ubuntu1) UNRELEASED; urgency=medium - Avoid polluting the the x11 shortcut map. + avoid-polluting-x11-shortcut-map.patch + Upstream commit c79d560. + - Add super key binding support. + + add-super-key-binding-support.patch + + Upstream commit fc35a3b. -- Simon Quigley Mon, 05 Feb 2018 20:38:35 -0600 diff --git a/debian/patches/add-super-key-binding-support.patch b/debian/patches/add-super-key-binding-support.patch new file mode 100644 index 0000000..eca454b --- /dev/null +++ b/debian/patches/add-super-key-binding-support.patch @@ -0,0 +1,145 @@ +Description: Triggering shortcuts with meta keys + The left and right meta keys can trigger shortcuts + at the KeyRelease event. +Author: ska67 +Origin: backport +Bug: https://github.com/lxde/lxqt/issues/1259 +Applied-Upstream: commit +Last-Update: 2018-02-05 +--- a/daemon/core.cpp ++++ b/daemon/core.cpp +@@ -1140,6 +1140,8 @@ void Core::run() + allModifiers.insert(ignoreLocks); + } + ++ const QString metaLeft = XKeysymToString(XK_Super_L); ++ const QString metaRight = XKeysymToString(XK_Super_R); + + char signal = 0; + if (write(mX11ResponsePipe[STDOUT_FILENO], &signal, sizeof(signal)) == sizeof(signal)) +@@ -1316,65 +1318,84 @@ void Core::run() + } + else + { ++ if (event.type == KeyRelease) ++ { ++ event.xkey.state &= ~allShifts; // Modifier keys must not use shift states. ++ } ++ + X11Shortcut shortcutKey = qMakePair(static_cast(event.xkey.keycode), event.xkey.state & allShifts); + ShortcutByX11::const_iterator shortcutIt = mShortcutByX11.constFind(shortcutKey); +- if(shortcutIt != mShortcutByX11.constEnd()) ++ if (shortcutIt == mShortcutByX11.constEnd()) + { +- const QString& shortcut = shortcutIt.value(); +- log(LOG_DEBUG, "KeyPress %08x %08x %s", event.xkey.state & allShifts, event.xkey.keycode, qPrintable(shortcut)); ++ continue; ++ } ++ const QString& shortcut = shortcutIt.value(); + +- IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut); +- if (idsByShortcut != mIdsByShortcut.end()) ++ if (event.type == KeyPress) ++ { ++ if ((shortcut == metaLeft) || (shortcut == metaRight)) + { +- Ids &ids = idsByShortcut.value(); +- switch (mMultipleActionsBehaviour) +- { +- case MULTIPLE_ACTIONS_BEHAVIOUR_FIRST: +- { +- Ids::iterator lastIds = ids.end(); +- for (Ids::iterator idi = ids.begin(); idi != lastIds; ++idi) +- if (mShortcutAndActionById[*idi].second->call()) +- { +- break; +- } +- } +- break; ++ keyReleaseExpected = true; ++ continue; ++ } ++ log(LOG_DEBUG, "KeyPress %08x %08x %s", event.xkey.state & allShifts, event.xkey.keycode, qPrintable(shortcut)); ++ } ++ else ++ { ++ log(LOG_DEBUG, "KeyRelease %08x %08x %s", event.xkey.state & allShifts, event.xkey.keycode, qPrintable(shortcut)); ++ } + +- case MULTIPLE_ACTIONS_BEHAVIOUR_LAST: +- { +- Ids::iterator firstIds = ids.begin(); +- for (Ids::iterator idi = ids.end(); idi != firstIds;) ++ IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut); ++ if (idsByShortcut != mIdsByShortcut.end()) ++ { ++ Ids &ids = idsByShortcut.value(); ++ switch (mMultipleActionsBehaviour) ++ { ++ case MULTIPLE_ACTIONS_BEHAVIOUR_FIRST: ++ { ++ Ids::iterator lastIds = ids.end(); ++ for (Ids::iterator idi = ids.begin(); idi != lastIds; ++idi) ++ if (mShortcutAndActionById[*idi].second->call()) + { +- --idi; +- if (mShortcutAndActionById[*idi].second->call()) +- { +- break; +- } ++ break; + } +- } +- break; ++ } ++ break; + +- case MULTIPLE_ACTIONS_BEHAVIOUR_NONE: +- if (ids.size() == 1) ++ case MULTIPLE_ACTIONS_BEHAVIOUR_LAST: ++ { ++ Ids::iterator firstIds = ids.begin(); ++ for (Ids::iterator idi = ids.end(); idi != firstIds;) ++ { ++ --idi; ++ if (mShortcutAndActionById[*idi].second->call()) + { +- mShortcutAndActionById[*(ids.begin())].second->call(); ++ break; + } +- break; ++ } ++ } ++ break; + +- case MULTIPLE_ACTIONS_BEHAVIOUR_ALL: ++ case MULTIPLE_ACTIONS_BEHAVIOUR_NONE: ++ if (ids.size() == 1) + { +- Ids::iterator lastIds = ids.end(); +- for (Ids::iterator idi = ids.begin(); idi != lastIds; ++idi) +- { +- mShortcutAndActionById[*idi].second->call(); +- } ++ mShortcutAndActionById[*(ids.begin())].second->call(); + } + break; + +- default: +- ; ++ case MULTIPLE_ACTIONS_BEHAVIOUR_ALL: ++ { ++ Ids::iterator lastIds = ids.end(); ++ for (Ids::iterator idi = ids.begin(); idi != lastIds; ++idi) ++ { ++ mShortcutAndActionById[*idi].second->call(); + } + } ++ break; ++ ++ default: ++ ; ++ } + } + } + diff --git a/debian/patches/series b/debian/patches/series index 255d84f..76ef617 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ # Ubuntu-specific patches fix-wrong-radio-buttons.patch avoid-polluting-x11-shortcut-map.patch +add-super-key-binding-support.patch