Commit Graph

14564 Commits (a95be71ec183ef87cdd2665d20691cf3fc9e38de)

Author SHA1 Message Date
Martin Gräßlin 4548ba403b [autotest/libinput] Verify that Event::create can handle a null argument 2016-05-31 10:15:44 +02:00
Martin Gräßlin 1e564989c9 [autotest/libinput] Add a mocked test for Libinput::TouchEvent 2016-05-31 10:14:28 +02:00
Martin Gräßlin 8851bb8daa [autotest/libinput] Add a mocked test for Libinput::PointerEvent 2016-05-31 09:23:48 +02:00
Martin Gräßlin 4b3e8425a3 [autotests/libinput] Add include_directories for libinput
Libinput header is needed by the tests.
2016-05-30 18:03:42 +02:00
Martin Gräßlin ac227e57c7 [autotest/libinput] Add a mocked test for Libinput::KeyEvent
This new test includes everything used in events.cpp to the mocked
functionality of libinput. Only key event is implemented so far, the
referenced pointer and touch functions are mocked with default values.

The test verifies that a KeyEvent gets created and the key press/release
works as expected.
2016-05-30 17:46:53 +02:00
Martin Gräßlin 2e4db5c2b8 [autotests/libinput] Add test case for Device::setEnabled and isEnabled 2016-05-30 16:04:06 +02:00
Martin Gräßlin ad3101c4cf Trimm the buttonsToString in debug console 2016-05-30 15:32:05 +02:00
Martin Gräßlin 5f2245adaf Add the Device to the input event summary
Summary:
Now that we have access to the actual LibInput Device from the event
handler, let's also print out which device received an event.

Test Plan: Manual testing whether the correct device is shown

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1668
2016-05-30 15:27:55 +02:00
Martin Gräßlin 69cbb40903 Pass LibInput::Device* through the event handlers
Summary:
The signals emitted by LibInput::Connection carry the Device for which
the input event was received. This Device is passed to the input handlers.

Custom event classes are added which extend QMouseEvent, QKeyEvent and
QWheelEvent respectively and expose the Device. The Device is only passed
around as a forward declared pointer, so even if compiled without libinput
support, it should still compile.

Event handlers which need to get access to the Device can now just cast
the event pointer to the custom class and access it. This can be used in
future to handle device specific key codes, etc.

As we don't have a proper event classes for touch events the event
handlers do not yet have access to the Device. Here the internal API
needs to be adjusted in future.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1667
2016-05-30 15:26:37 +02:00
Martin Gräßlin 6d090cd263 [libinput] Add the Device to Event
Summary:
The Event class now holds a pointer to the Device and not only to the
native libinput_device.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1666
2016-05-30 15:23:38 +02:00
Martin Gräßlin b72e4ec897 Revert "Fix build."
This reverts commit abe582c27d.

To explain: the test uses a mocked implementation of libinput. Because
of that it must not link against libinput. The whole idea is to not link
libinput.

So I'm reverting the addition of libinput to linkage. I don't know the
build error, if it gets presented to me, I'll fix it properly without
having to add a linkage to libinput.
2016-05-30 15:06:30 +02:00
Bhushan Shah def8421d67 Don't look out for libis
We no longer use it
Reviewed-by: mgraesslin
2016-05-30 12:45:38 +05:30
Martin Gräßlin 27523b6ecb [autotests/libinput] Add test case for Device::isAlphaNumericKeyboard 2016-05-30 08:22:04 +02:00
Christophe Giboudeaux abe582c27d Fix build. 2016-05-28 17:09:24 +02:00
Martin Gräßlin 202f4beeba [autotest/libinput] Two more test cases for testLeftHanded
With that all conditions should be covered.
2016-05-25 17:47:49 +02:00
Martin Gräßlin 3aa8dc376e [autotest/libinput] Add test case for the supported pointer buttons 2016-05-25 17:25:58 +02:00
Martin Gräßlin 72d9472674 Fix auto-complete failure 2016-05-25 13:28:14 +02:00
Martin Gräßlin b5b2adc5a2 [platforms/drm] Only show cursor if a pointer device is available
Summary:
When the pointer device gets plugged off the cursor is hidden, when
a pointer device gets plugged in the cursor is shown again.

This allows to easily turn a tablet into a proper system by showing
the cursor only when it makes sense.

Test Plan: Tested on exopc with external mouse

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1682
2016-05-25 12:14:00 +02:00
Martin Gräßlin 6f733c3bd0 Bind seat hasKeyboard capability to alphanumeric keyboard availability
Summary:
Just because we have a power button, doesn't mean we have a keyboard.
So let's bind the seat keyboard to whether we have a proper keyboard.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1681
2016-05-25 12:13:33 +02:00
Martin Gräßlin 82d2a2f9f1 [libinput] Track all created Devices in Device
Summary:
Device has a static QVector<Device*> into which each created Device
is added and provides a static method to match a libinput_device* to
the already created Device.

This can be used by the the libinput Event class wrapper to properly
reference the Device the event is for.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1665
2016-05-25 12:13:03 +02:00
Martin Gräßlin 9cdd76f20d [libinput] Expose whether an alpha-numeric keyboard is connected
Summary: Similar to the already existing hasKeyboard, hasTouch and hasPointer.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1671
2016-05-24 13:00:41 +02:00
Martin Gräßlin aeb408d7fe [autotests/libinput] Use GUILESS_MAIN in TestLibinputDevice
No need to have a QGuiApplication for this test.
2016-05-24 11:46:40 +02:00
Martin Gräßlin ff88f93852 Support touch events on KWin internal windows
Summary:
Qt's touch event API is rather difficult and complex to implement.
As none of KWin's internal windows supports multi-touch gestures yet,
this is going the easy route and just simulates a left mouse button
press. If in future need arises for touch gesture support on KWin's
internal windows, this can be added.

Test Plan: Tested on exopc with DebugConsole and auto test

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1661
2016-05-23 18:40:06 +02:00
Martin Gräßlin d758eae6c5 [autotests/wayland] Try to make PointerInputTest::testMouseActionActiveWindow more robust
It's currently failing on build.kde.org. I'm not able to reproduce the
failure localy so I can only interpret the failure. The failure looks
like a window is still present in the next executed test case thus
breaking the positioning.

This change ensures that the window is properly gone before going into
the next test case.
2016-05-23 11:19:29 +02:00
Martin Gräßlin d7f3ed5513 Destroy decoration when DecorationBridge is destroyed
When KWin goes down the DecorationBridge might be destroyed before the
last AbstractClient is destroyed. Thus we should destroy the Decoration
when the DecorationBridge gets destroyed.
2016-05-23 10:01:31 +02:00
Martin Gräßlin 00fe5ec401 [decorations] Don't recreate Renderer once the Compositor is destroyed
If we get a compositingToggled because the Compositor is going down we
don't need to recreate the Renderer as KWin as a whole is going down.

Thus we disconnect the compositingToggled connection when the Compositor
is about to be destroyed.
2016-05-23 09:28:27 +02:00
Martin Gräßlin 1d9653953b Destroy ShellClient when the SurfaceInterface gets destroyed
KWayland was changed: the ShellSurfaceInterface does no longer get
destroyed when the parent SurfaceInterface gets destroyed. For the
wl_shell_surface there is no dtor request in the interface so the
resource sticks around and also the ShellClient is kept.

This change ensures that the ShellClient also gets destroyed when
the Surface is destroyed. This should fix some broken tests.
2016-05-23 08:54:28 +02:00
Martin Gräßlin eb44bbe460 [autotest] Add a test case for KWin::LibInput::Device
Summary:
The usage of libinput is completely mocked. The test covers all the
constant properties read by Device.

There are some features which are not yet tested:
* alphaNumericKeyboard
* supportedButtons
* enabled

The setters for leftHanded and pointerAcceleration are also covered
including the variants where it can fail.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1648
2016-05-20 15:51:20 +02:00
Martin Gräßlin 3c4619893c Don't update decoration when ServerSideDecoration gets destroyed and ShellClient is unmapped
Summary:
Most likely the window is in the process of getting destroyed. In that
case the following destroy of the Surface is also going to destroy the
decoration.

This was causing an interesting effect with the QQuickRenderControl used
by Aurorae. When getting destroyed it ensures that all posted events get
processed. This includes the destroy of the Surface which entered
ShellClient::destroyClient which again destroyed the decoration. In other
words a recursive destroy which ended with wonderful crashers due to
double deletions.

If the window is not unmapped this might still cause problems: more
testing needed.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1641
2016-05-19 16:53:08 +02:00
Burkhard Lück 50184cc53f Fix X-DocPath in kcmkwineffects.desktop
change X-DocPath in kcmkwineffects.desktop to kcontrol/kwineffects/index.html
REVIEW:127907
2016-05-17 18:06:03 +02:00
Martin Gräßlin 7c822fadee Move the OpenGL unsafe check into the Platform
Summary:
A new virtual method createOpenGLSafePoint is added to Platform.
This is invoked through the Compositor with a PreInit and a PostInit
argument pre and post creating the SceneOpenGL.

The Platform plugin can implement this and use it for detecting whether
creating the OpenGL compositor on this platform crashed in the past.
Thus it's the base for the openGLIsBroken platform check.

The x11 standalone plugin is the first to implement this functionality
using the previous code which was designed for X11.

This also means that a crash of the OpenGL compositor during init on
Wayland won't result in OpenGL being disabled.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1582
2016-05-17 14:29:29 +02:00
Martin Gräßlin 48e69b77d9 If glx is not available try to create egl backend
Summary:
So far the OpenGL is unsafe check functionality in Compositor disabled
OpenGL compositing if glx is not available and we are in standalone X11
mode.

This is technically no longer correct for quite some time. Just because
GLX is not available doesn't mean that OpenGL doesn't work. We have an
EGL backend. So let's try to use that if glx is not available.

This change removes the check completely from Compositor. Instead the
standalone x11 plugin checks whether glx is available prior to createing
the glx backend. If not available it falls through to the egl backend.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1581
2016-05-17 14:25:33 +02:00
Martin Gräßlin ea4de85553 Destroy static Client helper window before application goes down
Summary:
Client uses a static Xcb::Window helper. This so far didn't get
explicitly destroyed, so the application finalize cleaned it up.
To destroy the window the xcb_connection_t* is used which the
QGuiApplication already destroyed.

This change ensures that the window gets destroyed before the xcb
connection gets destroyed.

In addition an assert is added to KWin::connection() to ensure that
we still have the QGuiApplication::instance() when it's invoked.
This way we'll notice if we have more cases where we call into xcb
after the application went down.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1573
2016-05-17 14:17:07 +02:00
Martin Gräßlin 24bdfc6317 Make Toplevel::window() no longer virtual and introduce ::windowId()
Summary:
Toplevel::window() is the actual X11 window. This makes it difficult
to use as the generic identifier for both X11 and Wayland. The Wayland
ShellClient already had a windowId() which is now added to Toplevel as
a virtual method. On X11 (Toplevel default) it returns the window().

The method window() now returns XCB_WINDOW_NONE for classes without
the Toplevel::m_client, such as ShellClient. Thus it allows to properly
check whether we are on Wayland or X11.

The code is adjusted to use windowId where a generic id is needed and
to properly check whether the window is valid before using it where
a window() is used.

This also fixes at least one additional unknown issue in
Workspace::setActiveClient

where the windowId of a Wayland client was passed to X11.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1527
2016-05-17 14:13:24 +02:00
Martin Gräßlin d15d3a5ff1 Provide functionality of CompositingPrefs through Platform
Summary:
CompositingPrefs is only relevant for X11 standalone. It had some
"hacks" to make it not block Compositing on Wayland. Thus it was in
its current form not really useful.

Now all the functionality is provided through Platform with a default
implementation which is sensible for Wayland platforms.

The X11 standalone platform implements the new methods with the
Wayland checks removed.

In addition all calls to CompositingPrefs now go through the platform
directly and CompositingPrefs is completely dropped.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1576
2016-05-17 13:59:52 +02:00
Martin Gräßlin c45942a70c Move requiresCompositing from Application to Platform
Summary:
This change reduces the windowing system specific code pathes. Instead
of checking whether we are on X11 or Wayland to decide whether
compositing is required, we just ask the Platform.

The default is true, only x11 standalone allows to not require
compositing.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1575
2016-05-17 13:59:32 +02:00
Martin Gräßlin 73fae5e63d Support touch events in DecorationEventFilter
Summary:
Touch events are emulating mouse events, in particular left mouse
button.

With this change one can move windows through the decoration, use
the decoration buttons and also support the double click action.

As finding the decoration is pretty much exactly the same as for
pointer events, a new base class is introduces which provides the
functionality of updating the decoration and the shared common
variables.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1604
2016-05-17 07:33:02 +02:00
Martin Gräßlin 1350653d44 [plugins/qpa] Add support for QT_WAYLAND_FORCE_DPI env variable
Summary:
If a user specifies the QT_WAYLAND_FORCE_DPI env variable, KWin uses
it to force a logicalDPI, just like QtWayland.

Test Plan: Normally sized window decorations

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1605
2016-05-17 07:32:30 +02:00
l10n daemon script c331b3f825 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-05-16 10:31:39 +00:00
Martin Gräßlin 56331942f3 Bind sending frameRendered to whether we have a Wayland Server not to operation mode
Summary:
This ensures that frameRendered is also sent if we start a Wayland Server
on X11.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1597
2016-05-13 10:05:38 +02:00
Martin Gräßlin a3ca25ecd4 Don't reset InputDevicesModel when devices change
Summary:
Instead of reset a proper beginInsertRows, beginRemoveRows is used.
In addition changes in the device are also listened on and emit the
proper dateChanged signal.

Test Plan:
Opened debug console, selected the touchpad device,
toggled shortcut and verified that this updated the data column.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1547
2016-05-13 10:04:40 +02:00
Burkhard Lück 7dbad7bade Add docbook for kwineffects kcm
REVIEW:124341
2016-05-13 08:11:27 +02:00
Martin Gräßlin 14d12c0585 Do not limit mouse actions to titleBarArea but allow on complete titleBarPosition
Summary:
Mouse actions like wheel and double click were restricted to the titleBar
area. This made the top most pixel non-interactive as it's not part of the
titleBarArea.

This change makes the complete titlebarPosition interactive. That is it
includes for a "normal" (top) setup also the TopLeft/Top/Right section.
Thus the top most pixel can be double clicked, mouse wheeled, etc.

For the Wayland case the test case is adjusted.

BUG: 362860
FIXED-IN: 5.7.0

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1596
2016-05-12 16:58:15 +02:00
Martin Gräßlin 8d7d51e4ef Merge branch 'Plasma/5.6'
dont_crash_aurorae_destroy_deco.cpp is adjusted to Platform.
2016-05-12 16:43:12 +02:00
Martin Gräßlin 0be773262e Unmap PlasmaWindowInterface instead of deleting directly
Summary:
The window will be cleaned up automatically once all bound resources
are destroyed. A manual delete though might cause protocol errors on
client side as the unmap and resource destroy happen together and we
are in a race condition.

To ensure that we don't leak the interface is set as the parent, so
on tear-down remaining resources will be destroyed eventually, even
if it triggers a protocol error on the client.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1595
2016-05-12 11:10:10 +02:00
Kai Uwe Broulik 4f222c2cda [Rules Widget] Change decoration fallback color from "Oxygen" to "Breeze"
Reviewed-By: mgraesslin
2016-05-12 10:34:14 +02:00
Martin Gräßlin 5e284224ee [libinput] Support toggleTouchpad
Summary:
The LibInput::Device provides a way to enable/disable the device.
This is used by the Connection to toggle all touchpad devices on/off
when the touchpad key is pressed. For this KWin "steals" the global
shortcuts from the touchpad kded.

Detecting what is a touchpad is unfortunately not tivial. The code
uses the following approach:
* it's a pointer
* it's not also a keyboard or touch screen
* it's at least one of the following:
 ** supports multiple tap fingers
 ** supports disable while typing
 ** supports disable on external mouse

If the code finds a touchpad and changes it's state successfully,
it triggers the touchpadEnabledChanged on Plasma's osdService.

Test Plan: Tested on notebook with toggle touchpad button

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1545
2016-05-11 14:19:25 +02:00
Martin Gräßlin 78c70a0775 [lbinput] Support setting pointer acceleration
Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1544
2016-05-11 14:17:05 +02:00
Martin Gräßlin 254573bee1 [libinput] Support for left-handed pointer
Summary:
The configuration file kcminput, group Mouse is parsed to decide whether
pointer devices should be in left handed mode. The config is applied
whenever a new device is added.

In addition the Connection listens to KGlobalSettings for a mouse
settings changed signal which might be emitted by the mouse KCM.

When such a signal is emitted, all pointer devices are reconfigured.

This allows to change the mouse handed settings on Wayland.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1543
2016-05-11 14:12:25 +02:00
Martin Gräßlin 6cd0d5a54a Delay maximize button click to next event cycle
Summary:
The delay to next cycle dance is needed for Aurorae. Maximizing a
window can result in the decoration being destroyed, in which case
QtQuick can trigger a crash.

A test case is added to simulate the situation and ensure that maximize
still works also after the change.

BUG: 362772
FIXED-IN: 5.6.5

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1586
2016-05-11 13:45:14 +02:00