From cf157c070536bf2449d0f8b9fccbf673d567e990 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 5 Feb 2018 20:51:33 -0600 Subject: [PATCH] Avoid polluting the the x11 shortcut map. --- debian/changelog | 3 + .../avoid-polluting-x11-shortcut-map.patch | 119 ++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 123 insertions(+) create mode 100644 debian/patches/avoid-polluting-x11-shortcut-map.patch diff --git a/debian/changelog b/debian/changelog index 49d3552..b7ab29b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ lxqt-globalkeys (0.12.0-3ubuntu1) UNRELEASED; urgency=medium - Fix wrong radio buttons when changing shortcuts. + fix-wrong-radio-buttons.patch + Upstream commit a9ec3c0. + - Avoid polluting the the x11 shortcut map. + + avoid-polluting-x11-shortcut-map.patch + + Upstream commit c79d560. -- Simon Quigley Mon, 05 Feb 2018 20:38:35 -0600 diff --git a/debian/patches/avoid-polluting-x11-shortcut-map.patch b/debian/patches/avoid-polluting-x11-shortcut-map.patch new file mode 100644 index 0000000..0f9599d --- /dev/null +++ b/debian/patches/avoid-polluting-x11-shortcut-map.patch @@ -0,0 +1,119 @@ +Description: Avoid polluting the the x11 shortcut map + When user presses a key, but this key was not previously registered as a + shortcut, the shortcut map is polluted with "" entry. + . + This could cause an error when the shortcut is not set after clicking OK in the + keybinding editing dialog and you are told that shortcut "" is being used + instead (in the logs). +Author: Roman Kapl +Origin: backport +Bug: https://github.com/lxde/lxqt-globalkeys/pull/50 +Applied-Upstream: commit:c79d560 +Last-Update: 2018-02-05 +--- a/daemon/core.cpp ++++ b/daemon/core.cpp +@@ -1316,59 +1316,64 @@ void Core::run() + } + else + { +- QString shortcut = mShortcutByX11[qMakePair(static_cast(event.xkey.keycode), event.xkey.state & allShifts)]; +- log(LOG_DEBUG, "KeyPress %08x %08x %s", event.xkey.state & allShifts, event.xkey.keycode, qPrintable(shortcut)); +- +- IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut); +- if (idsByShortcut != mIdsByShortcut.end()) ++ X11Shortcut shortcutKey = qMakePair(static_cast(event.xkey.keycode), event.xkey.state & allShifts); ++ ShortcutByX11::const_iterator shortcutIt = mShortcutByX11.constFind(shortcutKey); ++ if(shortcutIt != mShortcutByX11.constEnd()) + { +- 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; ++ const QString& shortcut = shortcutIt.value(); ++ log(LOG_DEBUG, "KeyPress %08x %08x %s", event.xkey.state & allShifts, event.xkey.keycode, qPrintable(shortcut)); + +- case MULTIPLE_ACTIONS_BEHAVIOUR_LAST: ++ IdsByShortcut::iterator idsByShortcut = mIdsByShortcut.find(shortcut); ++ if (idsByShortcut != mIdsByShortcut.end()) + { +- Ids::iterator firstIds = ids.begin(); +- for (Ids::iterator idi = ids.end(); idi != firstIds;) ++ Ids &ids = idsByShortcut.value(); ++ switch (mMultipleActionsBehaviour) + { +- --idi; +- if (mShortcutAndActionById[*idi].second->call()) +- { +- break; +- } ++ 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; ++ break; + +- case MULTIPLE_ACTIONS_BEHAVIOUR_NONE: +- if (ids.size() == 1) ++ case MULTIPLE_ACTIONS_BEHAVIOUR_LAST: + { +- mShortcutAndActionById[*(ids.begin())].second->call(); ++ Ids::iterator firstIds = ids.begin(); ++ for (Ids::iterator idi = ids.end(); idi != firstIds;) ++ { ++ --idi; ++ if (mShortcutAndActionById[*idi].second->call()) ++ { ++ break; ++ } ++ } + } + break; + +- case MULTIPLE_ACTIONS_BEHAVIOUR_ALL: +- { +- Ids::iterator lastIds = ids.end(); +- for (Ids::iterator idi = ids.begin(); idi != lastIds; ++idi) ++ case MULTIPLE_ACTIONS_BEHAVIOUR_NONE: ++ if (ids.size() == 1) ++ { ++ mShortcutAndActionById[*(ids.begin())].second->call(); ++ } ++ break; ++ ++ case MULTIPLE_ACTIONS_BEHAVIOUR_ALL: + { +- mShortcutAndActionById[*idi].second->call(); ++ Ids::iterator lastIds = ids.end(); ++ for (Ids::iterator idi = ids.begin(); idi != lastIds; ++idi) ++ { ++ mShortcutAndActionById[*idi].second->call(); ++ } + } +- } +- break; ++ break; + +- default: +- ; ++ default: ++ ; ++ } + } + } + } diff --git a/debian/patches/series b/debian/patches/series index 6db0d9e..255d84f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ # Ubuntu-specific patches fix-wrong-radio-buttons.patch +avoid-polluting-x11-shortcut-map.patch