Commit graph

14680 commits

Author SHA1 Message Date
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
facca93606 Also finishCompositing for Wayland windows in Compositor::finish
We should be able to restart the Compositor also on Wayland.

As the Compositor might be terminated after Workspace we need to
ensure to not call into Workspace while doing finishCompositing.

Reviewed-By: bshah
2016-08-19 09:18:30 +02:00
Martin Gräßlin
2ab8a7b80a Emit Workspace::deletedRemoved for every Deleted still around when terminating Workspace
For the exit-with-session option in kwin_wayland there is a chance that
the window which triggered termination is currently a Deleted. The
Wayland shutdown sequence terminates Workspace before the Compositor
which results in that Deleted's Scene::Window surviving the shutdown
process and thus the Shadow not being removed from the cache. This
makes KWin assert very late in the shutdown process when the decoration
shadow cache gets destroyed.
2016-08-19 09:15:53 +02:00
Martin Gräßlin
d03a50c6e1 Merge branch 'Plasma/5.7' 2016-08-19 07:46:46 +02:00
Martin Gräßlin
fe8fc6f83d Ensure to directly delete old Shadow on update
Summary:
So far when deleting a Shadow we used deleteLater which caused it
to be deleted in the next event cycle. This could in worst case result
in the Shadow being deleted after compositing got suspended. Thus the
Shadow not getting removed from the DecorationShadowCache which in
turn would mess up rendering on resume of compositing as the cache
returns a texture created for a different context.

BUG: 361154
FIXED-IN: 5.7.4

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2483
2016-08-18 16:08:42 +02:00
Bhushan Shah
88002fcb01 [platforms/hwcomposer] Set default old brightness to 50% (0x7f)
0xff or 100% is too much bright, this happens in first setup.

Reviewed-by: mgraesslin
2016-08-18 17:59:07 +05:30
Martin Gräßlin
b7f49244e0 [effects] Add new effect for touch point visualization
Summary:
The new effect is based on the mouse click effect and uses the same
rendering code (this could be improved by merging them better).

Unlike mouse click there is no keyboard shortcut needed to activate:
as soon as the effect is loaded all touch points are visualized.

The visualization creates an animated circle for each touch down
position, motion and up position. The ids are tracked and each touch
id gets the same color. The first ten different touch ids get a
different color. As touch ids are stable the first finger will always
have the same color.

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2464
2016-08-18 10:36:48 +02:00
Martin Gräßlin
a4af242081 Fix crash when unminizing a ShellClient
On unminize we should not call windowHidden, but windowShown.

Reviewed-By: bshah
2016-08-18 10:30:27 +02:00
Martin Gräßlin
9581f23ed8 Translate Qt key events through the unicode text with xkbcommon
Summary:
KKeyServer does an incorrect translation to keysyms: it always
translates to the uppercase variant.

This change makes the default go through xkbcommon and tries to get
the keysym from matching the unicode representation. E.g. an "a" is
then recognized as the lower case a, and an "A" as the uppercase one.

Only if the translation through text fails we pass back to KKeyServer
which does a reasonable translation for non-text symbols.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2471
2016-08-18 07:55:27 +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
Bhushan Shah
c04e764369 [platforms/hwcomposer] Reset old brightness when turning screen back on
Summary:
Now powerdevil can adjust brightness using leds subsystem, however, kwin
as well sets brightness to 0 for turning off screen and 0xff when
turning screen back on. This resets the brightness set by the powerdevil
to 100%.

As a solution now kwin listens to brightnessChanged dbus signal of
brightnesscontrol and book-keeps the changed brightness, if screen is
turned off it sets brightness to 0 and when turning screen on, it resets
to old brightness.

If powermanagement service doesn't appear on dbus by default it restores
100% brightness.

Test Plan:
Appearantly this still doesn't work as-it-is on phone, because powerdevil
doesn't emit brightnessChanged dbus signal because of bug in the driver of
backlight control, driver doesn't seem to trigger uevents for changes in
backlight. But with hack in powerdevil to emit brightnessChanged when setting
brightness, this works

Reviewers: broulik, #plasma_on_wayland, graesslin

Reviewed By: #plasma_on_wayland, graesslin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2468
2016-08-17 16:47:37 +05:30
Martin Gräßlin
e40344c6bb [autotests/integration] Split InternalWindowTest::testKeyboard into two test methods
Creating a dedicated method for the leave event on client.
This restructuring of the test should hopefully work around the
failing test condition on build.kde.org.
2016-08-16 15:39:47 +02:00
Martin Gräßlin
0b475c50d2 [autotests/integration] Some more changes to try to make InternalWindowTest pass again 2016-08-16 14:32:27 +02:00
Martin Gräßlin
6af0cc6ebe Add support for touch events in the Effect system
Summary:
The Effect class is extended by three new virtual methods:
* touchDown
* touchMotion
* touchUp

The methods return a boolean value so that the events can be filtered
out. E.g. an effect which has also a mouse grab installed wants to
filter out all events, other effects don't need the events exclusively.

This is a difference to how e.g. keyboard and pointer events are handled.
But is more close to how KWin's internal input event passing works and
makes it easier to get touch event: one does not explicitly has to grab
the events. It's also closer to Wayland where all input events are
available.

As a first example the Present Windows effect is adjusted and allows to
activate windows through the touch screen. As much code as possible is
shared with pointer input.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2450
2016-08-16 14:18:40 +02:00
Martin Gräßlin
d68a3fecd7 [autotests] Use QTR_COMPARE instead of QTest::qWait in TestScriptedEffectLoader
Hopefully makes the test more reliable on build.kde.org.
2016-08-16 14:08:07 +02:00
Martin Gräßlin
2c333417fa Support modifier only shortcuts on X11
Summary:
With this change KWin/X11 reuses Wayland's modifier only shortcut
architecture. The XInput2 event filter also listens for
 * XI_RawKeyPress
 * XI_RawKeyRelease

Those events are also reported if another X11 client grabs keyboard
input. Thus KWin gets all key events, just like on Wayland.

All key events are then sent through the Xkb class which performs the
mapping from key codes to key syms and is able to detect whether the
modifier got pressed/released without another key being pressed.

This change will require a few follow up changes, which are required
also for Wayland:
 * ignore if another input device got interacted (e.g. mouse press,
   touch screen, scroll, etc)
 * use the layout from XServer instead of using our own (needed on
   Wayland in nested setup)

The biggest disadvantage of the change is that it triggers a wake
up of KWin on every key event. But as KWin already listens to all
pointer events that's not a big difference and normally a key event
will wake up the compositor any way.

Reviewers: #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2425
2016-08-16 12:56:06 +02:00
Martin Gräßlin
1eac18a8fd [autotests/integration] More changes in InternalWindowTest::testKeyboard
Test is still failing on build.kde.org. Adding more test conditions to
better understand what works and what doesn't.
2016-08-16 12:45:21 +02:00
l10n daemon script
46691b17ac SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-08-16 10:09:08 +00:00
Martin Gräßlin
0eecb202e2 [autotests/integration] Try to fix InternalWindowTest::testKeyboard
It fails on build.kde.org, but failing condition is not reproducable
locally.
2016-08-16 11:10:26 +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
ca50a24728 [autotests/integration] Add ScreenLockerWatcher to the Test::lockScreen and ::unlockScreen
This extends the test helper for locking the screen and unlocking the
screen to also wait for the ScreenLockerWatcher to have that state.

This is going to fail on build.kde.org as we don't have EGL there and
the greeter crashes. This needs an extension to fake that we have a
screen lock window.
2016-08-16 10:23:37 +02:00
Martin Gräßlin
697ea3ae00 Delay query whether screenlocker is registered till WaylandServer is initialized
If we try to query before WaylandServer created the KSldApp the service
owner change is never delivered. Thus a delay till we know that the
service is there on Wayland. On X11 the initialization can be done
directly.

To know when the WaylandServer is fully initialized an additional
signal is added to WaylandServer.
2016-08-16 10:17:14 +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
4651aa1d79 [wayland] Unset focused keyboard surface when handling key event internally
Summary:
So far when KWin intercepted a key event a leave was not sent to the
Wayland surface currently having keyboard focus. This could result in
the Wayland application to start repeating keys. E.g.

1. application gets key press event
2. This triggers an internal window to show
3. key release goes to KWin internal window
4. application starts to repeat key as there is no release

With this change whenever KWin intercepts the key event e.g. due to
 * internal window
 * Effects grabbing key event
 * Tabbox

the focused keyboard surface is set to null, thus triggering a leave
event and the client not starting to repeat the event.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2402
2016-08-16 07:40:59 +02:00
Martin Gräßlin
1111b9c98b Trigger global shortcuts also on key-repeat
Summary:
Restores feature parity with X11. Global shortcuts need to trigger
also for repeat events. An example is the volume key or screen
brightness.

For other shortcuts like showing yakuake it does not make sense to
trigger on repeat. Thus a long term solution is to add a flag to
global shortcuts whether the key should trigger on repeat.

BUG: 366608

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2413
2016-08-15 17:39:01 +02:00
Martin Gräßlin
142aab2e24 Introduce an EffectsHandler::animationsSupported -> bool
Summary:
A new method to tell the effects system whether the compositor scene
is able to drive animations. E.g. on software emulation (llvmpipe) it's
better to not do any animations at all.

This information can be used by effects to adjust their behavior, e.g.
PresentWindows could skip transitions or effects can use it in their
supported check to completely disable themselves.

As a first step all scripted effects are considered to be unsupported
if animations are not supported. They inherit AnimationEffect and are
all about driving animations.

The information whether animations are supported comes from the Scene.
It's implemented in the following way:
 * XRender: animations are always supported
 * QPainter: animations are never supported
 * OpenGL: animations are supported, except for software emulation

In addition - for easier testing - there is a new env variable
KWIN_EFFECTS_FORCE_ANIMATIONS to overwrite the selection.

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2386
2016-08-15 17:38:33 +02:00
Martin Gräßlin
bfb2094c0a [autotests/integration] Fix TestLibinputDevice::testName
sysName may not be empty. Set a different name.
2016-08-15 17:21:45 +02:00
Martin Gräßlin
a9ac2739f7 [autotests/libinput] Set a valid sysName by default
The autotests are failing on build.kde.org due to the generated DBus
object path not being valid. This might be due to sysName having been
empty by default.
2016-08-15 16:55:10 +02:00
Martin Gräßlin
ab5d31426a [libinput] Expose all input devices through DBus
Summary:
The Connection exposes a new service called org.kde.KWin.InputDevice
and every Device registers an own object exposing all properties.

This allows an external configuration tool to change the behavior of
the devices at runtime. E.g. to test configuration settings.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2407
2016-08-15 16:10:50 +02:00
Martin Gräßlin
8bbd53a774 [wayland] Properly implement minimize of ShellClient
Summary:
We need to call Workspace::clientHidden when minimizing. Otherwise
Workspace doesn't update the active client and the now minimized
window is still active.

BUG: 366634

Test Plan:
Test case works now and also tested in nested setup that
active window changes.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2410
2016-08-15 16:10:11 +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
3a730fa51e Merge branch 'Plasma/5.7' 2016-08-15 16:07:50 +02:00
Martin Gräßlin
71c996fe33 Select also raw button press/release in XInput2 based polling
Summary:
The mouse polling is also used to detect mouse button press/release
events. This is used e.g. by the MouseClickEffect. The XInput2 filter
only selected for Raw Motion events which means mouse button events
are missed in case it's not combined with a motion.

This change makes the input filter also select for raw button press
and release events. To support this the X11EventFilter needed to
be adjusted to support multiple generic event types to filter for.

BUG: 366612
FIXED-IN: 5.7.4

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2406
2016-08-15 16:06:30 +02:00
Martin Gräßlin
490eaadb83 Turn ScreenLockerWatcher into a KWIN_SINGLETON
It's created together with input, so that the input mechanismn already
has a way to check whether screen is locked.

Effects doesn't hold a member variable any more and instead uses the
singleton instance.
2016-08-15 08:37:24 +02:00
Martin Gräßlin
d2a3a10802 Split ScreenLockerWatcher into dedicated source files
Being able to monitor whether the screen is locked is useful not only
to the effects system but overall in KWin. Thus to make it possible to
use it from more locations as a first step it's moved into dedicated
source files.
2016-08-15 08:16:33 +02:00
l10n daemon script
81d0454147 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-08-14 11:55:28 +00: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
Martin Gräßlin
83d8181675 [libkwinglutils] Revert version hack for Qualcomm Adreno on libhybris
The idea to set proper version is good, but it results in epoxy
thinking it does not have the entry points and terminating KWin.
2016-08-12 15:46:55 +02:00
David Edmundson
6c8f0e6cc0 Include setOnActivity in the test 2016-08-12 13:21:09 +01:00
David Edmundson
628fe79d3e Fix activites_test check
client->isOnActivity("foo") will return true if the client is on no
activities, as that's the equivalent of saying we are on all activities.

In our case we do want to check activities() shows the right thing.
2016-08-12 13:21:09 +01:00
David Edmundson
0dd927c4a4 Validate activities in setOnActivities
Summary:
This fixes a bug I had where Session Management restored a window on an
activity that didn't exist that, meaning I was unable to access it.

setOnActivity() already has this check

BUG: 362620

Test Plan:
Using my broken session, restored and got my ghost process back
on all activities

Added a window to activity 2, checked it came back there and
only there.

Reviewers: #plasma, graesslin

Subscribers: ivan, luebking, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D1982
2016-08-12 13:19:28 +01:00
Martin Gräßlin
b14618994b [autotests/integration] Add a first test case for activities
Verifies the condition from D1982 with expected_fail. That is sets
a Client on non existing activities and expects that it should be on
all activities.
2016-08-12 12:52:47 +02:00
Martin Gräßlin
5ea88effee Implement addDamage in Unmanaged
For Xwayland Unmanaged needs to override the addDamage method and
update the repaints_region accordingly, otherwise the repaint is not
triggered for the Unmanaged window.

Reviewed-By: bshah
2016-08-12 11:32:48 +02:00
Martin Gräßlin
b4c6b4b35d [libkwinglutils] hasGLVersion uses GLPlatform for verison check
Summary: No need to parse the OpenGL version twice with different algorithms.

Reviewers: #kwin, bshah

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2414
2016-08-12 10:14:49 +02:00
Martin Gräßlin
a5c8356d40 [libkwineffects] Add detection code for Qualcomm Adreno to GLPlatform
Summary:
The Qualcom Adreno classes are recognized and a version detection
workaround is added for libhybris which only announces GLES version 2
although GLES version 3 is supported. KWin at least used to work with
GLES version 3 which gives us e.g. framebuffer blit.

Reviewers: #kwin, bshah

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2415
2016-08-12 09:59:38 +02:00
Martin Gräßlin
79641df928 [autotests/libkwineffects] Add test data for Adreno 330
This is the device used in Nexus 5 and reference for Plasma Mobile.
The output is with using libhybris on top of hwcomposer backend.
2016-08-12 09:16:28 +02:00
Martin Gräßlin
7586394b81 [autotests] Don't try to load StartupFeedbackEffect on GL compositor
The test terminated cleanly as it tried to load a shader which obviously
fails.
2016-08-12 08:24:43 +02:00
Martin Gräßlin
ec596519c6 [autotests/integration] Add test case for minimizing active ShellClient
When minimizing an active ShellClient it should become inactive.
This is not the case as the test case shows through expected failures.

CCBUG: 366634
2016-08-11 17:08:08 +02:00