151 Commits (master)

Author SHA1 Message Date
Xaver Hugl 15d6d8c336 wayland/surface: add the output a surface is on the most 11 months ago
Vlad Zahorodnii d7b1661e08 Merge libkwineffects into libkwin
libkwineffects was introduced when kwin used to be an executable. It
provided an api to implement effects and shielded from the technical
quirks in kwin.

Over the time, kwin internals had been split and abstractions were
refactored so they can be consumed in scripts or plugins. Besides that,
new ways to implement extensions have been introduced, which use
kwin's internal abstractions.

On the other hand, effects continue using libkwineffects specific apis.
This has a few issues: qtquick effects use both apis and it bites us,
duplicating same apis.

The best solution so far is to merge libkwineffects with libkwin, and
replace libkwineffects abstractions with libkwin abstractions, e.g.
EffectScreen -> Output, etc. This change takes care of adjusting libs.

Obviously, the main disadvantage of doing so is that binary effects
have to be recompiled every time new libkwin is released. But it's
already the case with libkwineffects too.
11 months ago
Aki Sakurai 115ea7454b Send tablet events to every bound wl_resource
Some apps, notably Tablet KCM, will rebind the tablet interface and consume all events that should be sent to the GUI toolkit.
This commit sends events to every consumer and also stores the latest cursor indexed by wl_client instead of wl_resource.
BUG:473126
11 months ago
Laurent Montel bc6116c5a7 There's no QVector anymore, QList is the QVector in Qt6 11 months ago
Vlad Zahorodnii 5246d3924f wayland: Destroy ClientConnection immediately
With QObject::deleteLater(), the client object can unexpectedly outlive
the expected lifetime as in 03d0a226fb.
12 months ago
Vlad Zahorodnii 7e99ab9438 Build wayland tests with same build options as other tests 12 months ago
Vlad Zahorodnii 7d56aa3687 Merge wayland tests with other tests
This makes wayland tests organization consistent with other kwin tests.
12 months ago
Martin Gräßlin d6dd4af8cf Rename autotests/wayland to autotests/integration
It's not about Wayland, but more about Integration. It can test both
Wayland and X11 windows.

Reviewed-By: Bhushan Shah
8 years ago
Martin Gräßlin c9984094de Add support for ToolTip Role on PlasmaSurface
Summary:
It's mapped to be on all desktops in order to properly have tooltips
show for the panel (which is on all desktops) instead of just on the
desktop it's created.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2032
8 years ago
Martin Gräßlin 3493e97655 Support for syncing the clipboard from X11 to Wayland and vice versa
Summary:
The clipboard sync is done by a dedicated helper binary launched by
KWin. This helper binary is forced to xcb platform to piggy-back on
Qt's implementation of the X11 clipboard. In addition it implements
the Wayland clipboard - which is much simpler. Reading the Wayland
clipboard is based on the implementation in QtWayland.

KWin internally knows the DataDeviceInterface belonging to the helper
application. Whenever an xwayland client is focussed, this DataDevice
is allowed to set the selection and KWin manually updates the current
selection in the SeatInterface. By that the sync from X11 to Wayland
is implemented. When afterwards a Wayland client is selected, it's sent
the current selection which references the X clipboard and a data
transfer can be initiated in the normal Wayland way.

For the other direction KWin sends the current selection to the helper's
DataDevice whenever an xwayland window is focused. The helper application
reads the Wayland clipboard and sets it on the X11 clipboard. Thus the
Wayland clipboard is synced to X11.

The approach used here will also be useful for implementing a clipboard
manager (aka klipper).

Currently the implementation is not yet fully completed. We need to
make sure that the helper application gets restarted in case of a crash.

Test Plan: See added test case

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1973
8 years ago
Bhushan Shah a69b47f7b7 [autotests] Extend StrutsTests for setup on mobile
This testcase tries to emulate the panel setup on the phone,

- Window placement strategy is set to maximizing
- Top panel with height of 60
- Bottom panel with height of 150

However this is still not complete testcase, some todo items:

- Create Plasmashell desktop window before creating panels
- Create normal window and verify if its placement/position is right

Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
8 years ago
Martin Gräßlin 1a779ccd88 Merge branch 'Plasma/5.7' 8 years ago
Martin Gräßlin c81d8204f9 Add support for new Notification role on PlasmaSurface
Summary:
Sets notifications on all desktop and doesn't activate them.

Unfortunately doesn't work on Plasma yet. Seems the windows don't get
tagged properly.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1930
8 years ago
Martin Gräßlin 7adf69dece Update Keyboard focus when the Surface of the active client changes
Summary:
For XWayland windows the window might be activated before the Wayland
Surface is set for it. Thus the keyboard focus is not passed to the
window. Only on the next activate after the window got created the
window got keyboard focus.

This change addresses this problem by emitting a signal from Toplevel
when the surface changes. The KeyboardInput listens to this signal
for the active client and updates keyboard focus again if the surface
changes. Thus keyboard focus is properly passed to XWayland windows.

Test Plan:
Test case which creates an X11 window is adjusted to verify
the condition.

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2009
8 years ago
Martin Gräßlin 02ba1e7c0a Don't crash if a decoration doesn't get created
Summary:
With the NoBorder option set the DecorationBridge won't create
decorations. Thus we get a nullptr and obviously should not call
into it. There was already a check for whether decoration is null,
so that is a rather embarrassing bug.

Test Plan: Test case added which exposes the crash

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1980
8 years ago
Martin Gräßlin 8a85cc5f9c Do not activate on-screen-display windows
Summary:
Plasma's OSD windows were stealing focus on Wayland. We can be sure
that they should not get keyboard focus, so a check to acceptsFocus
is added.

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1927
8 years ago
Martin Gräßlin 4560f8d253 Handle ShellClient::windowShown in Workspace
Summary:
When a ShellClient gets unmapped and mapped again the signal windowShown
gets emitted. We need to handle this in Workspace to ensure the window
is in the proper layer and gets focus.

This fixes applications like KRunner/Yakuake not having focus on a
second show. Unfortunately it also brings back the problem that
notifiations steal focus (this needs to be fixed by passing a proper
window type to a notification).

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1864
8 years ago
Martin Gräßlin e5fe3137b8 Fix the ignore struts multi-screen handling
Summary:
The checks in Client::adjustedClientArea were a little bit too
agressive, excluding also valid setups.

This change addresses the regression by keeping the actual intended
improvements in place.

The check in Client::adjustedClientArea is now only done for the
special case of desktopArea == area. This ensures that a strut excluding
a complete screen won't affect the overall workarea.

In addition new checks are introduced in Workspace::updateClientArea.
When calculating the new sareas a check is performed whether the
intersection with the adjustedClientArea would result in the sarea
becoming empty (thus a screen being completely removed). If that's the
case the geometry is ignored to not exclude a complete screen.

Interestingly I should have noticed that something with the logic is
odd. As the test case had two commented geometries which we now get.

BUG: 363804

Reviewers: #plasma, apol, lbeltrame

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1744
8 years ago
Martin Gräßlin 39e7b26243 Introduce a RequestGeometryBlocker in ShellClient
Summary:
The idea is to not send multiple resize requests to a client when we
know that we might have multiple geometry changes. E.g. when going
from maximized to restored the borders change and trigger a resize in
addition to the resize from switching to restored.

The implementation is inspired by the GeometryUpdateBlocker.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1808
8 years ago
Martin Gräßlin 53a3740082 Request the resize of ShellSurface after Decoration updated the borders when maximizing
Summary:
This ensures that we don't send a size request with the borders still
added.

Test Plan:
Verified that a maximized window is properly sized and
doesn't have empty borders

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1807
8 years ago
Martin Gräßlin c7828eab8f Ensure that WaylandServer::shellClientAdded only gets emitted once
Summary:
When a shell client got mapped, unmapped and mapped again we emitted
the shellClientAdded signal in WaylandServer again. This resulted in
e.g. Workspace, EffectsHandler, etc. to start managing the window again.
This can be a reason for problems we see with such windows like the
Plasma panel dialog when opened the second time.

Test Plan:
Needs extensive testing on real world system as that changes
behavior now.

Reviewers: #kwin, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D1784
8 years ago
Martin Gräßlin 2343a90aa5 UpdateClientArea from ShellClient::doSetGeometry if the ShellClient has a strut
Summary:
This ensures that resizing a panel updates the client area. On X11 there
is an event when the struts change, but on Wayland the struts are implied
from window type (panel) and the panel behavior, so we need to trigger it
manually.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1811
8 years ago
Martin Gräßlin 58db477796 Fix the strut handling for wayland clients
Summary:
The implementation was broken as it transformed the QRects into QRegions,
subtracted the geometries and took the bounding rect again. In several
setups this could result in the strut getting ignored.

This change improves the calculation of the struts by creating a QMargin
which describes the area which needs to be subtracted from a screen rect.
The QMargin is only adjusted for the edge the window borders. We can
assume that a window with a strut needs to border a screen on Wayland.

With this change we are also able to support panels between screens.
On Wayland a panel placed on the right of a left screen affects the
maximization area of the left screen, but does not affect the overall
workarea.

CCBUG: 167852

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1803
8 years ago
Martin Gräßlin c95ddb7102 Pass the maximized signal to DecoratedClient
Summary:
From the famous category: "How could that code ever have worked".

Maximized state changes were never passed to window decorations. For
X11 windows the decoration updated the state nevertheless, for Wayland
windows the state did not get updated, thus a maximized window had
borders and was shown with a not maximized button.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1805
8 years ago
Martin Gräßlin c65c9728d1 [autotest/wayland] Add a test case for maximize windows
The added test exposes the problem that a shell surface might request
being maximized and then provide an incorrectly sized buffer. In this
case the ShellClient is incorrectly considered as maximized.

I don't have a good idea how to address this yet, but still publish
the test case exposing the problem.
8 years ago
Martin Gräßlin 9d0360b3ef [autotests] Skip PlasmaWindowTest::testLockScreenNoPlasmaWindow on build.kde.org
Needs to start kscreenlocker_greet which needs EGL which we don't have.
8 years ago
Martin Gräßlin 0388ed02a6 Call destroyWindowManagementInterface from ShellClient::destroyClient
Summary:
So far destroyWindowManagementInterface was only called when the
ShellClient got unmapped. But it's possible (although not recommended)
to just destroy the Surface without prior unmapping. In that case the
PlasmaWindow got leaked.

This change addresses this problem by always calling
destroyWindowManagementInterface from ShellClient::destroyClient.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1762
8 years ago
Martin Gräßlin 210d57bb45 Set ShellClient on all desktop depending on Plasma Surface role
Summary:
If a PlasmaShellSurface is a Desktop, a Panel or an OSD it implies
that the window is on all desktop. So let's set it like that.

Test Plan: Auto test added and also confirmed by manual testing

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1747
8 years ago
Martin Gräßlin 76de85b449 Don't setup PlasmaWindowManagement integration for lock screen windows
Summary:
We don't want external processes to know anything about the lock screen
windows. Especially we don't want them to be able to request close on
them.

Thus better never show thus windows to them.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1760
8 years ago
Martin Gräßlin 5d396add12 Restrict when to expose a ShellClient to PlasmaWindowManagement
Summary:
For some windows we don't want to create a PlasmaWindow. Not all
ShellClients are something the outside world should see. This change
introduces the first restrictions:
* KWin internal windows are hidden
* transients not accepting focus are hidden

The latter case doesn't work though if the Surface is mapped prior
to creating the shell surface. In such a situation it's racy as KWin
handles the create surface request before we get the setTransient
request. This is difficult to handle as we do want to react quickly.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1759
8 years ago
Martin Gräßlin 67b869218f [autotest/wayland] Force kscreenlocker_greet to QMLSCENE_DEVICE softwarecontext
OpenGL/EGL doesn't work on build.kde.org. Because of that the
kscreenlocker_greet aborts on startup and we cannot really test whether
it works on build.kde.org. E.g. we never actually see the window.

This change just makes sure that QMLSCENE_DEVICE=softwarecontext is
passed to the greeter in the LockScreenTest. Hopefully that fixes it
on build.kde.org.
8 years ago
Martin Gräßlin 4034795893 [autotests/wayland] Add a test case for PlasmaWindow
The new added test case verifies a few cases in which a PlasmaWindow
should or should not be created or destroyed.

Some cases are clearly wrong and are marked with expect_fail.
8 years ago
Martin Gräßlin fdb04e6f75 [autotests] Correct the expected values from 1a23ab7cf0 8 years ago
Martin Gräßlin 1a23ab7cf0 [autotest] Add test case exposing problem of bug 363804
The test case sets up apol's screen setup and the panel as described
in the attachements in bug 363804. As the test shows the panel's strut
is incorrectly ignored.

CCBUG: 363804
8 years ago
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
8 years ago
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.
8 years ago
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
8 years ago
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
8 years ago
Martin Gräßlin 8d7d51e4ef Merge branch 'Plasma/5.6'
dont_crash_aurorae_destroy_deco.cpp is adjusted to Platform.
8 years ago
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
8 years ago
Martin Gräßlin 568a036762 [autotests] Add test case for verifying that (un)shade keeps window geometry
This adds a new test case which creates an x11 window, shades it,
unshades it and verifies that the geometry is still the same.

CCBUG: 362501
8 years ago
Martin Gräßlin d19690ce98 Honor input mask set on internal windows
Summary:
This ensures that QWindow::setMask works for KWin internal windows.
Without KWin sends all pointer events to the QWindow, even if the
mask says it shouldn't get events.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1509
9 years ago
Martin Gräßlin 319869881c Connect Application::screensCreated to WaylandServer::initOutputs
Summary:
Instead of having the Application invoke initOutputs after creating
the Screens, we can just connect to the signal emitted there.

This allows to make initOutputs a private, WaylandServer internal
method.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1482
9 years ago
Martin Gräßlin e64450c807 Merge branch 'Plasma/5.6' 9 years ago
Martin Gräßlin 6d60f01ad9 Skip DontCrashEmptyDecorationTest if we don't have a /dev/dri/card0 device
Without the /dev/dri/card0 mesa fails to initialize egl and the test
fails. In order to silence the failure till the system provides the
device file, we better skip the test.

A nullptr crash in that case is fixed in WaylandServer tear-down.
9 years ago
Luigi Toscano 654a17686e Conditionally compile tests which depend on XCB_ICCCM
Summary: Move/Resize and Strut tests Wayland tests are affected.

Test Plan: Successful compilation when XCB_ICCCM is not found

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1476
9 years ago
Martin Gräßlin e2e6d8b08b Warp the cursor pos to the specificed global position in a NET::Move request
Summary:
The cursor position is the reference KWin uses while moving a window.
If we don't warp the cursor position the window "jumps" to the cursor
position on first movement.

For requests triggered by the client (e.g. widget style) this does not
matter as the cursor is at the correct position. But for tools such as
task bars we should ensure the cursor is at the right pos.

Reviewers: #plasma, hein

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1421
9 years ago
Martin Gräßlin 380c5e0bd8 [autotests] Only start Xwayland if compositor created a scene
Same as df2c26e3d9 for
WaylandTestApplication.
9 years ago
Martin Gräßlin 0df4406c2c Fix crash on repainting an invalid sizes decoration
Summary:
If a window has an invalid size the decoration also has an invalid
size. This results in the texture used by the
SceneOpenGLDecorationRenderer to be invalid and being reset to null.
Of course we shouldn't try to use this texture to render to.

The change comes with a test case to simulate the situation. We cannot
simulate it with Wayland clients as the geometry can never be empty.
Thus we create an X11 client, resize it to an empty size and unmap it.

This is the first integration test case which creates an X11 Client!
It's also a test case which needs the OpenGL compositor. This will most
likely not work on build.kde.org yet - we need to see what to do about
it. Will need adjustments to get it at least skip on build.kde.org.

BUG: 361551
FIXED-IN: 5.6.3

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1383
9 years ago
Martin Gräßlin bc25677caf Strut sanity checking: ignore struts which would exclude a complete screen
Summary:
Mostly meant for multi-screen setups: we don't want that a strut set on
a window on screen 0 results in screen 1 completely being excluded. Even
if that's strictly seen a client bug, it's better to just ignore the
strut from KWin's side.

The sanity check is implemented in Client::adjustedClientArea.

From a pure standard point of view this change is a EWMH violation and
thus can cause regressions: struts by clients no longer working.

A test case for struts is added, including some invalid combinations
whose strut is ignored with this change.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1386
9 years ago