Avoid polluting the the x11 shortcut map.

ubuntu/bionic
Simon Quigley 6 years ago
parent 76cfbfae25
commit cf157c0705

3
debian/changelog vendored

@ -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 <tsimonq2@ubuntu.com> Mon, 05 Feb 2018 20:38:35 -0600

@ -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 <code@rkapl.cz>
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<KeyCode>(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<KeyCode>(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:
+ ;
+ }
}
}
}

@ -1,2 +1,3 @@
# Ubuntu-specific patches
fix-wrong-radio-buttons.patch
avoid-polluting-x11-shortcut-map.patch

Loading…
Cancel
Save