parent
cf157c0705
commit
8a7f3aa1fa
@ -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 <git17@ska67.de>
|
||||
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<KeyCode>(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:
|
||||
+ ;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Ubuntu-specific patches
|
||||
fix-wrong-radio-buttons.patch
|
||||
avoid-polluting-x11-shortcut-map.patch
|
||||
add-super-key-binding-support.patch
|
||||
|
Loading…
Reference in new issue