Summary:
Making QActions with the Connection as a parent is dangerous as it gets
moved to a new thread, moving all child objects to that thread.
KGlobalAccel and QAction aren't thread safe and we shouldn't be using it
in two threads. This was notably seen when runnng invokeShortcut over
DBus which then invokes it on the main thread. Something my laptop was
doing when I closed the lid.
This patch simply moves the code to the Input class, where we set up the
libinput connection.
Test Plan:
Closed lid, kwin_wayland was still there when I resumed
Set manual shortcut for toggling touchpad, that still worked
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5733
Summary:
Change 0bec9ad733 introduced a regrssion
on Wayland. On Wayland getTimestamp always returns 0, thus the X11
timestamp gets reset again and again. This results in broken interaction
for Xwayland windows as the broken unit tests show.
This change addresses the regression by ignoring a value of 0.
It means the addressed bug is still present on Wayland for X11 windows
as the timestamp doesn't get updated properly. This requires further
changes.
Test Plan: TestShade works again, testX11TimestampUpdate still works
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5731
Summary:
Normally the xclipboardsyncer should terminate because the socket
becomes unusable. But we have reports of it not really going down and
running amok.
In order to prevent such situations this change registers SIGTERM to be
sent to xclipboardsyncer when the parent process (that is kwin_wayland)
dies in whatever way. This ensures that xclipboardsyncer cannot become
an orphan.
BUG: 371862
Test Plan: Only compile tested, no way to get into the problematic situation
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5589
Summary:
So far KWin only updated the x11 timestamp if the new timestamp is larger
than the existing one. While this is a useful thing it creates problems
when the 32 bit msec based time stamp wraps around which happens after
running an X server for 49 days. After the timestamp wrapped around KWin
would not update the timestamp any more and thus some calls might fail.
Most prominent victims are keyboard and pointer grab which fails as the
timestamp is either larger than the server timestamp or smaller than the
last grab timestamp.
Another problem related to timestamp handling is KWin getting broken by
wrong timestamps sent by applications. A prominent example is clusterssh
which used to send a timestamp as unix time which is larger than the
x timestamp and thus our timestamp gets too large.
This change addresses these problems by allowing to reset the timestamp.
This is only used from updateXTime (which is normally invoked before we
do things like grabKeyboard). Thus we make QX11Info::getTimestamp the
ultimate trusted source for timestamps.
BUG: 377901
BUG: 348569
FIXED-IN: 5.8.7
Test Plan: As I cannot wait 50 days: unit tests for the two conditions added.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5704
Summary:
Based on the feedback from discussion on plasma-devel the currently only
default touch action on a screen edge should be window switching. Given
that our default window switcher is located on the left and works very
nicely for touch event it becomes the default action on the left screen.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5551
Summary:
To have touch events working we need to do memory layout changes on the
xcb events. This is fine for identifying the touch events which should
trigger the screen edge. But when passed on to Qt to have QtQuick windows
(e.g. Alt+Tab) handle the touch events, this results in a problem:
Qt itself does also the memory movement and then the movement is double
and touch events break.
To prevent this problem an RAII class is added which moves the memory in
the ctor and moves it back in the dtor. So during KWin's processing it
has the right memory layout and later on in Qt's processing it has the
proper "wrong" layout which Qt can fix again.
Test Plan: Touch events in Alt+Tab work
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5549
Summary: Basically just a copy and paste from the relevant Qt Wayland
parts.
Reviewers: #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D5172
Summary:
This patch caputres from the framebuffer using the framebuffer's
geometry, factoring in scale. We then keep the current normal DPI
framebuffer causing it to downsample there.
This is good because:
- it keeps the code very simple
- it's a performance optimisation. Blurring on 4k is naturally more
expensive than at regular DPI. Downsampling keeps it the same - and you
can't see a difference given it's high DPI and you're going to blur it
anwyay.
- it keeps kernel sizes somewhat resolution independent so it will look
just as blurry across multiple screens.
::doCachedBlur still needs doing.
Test Plan:
Ran an app
Ran the kwindowsystem blur test
Observed the right part of the window being blurred
Reviewers: #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D4963
Summary:
The backend is responsible for setting the viewport, the GLRenderTarget
should save and restore the viewport actually set by the backend.
Test Plan:
Ran Blur effect which uses this method, under scaling the viewport "restored"
differed from the one set by the backend.
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D4952
Summary:
This method already translates to s_virtualScreenGeometry as the source
co-ordinates are in compostior space we should take scaling into account here too.
This method already supports resizing if source and target sizes do not match.
Calling funcitons can either double the size of the target if they want native resolution
or leave as-is if they want the result in standard DPI.
This implements scaling in the screenshot, magnifier and simple blur effect.
Test Plan:
Tested screenshot effect using spectacle.
I hit an (unrelated, was reproducible on master) crash whilst using this, so it is not fully tested
Ran magnifier effect manually
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D4951
Summary:
glReadPixels needs the correct location relative to the
framebuffer so we need to factor in the scale as well as translation
when going from compositor space.
Test Plan:
Ran the plasma colour picker plasmoid in windowed mode
Clicked on multiple parts of a window
It was right every time
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D4950
Summary:
Background contrast reads pixels from the framebuffer
we need to convert from compositor to framebuffer co-ordinates
when an output is scaled
Test Plan:
Ran the manual test in kwindowsystem. Moved window over dolphin.
Visually checked output
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D4949
Summary:
GLRenderTarget already stores the translation from global compositor
space to the render target co-ordinates, we also need a scale factor for
the exact same reasons.
Test Plan: Used in various effects after this patch and it works there.
Reviewers: #plasma
Subscribers: plasma-devel, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D4948
Summary: We need to set the viewport so that we scale from device pixels to global compositor space.
Test Plan:
Ran kwin_wayland properly on my laptop without setting KWIN_COMPOSE.
Most things worked.
Reviewers: #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3504
When quick tiling animate the outline from the window geometry to the position it would have afterwards.
This provides a visual hint to from where to where the window will go.
Differential Revision: https://phabricator.kde.org/D5262
Summary:
There are a few places where KWin needs to read values from kcminputrc.
As I need to add yet another one it makes more sense to properly
structure it like in other cases and have only one kcminputrc hold in
the application. This also allows to better mock the config values in
the integration tests.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5540
Summary:
Consider the case that capslock gets pressed and released.
In the case of Weston we have a sequence of:
1. Key press event
2. Modifier changed event
3. Key release event
4. Modifier changed event
KWin however used to send the events in the following sequence:
1. Modifier changed event (on key press)
2. Key press event
3. Modifier changed event (on key release)
4. Key release event
It looks like Xwayland is not able to properly process the sequence
sent by KWin. And in fact KWin's sequence is wrong as it sends a state
which does not match. We report that the caps lock is pressed in the
modifiers prior to the application getting informed about the key press
of caps lock.
This change aligns KWin's implementation to the behavior of Weston. The
main difference is that when modifiers change Xkb internally caches the
serialized modifier states. And KeyboardInputRedirection just forwards
the modifiers to KWayland::Server::SeatInterface once the processing has
finished. SeatInterface ignores the forwarding if no states changes, so
it is fine to do it that way.
BUG: 377155
Test Plan:
Not yet tested with an affected Xwayland as I only have 1.18 and the
problem started with 1.19. But verified the sequence of events with WAYLAND_DEBUG
and caps lock stil working in QtWayland clients and Xwayland 1.18
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5452
Summary:
Another regression from enabling touch support on X11.
The approach window for pointer input gets unmapped as soon as the mouse
enters the window. This ensures that mouse motion events are not stolen
from other applications. But with the touch events we did not even react
on the enter event if it's not activated for pointer. The result was an
area around the screenedge being blocked for pointer input.
This change only creates and maps the approach window if the edge is
activated for pointer input.
BUG: 378951
Test Plan:
Activated edges through pointer and touch, reconfigured and tested
motion events
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5528
Summary:
With the TabBox I observed the following issue:
1: trigger TabBox through screen edge
2: exit TabBox
3: trigger TabBox again through screen edge
Actual behavior: in step 3 the GUI does not show. If now using Alt+Tab
to show the TabBox the gui shows, but through screen edge it stays
broken.
Investigation showed that the difference is a direct show in screen edge
case and a delayed show in Alt+Tab case. Futher investigation shows that
an invalid geometry gets requested in the broken case. While this might
indicate an issue in another area it makes sense to protect KWin
internally against it and not to break rendering.
Thus this change ensures that a valid FBO does not get replaced by an
invalid sized FBO.
Test Plan:
Tested that Alt+Tab works correctly when triggered through
edge
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5438
Summary:
This change ensures that the blocking condition of screen edges is also
honored for touch screen swipe gestures.
Test Plan: Only the added test case
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5403
Summary:
This is quite similar to the policy "window" - the main difference is
that windows from the same application share the layout. So only
switching to a window from another application changes the layout.
This change is the last policy to add for support of all the policies we
have on X11.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D5365
Summary:
This policy stores the layout for each window which becomes active
and restores the layout once it gets activated again.
Test Plan: Added test case
Reviewers: #kwin, #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D5315
Summary:
This change introduces the initial support for keyboard layout switching
policies like in the X11 session. This first change only adds support for
Global and Virtual Desktop policy. This means the current layout is
stored in context to the current virtual desktop. Whenever one changes
the virtual desktop the previous layout is restored. If the user has not
yet navigated to this virtual desktop a switch to default layout is
performed.
This is the first code interacting with the new Virtual Desktop API which
is not based on integer ids. To fully support this the API is slightly
extended.
Test Plan: Added test case
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5301
Summary:
Grabbing the touch events seems to cause issues. It seems to also grab
pointer events from touchpad and breaks touch input on other events.
Also testing shows that we don't need it and get touch ownership events
for our screenedge windows reported.
BUG: 378951
Test Plan: Triggered touch screen edge, normal system usage on X11
Reviewers: #plasma, #kwin
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5520
Summary:
On Wayland it can happen that a window is still in the stacking order
although it is not visible. This is mostly the case for Plasma windows.
So far the slideback effect did not ignore those windows and as they are
higher in the stacking order than most other windows it blocked the
effect from working once a Plasma panel element got closed.
This change considers a window which has painting disabled in the
stacking order as not usable and thus filters out all those windows.
BUG: 364483
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5462
Summary:
During pointer motion we already had the condition that an update of
focused pointer surface can only happen when no button is pressed. But
there are more conditions where we try to update the focused pointer even
if a button is pressed. E.g. if the stacking order changes.
This happens when trying to move one of Qt's dock widgets:
1. Press inside a dock widget
2. Qt opens another window, which is underneath the cursor
3. KWin sends pointer leave to parent window
4. dock widget movement breaks
This change ensures that also this sequence works as expected and the
pointer gets only updated when there are no buttons pressed, no matter
from where we go into the update code path.
BUG: 372876
Test Plan: Dock widgets in Dolphin can be moved now.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5461
Summary:
On X11 the edges reserved only for pointer started to show the approach
geometry. This problem is addressed by this change.
Touch screen events do not go through this method, neither is it used on
Wayland.
Test Plan: Tested on X11, problem fixed
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D5421
Summary:
By changing all kcfg to have arg="true" we can pass in the same
KSharedConfigPtr into all effects. This allows to have fake config in
the tests and in the planned effect demo mode.
Also it means that we don't have to hardcode the name kwinrc into the
files. In the configs - where we cannot access the effectshandler - we
use the define KWIN_CONFIG which gets generated based on the compile
time arguments.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3571