Summary:
Provides a testing application for pointer locking and pointer confining in
a Wayland session.
The application can be started with QT_QPA_PLATFORM variable set to wayland
or xcb to test constraining in native mode as well as through Xwayland.
Several modes and properties can be selected to test various forms of locking
and confining.
{F5899580}
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13439
Summary:
Do not construct QStringList with classes of windows that ask for
permissions. Instead, create a static set of those window classes (to
avoid the unnecessary construction of QStringList and make lookups
faster).
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13440
Summary:
Decoration KCM module doesn't render properly shadows with big tiles.
This change tries to address that problem by clipping overlaps, similar
to the OpenGL backend.
Before
{F5734862, layout=center, size=full}
After
{F5734863, layout=center, size=full}
Test Plan:
* apply a given patch https://raw.githubusercontent.com/zzag/repo/sources/arch/breeze/refine-decoration-shadows.patch to breeze
* go to System Settings/Application Style/Window Decorations
Reviewers: #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: abetts, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10942
Summary:
QPainter doesn't render decoration shadows. It renders only
shadows provided through ShadowInterface.
With this change, painting of shadows is done in similar way OpenGL backend is
currently doing.
Before
{F5734867, layout=center, size=full}
After
{F5734870, layout=center, size=full}
Depends on D10811 (dummy decoration with shadows in autotests)
Test Plan:
* start kwin with QPainter backend enabled:
```
KWIN_COMPOSE=Q kwin_wayland --xwayland --windowed
```
* open konsole and kate:
```
DISPLAY=:1 konsole
DISPLAY=:1 kate
```
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: davidedmundson
Subscribers: abetts, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10943
Summary:
This problem appears if shadow corner tiles are too big and
some window has size smaller than 2 * shadowTileSize.
This change tries to address the problem above by exclusing
overlapping tile parts. If there are any two overlapping corners
then tile between them(top/right/bottom/left) is not rendered.
Also, because some corner tile parts can be excluded, corner tiles
are expected to be symmetrical(i.e. if we remove right half from
the top-left tile and left half from the top-right tile and
stick them together, they still look fine, there are no misalignments, etc).
Most shadows(e.g. shadows from Breeze) have such behaviour.
No tiles are overlapping
{F5728514, layout=center, size=full}
Overlapping tiles
{F5728516, layout=center, size=full}
And this is how it supposed to be
{F5728517, layout=center, size=full}
Test Plan:
* apply D11069 to Breeze
* in System Settings/Application Style/Window Decorations, choose "Very Large" shadow size
* open Konsole
* resize it to a minimum possible size
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, ngraham, anemeth, abetts, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D10811
The main problem was that inside the effect there was manualVerticalAngle,
which did not represent the actual rotation angle of the cube during the
animation, but used to calculate the position of the reflection. The actual
angle was calculated on-the-fly and was not exposed outside.
Brief description of what the code does:
- variables currentAngle and verticalCurrentAngle now always represent the
current position of the cube. They are updated when one uses the mouse and
inside the rotateCube() method, which is called in prePaintScreen().
- two queues, animations (used for Start / Stop / Left / Right) and
verticalAnimations (used for Up / Down) are used for scheduling the animations
if i.e. user presses several keys in a row. The code checks whether the last
animation has finished (and thus we need to start a new one) inside
prePaintScreen() and postPaintScreen()
- when the animation starts, code saves the starting position of the cube
inside startAngle, startFrontDesktop and verticalStartAngle variables, which
are used to calculate the actual cube position during the animation later.
This is done by startAnimation() and startVerticalAnimation(), which also
calculates the QTimeLine curves needed for animation
BUG: 213599
BUG: 373101
Differential Revision: https://phabricator.kde.org/D9860
Summary:
If the env var is 0 we calculate the cursor size based on the
physical resolution.
The size is multiplied by the output scale.
Either would make sense, together does not and reuslts in kwin
having massive cursors.
This patch is for 5.13.
For master I intend to kill this concept of "resolution dependent size"
on the KCM. We then should do wayland scaling on cursors properly no matter
what size the user selects which will work better for when we have
multiple screens.
I have a WIP patch pending for the latter, but it's too big for here.
It still involves deleting this code.
Reviewers: #plasma, romangg
Reviewed By: #plasma, romangg
Subscribers: romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13267
Summary:
In D12678 blur was changed to use `blitFromFramebuffer()` instead of `glCopyTexSubImage2D()`
Now it checks if the GPU supports it.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13246
Summary:
Blur should now work on Wayland when scaling is used.
This does not affect X11 as `GLRenderTarget::virtualScreenScale()` is always 1 on X11
BUG: 391387
Depends on D12678
Test Plan:
- log in in a Wayland session
- turn display scaling to 2x
- open a transparent window (for example: Konsole with transparent and blur enabled profile)
- blurs the content under the window corretly
Reviewers: davidedmundson, #kwin
Reviewed By: davidedmundson, #kwin
Subscribers: romangg, apol, zzag, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12700
Test Plan:
* Maximized Konsole with enabled blur
* Everything works as expected
Reviewers: #kwin, mart
Reviewed By: #kwin, mart
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13156
Summary: It improves a little bit readability and comprehensibility of the code.
Reviewers: #kwin, mart
Reviewed By: #kwin, mart
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13116
Summary:
When disconnecting from `blurChanged` signal, `(w, connection)` pair is
being looked up three times. We can do better by using `QMap` in a more
STL-like way.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13118
Test Plan:
* Passed `BUILD_TESTING=OFF` option to cmake, no tests have been built;
* Didn't pass `BUILD_TESTING` option, all tests have been built.
Reviewers: #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13163
Summary:
On wayland blur on secondary monitor would not render correctly.
BUG: 393723
Depends on D12452
Test Plan:
- use more than one output
- log in in a wayland session
- open a transparent window (for example: Konsole with transparent and blur enabled profile)
- drag the window to another screen
- blurs the content under the window corretly
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: apol, zzag, davidedmundson, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12678
Summary:
There are several spaces that have to be considered in `GLRenderTarget::blitFromFramebuffer`:
* KWin logical space: the origin is located at the global top-left corner
* display space: the origin is located at the top-left corner of monitor/display
* OpenGL screen space: the origin is located at the bottom-left corner of monitor/display
Given `s`, which is in the KWin logical space, we have to transform it to the display space, then to the OpenGL screen space:
* KWin logical space -> display space: `y' = s.y() - s_virtualScreenGeometry.y()`
* display space -> OpenGL screen space: `y'' = s_virtualScreenGeometry.height() - y'`
Overall, `srcY0` and `srcY1` should be written as follows:
```
srcY0 = s_virtualScreenGeometry.height() - (s.y() - s_virtualScreenGeometry.y() + s.height())
srcY1 = s_virtualScreenGeometry.height() - (s.y() - s_virtualScreenGeometry.y())
```
Test Plan:
Tweak background contrast effect to use GLRenderTarget::blitFromFramebuffer
```
diff --git a/effects/backgroundcontrast/contrast.cpp b/effects/backgroundcontrast/contrast.cpp
index f920fcd88..5247d83b8 100644
--- a/effects/backgroundcontrast/contrast.cpp
+++ b/effects/backgroundcontrast/contrast.cpp
@@ -447,11 +447,10 @@ void ContrastEffect::doContrast(EffectWindow *w, const QRegion& shape, const QRe
GLTexture scratch(GL_RGBA8, r.width() * scale, r.height() * scale);
scratch.setFilter(GL_LINEAR);
scratch.setWrapMode(GL_CLAMP_TO_EDGE);
- scratch.bind();
- const QRect sg = GLRenderTarget::virtualScreenGeometry();
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (r.x() - sg.x()) * scale, (sg.height() - sg.y() - r.y() - r.height()) * scale,
- scratch.width(), scratch.height());
+ GLRenderTarget scratchTarget(scratch);
+ scratchTarget.blitFromFramebuffer(r);
+ scratch.bind();
// Draw the texture on the offscreen framebuffer object, while blurring it horizontally
```
GLRenderTarget::blitFromFramebuffer without this change:
{F5817883, layout=center, size=full}
Reviewers: #kwin, fredrik, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kpiwowarski, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12452
Summary:
KWin is not designed to run as root. It is not hardened enough and
there is a great risk that applications could attack KWin through
X11 properties, Wayland protocol requests, etc. to trigger stack or
heap overflows and execute random code. As clients connected to KWin
could be remote there is a great risk in running KWin as root. Also
clients on the same system but started as a different user could
try to gain more privs by exploiting KWin.
Furthermore KWin is designed to not run as root. It interacts with
logind to get the devices opened which would require root. Whether
KWin would work as root at all is questionable.
We cannot guarantee that running KWin as root is secure, thus this
change disallows running KWin and thus a Wayland session as root.
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13008
Summary:
Recently a KSharedConfig was introduced in RuleBook. It makes sense to
also use it in save and not just in load.
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12747
Summary:
We used to recreate the KConfig when rules needed to update. Now that it
is a KSharedConfig, which is kept, it needs to be reparsed as it changes
outside of KWin.
BUG: 393788
FIXED-IN: 5.13.0
Test Plan: Restarted session, changing rules work again
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12706
Summary:
Our rule handling has had a grave error for years. Whenever a window
with a rule was openend or closed the kwinrulesrc was written back to
disk.
The reason for this behavior is that temporary rules need to be discarded
once they were used. For that there is a method discardUsed which invokes
requestDiskStorage whenever a rule for the window was found. But it did
not check whether there was a rule requiring this.
This change modifies the discardUsed to track whether it changed a rule
and only writes back in case there was a change.
BUG: 393911
FIXED-IN: 5.12.6
Test Plan: Only compile tested
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12749
Summary:
The drm platform has a special handling for touch events while the
screen is in dpms. All touch events are filtered out, but a double
tap wakes up the screen.
Due to the filtering out of the events the idle timers were not reset.
So if you only double tapped, the screen turned on, but not off again.
This change updates the timestamp after double tap, so that the idle
timers are restarted. All other events are still filtered out, to not
have "fake" events (e.g. smart phone in pocket) wake up the device.
BUG: 392754
FIXED-IN: 5.12.6
Test Plan: only compile tested
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12668
Summary:
Changing the creation of the nested window from unstable v5 to v6 in
order to be supported on more compositors and to use KWin's better
supported platform.
Targeting 5.12 as this will help to remove support for unstable v5
from KWayland.
Test Plan: Run a nested KWin/Wayland on KWin/Wayland, everything looked fine
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D11806
Summary:
BUG: 393253
FIXED-IN: 5.13.0
Test Plan: manual testing and new unit test
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12633
Summary:
From Wayland documentation:
"When a seat's focus enters a surface, the pointer image is undefined and
a client should respond to this event by setting an appropriate pointer
image with the set_cursor request."
KWin's interpretation so far for the undefined pointer image was to
remove the pointer image when entering a surface waiting for the client
to set a cursor image. This can result in a short flicker as there might
be a frame without a cursor image.
This patch changes the behavior by keeping the previous image till the
application set a new one. This brings some advantages:
* if the application is not responding a cursor is still shown
* if the same cursor is used as in the previous window we don't have a
flicker
CCBUG: 393639
Test Plan: I cannot see the flicker, so only tested with the adjusted tests
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12631
Test Plan:
Very minimal expansion of unit tests which uses WaylandScreens
Wrote mini app to debug actual output of xdg-output for testing the DRM code
Main relevant user of this is xwayland > 1.20 which I don't have, so that
part remains untested
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: romangg, graesslin, bshah, kwin
Tags: #kwin
Maniphest Tasks: T8501
Differential Revision: https://phabricator.kde.org/D12243