Commit graph

16066 commits

Author SHA1 Message Date
David Edmundson
5b4eb80c8f Set specific edge cursor shape when resizing
Summary:
Instead of seeing the cursor <--> on the left edge you now see an icon
that looks like |<-  .

This brings kwin decorations in line with GTK CSD icons.

In theory this is also useful to tell which window will resize in the
case of side-by-side windows (regardless of whether borders are on or
not). In practice with the adwaita icon theme I tested with it's not
very intuitive to realise which is which till you learn the icon.

Change is more involved than it should be as Qt::CursorShape doesn't
have these entries, and I don't want to shadow that enum internally or
have
to change kwin effect code.

Specifics depend on cursor icon theme if they are not present it will
fallback to the <--> icon. (Breeze does not have them currently)

Test Plan:
Resized some windows (on X and on Wayland)
Correct icon appeared on Adwaita
Existing icon appeared on Breeze

Reviewers: #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13396
2018-06-11 10:05:07 +01:00
Roman Gilg
fcfe8763f6 [tests] Fix unconfine Button 2018-06-10 19:50:44 +02:00
Martin Flöser
c86fdf4c54 Merge branch 'Plasma/5.13' 2018-06-10 09:20:00 +02:00
Martin Flöser
c44adda40f Hide decoration tooltip when the decoration gets destroyed
Summary:
BUG: 394977
FIXED-IN: 5.13.1

Test Plan: Manual testing

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13299
2018-06-10 09:18:51 +02:00
Roman Gilg
497d077349 [tests] Add pointer constraints test
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
2018-06-09 15:22:49 +02:00
Vlad Zagorodniy
7550d2a020 [effects/dimscreen] Use QSet for checking whether activated window asks for permissions
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
2018-06-09 12:27:52 +03:00
Bhushan Shah
7e2687ed3f Update version number for 5.13.0
GIT_SILENT
2018-06-07 17:46:55 +05:30
Vlad Zagorodniy
d50f28033a [kcmkwin/kwindecoration] Properly render shadows with big tiles
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
2018-06-07 12:47:01 +03:00
Vlad Zagorodniy
2d01ba6450 [scenes/qpainter] Draw decoration shadows
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
2018-06-07 12:27:31 +03:00
Vlad Zagorodniy
7637cfc22b [scenes/opengl] Fix overlapping shadow tiles
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
2018-06-07 12:07:57 +03:00
David Edmundson
a3cff85e7a Remove Qt module declarations in includes
Summary:
Test Plan: Compiles

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13359
2018-06-05 18:07:23 +01:00
Vlad Zagorodniy
60c34b1413 [effects/minimizeanimation] Use new connect syntax
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13354
2018-06-05 13:03:41 +03:00
David Edmundson
7d7112b633 Merge branch 'Plasma/5.13' 2018-06-02 20:58:07 +01:00
l10n daemon script
3f18e2b6ee 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"
2018-06-02 05:45:32 +02:00
Vlad Zagorodniy
c629d282ac [effects/glide] Do not animate logout screen
Summary: BUG: 391907

Reviewers: #plasma, #kwin, romangg

Reviewed By: #plasma, #kwin, romangg

Subscribers: romangg, broulik, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13263
2018-06-01 19:15:26 +03:00
Igor Poboiko
6408e0ba60 [effects/cube] Fix animation and reflection issues
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
2018-06-01 18:32:27 +03:00
David Edmundson
b300229ca2 Don't scale resolution dependent cursor size twice
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
2018-06-01 16:28:41 +01:00
Alex Nemeth
81f38abe6d [effects/blur] Check for blitting support
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
2018-06-01 12:18:50 +02:00
Alex Nemeth
b3b691a250 Fix blur on Wayland when scaling is used
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
2018-05-31 14:34:58 +02:00
Vlad Zagorodniy
42dc3e4cd5 [effects/maximize] Use more verbose name for WindowForceBlurRole instead of an integer
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
2018-05-31 12:11:06 +03:00
Vlad Zagorodniy
c5697d6415 [effects/slide] Const-ify variables
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
2018-05-31 12:09:14 +03:00
Vlad Zagorodniy
02c08ca33d [effects/frozenapp] Delete debug prints
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13157
2018-05-31 12:08:39 +03:00
Vlad Zagorodniy
95ee052442 [effects/blur] Lookup window once when disconnecting from blurChanged
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
2018-05-31 12:08:08 +03:00
Vlad Zagorodniy
54b69bec44 Honor BUILD_TESTING
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
2018-05-31 12:06:55 +03:00
Alex Nemeth
99532fb95c Fix multimonitor blur
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
2018-05-29 15:32:55 +02:00
Alex Nemeth
8342cdd3b6 [libkwineffects/kwinglutils] Calculate correct srcY0 and srcY1 in GLRenderTarget::blitFromFramebuffer
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
2018-05-29 15:27:02 +02:00
Scott Harvey
393af855c4 Revert "Revert "Add "SkipSwitcher" to API""
This reverts commit 5ef119044d.
2018-05-23 23:33:39 -05:00
Martin Flöser
267b5a1122 Disallow running KWin/Wayland as root
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
2018-05-20 21:51:32 +02:00
Martin Flöser
b19c3c1c8e Drop no longer needed cast to Client in TabGroup related code
Differential Revision: https://phabricator.kde.org/D12730
2018-05-20 20:18:09 +02:00
Martin Flöser
b6befb4ef8 Use AbstractClient in UserActionsMenu for tab functionality 2018-05-20 19:50:35 +02:00
Martin Flöser
46d8b87646 Move TabGroup functionality from Client to AbstractClient
Only setClientShown remains in Client. This might need a dedicated
implementation for ShellClient.
2018-05-20 19:50:35 +02:00
Martin Flöser
7defd93047 Port TabGroup from Client to AbstractClient
First step towards a return of window tabbing.
2018-05-20 19:50:29 +02:00
Martin Flöser
a02797ca06 Use existing KSharedConfig in RuleBook::save
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
2018-05-20 15:45:39 +02:00
Martin Flöser
32a715b0c9 Merge branch 'Plasma/5.13' 2018-05-20 15:43:46 +02:00
Martin Flöser
bed31e0557 Reparse rules config prior to update
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
2018-05-20 15:43:11 +02:00
Martin Flöser
9a9c34f352 Merge branch 'Plasma/5.12' into Plasma/5.13 2018-05-20 15:41:48 +02:00
Martin Flöser
9a02ed4d36 Do not save kwinrulesrc on every window opening/closing
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
2018-05-20 15:40:02 +02:00
Martin Flöser
69afe4d266 Update seat's timestamp after waking up screen through double tap
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
2018-05-20 15:38:31 +02:00
Martin Flöser
f28d44e5b2 Use XdgShell Unstable V6 in nested wayland platform
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
2018-05-20 15:37:19 +02:00
Yuri Chornoivan
eb47c08204 Fix message extraction 2018-05-20 08:14:50 +03:00
Martin Flöser
cf53957bd8 Merge branch 'Plasma/5.13' 2018-05-19 09:01:44 +02:00
Martin Flöser
08455f297d Ensure the QToolTip on the deocration does not steal key events
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
2018-05-19 09:01:11 +02:00
Martin Flöser
04dab3de1b Merge branch 'Plasma/5.12' into Plasma/5.13 2018-05-19 09:00:43 +02:00
Martin Flöser
e3250460cc Do not unset cursor image when cursor enters a surface
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
2018-05-19 08:58:42 +02:00
l10n daemon script
4be9264b8a 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"
2018-05-19 08:34:54 +02:00
l10n daemon script
ee0c1c4de2 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"
2018-05-19 08:07:27 +02:00
l10n daemon script
553f95be94 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"
2018-05-19 06:12:38 +02:00
Jonathan Riddell
e868f9c50e Update version number for 5.13.80
GIT_SILENT
2018-05-18 15:56:08 +01:00
Jonathan Riddell
0550fc383c Update version number for 5.13.90
GIT_SILENT
2018-05-18 15:46:13 +01:00
David Edmundson
1403fcf316 Add XDG Output support
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
2018-05-18 14:16:13 +01:00