Commit graph

13 commits

Author SHA1 Message Date
Martin Flöser
e55e437d86 [autotests] Force XKB_DEFAULT_RULES to evdev in ModifierOnlyShortcutsTest
This is an idea to fix the failing test on FreeBSD (see T6624). For
Linux this does not change anything.
2017-09-17 20:54:32 +02:00
Martin Gräßlin
5a87fa3f92 Support modifier-only-shortcuts when capslock is on
Summary:
So far we didn't trigger modifier-only-shortcuts when capslock was
enabled. In fact we even ensured that the shortcuts did not trigger.
This seems not to be what our users expect. Meta should still trigger
if capslock is on.

This change modifies the logic to determine which modifier is currently
pressed by using the modifiersRelevantForGlobalShortcuts. The difference
to the "normal" modifiers is that this excludes capslock from modifiers
and excludes consumed modifiers. The latter is not really relevant as
modifier-only-shortcuts do not trigger if multiple keys are pressed,
which is required to have a modifier consumed.

BUG: 375355
FIXED-IN: 5.8.6

Test Plan: Only with adjusted autotest

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4241
2017-01-25 13:39:04 +01:00
Martin Gräßlin
0acfebd96b [autotests] Add test case for modifier only trigger when capslock enabled
This extends the testCapsLock to ensure that modifier only shortcut
trigger when capslock is enabled. So far the test only ensured that
capslock doesn't trigger the shift modifier only shortcut.

As the test shows currently when capslock is on, the meta key doesn't
trigger any more.

CCBUG: 375355
2017-01-22 09:42:00 +01:00
Martin Gräßlin
db2ff13d4f Only trigger mod-only-shortcuts if global shortcuts are enabled
Summary:
KWin supports blocking global shortcuts when a window is active through
window specific rules. This change ensures that the modifier only
shortcuts also honor the blocking of global shortcuts. If global
shortcuts are disabled, they won't trigger any more.

BUG: 370146
FIXED-IN: 5.8.1

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2952
2016-10-06 13:28:31 +02:00
Martin Gräßlin
26ad65b1e9 Test case for mod only shortcut with global shortcuts disabled
KWin supports disabling global shortcuts while a specific window is
active through window rules. This blocks global shortcuts but does not
block the modifier-only-shortcuts as the new test case shows.

CCBUG: 370146
2016-10-06 07:36:12 +02:00
Martin Gräßlin
ec98f498e8 Ensure modifier locks and latches don't trigger the mod only shortcut
Summary:
If caps lock is on the shift key should not trigger. Similar pressing
caps lock should neither on activation press nor on deactivation press
trigger the shortcut. Related to that are latched modifiers aka sticky
modifiers: if the modifier is still on after releasing the key the
shortcut should not trigger. We must assume the user wanted to use the
modifier to activate the modifier, not to activate the shortcut.

This change ensures that we don't track for modifier only shortcuts if
a modifier is active before press or after release.

The added test case demonstrates for caps lock, latched modifiers is
currently still untested. (Needs a way to mock it).

Test Plan: See test case for caps lock.

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2467
2016-08-19 10:56:41 +02:00
Martin Gräßlin
ea22b8f15d Introduce env variable KWIN_XKB_DEFAULT_KEYMAP to force default layout creation
Summary:
The Xkb class loads keyboard layouts from the users configuration. This
makes tests fail locally if the user has a layout which behaves
differently to the one the test expects. E.g. on a German layout the
right alt key is different to the one of US layout.

In order to have a more stable test base the env variable
KWIN_XKB_DEFAULT_KEYMAP forces the loading of the default keymap, thus
tests have a common layout set.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2466
2016-08-18 07:46:59 +02:00
Martin Gräßlin
06d562a5ba Block modifier only shortcuts when screen is/gets locked
If the screen is locked the modifier only shortcuts should not trigger.
Also if the screen gets locked while a modifier is hold the shortcuts
should not trigger.

Reviewed-By: bshah
2016-08-16 10:32:29 +02:00
Martin Gräßlin
440d49da00 [autotests/integration] Test case for screen locked with mod-only-shortcuts
Currently expected failures as modifier only shortcuts don't check
for locked screen yet.
2016-08-16 08:19:45 +02:00
Martin Gräßlin
bd58d7792f Don't trigger modifier only shortcuts if pointer interaction
Summary:
If the user clicked a pointer button or scrolled a pointer axis the
held modifier was most likely intended to modify the pointer event.
Thus the modifier only shortcut should not be triggered.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2435
2016-08-15 16:09:03 +02:00
Martin Gräßlin
03f66b02c3 [autotest/integration] Add pointer axis events to ModifiersOnlyShortcutTest
If a pointer axis is scrolled while a modifier is hold, the modifier only
shortcuts should not trigger. The user wanted to use the modifier for the
pointer axis.

This is not implemented yet, thus all is QEXPECT_FAIL.
2016-08-13 15:15:54 +02:00
Martin Gräßlin
280663fede [autotest/integration] Add pointer button events to ModifiersOnlyShortcutTest
If a pointer button is pressed or gets pressed while a modifier is
hold, the modifier only shortcuts should not trigger. The user wanted
to use the modifier for the pointer button.

This is not implemented yet, thus all is QEXPECT_FAIL.
2016-08-13 15:09:21 +02:00
Martin Gräßlin
fcd9a15186 [autotest/integration] Add a test case for modifier only shortcuts
This test verifies the functionality of modifier only shortcut
activation. The base test case uses a helper object which is exported
to DBus and has a slot which can get triggered.

The test configures the individual modifiers to call that DBus method
when the shortcut is triggered. It simulates pressing the modifier and
verifies the DBus method was invoked or not.
2016-08-13 14:35:01 +02:00