Commit graph

10 commits

Author SHA1 Message Date
Martin Gräßlin
7dfe408506 Pass Qt::Key to GlobalShortcutsManager::processKey
So far this method translated the keysym to Qt::Key. This is no longer
needed as the only method which invokes processKey has access to the
translated key. Thus saving one translation for every key press.

Reviewed-By: bshah
2016-09-15 09:02:38 +02:00
Martin Gräßlin
4235871667 Remove not-wanted modifiers prior to evaluating global shortcuts
Summary:
When triggering global shortcuts we are more interested in the hold
keys than the currently active modifiers. E.g. capslock should not
be seen as "shift is hold". Similar we need to remove consumed
modifiers. Shift+5 is % and not Shift+% - the shift modifier is
consumed and needs to be removed from shortcut evaluation.

To support this we need to have the actual state directly from
xkbcommon. Thus a new method is added which exposes the modifiers
relevant for global shortcut matching. In addition on every key press
all consumed modifiers are calculated and kept so that they can be
used for shortcut matching.

In addition a workaround is added for Backtab. Similar workaround
exists in kglobalaccel for X11. The problem is that our shortcuts are
stored incorrectly: Shift+Tab instead of Backtab. Thus a mapping back
is required. To make everything worse KWin registers the wrong key
sequence "Alt+Shift+Backtab" which doesn't make any sense and is
broken on X11 at least.

The workaround supports both special cases. The one for Backtab should
be turned into Shift+Tab and also KWin's special case of adding shift
to backtab.

CCBUG: 368581

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2768
2016-09-14 10:25:13 +02:00
Martin Gräßlin
316914a38b Change supported platforms of kglobalaccel plugin to "org.kde.kwin"
Overwrite the platform name through the environment variable and ensure
that the plugin is not picked in non-kwin Wayland sessions as that puts
kglobalaccel5 into a crash restart loop.

BUG: 349911
2015-07-07 13:36:27 +02:00
Martin Gräßlin
3041a7c32d [wayland] Add a plugin for kglobalaccel
The KGlobalAccelD which gets created by KWin needs a plugin for the
platform specific parts. This change introduces such a plugin. It's
linked against kwin so that it can integrate with the core.

On enable the plugin registers itself in the InputRedirection and
GlobalShortcutsManager checks the plugin whether a shortcut got
triggered.

As the loading of the plugin must happen after InputRedirection is
fully created a dedicated init method is added to InputRedirection.

REVIEW: 124187
2015-07-02 13:42:29 +02:00
Martin Gräßlin
8461344ce1 [wayland] Create a KGlobalAccelD during startup
We need to grab the DBusInterface before anything interacts with
org.kde.kglobalaccel to prevent kglobalaccel5 from starting.
2015-07-02 13:22:23 +02:00
Martin Gräßlin
c5def47bf5 Share implementation for adding shortcut (keyboard/pointer/axis)
Using templated function instead of copy and pasted code.
2014-03-19 14:14:57 +01:00
Martin Gräßlin
19c5a06fe9 Improve handleDestroyedAction
--crash on restart
2014-03-19 14:14:57 +01:00
Martin Gräßlin
89c2f2bf02 Support for global pointer axis activation
Just as pointer buttons...
2014-03-19 14:14:56 +01:00
Martin Gräßlin
28406d153d Support for global pointer shortcut activation
Sharing most of the code with keyboard shortcuts allowing to trigger a
QAction with holding modifiers and clicking a mouse button.
2014-03-19 14:14:56 +01:00
Martin Gräßlin
24b23dfc01 Beginning of global shortcut handling inside KWin
A new GlobalShortcutsManager is introduced which is responsible for
holding the registered shortcuts and triggering the matching action.

The InputRedirection checks with the GlobalShortcutManager whether a key
press event triggers a global shortcut and stops processing the event in
that case.

At the moment the GlobalShortcutsManager only supports the very basics
for KWin internal usage. External applications can not yet make usage of
the global shortcut system inside KWin.
2014-03-19 14:14:56 +01:00