Commit graph

14140 commits

Author SHA1 Message Date
Martin Gräßlin
f8f13a7fba Implement modifier+click in InputRedirection for Wayland
This change implements the mouse command for modifier (alt/meta) plus
click in InputRedirection so that it also works on Wayland.

Modifier plus mouse wheel is not implemented yet.

For easier code in Options a new method is added which provides the
configured modifier as a Qt::KeyboardModifier instead of a Qt::Key code.

Test case is added which simulates all variants of modifiers plus
supported mouse buttons to trigger move.
2016-02-17 17:07:09 +01:00
Martin Gräßlin
fd692ecf07 [autotest] Adjust TestScriptedEffectLoader::testLoadAllEffects for morphingpopups
A new default effect means a new line in the mock config.
2016-02-17 15:27:06 +01:00
Marco Martin
82a1b3ee13 Morphingpopups effect, to animate tooltips
this effect, derived from the Maximize one, will
take the place of the manual window position
animation that Plasma tooltip are using.
this should cause less problems as animationg
positions on X is very error prone, plus it's
less jarring when the tooltip sizes changes too,
since that gets animated as well (behavior similar
to Windows7 taskbar tooltips)

REVIEW:126968
2016-02-17 15:03:55 +01:00
Martin Gräßlin
093e56ff05 Move decoration double click logic to button press
Complements ed1d32288b for Wayland.
2016-02-17 14:41:26 +01:00
Martin Gräßlin
cc8b3a5a96 [autotest] Don't crash when cancel animation from animationEnded in scripted effect
Canceling the animation in the animationEnded handler triggers a crash.
This is due to multiple lists being iterated and manipulated at the same
time.

This adds a test case which simulates the crashy situation.

REVIEW: 126975
2016-02-17 13:59:55 +01:00
Martin Gräßlin
521470b04a Improve keyboard handling for internal windows
So far the key handler in the InternalWindowEventFilter used the
PointerInputRedirection's internal window. This had the result that
key events were only delivered to an internal window if the window
was under the cursor.

This change tries sending the event to the latest created and visible
window. Thus e.g. with nested context menus it goes to the current
sub menu as expected. The return value of sendEvent is used to filter
out the event.
2016-02-17 13:34:24 +01:00
Martin Gräßlin
36facda110 Reintroduce the useage of FBConfigInfo* hash in glxbackend
The hash was completely useless as we never inserted created
FBConfigInfo* into the hash. This change fixes the usage of the
hash and also ensures that it doesn't leak by deleting all hash
elements on tear down.

Current memleak backtrace from ASAN:
Direct leak of 48 byte(s) in 2 object(s) allocated from:
    #0 0x4dc932 in operator new(unsigned long) (/home/kfunk/devel/install/kf5/bin/kwin_x11+0x4dc932)
    #1 0x7f3c596de0f3 in KWin::GlxBackend::infoForVisual(unsigned int) /home/kfunk/devel/src/kf5/kwin/glxbackend.cpp:454:12
    #2 0x7f3c596e7ef4 in KWin::GlxTexture::loadTexture(unsigned int, QSize const&, unsigned int) /home/kfunk/devel/src/kf5/kwin/glxbackend.cpp:826:32
    #3 0x7f3c596e921e in KWin::GlxTexture::loadTexture(KWin::WindowPixmap*) /home/kfunk/devel/src/kf5/kwin/glxbackend.cpp:869:12
    #4 0x7f3c5916e895 in KWin::SceneOpenGL::Texture::load(KWin::WindowPixmap*) /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1232:12
    #5 0x7f3c5917019a in KWin::OpenGLWindowPixmap::bind() /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1681:20
    #6 0x7f3c5916fce0 in KWin::SceneOpenGL::Window::bindTexture() /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1288:12
    #7 0x7f3c5917294b in KWin::SceneOpenGL::Window::beginRenderWindow(int, QRegion const&, KWin::WindowPaintData&) /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1349:10
    #8 0x7f3c59176f24 in KWin::SceneOpenGL2Window::performPaint(int, QRegion, KWin::WindowPaintData) /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1510:10
    #9 0x7f3c5916d410 in KWin::SceneOpenGL2::performPaintWindow(KWin::EffectWindowImpl*, int, QRegion, KWin::WindowPaintData&) /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1161:9
    #10 0x7f3c5916cbc9 in KWin::SceneOpenGL2::finalDrawWindow(KWin::EffectWindowImpl*, int, QRegion, KWin::WindowPaintData&) /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1147:9
    #11 0x7f3c5922e92f in KWin::EffectsHandlerImpl::drawWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) /home/kfunk/devel/src/kf5/kwin/effects.cpp:502:9
    #12 0x7f3c590d7bc5 in KWin::Scene::finalPaintWindow(KWin::EffectWindowImpl*, int, QRegion, KWin::WindowPaintData&) /home/kfunk/devel/src/kf5/kwin/scene.cpp:606:5
    #13 0x7f3c5922c979 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) /home/kfunk/devel/src/kf5/kwin/effects.cpp:465:9
    #14 0x7f3c590d2b38 in KWin::Scene::paintWindow(KWin::Scene::Window*, int, QRegion, KWin::WindowQuadList) /home/kfunk/devel/src/kf5/kwin/scene.cpp:478:5
    #15 0x7f3c590ced89 in KWin::Scene::paintSimpleScreen(int, QRegion) /home/kfunk/devel/src/kf5/kwin/scene.cpp:381:9
    #16 0x7f3c5916b2b1 in KWin::SceneOpenGL2::paintSimpleScreen(int, QRegion) /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:1098:12
    #17 0x7f3c590c8bd3 in KWin::Scene::finalPaintScreen(int, QRegion, KWin::ScreenPaintData&) /home/kfunk/devel/src/kf5/kwin/scene.cpp:200:9
    #18 0x7f3c5922b062 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion, KWin::ScreenPaintData&) /home/kfunk/devel/src/kf5/kwin/effects.cpp:422:9
    #19 0x7f3c590c791f in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, QMatrix4x4 const&) /home/kfunk/devel/src/kf5/kwin/scene.cpp:150:5
    #20 0x7f3c5915e500 in KWin::SceneOpenGL::paint(QRegion, QList<KWin::Toplevel*>) /home/kfunk/devel/src/kf5/kwin/scene_opengl.cpp:751:9
    #21 0x7f3c5907ea3c in KWin::Compositor::performCompositing() /home/kfunk/devel/src/kf5/kwin/composite.cpp:726:29
    #22 0x7f3c5907c230 in KWin::Compositor::startupWithWorkspace() /home/kfunk/devel/src/kf5/kwin/composite.cpp:347:5
    #23 0x7f3c59079bbb in KWin::Compositor::slotCompositingOptionsInitialized() /home/kfunk/devel/src/kf5/kwin/composite.cpp:283:9
    #24 0x7f3c59076084 in KWin::Compositor::setup() /home/kfunk/devel/src/kf5/kwin/composite.cpp:184:9
    #25 0x7f3c598b165f in KWin::Compositor::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/kfunk/devel/build/kf5/kwin/moc_composite.cpp:263:18
    #26 0x7f3c52de67b0 in QObject::event(QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2b67b0)
    #27 0x7f3c536ab9db in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15b9db)

REVIEW: 127096
2016-02-17 12:44:25 +01:00
Martin Gräßlin
7d81e9cf22 [plugins/qpa] Implement a custom QPlatformCursor
This makes QCursor::pos and QCursor::setPos function correctly. KWin
actually wouldn't need it as KWin has the KWin::Cursor replacement, but
it allows Qt internal API to have it function correctly and also the
zoom effect does use QCursor::setPos.
2016-02-17 12:42:12 +01:00
Martin Gräßlin
44bb78c193 Map all pointer buttons to Qt::MouseButton
The mapping is slightly inspired by the mapping in QtWayland.
But the mapping in QtWayland seems wrong. E.g. there is a linux kernel
button called BTN_BACK which is not mapped to Qt::BackButton.

Anyway we are not really interested in the mapping being 100 % correct
for the case in KWin. KWin internally uses only very few mouse buttons
and all others are only relevant to figure out whether buttons are
pressed. The button code itself is passed to the seat with the native
code.
2016-02-17 11:16:57 +01:00
Martin Gräßlin
61428b164e [autotests] Test move ends when all pointer buttons are released
The MoveResizeWindowTest is extended by a test case to verify that
the move only ends once all mouse buttons are released. So far this
is not yet the case as KWin has an incorrect mapping of buttons to
Qt::MouseButtons.
2016-02-17 11:00:58 +01:00
Martin Gräßlin
5200a484ce [autotest] Adjust LockScreenTest to fix that KSldApp goes to Locked state
So far KSldApp was always either in state AcquiringLock or Unlocked
during the tests. Due to a fix in WaylandServer it now can also enter
the Locked state. But this is timing related and also depends on whether
the greeter works at all. E.g. on build.kde.org the greeter fails to
start, so it never enters the Locked state.

The adjusted test now considers that the state might have changed to
Locked and expects one additional signal to be emitted.
2016-02-17 09:41:17 +01:00
Martin Gräßlin
9e54cb5a1f Move global event filter from Application to ApplicationX11
The event filter is only used to let Qt compose a QKeyEvent from an
x11 event for grabbed key events. On Wayland we don't need it as we
can generate good QKeyEvents ourself. This means less event processing
as the events no longer need to pass through the
Workspace::workspaceEvent.

In addition it fixes a regression in LockScreenTest::testEffectsKeyboard
caused by the LockScreenEventFilter sending a QKeyEvent to KSldApp.
This event got intercepted by the global event filter making the test
rightfully fail.
2016-02-17 09:26:38 +01:00
Martin Gräßlin
46e3da297c Set timestamp on WaylandSeat for key event in LockScreenFilter
Was missing.
2016-02-16 17:14:28 +01:00
Thomas Lübking
5ee90dce3d fix validation cnp bugs
pushed wrong branch, this fixes the unguarded
from resolution in the to branches

REVIEW: 126981
2016-02-16 15:08:21 +01:00
Thomas Lübking
c9c86f29fb fix retargetting script export
pushed wrong branch, this fixes the wrong parameter count

REVIEW: 126981
2016-02-16 15:07:27 +01:00
Thomas Lübking
cae90bb035 catch nullptr effects when deleting shadows
the shadow can be deleted deferred from an update
there's a slight chance, to be eg. triggered by clients
blocking compositing, that the compositor is suspended in the same
cycle and the effects pointer (and scene and context) thus gone

CCBUG: 356938
FIXED-IN: 5.6
REVIEW: 126441
2016-02-16 13:59:22 +01:00
Thomas Lübking
070b85bbcf export retarget to scripts 2016-02-16 13:59:22 +01:00
Thomas Lübking
1faa8aa039 allow to retarget animations 2016-02-16 13:59:22 +01:00
Thomas Lübking
07cc30d136 protect against cancel of just ended animations 2016-02-16 13:58:24 +01:00
Martin Gräßlin
4f66f324d7 LockScreenEventFilter passes key events to KSldApp
The KSldApp needs all key events to be able to invoke the whitelisted
global shortcuts.

Reviewed-By: Bhushan Shah
2016-02-16 13:01:32 +01:00
Martin Gräßlin
2b34f97344 Always notify lock screen when a lock surface got created
WaylandServer considers AcquiringLock already as locked thus we
never notified KSldApp about the added window.

Reviewed-By: Bhushan Shah
2016-02-16 12:53:58 +01:00
Martin Gräßlin
1c4c5caf65 [backends/hwcomposer] Use input event filter for turning screen on/off
Like in the drm backend we use an InputEventFilter to turn the backlight
on and off. In this case the filter needs to be always installed as key
event should also turn the screen off. We cannot use a global shortcut
as it would not trigger while the screen is locked.

Unlike the filter in DRM backend only the power key can toggle the
backlight, other key events are ignored. For pointer we are optimistic
and already support enabling the backlight. Double tap to wake is also
implemented, but at least on reference hardware (Nexus 5) doesn't work
as disabling the backlight also disables touch input.

Reviewed-By: Bhushan Shah
2016-02-16 10:49:04 +01:00
Kevin Funk
a33c2730ba AnimationEffect: Fix memory leak
Detected by ASAN

```
Direct leak of 144 byte(s) in 6 object(s) allocated from:
    #0 0x4dc922 in operator new(unsigned long)
(/home/kfunk/devel/install/kf5/bin/kwin_x11+0x4dc922)
    #1 0x7f43dc33d019 in KWin::AnimationEffect::AnimationEffect()
/home/kfunk/devel/src/kf5/kwin/libkwineffects/kwinanimationeffect.cpp:50:44
    #2 0x7f43dbb63e9a in KWin::ScriptedEffect::ScriptedEffect()
/home/kfunk/devel/src/kf5/kwin/scripting/scriptedeffect.cpp:422:1
    #3 0x7f43dbb60513 in KWin::ScriptedEffect::create(QString const&,
QString const&, int)
/home/kfunk/devel/src/kf5/kwin/scripting/scriptedeffect.cpp:407:30
    #4 0x7f43dbb5fcbb in KWin::ScriptedEffect::create(KPluginMetaData
const&)
/home/kfunk/devel/src/kf5/kwin/scripting/scriptedeffect.cpp:402:12
    #5 0x7f43db955fa3 in
KWin::ScriptedEffectLoader::loadEffect(KPluginMetaData const&,
QFlags<KWin::LoadEffectFlag>)
/home/kfunk/devel/src/kf5/kwin/effectloader.cpp:242:25
    #6 0x7f43db9994bf in
KWin::EffectLoadQueue<KWin::ScriptedEffectLoader,
KPluginMetaData>::dequeue()
/home/kfunk/devel/src/kf5/kwin/effectloader.h:257:9
    #7 0x7f43dbf0e2bd in
KWin::AbstractEffectLoadQueue::qt_static_metacall(QObject*,
QMetaObject::Call, int, void**)
/home/kfunk/devel/build/kf5/kwin/moc_effectloader.cpp:179:17
    #8 0x7f43d54de7b0 in QObject::event(QEvent*)
(/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2b67b0)
    #9 0x7f43d5da39db in QApplicationPrivate::notify_helper(QObject*,
QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15b9db)
```

Differential Revision: https://phabricator.kde.org/D942
2016-02-15 17:42:32 +01:00
Kevin Funk
43bd3e44e1 Scene: Fix memory leak
Detected by ASAN

```
Indirect leak of 2080 byte(s) in 10 object(s) allocated from:
    #0 0x4dc922 in operator new(unsigned long)
(/home/kfunk/devel/install/kf5/bin/kwin_x11+0x4dc922)
    #1 0x7f43db47efd6 in
QList<KWin::WindowQuad>::node_construct(QList<KWin::WindowQuad>::Node*,
KWin::WindowQuad const&)
/usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:404:65
    #2 0x7f43db47e51c in
QList<KWin::WindowQuad>::append(KWin::WindowQuad const&)
/usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:553:13
    #3 0x7f43db72787d in
KWin::Scene::Window::makeQuads(KWin::WindowQuadType, QRegion const&,
QPoint const&) const /home/kfunk/devel/src/kf5/kwin/scene.cpp:927:9
    #4 0x7f43db725817 in KWin::Scene::Window::buildQuads(bool) const
/home/kfunk/devel/src/kf5/kwin/scene.cpp:834:15
    #5 0x7f43db899c79 in KWin::EffectWindowImpl::buildQuads(bool) const
/home/kfunk/devel/src/kf5/kwin/effects.cpp:1700:12
    #6 0x7f43db4666d6 in KWin::Shadow::createShadow(KWin::Toplevel*)
/home/kfunk/devel/src/kf5/kwin/shadow.cpp:69:17
    #7 0x7f43db6fb825 in KWin::Toplevel::getShadow()
/home/kfunk/devel/src/kf5/kwin/toplevel.cpp:318:9
    #8 0x7f43db7197dc in KWin::Scene::windowAdded(KWin::Toplevel*)
/home/kfunk/devel/src/kf5/kwin/scene.cpp:408:5
    #9 0x7f43db6d6b71 in KWin::Toplevel::setupCompositing()
/home/kfunk/devel/src/kf5/kwin/composite.cpp:981:5
    #10 0x7f43db6db215 in KWin::Client::setupCompositing()
/home/kfunk/devel/src/kf5/kwin/composite.cpp:1248:10
    #11 0x7f43db6c4517 in KWin::Compositor::startupWithWorkspace()
/home/kfunk/devel/src/kf5/kwin/composite.cpp:329:9
    #12 0x7f43db6c28db in
KWin::Compositor::slotCompositingOptionsInitialized()
/home/kfunk/devel/src/kf5/kwin/composite.cpp:283:9
    #13 0x7f43db6beda4 in KWin::Compositor::setup()
/home/kfunk/devel/src/kf5/kwin/composite.cpp:184:9
    #14 0x7f43dbef60af in KWin::Compositor::qt_static_metacall(QObject*,
QMetaObject::Call, int, void**)
/home/kfunk/devel/build/kf5/kwin/moc_composite.cpp:263:18
    #15 0x7f43d54de7b0 in QObject::event(QEvent*)
(/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2b67b0)
    #16 0x7f43d5da39db in QApplicationPrivate::notify_helper(QObject*,
QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15b9db)
```
2016-02-15 17:42:32 +01:00
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