Commit graph

14116 commits

Author SHA1 Message Date
Martin Gräßlin
a66eb1a5b9 [backends/drm] Double Tap to enable output
If the output is off a double tap (touch) can re-enable it. The two
taps have to happen in the double click interval (we don't have
something better and it kind of matches) and have to be by only one
touch point. If there are multiple touch points it's not considered
as a double tap. A todo is to restrict the possible distance of the
two taps to one thumb.

Tested-By: Marco Martin
2016-02-15 17:35:36 +01:00
Martin Gräßlin
5b1eb584d6 [backends/drm] Fix typo
Thanks to kbroulik for noticing that I really, really should bye a
new keyboard as it's eating my "p" key.
2016-02-15 16:30:22 +01:00
Martin Gräßlin
57b11f8429 [backends/drm] Use an InputEventFilter to reenable outputs
So far the DrmOutput connected to all input events when going into
power saving. As we now have the input filters it's better to just
install a filter when an output goes into powersave and remove the
input filter again when all outputs are enabled again.

To make this work InputRedirection gains a new method to add a new
filter as the first filter. This is a potentially dangerous method
as it allows to have a filter before LockScreenFilter gets the
events. But in case of DPMS it's something we actually want.

A nice new feature possible with the input filter is that we can
filter out the event which re-enables the outputs. Thus when getting
on a system with output off and screen locked, the first key hit
doesn't go to the lock screen.

Reviewed-By: Bhushan Shah
BUG: 341201
Fixed-in: 5.6.0 (Wayland-only)
2016-02-15 15:53:43 +01:00
Martin Gräßlin
4e32dcfbfe Cleanup includes of input.(h|cpp) a little bit 2016-02-15 13:51:36 +01:00
Martin Gräßlin
849d17519c Split keyboard related functionality from InputRedirection
Similar to the change regarding pointer and touch a
KeyboardInputRedirection is created. The Xkb class is also moved to
the new files keyboard_input.h and keyboard_input.cpp.

Just like in the case of PointerInputRedirection no signals are added,
but the existing signals in InputRedirection are directly invoked.
2016-02-15 13:42:48 +01:00
Martin Gräßlin
71a8879e95 Reset TouchInputRedirection::m_inited when Workspace or WaylandServer get destroyed
We don't want to continue processing events once KWin is shutting down.
2016-02-15 11:43:36 +01:00
Martin Gräßlin
59dc3816b4 Add missing override to LockScreenFilter 2016-02-15 10:36:42 +01:00
Vladimir Panteleev
41e16f56ec Fix grammar in KCM MESA warning
REVIEW: 127066

From c8bc51b46a31b30b6400bcfdbbfd00d2ac648d45 Mon Sep 17 00:00:00 2001
From: Vladimir Panteleev <git@thecybershadow.net>
Date: Sat, 13 Feb 2016 18:41:56 +0000
Subject: [PATCH] Fix grammar in KCM MESA warning
2016-02-15 09:39:06 +01:00
Martin Gräßlin
b8f8b2d8a0 Split out touch related functionality from InputRedirection
Similar to c044ad98be this change splits
all touch handling related functionality into a dedicated class called
TouchInputRedirection.
2016-02-15 09:36:59 +01:00
Martin Gräßlin
fed7a48112 Revert "[autotest] Let's dare enabling the OpenGL compositor in the tests"
This reverts commit 5e21963a3b.

Unfortunately all tests failed on the CI system, so no GL yet :-(
2016-02-12 15:22:55 +01:00
Martin Gräßlin
5e21963a3b [autotest] Let's dare enabling the OpenGL compositor in the tests
CI system is adjusted, so that OpenGL should work. At least latest
run didn't show the EGL warnings in the lock screen test. So let's
try to enable again. It's possible that this fails horribly. If that's
the case I'll revert again.

The dontCrashGlxgearsTest is kept on QPainter as locally it crashes
on teardown (needs fixing).
2016-02-12 14:18:14 +01:00
Martin Gräßlin
8f28e900ec Check for Workspace when a ServerSideDecorationInterface gets destroyed
This is a complementary commit to 4c7450a1f6:
After Workspace gets destroyed it's possible that ShellClient's are still
around. Their tear down should not crash due to calling into Workspace.
2016-02-12 14:15:51 +01:00
Martin Gräßlin
c044ad98be Split out pointer related handling from InputRedirection
All pointer related code is moved into a new class called
PointerInputRedirection.

The main idea is to simplify the code and make it easier to maintain.
Therefore also a few changes in the setup were performed:
* before init() is called, no processing is performed
* init() is only called on Wayland and after Workspace is created
* init property is set to false once Workspace or WaylandServer is
  destroyed

Thus code can operate on the following assumptions:
* Workspace is valid
* WaylandServer is valid
* ScreenLocker integration is used

The various checks whether there is a waylandServer() and whether
there is a seat are no longer needed.

Some of the checks have been reordered to be faster in the most common
use case of using libinput. E.g. whether warping is supported is first
evaluated by the variable bound to whether we have libinput and only if
that is false the backend is checked.

The new class doesn't have signals but invokes the signals provided
by InputRedirection. I didn't want to add new signals as I consider
them as not needed. The areas in KWin needing those signals should
be ported to InputEventFilters.
2016-02-12 13:38:26 +01:00
Martin Gräßlin
768f1be939 Drop InputRedirection::pointerButtonState(uint32_t button) const
Unused code.
2016-02-11 16:34:36 +01:00
Martin Gräßlin
b8fcfbb8fc Drop bool InputRedirection::areButtonsPressed() const
Unused code, no longer needed as we have it in the events.
2016-02-11 16:30:58 +01:00
Martin Gräßlin
9b917a20fe ScreenEdgeInputFilter for checking whether a screenedge gets activated
So far the area based edges connected directly to global pointer pos
changed in InputRedirection. This didn't allow proper checking whether
the edge was triggered (e.g. missing timestamp).

This change merges the functionality into the new input filter mechanism.
There is now a dedicated input filter for screen edges, installed after
lock screen and before effects. It always passes events on, but also passes
all events through ScreenEdges to handle the activation. As it's installed
after the lock screen filter we don't need to check for screen locked any
more.

The code is now similar strucutured to the existing X11 based variants
and maybe will allow to also merge the X11 variant with the new one.
2016-02-11 15:56:40 +01:00
Martin Gräßlin
a51171720e Improve updating the pointer position after screen changes
The logic should not be tied to whether libinput is used. It's relevant
for all Wayland backends whether they use libinput or not.

In addition this should generate a pointer motion event, so that proper
processing can take place and we get proper pointer enter events.
2016-02-11 14:27:30 +01:00
Martin Gräßlin
79c274b942 [autotest] Add test case for update pointer focus after screen change
The test removes the second screen while the cursor is on it. This
should warp the pointer to the center of first screen and trigger
a focus enter event.

As can be seen by the expect failures currently it's bound to libinput
and also doesn't process the event as if it were a pointer event.
2016-02-11 14:25:04 +01:00
Martin Gräßlin
5b5a966e48 Process pointer warped positions like normal updates
If the pointer is warped the position change should be treated like
a change coming from the input device. Our normal processing should
take place.

A problem in this case is the timestamp to pass to the wayland server.
Normally our timestamps come from the backend/libinput and we don't
know the next one. As an intermediate solution we just use the last
timestamp on the seat. In future a solution could be to not use the
backend's timestamp at all, but have our own timestamp handling.
2016-02-11 12:56:26 +01:00
Martin Gräßlin
3aeec88449 [autotest] Add test for internal pointer warping
When warping a pointer through Cursor::setPos it should be processed
just like any other pointer event. It should generate enter/leave event,
create motion events, etc. This is currently not the case as the test
shows.
2016-02-11 12:48:42 +01:00
Martin Gräßlin
8e6f387a6e [autotest] Test case for stacking order changes should change focus
A new test case which ensures that when stacking order changes the
pointer focus gets re-evaluated and updated. I was positively surprised
to notice that this already works.

Noticed two other problems while writing the test case:
* warping pointer does not re-evaluate the pointer pos
* deleting a ShellSurface (client) does not destroy the ShellClient (server)
2016-02-11 10:47:21 +01:00
Martin Gräßlin
f4e28e2c9c Fix typo 2016-02-11 09:34:19 +01:00
Martin Gräßlin
c8c33ae398 Implement lock screen security for touch events
When the screen gets locked any existing sequence gets cancelled
and the focused touch surface gets reset. While screen is locked
touch events are filtered to only go to lock screen or input methods.

Test case is added for touch event during lock screen.

Reviewed-By: Bhushan Shah
2016-02-11 08:09:10 +01:00
Martin Gräßlin
a311f9bfda Add check for lock screen in InputRedirection::updateKeyboardWindow
Instead of only making the active client the focused keyboard surface,
the method now also performs the lock screen security restriction.

Also just like udatePointerWindow the method becomes public, so that
it can be used from the LockScreenEventFilter and is connected for
lock state changes. This means as soon as the screen locks the current
focused keyboard surface will get a leave event and get an enter event
once the screen unlocks.

The auto test is adjusted to verify these new conditions.

Reviewed-By: Bhushan Shah
2016-02-11 08:09:10 +01:00
Martin Gräßlin
16a33f662b Improve lock screen interaction for pointer in InputRedirection
InputRedirection connects to lockStateChanged to udate the current
pointer window. This way we can ensure that the current pointer
surface gets reset as soon as the screen locks (c.f. the expect
fail in the autotest) and also that it restores to the surface under
the mouse once the screen is unlocked.

The relevant code was not yet lock screen aware and performed an
early exit. Part of the code was fine, e.g. findToplevel is lock
screen aware. So this change adjusts the methods for updating the
internal window and decoration to be lock screen aware, that is they
get reset. With that updatePointerWindow is also lock screen aware.

Thus the LockScreenFilter can also use updatePointerWindow just like
the normal handling and does not need to reimplement parts of it. As
it now relies on other code being correct it has an additional check
to verify that the current pointer surface is a surface which is allowed
to get events. If it isn't the events are not forwarded.

Reviewed-By: Bhushan Shah
2016-02-11 08:09:10 +01:00
Martin Gräßlin
142e826191 Clear touch ids when canceling a touch sequence
Before calling touchUp would hit an abort in KWayland::Server.
2016-02-11 08:09:10 +01:00
Martin Gräßlin
d02c325a61 Refactor input event handling to be based on filters
The main motivation of this change is to remove the spaghetti code
in the input event handling. Each area of processing (e.g. lock screen)
is moved into a dedicated event filter. Processing the events now just
means calling a virtual method on each of the filters. As soon as the
method returns true, the processing is stopped.

This allows to have the security for the lock screen just in one place:
whenever the screen is locked the event filter can ensure that the events
are not further processed.

Currently all event filters are implemented directly in input.cpp and
are registered by InputRedirection itself. In future it would be better
to have those moved to the area they belong to and get registered from
there. E.g. the input filter for EffectsHandlerImpl should be created
by EffectsHandlerImpl. This requires an improved API to ensure that the
filters are installed in the correct sequence.
2016-02-11 08:09:10 +01:00
Marco Martin
5e6f0b8b4f make animate() return something JS understands
the result of animate is an array of animids: in order for
dumb QScript to understand what it is, we have to build it
as an actual JavaScript Array
reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
2016-02-10 16:58:37 +01:00
Oleg Chernovskiy
7ccca92c3e Remove crash handling in kwin_wayland
This patch introduces additional method to Application class
that has default policy of restarting the app.
This method is overridden for wayland case disabling this step.

REVIEW: 126655
2016-02-09 17:20:43 +01:00
Oleg Chernovskiy
61e1a98fb7 Maintenance - fixing naming typos
Fix typos in signal naming var
Fix typo in KWin QPA environment variable
2016-02-09 17:20:12 +01:00
Martin Gräßlin
357e082d7a Drop InputRedirection::toXPointerButton
Unused code is unused.
2016-02-09 12:39:55 +01:00
Marco Martin
e97eaffc6b Scale blurbehind and contrast besides translating
if the window we are blurring the background or adding contrast
has a scale transform applied, scale the area to be blurred as well
REVIEW:126980
2016-02-09 12:10:47 +01:00
l10n daemon script
dce5bc1bc0 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-02-09 10:37:25 +00:00
Martin Gräßlin
4e907d6773 [autotest] Add test for touch input
Basic test validating:
* multiple touch points are handled
* cancel is handled
2016-02-09 11:35:15 +01:00
Martin Gräßlin
a47b6f9435 Unset focused keyboard surface when screen is locked
If the screen is locked and no lock screen is shown yet we unset
the focused keyboard surface on key event. Similar we restore when
screen is unlocked.

This should hopefully fix the broken lockscreen unit test which hits
the special condition as the greeter doesn't show up on build.kde.org.
2016-02-09 08:45:29 +01:00
Martin Gräßlin
09cc134bfc [autotests] Test case for lock screen intercepts key events
Our active client should lose keyboard focus when screen gets locked
and re-gain after the screen unlocks.
2016-02-08 16:52:22 +01:00
Martin Gräßlin
500bc9c18c [autotest] Add test case for global shortcuts while screen is locked
They shouldn't be triggered if the screen is locked.
2016-02-08 15:23:06 +01:00
Martin Gräßlin
75261ab9f6 [autotests] Test case for key events on internal windows 2016-02-08 15:03:21 +01:00
Martin Gräßlin
037b3ba66e [autotests] Add test case for effects key handling during screen lock
Verifies that no key events are forwarded to the Effects during a
locked screen.
2016-02-08 12:36:39 +01:00
Martin Gräßlin
dfd0664fd6 [autotest] Add a test for a KWin internal QWindow
The test creates a QRasterWindow which through KWin's internal QPA
is considered an internal window. In the test methods we simulate
various pointer events (enter/leave, press/release, wheel).
2016-02-05 15:39:04 +01:00
Martin Gräßlin
eca06ecb02 [libinput] Install a log handler
Let's get all debug events from libinput and forward them to a custom
log handler. This in turn can pass them to Qt's categorized logging.
So it's still easy to
* disable all libinput related logging
* configure the log level

Both was not possible before.
2016-02-05 12:50:49 +01:00
Martin Gräßlin
66c77bcd31 [autotest] Move window through decoration
Interestingly just trigger the move and instant release doesn't move
the window.
2016-02-04 15:07:03 +01:00
Martin Gräßlin
a9f48ec62c [autotest] Test case for hover move on decoration
Verifies that the cursor shapes are adjusted correctly.
2016-02-04 14:20:36 +01:00
Martin Gräßlin
749ec28e23 [autotests] Add test case for double click on window decoration
Shows that currently a tripple-click triggers two double click events.
2016-02-04 11:56:45 +01:00
Martin Gräßlin
938a0ff7fc [autotests] New test for input on window decoration
First test case is whether wheel events are forwarded correctly.
From the code it seems to me like up/down is inversed. Needs manual
testing.

As this requires working decorations it's possible that this test
will fail on build.kde.org.
2016-02-04 11:20:28 +01:00
Martin Gräßlin
4c7450a1f6 Add nullptr check in AbstractClient::checkWorkspacePosition for workspace()
If a decorated ShellClient is still around after Workspace got destroyed
this method is still invoked and can lead to a crash. As we have a
workspace initing test there already it makes sense to combine it with
a workspace being down check.
2016-02-04 11:16:55 +01:00
Martin Gräßlin
7558fcd4b4 [autotest] Extend LockScreen test for global pointer and axis shortcuts
The global shortcuts may not be triggered while screen is locked.
2016-02-04 09:06:15 +01:00
Martin Gräßlin
d83780fea3 Fix axis direction for processing global axis shortcuts
It mixed up horizontal and vertical.
2016-02-04 09:05:38 +01:00
Martin Gräßlin
48ec13a881 Check for Xwayland as RUNTIME dependency
Make distro's life easier by pointing out that kwin_wayland requires
Xwayland.
2016-02-03 15:49:05 +01:00
l10n daemon script
c54ec46b65 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-02-03 09:28:15 +00:00