Commit graph

3614 commits

Author SHA1 Message Date
Xaver Hugl
671672871b LogindSession: adjust warning when openRestricted fails
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2482>
2022-05-30 12:44:22 +00:00
Luca Carlon
2d563dc63f AppletPopup window type should accept focus.
AppletPopup window type should accept focus, behaving like other window types like
Dock. At the moment it is instead behaving like notification, which seems wrong.
This should also fix a failing unit test.
2022-05-30 09:41:01 +00:00
Luca Carlon
7865a9b355 AppletPopup window type should be shown on all desktops.
AppletPopup's are typically supposed to be attached to the panel and
should remain visible when the virtual desktop is changed. If the
AppletPopup is pinned and the virtual desktop is changed, without
this patch, the window does not remain attached to the panel. This is
how AppletPopup was supposed to work even according to the unit test
which currently fails.
2022-05-30 08:36:52 +00:00
Malte Dronskowski
d8da0c7708 Fix typo in latency policy
The lowest latency setting wasn't applied because the internal 
implementation contained an excess 'e' in comparison to the setting 
exposed to the user

BUG: 453694
2022-05-29 18:07:37 +00:00
l10n daemon script
450d8e286a 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"
2022-05-29 01:45:37 +00:00
l10n daemon script
df7e386714 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"
2022-05-28 02:21:02 +00:00
Luca Carlon
da0dd1e367 Support new AppletPopup window type
See the discussion in https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/500.

BUG: 411462
BUG: 332512
FIXED-IN: 5.25
2022-05-27 21:49:37 +00:00
Xaver Hugl
615cd352fb add autotest for touchscreen gestures 2022-05-27 17:49:59 +00:00
Xaver Hugl
61efc4c2e1 input: don't fail touchscreen gestures with invalid physical size 2022-05-27 17:49:59 +00:00
Xaver Hugl
9957f8c84a input: fix touchscreen gesture detection
When a gesture is cancelled because of the distance between fingers or the
time it took to register them all, no gesture has been taken yet. In that
case, the canceling would never be ended, effectively disabling all touchscreen
gestures.
2022-05-27 17:49:59 +00:00
Vlad Zahorodnii
97a82c97df effects: Fix QQuickItem::mapToGlobal() in qtquick effects on wayland
On Wayland, we create a dummy window to fix HiDPI issues. At the moment,
the QQuickRenderControl::renderWindow() returns a fixed offset 0,0.

As it turns out, QQuickItem::mapToGlobal() will poke the
QQuickRenderControl::renderWindow() function to map the specified point
to the global coordinate space.

Since the renderWindow() function returns hardcoded offset, the
mapToGlobal() function is sort of broken in fullscreen effects.

In order to fix mapToGlobal() on Wayland, this change makes the
EffectQuickRenderControl return the position of the associated
OffscreenQuickView.
2022-05-27 15:43:00 +00:00
Xaver Hugl
f86f159fd5 backends/drm: fall back to a software cursor if drmModeAddFB2 fails
CCBUG: 453860
2022-05-27 15:24:27 +00:00
Marco Martin
f6db8b1178 Toggle all desktop on middle click
restores the behavior of the old desktop grid which toggled on all desktops on middle click

BUG:454001
2022-05-27 08:29:57 +00:00
Vlad Zahorodnii
6180a9b144 effects/zoom: Fix repainting with zoom factor of 1
When zoom factor is 1, the zoom effect will paint the scene in an
offscreen texture, but not actually paint the textures on the screen.

Zoom factor can be 1 when the effect has been just stopped.

BUG: 454407
2022-05-27 08:14:21 +00:00
Marco Martin
207c59002b Properly reset offToCornerId and apertureCorner when the effect closes
When the effect closes, all the extra data attached to the window
(offToCornerId and apertureCorner properties) are not valid anymore
and need to be reset right after the animation end.
also manage the two edge cases where a window either appeared or
got minimized while the effect was running to either show it or not

BUG: 454280
2022-05-27 08:00:32 +00:00
Vlad Zahorodnii
1f6d9d482f effects/zoom: Schedule a fullscreen repaint if stopped zooming
On Wayland, screens are repainted independent of each other. If zooming
animation stops on one screen, other screens may still be stuck in the
zoomed state and therefore result in potential flickering. Issue a full
screen repaint when zooming stops to ensure that other screens are
repainted with "unscaled" contents.

BUG: 454407
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2472>
2022-05-27 07:27:06 +00:00
Vlad Zahorodnii
f3b291bce0 Make TimeLine API ergonomic with presentation timestamps
Currently, if you want to use TimeLine, you need to track the last
presentation timestamp which boils down to carrying some boilerplate
code.

The current situation can be improved by making TimeLine work with
presentation timestamps.

Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2473>
2022-05-26 17:10:07 +00:00
Vlad Zahorodnii
6a5173b6c4 effects/zoom: Use GL_LINEAR filter
The magnification filter was changed to GL_NEAREST with the reasoning
that "pixel granularity" would be more correct. Perhaps that was not a
bright idea. Change it back to GL_LINEAR.

BUG: 454408
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2471>
2022-05-26 10:11:01 +00:00
Kai Uwe Broulik
b6001d12cc backends/x11/windowed: Don't create cursor pixmap from null image
There's no point and it results in a "QImage::scaled: Image is
a null image" warning.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2469>
2022-05-26 06:51:46 +00:00
Kai Uwe Broulik
b062d09fdc backends/x11: Support resizing the windowed output
In response to a XCB_CONFIGURE_NOTIFY on the output window, the new size
is set as mode and the output layer buffer is recreated.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2459>
2022-05-26 06:38:32 +00:00
Vlad Zahorodnii
486d229cae effects/desktopgrid: Fix config group name
The config group is formed as "Effect-" + plugin id, i.e. "desktopgrid"

Config migration from DesktopGrid to desktopgrid is already handled by
a kconf_update script.

BUG: 454102
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2464>
2022-05-25 18:11:57 +00:00
Kai Uwe Broulik
b018dd3204 qpa: Provide a QPlatformNativeInterface
Under Gnome/Unity/XFCE, but not Plasma(!), QFontconfigDatabase queries
the platform native interface for certain font settings
(e.g. antialiasingEnabled). Without a QPNI this would crash KWin
as soon as it tried to query for fonts.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2468>
2022-05-25 16:37:32 +00:00
Vlad Zahorodnii
f2be602266 kcms/touch: Fix crash
"effects" is a typo, we need to populate "m_scripts"

BUG: 454360
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2465>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2465>
2022-05-25 10:26:03 +00:00
Vlad Zahorodnii
e57be93108 backends/drm: Specify clear color for cursor plane
Otherwise the results are undefined.

BUG: 454068
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2466>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2466>
2022-05-25 09:45:18 +00:00
Vlad Zahorodnii
7c849ee05a Use font metrics to compute corner offset
The problem with the current approach is that it doesn't work reliably
on wayland. Outputs can have different pixel density, etc.

Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2461>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2461>
2022-05-25 06:29:28 +00:00
l10n daemon script
68f6734d5c 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"
2022-05-25 01:46:45 +00:00
Kai Uwe Broulik
f013dc410e Don't block screen edge for fullscreen effects
Otherwise in overview effect you cannot go back out the way you came.

Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2416>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2416>
2022-05-24 23:58:33 +00:00
Kai Uwe Broulik
d143f6e3c4 backends/x11: Arm vsync monitor in EglX11Backend
This was originally on `EglX11Backend::endFrame` and got lost
as part of refactoring in 7358daa9, breaking nested `kwin_wayland`
rendering with GL.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2458>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2458>
2022-05-24 14:44:59 +00:00
Aleix Pol
cad5ddbab3 xdg_activation_v1: Do not bounce icon if the desktop file was not found
It's annoying and doesn't buy us much.
Additionally, take X-KDE-StartupNotify into account as we are meant to.

BUG: 453940
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2415>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2415>
2022-05-24 13:14:43 +00:00
Vlad Zahorodnii
221f114d80 effects/zoom: Render scene in an offscreen texture
This fixes integration of the zoom effect with the blur effect and qtquick
effects such as overview or window view.

The main con of the proposed solution is that offscreen rendering can be
a bit overkill. But on the other hand, it's the most robust way to
ensure that fullscreen effects integrate correctly with the zoom effect.
For example, without it, the quick scene effect would need to figure out
what screen views to paint for the given screen. There are also more
finicky cases, e.g. the screen transform effect.

BUG: 447002
BUG: 447670
BUG: 453467
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2451>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2451>
2022-05-24 12:29:11 +00:00
Vlad Zahorodnii
cc487d4292 effects/zoom: Specify effect chain position
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2451>
2022-05-24 12:29:11 +00:00
Vlad Zahorodnii
80b9617bad effects/fallapart: Fix glitch
The WindowItem visibility reference must be dropped after, not before
starting painting. It also makes the fall apart effect code consistent
with other effects.

BUG: 454243
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2455>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2455>
2022-05-24 12:06:09 +00:00
Kai Uwe Broulik
cfd3676e96 backends/x11: Restore dedicated XRenderUtils::init function
Under kwin_wayland `kwinApp()->connection()` is for communicating with
XWayland, but in X11Windowed backend we need to talk to the host XServer.

Restore `XRenderUtils::init` and set it accordingly based on
whether we're running standalone or windowed, so that `kwin_wayland`
works running nested in an X session again.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2457>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2457>
2022-05-24 11:45:52 +00:00
Vlad Zahorodnii
8b644fee58 backends/x11: Ensure that Output::geometryChanged is emitted when modes change
BUG: 453696
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2454>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2454>
2022-05-24 09:51:44 +00:00
Alexander Lohnau
38eef5e2b7 Adjust name of KCM desktop files
The name should match the KCM plugin id, otherwise the entry can not be fond when the KCM should get pinned in the task manager
2022-05-23 19:40:26 +02:00
Vlad Zahorodnii
e6a2cbc345 wayland: Simplify keystate protocol implementation
Access input machinery directly to monitor modifiers.

Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2447>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2447>
2022-05-23 07:06:29 +00:00
Volker Krause
f64214e8b3 Add missing include
This is no longer indirectly included with KF deprecation level 5.94.
2022-05-22 15:13:40 +02:00
Vlad Zahorodnii
d91bdee3c7 Allow fullscreen effects to override latency policy
With some effects, latency policy doesn't matter and it's preferred if
kwin uses the smoothest animation latency policy in order to minimize
the number of frame drops, e.g. slide.
2022-05-21 17:21:20 +00:00
Vlad Zahorodnii
773384b59f Remove unused includes in scene.cpp
QQuickWindow and QVector2D are unused.
2022-05-21 15:27:42 +03:00
Vlad Zahorodnii
e3da5fc76e Remove EffectFrame leftovers in Scene 2022-05-21 14:20:33 +03:00
Ismael Asensio
329ddf5789 kcm/rules: Use the new KCM namespace for standalone launch
After commit c1d0aa18, the namespace where the KCM is installed
changed to `plasma/kcms/systemsettings/`.

We need to point to this new plugin location when the KCM is
launched via Alt-F3 > "Window Specific Properties"

Also let's set the full plugin location from CMake instead of
harcoded in C++ so it is easier to keep it in sync.

BUG: 454066
FIXED-IN: 5.25.0
2022-05-21 04:31:10 +00:00
Aleix Pol
14aefcb373 xkb: Explain mystery constant
While looking at xkb code I found what this + 8 meant, figured we better
include it in our code so it feels less magical.
2022-05-20 23:10:57 +00:00
Aleix Pol
da8ad3201b xdg_activation_v1: Improve internal API
Be explicit about how we only request privileged tokens internally in
KWin.
2022-05-20 16:36:55 +00:00
Xaver Hugl
13dd31d98a effects/windowview: allow closing windows with touch 2022-05-20 12:50:15 +00:00
David Edmundson
e23c3a69d9 [Effects/blend] Let fullscreen effects take priority
The Blendchanges effect works by showing a snapshot of the current
screen for a few ms. Any other active full screen effect will look
broken, so it should take priority.

This is pre-empting an issue with a new Plasma feature that syncs
colours to wallpapers. Once we animate activity switches / have per
desktop wallpapers it'll glitch out.
2022-05-20 08:15:22 +00:00
Alexander Lohnau
af18335a0d Add missing NoDisplay=true to KCM desktop files
We want those to be shown when they are explicitly pinned, but
not in the normal app search/overview.

Fixes https://invent.kde.org/teams/plasma-mobile/issues/-/issues/154#note_452861
2022-05-19 18:23:06 +02:00
Vlad Zahorodnii
efece0a300 effects/windowview: Add ability to deactivate the effect by hitting the same screen edge
In present windows, you could hit the same screen edge that you use to
activate the effect in order to deactivate it.
2022-05-19 15:14:28 +00:00
Vlad Zahorodnii
843b3cfb2a effects/screenedge: Move it forward in the effect chain
Move the screen edge effect earlier in the effect chain so QML effects
can render their contents first, then draw screen edge glow.
2022-05-19 14:11:05 +00:00
Kai Uwe Broulik
a2c91f9434 backends/x11: Cleanup KWinXRenderUtils and move it to eglx11common
The XRender backend has been removed, leaving most of KWinXRenderUtils unused.

The few features that are still used, notable `XRenderPicture` and pict format
are moved into the x11/common directory.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-05-19 12:10:18 +00:00
Xaver Hugl
0bbd4445f2 backends/drm: fix offset cursor
For some reason with legacy the cursor gets an offset when changing the
image. In order to work around this, directly issue a cursor move with the
corrected position when changing the buffer
2022-05-19 09:43:27 +00:00
Xaver Hugl
23c68fd9da effects/desktopgrid,overivew: set touchpad gestures to match 5.24
As we don't provide any ability for the user to configure the gestures yet,
the gesture for the desktop grid should stay as it was in the last release.
This commit swaps the gestures for desktopgrid and overview to achieve that.
2022-05-19 07:37:29 +00:00
Vlad Zahorodnii
1ee00bc6f9 wayland: Fix drag-and-drop issues in Firefox
At the moment, the data offer initializes supported and preferred action
to "none". But if the target doesn't accept anything the source
provides, the compositor may still need to send action events with "none"

This change makes data offer and data source provide dnd actions wrapped
in std::optional in order to indicate if they have been set explicitly.
2022-05-19 07:00:43 +00:00
David Redondo
20a94d7157 xwayland: Keep source/Xvisit alive for longer
SeatInterface emits dragEnded when the drag is dropped. The target may want
to interact with the data source after the drop happened, for example only
fetching data after the drop and not during the drag.
(Note that the Wayland protocol has the same
Xvisits are now not deleted prematurely but only when they are really finished.
(Note that the Wayland protocol has the same distinction between dropped and
finished so it maps nicely).
For storing  previous visits the same code pattern as in the rest of the XWayland
DND code is used.
The SelectionSource is reset when the next Drag/Drop operation involving a X window
is started (see startDrag and doHandleXfixesNotify) or when the Wayland source is
about to be deleted.

BUG:450460
FIXED-in:5.25.0
2022-05-19 06:45:00 +00:00
Guenther Grau
f6f4a296f2 Fix argument order for clientMaximizedStateChanged
Arguments for clientMaximizedStateChanged were incorrect in window.cpp.
They are correct in xdgshellclient.cpp and window.h

BUG: 380836
2022-05-19 09:33:05 +03:00
Xaver Hugl
a262f2b28a Revert "wayland/outputdevice: use OutputMode directly"
This reverts commits 67181d5db7 and
d03e352dbf.

BUG: 454014
2022-05-19 00:59:54 +02:00
Vlad Zahorodnii
bcbbbc561b Rename Workspace::removeAbstractClient() to Workspace::removeWindow() 2022-05-18 17:14:09 +00:00
Vlad Zahorodnii
06a9c686f1 Move popup cleanup from Workspace::removeX11Window() to Workspace::removeAbstractClient()
This popup cleanup code can be useful also on wayland.
2022-05-18 17:14:09 +00:00
Xaver Hugl
62e1130846 gestures: limit progress range for pinch gestures
If progress goes out of the [0, 1] range, effects misbehave
2022-05-18 16:55:27 +02:00
Xaver Hugl
2238e608d6 gestures: rename weirdly named methods 2022-05-18 16:54:24 +02:00
Xaver Hugl
103d6b9e92 globalshortcuts: fix warning 2022-05-18 16:53:13 +02:00
Aleix Pol
1176f31e0d Support KWindowSystem interface with activation support
Allow internal uses of KWindowSystem to support activating other
clients.

BUG: 453748
BUG: 453785
2022-05-18 13:48:52 +00:00
David Redondo
d3a37aa9ae Update device outputName when setting output
BUG:451279
FIXED-IN:5.25.0
2022-05-18 12:50:24 +00:00
Xaver Hugl
b0b551653f backends/drm: update cursor after compositing reset
Otherwise the cursor won't be shown, as its buffer and layer got destroyed

BUG: 453823
2022-05-18 11:00:14 +00:00
Xaver Hugl
d03e352dbf wayland/outputinterface: fix crash
The current mode may be nullptr
2022-05-18 10:03:13 +00:00
Vlad Zahorodnii
be717d5c67 autotests: Fix testTouchPoint
Gesture recognition code doesn't handle correctly cancelling a touch
sequence. testTouchPoint in one of its tests simulates pressing the
screen with three fingers and cancelling the touch sequence.
2022-05-18 09:46:56 +00:00
Vlad Zahorodnii
f1c9cb5d64 Emit Workspace::windowAdded() at more intuitive time when starting to manage an X11 window
Emitting the Workspace::windowAdded() signal before actually adding the
window to the Workspace is counter-intuitive and it can a source of
potential bugs as relevant window lists in Workspace don't contain the
window yet.
2022-05-18 07:44:50 +00:00
Xaver Hugl
67181d5db7 wayland/outputdevice: use OutputMode directly 2022-05-18 07:04:32 +00:00
Nate Graham
4fb78a415c kcmkwin/kwinscreenedges: only show KCM on Wayland
The features that this KCM lets you trigger barely work on X11 and
really only work properly on Wayland.

Unfortunately we don't have the ability to have separate settings
between X11 and Wayland, and for this reason we removed a default left
touch edge in 3df7985570 a year and a half
ago because it was too buggy on X11.

This commit takes the next step and hides the KCM entirely on X11, so
you can only use it on Wayland where it actually works properly.

One potential downside is be that any users who are actually using it
on X11 will lose the ability to use a GUI to configure these features
unless they go to the Wayland session to do it. However the number of
such users is likely small given how the feature does not really work on
X11.

However the upside is that Wayland users who can see the KCM can
actually use the features that it lets you configure because they work
properly there.
2022-05-17 21:27:11 +00:00
Xaver Hugl
441266c427 wayland/outputinterface: use the same enums as core KWin 2022-05-17 19:05:15 +00:00
Vlad Zahorodnii
4c05db3c30 Simplify Workspace::addWaylandWindow()
I believe this is a relic from the past when we used not to destroy
the ShellClient when the associated surface is unmapped.
2022-05-17 16:38:47 +00:00
Vlad Zahorodnii
09ba8729fc Partially revert 89b35c3238
As it turns out, it's needed to ensure that the Workspace emits the
stackingOrder changed signal when a new window is added. It's also
implicitly needed to make sure that Window::stackingOrder() is updated.
2022-05-17 14:52:24 +00:00
Aleix Pol
f4c704a904 screenedges kcm: Fix initial screen detection
Use QWidget::screen instead of having own code to fetch the screen. It
works better this way before the window is initialised.
2022-05-17 14:58:20 +02:00
l10n daemon script
ad74b8cd59 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"
2022-05-17 01:45:45 +00:00
Vlad Zahorodnii
a47f18d8a2 wayland: Fix supported action initialization in data offer interface
Currently we guess the supported and preferred dnd actions in data offer
for version >= 3. This can create problems because kwin may not send the
right action events when the supported dnd actions actually change.
2022-05-16 12:38:07 +00:00
Vlad Zahorodnii
00fb259c41 backends/drm: Fix cursor size check
Currently, the cursor size check ignores the cursor bitmap's size, so
the hardware cursor is used even though the bitmap size exceeds cursor
limits.
2022-05-16 12:09:27 +00:00
Vlad Zahorodnii
a601a08ba7 wayland: Make setting realtime scheduler more fine grained
With this only the main and the libinput threads will use realtime
scheduling, so it will be harder to leak realtime scheduling to somebody
else.

The only caveat is that kwin would need to keep CAP_SYS_NICE around,
however on the other hand, it's needed to ensure that kwin_wayland is
able to get high priority EGL contexts with some drivers, e.g. intel.
2022-05-16 11:15:20 +00:00
Kai Uwe Broulik
1878ba0e10 backends/drm: Guard gbm_bo_get_fd_for_plane in dmaBufAttributesForBo
It is guarded elsewhere but not here.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-05-16 10:48:58 +00:00
Kai Uwe Broulik
701bfc71be Link Qt X11Extras in kwin core library
QX11Info is used in `platform.cpp`, which is used by both
kwin_x11 and kwin_wayland. The latter only gets it implicitly
through KGlobalAccelPrivate.

Ideally, platform.cpp was split to not require QX11Info in
kwin_wayland in the first place.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-05-16 09:34:34 +00:00
Kai Uwe Broulik
edf9698e23 backends/drm: Drop QObject and moc include from layer
There's no QObject anymore which causes a MOC warning

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-05-16 10:49:50 +02:00
Vlad Zahorodnii
ed90be0783 wayland: Bump RLIMIT_NOFILE limit
As a wayland compositor kwin can hold many open file descriptors and
therefore it's easier for it to hit the soft file descriptor limit. This
change makes kwin_wayland bump the soft file descriptor limit to the
hard limit. With systemd, it's usually 500K.

In order to prevent causing mess in child processes, pthread_atfork() is
used to register a handler which will be invoked in the child process
after fork() in order to restore RLIMIT_NOFILE to its original value.
2022-05-16 07:00:47 +00:00
l10n daemon script
2178f26e7b 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"
2022-05-16 01:48:22 +00:00
Vlad Zahorodnii
6451cb2cfe backends/drm: Also release cursor layer buffers 2022-05-15 08:31:39 +00:00
l10n daemon script
d0d642ba68 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"
2022-05-15 01:56:42 +00:00
Nate Graham
9ff137f5cb effects/overview: enable it by default
Overview is quite polished now, enough that we have a default touchpad
gesture that opens it by default. It's time to move it out of public
beta and enable it by default, and this commit does that.

BUG: 446753
FIXED-IN: 5.25
2022-05-13 19:42:29 +00:00
Vlad Zahorodnii
d7ec51998b backends/drm: Import gbm bos using dmabuf
It appears that importing gbm_bo's using eglCreateImageKHR() doesn't
work on nvidia.

Another issue is that Platform::createDmaBufTexture() uses
gbm_bo_create(). The nvidia driver doesn't like that, it's preferred to
use gbm_bo_create_with_modifiers().

In order to address those issues, this change refactors how gbm_bo
objects are imported and how gbm_bo's are allocated for dmabuf textures,
so the same code can be reused in EglGbmBackend::textureForOutput()
and Platform::createDmaBufTexture().
2022-05-13 15:55:05 +00:00
Marco Martin
db2af5500f effects/overview: hide panels
This makes it consistent with WindowView (and the panel window doesn't respond
to input anyways even if shown, which is misleading).

BUG: 444274
FIXED-IN: 5.24.6
2022-05-13 15:37:13 +00:00
Xaver Hugl
5d37a59198 effects/overview: fix scale of windows when dragging them upwards 2022-05-13 14:19:34 +00:00
Arjen Hiemstra
79dfb1ff61 input: Move MoveResize input filter after global shortcut input filter
This allows using global shortcuts while a move/resize is ongoing. Most
importantly, this allows moving a window to a different desktop by
picking it up and then using a global shortcut to move to a different
desktop.

BUG: 444696
2022-05-13 10:37:29 +00:00
l10n daemon script
2575bf8cd8 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"
2022-05-13 01:45:45 +00:00
Vlad Zahorodnii
e26dca110e Drop Application::isClosingX11Connection()
It's unused.
2022-05-12 14:59:55 +00:00
Vlad Zahorodnii
89b35c3238 Remove redundant window propagation
If a wayland window is added, we don't need to propagate that to X11.
2022-05-12 14:59:55 +00:00
Vlad Zahorodnii
0489d4a2f6 Merge Workspace::stackingOrder() and Workspace::xStackingOrder()
The Workspace has two stacks - one with managed windows and deleted
windows, the other includes windows from the first stack + override
redirect windows.

This change merges both stacks. It has several benefits - we will be
able to move window elevation stuff to Workspace and streamline the
scene stuff, for example it will be possible to have a root item.
Another advantage is that unmanaged windows will have
Window::stackingOrder() property set, which can be useful in the future
in qml effects or (qtquick scene if we push harder in that front).
Another advantage is that kwin will make less X11 calls when restacking
managed windows.
2022-05-12 14:59:55 +00:00
Vlad Zahorodnii
fa0143fb97 backends/drm: Ensure that there's opengl context when painting cursor 2022-05-12 12:34:48 +00:00
Marco Martin
796e1cf5bf configurable way to force tabletmode on or off
The user may want to never have it, or may be needed to enable
or disable it for debugging purposes
2022-05-12 09:47:16 +00:00
Vlad Zahorodnii
654313d460 scene: Remove repaint on current activity/desktop change
WindowItem has proper visibility set now, so these two interim hacks can
be removed now.

Workspace::stackingOrderChanged still needs to be kept around as the
Scene has no root item which could track the order of its child (window)
items.
2022-05-12 07:59:42 +00:00
l10n daemon script
12ca0a6128 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"
2022-05-12 01:42:21 +00:00
Xaver Hugl
ed06d752f0 backends/drm: blacklist hardware cursors with the NVidia driver
It doesn't work and seems to cause hangs. If desired, this can be overwritten
by explicitly setting KWIN_FORCE_SW_CURSOR to 0.

BUG: 453632
2022-05-11 21:53:00 +00:00
Xaver Hugl
78794b4239 backends/drm: disable cursor layer when setCursor fails
Otherwise the next commit will still try to enable the cursor layer, and
possibly fail because of it
2022-05-11 21:53:00 +00:00
Xaver Hugl
0b27ce4d34 Make touchscreen gestures realtime 2022-05-11 15:08:43 +00:00
Aleix Pol
946087ef37 Inhibit edges when the active window is full screen by default
At the moment we trigger the edges even when the active window is full
screen which is unfortunate when running certain games, for example when
you're attacking the village at the north-east in Age of Empires and you
have the Overview effect on.

This changes the default to inhibit them (like we used to just do for
sides but not corners for some reason) and adds a checkbox to restore
them even in that case.

BUG: 441464
2022-05-11 16:54:38 +02:00
David Redondo
ed45af55bd Install tabbox kcm only once 2022-05-11 14:22:10 +00:00
Vlad Zahorodnii
ea1fadfe8d Remove Window::addRepaint() and Window::addLayerRepaint()
Conceptually, scheduling repainting in Window doesn't belong there. This
change rewires EffectWindow internals so it schedules repaints using the
associated WindowItem.

Window::addWorkspaceRepaint() has not been removed yet because
Window::elevate() uses it.
2022-05-11 15:13:45 +03:00
Vlad Zahorodnii
8cc5e04238 scenes/opengl: Rename RenderContext::transforms to RenderContext::transformStack
It's a better name and it's consistent with opacityStack.
2022-05-11 09:42:35 +00:00
Vlad Zahorodnii
63a866d98c Make WindowItem handle opacity
This change makes the WindowItem track the opacity and schedule a
repaint. It further decouples the legacy scene from code window
abstractions.

It's an API breaking change. WindowPaintData no longer can make windows
more opaque. It only provides additional opacity factor.
2022-05-11 09:42:35 +00:00
Alexander Lohnau
99f01ee9c5 Fix malformed X-KDE-OnlyShowOnQtPlatforms value in keyboard KCM metadata 2022-05-11 11:30:36 +02:00
Alexander Lohnau
cdab439bd0 Add missing installation of virtualkeyboard KCM 2022-05-11 11:29:59 +02:00
l10n daemon script
472bdf117c 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"
2022-05-11 01:45:27 +00:00
Xaver Hugl
d83121dbe4 backends/drm: also use modifiers by default for virtual outputs 2022-05-10 19:42:36 +02:00
Xaver Hugl
f02a6fd128 backends/drm: add fallback for missing gbm modifier support
It can happen that a gbm implementation does not support modifiers, while
the drm driver does. To prevent that from breaking KWin, fall back to creating
a gbm surface without modifiers when creating one with modifiers fails.

BUG: 453320
2022-05-10 19:42:32 +02:00
Alex Richardson
a264938ff3 Simplify cross-compilation of qtwaylandscanner_kde
I am trying to cross-compile and since qtwaylandscanner_kde is used
during the build, I need to build a native version of the
qtwaylandscanner_kde tool first. This change allows building
qtwaylandscanner_kde as a standalone CMake project which the cross-build
can then be pointed at to find the host tool. If an explicit path to
qwaylandscanner_kde is not passed, we will try to use ExternalProject_Add
to build it. This approach was taken from ksyntaxhighlighting:
https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/src/indexer/CMakeLists.txt

This patch makes it significantly easier to cross-compile KWin, as we now
only need a native QtCore library instead of all the dependencies.
2022-05-10 16:34:49 +00:00
Vlad Zahorodnii
a7d61f7bfa Fully replace SceneWindow with WindowItem
This completes the initial transition to scene items.
2022-05-10 15:45:48 +00:00
Xaver Hugl
15a9744979 effects/windowview: correct gesture direction
BUG: 453427
2022-05-10 14:30:00 +00:00
Aleix Pol
bbe886a083 ScreenEdge: fix double look-up 2022-05-10 13:14:26 +00:00
Aleix Pol
9c41ec461e kcm/edges: Draw the ratio of the monitor we are on
At the moment it's showing whatever is QGuiApplication::primaryScreen(),
which on Wayland is random.
2022-05-10 13:14:26 +00:00
Aleix Pol
b7f3db5aca edges: Also check edge blocking on fullscreen windows on Wayland
At the moment we were reconsidering the fullscreen block only on X11.
Instead, use the abstracted information.
2022-05-10 13:14:26 +00:00
Vlad Zahorodnii
94d91e6404 Remove redundant Window::isClient() call
Unmanaged windows are on all desktops, activities, not hidden and not
minimized.
2022-05-10 12:23:01 +00:00
Ahmad Samir
74482b2e2d Fix typo
Spotted by Luca Beltrame

GIT_SILENT
2022-05-10 14:16:47 +02:00
Xaver Hugl
94b0ca8146 tabbox: don't dismiss popups
The glitches that dismissing popups was supposed to prevent are apparently
no longer present.

BUG: 446318
2022-05-10 13:07:03 +02:00
Vlad Zahorodnii
313baa4b51 Remove QAction include in AnimationEffect
It builds fine without QAction include.

BUG: 453609
2022-05-10 10:14:11 +00:00
Xaver Hugl
7eefc48536 effects/overview,windowview: restore ability to close windows 2022-05-10 09:49:36 +00:00
Vlad Zahorodnii
2983727871 effects: Make DeformEffect disable clipping if specified region is infinite
The Scene no longer clips window quads if the specified paint region is
infinite. The infinite region is defined as (INT_MIN/2, INT_MIN/2,
INT_MAX, INT_MAX). If you try to scale the infinite region, you will
easily hit integer overflow.

This change makes the DeformEffect disable geometry clipping if the given
paint region is infinite region in order to avoid hitting integer
overflow.
2022-05-10 07:56:43 +00:00
Xaver Hugl
f07d6bd400 backends/drm: port the cursor to use output layers
CCBUG: 447797
2022-05-10 07:06:53 +00:00
Xaver Hugl
12515b4656 backends/drm: fix qpainter 2022-05-10 06:09:34 +00:00
Méven Car
1dd12a064a Fix a couple unused warnings
GIT_SILENT
NO_CHANGELOG
2022-05-10 07:33:30 +02:00
l10n daemon script
e1cec89ddb 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"
2022-05-10 01:45:54 +00:00
Kai Uwe Broulik
9cb5b38970 effects: Port EffectFrame to OffscreenQuickView
This allows to toss a large amount of custom rendering code.

Furthermore, it removes the build-time dependency on Plasma Framework
for FrameSvg and Theme from KWin core as it's pulled in through QML
imports now.

It also cleans up the API and removes functions that are effectively
unused or no-op after this change.

For instance, effects often destroy their effect frames
in pre/postPaintScreen, which would now destroy an `OffscreenQuickView`,
which changes GL context. This is alleviated by delaying detruction
of the internal view.

Support for the features of text cross-fade and selection frame,
which are not used by any of the built-in effects, is dropped.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-05-09 17:53:58 +00:00
David Redondo
f6bb95f18e Bump plasmashell version to 7 2022-05-09 15:59:19 +00:00
Xaver Hugl
e4695325a6 backends/drm: store gbm buffer for screen recording 2022-05-09 14:06:55 +00:00
Vlad Zahorodnii
0860efecc3 Move SceneWindow::decorationShape() to DecorationItem 2022-05-09 09:41:39 +00:00
Vlad Zahorodnii
bc1f808f0f Move paint method from SceneWindow to Scene
That's the next step in allowing to reuse surface painting code between
the workspace and the cursor layer.
2022-05-09 08:31:13 +00:00
Vlad Zahorodnii
683a222233 Drop lanczos filter
The lanczos filter depends on the effect system. It makes very difficult
changing painting code from SceneWindow to Item.

Given that the last big users of the laczos filter - present windows and
desktop grid effects were re-written in QML. The only remaining user of
the lanczos filter is the thumbnail aside effect. Given that it's a
really obscure usecase, switching to the linear filter won't be very
noticeable.

As a backup plan, one can reimplement the thumbnailaside effect using
QML. The lanczos filter is already implemented in plasma-framework.
2022-05-09 08:31:13 +00:00
Xaver Hugl
a110aabbcc backends/drm: consider escaped separators KWIN_DRM_DEVICES
':' conflicts with the file names in /dev/dri/by-path, so allow it to be
escaped with '\'

CCBUG: 453386
2022-05-09 08:16:47 +00:00
l10n daemon script
5ddcd0827b 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"
2022-05-09 01:43:54 +00:00
Aleix Pol
f3ec05c85a wayland: Fix activation when activating surfaces disappear
We track when the user last interacted with a window so that we can
decide on the relevance of newly activated windows.

Fixes network/neochat#524
2022-05-09 00:59:27 +02:00
Erik Kurzinger
e6d2bc153f platforms/drm: set read buffer in GbmSurface::makeContextCurrent
The first time the GBM backend's EGL context is made current after
creation, both the read and draw surfaces are set to EGL_NO_SURFACE.
This will set the GL read and draw buffers to GL_NONE in accordance with
the EGL spec.

When a real surface is later made current, however, the spec is arguably
unclear on whether the read and draw buffers should remain set to
GL_NONE or whether they should be restored to the default GL_BACK.  The
Mesa driver does the latter, the NVIDIA driver does the former.

To work around this difference, Kwin has an explicit call to
glDrawBuffer in GbmSurface::makeContextCurrent. It does not have a
corresponding call to glReadBuffer, though, which can cause some desktop
effects such as background contrast to render incorrectly with the
NVIDIA driver. This change adds that missing call.
2022-05-08 12:58:10 -07:00
Alex Richardson
35c36be140 Fix incorrect usage of __has_include
I introduced this typo in 0a0a1fd330
2022-05-08 12:11:02 +00:00
Alexander Lohnau
61eba32cdd Rename kcm metadata json files to metadata.json 2022-05-08 09:03:03 +00:00
Alexander Lohnau
c1d0aa18cf Port KCMs to new install location
Task: https://phabricator.kde.org/T14517
2022-05-08 09:03:03 +00:00
Vlad Zahorodnii
51e9340abb Remove a Workspace::findAbstractClient() overload
Workspace::findAbstractClient(QUuid) overload is used only by the
windows krunner plugin.

This change fixes a potential null dereferencing and removes the
findAbstractClient() overload in favor of a more generic findToplevel()
overload.
2022-05-07 18:51:05 +00:00
Xaver Hugl
9ef882f3fb backends/drm: use addfb2modifier again when supported
Otherwise the kernel might fail our request because the modifier doesn't
match the buffer
2022-05-07 13:28:47 +00:00
Xaver Hugl
788ae5891a backends/drm: zero metadata for unused planes
The kernel may fail requests if data for unused planes is non-zero.
2022-05-07 10:09:30 +00:00
l10n daemon script
14cf7524b6 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"
2022-05-07 01:44:29 +00:00
Volker Krause
f32df68f3d Use the properly named screencast Wayland protocol file
This is needed to build with Qt6.
2022-05-06 19:12:06 +00:00
Xaver Hugl
04509aaeb7 backends/drm: when creating a fd fails, reset all fds to -1 2022-05-06 18:31:03 +00:00
Vlad Zahorodnii
bc57e89b75 backends/drm: Fix file descriptor check 2022-05-06 17:24:47 +00:00
Vlad Zahorodnii
ad45deaf80 backends/drm: Add missing file descriptor initializer
We need to initialize file descriptors to -1 explicitly.

BUG: 453470
2022-05-06 17:24:47 +00:00
Marco Martin
9a5d34cf6c default value as false
this should also fix compilation on Qt6
2022-05-06 16:52:01 +00:00
Marco Martin
eca9b5047a effects/windowview+overview: get back option to hide minimized windows
Option to hide minimized windows as old present windows effect had.

BUG: 441627
BUG: 453426
FIXED-IN: 5.25
2022-05-06 15:48:41 +00:00
Xaver Hugl
d5dad1b471 backends/drm: properly release all buffers on render backend destruction
Releasing the buffers is necessary for example in the case of a GPU reset,
to make sure that the gbm surface is still properly destroyed and all buffers
with invalid content freed.
2022-05-06 12:39:15 +00:00
Xaver Hugl
c65c822392 backends/drm: refactor buffer management
Instead of buffers being both drm framebuffers and gbm / dumb buffers, these
responsibilities are now split, which makes it possible to do zero copy
screen casting in the future.

Both framebuffers and gbm / dumb buffers also now always hold a valid underlying
resource, which simplifies code a bit.
2022-05-06 12:39:15 +00:00
David Edmundson
ab06dd2e31 Add destructor for primary output global 2022-05-06 11:37:54 +00:00
Marco Martin
ae1937badc Remove completely present windows
since it has been replaced by windowview, and Desktop Grid
is ported as well, remove present windows which is effectively dead code
now

BUG:447001
BUG:362844
BUG:450487
BUG:453426
BUG:374481
BUG:185381
BUG:413342
BUG:451150
BUG:283333
BUG:315314
BUG:397500
BUG:321236
BUG:436572
BUG:335782
2022-05-06 11:37:17 +00:00
Marco Martin
7a4cabf328 QML version of the Desktop Grid effect
Replace completely the old desktop grid effect with a QML version.
Aims to feature parity and be a change as transparent as possible for the user.

BUG: 433071
BUG: 452625
BUG: 443971
BUG: 437121
BUG: 452925
BUG: 437928
BUG: 452439
BUG: 288530
BUG: 450254
BUG: 450106
BUG: 447832
BUG: 449960
BUG: 416576
BUG: 441862
BUG: 444859
BUG: 445999
BUG: 422117
BUG: 404627
BUG: 435483
BUG: 420744
BUG: 435482
BUG: 427055
BUG: 333445
BUG: 429120
BUG: 427391
BUG: 409295
BUG: 294322
BUG: 356955
FIXED-IN: 5.25
2022-05-06 10:44:38 +00:00
David Redondo
d548f4bce4 Implement plasma-surface open-under-cursor
The surface is positioned at the current cursor location but kept in
bounds to keep it fully visible when the cursor is near the screen border.
2022-05-06 07:19:25 +00:00
l10n daemon script
0130b53126 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"
2022-05-06 01:45:37 +00:00
Marco Martin
376ee357db Make windowview replace present windows
* give windowview the ability to show windows from current desktop, all
desktops or current class
* invokable from shortcuts screen edges or gestures
* add a search field to quickly filter
* current present windows effect still present but only internal as is used by desktop grid, which should eventually be ported as well

This can be done either from windowview or overview, tough note that some of the duplication from overview added in windowview is necessary regardless, as WindowHeap, the shared qml part needs some properties exposed from the c++ part.
Implementation wise I'm ok for it being in either place, but i think the functionality of present windows needs to be preserved, otherwise would be a completely unacceptable regression, namely:

* Behavior of what now are the ctrl+f7,f10 and f11 global shortcuts, showing windows of current app (invokable by shoortcut instead of having to use the pointer), windows of current desktop (the only thing overview does atm) or all desktops
* filter on typing, as opposed to invoking krunner. main use case of present windows is quickly switching, and filtering is the most helpful feature, some people do like krunner instead, but is completely out of place for my use case, and i suspect for many other users as well
* also clicking on a taskbar group should be possible to filter
* the view that opens by clicking on a taskbar group should follow the same layout strategy used elsewhere and currently being an effect used only there and not accessible form the list can't even be configured
2022-05-05 14:37:52 +00:00
Vlad Zahorodnii
2c514ac593 Drop ScreenLockerFilter
Since WindowItem::visible is kept in sync with the effective visible
status of the window, window items that are not lockscreen greeter or
input methods can be hidden when the lock state changes.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
def99b1a7c Update WindowItem's visibility
With this, the WindowItem will know whether it's actually visible. As
the result, if a native wayland window has been minimized, kwin won't
try to schedule a new frame if just a frame callback has been committed.

EffectWindow::enablePainting() and EffectWindow::disablePainting() act
as a stone in the shoe. They have the final say whether the given window
is visible and they are invoked too late in the rendering process.
WindowItem needs to know whether the window is visible in advance,
before compositing starts.

This change replaces EffectWindow::enablePainting() and
EffectWindow::disablePainting() with EffectWindow::refVisible() and
EffectWindow::unrefVisible(). If an effect calls the refVisible()
function, the window will be kept visible regardless of its state. It
should be called when a window is minimized or closed, etc. If an effect
doesn't want to paint a window, it should not call effects->paintWindow().

EffectWindow::refVisible() doesn't replace EffectWindow::refWindow() but
supplements it. refVisible() only ensures that a window will be kept
visible while refWindow() ensures that the window won't be destroyed
until the effect is done with it.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
ea0061cd03 Use explicit item visibility when rendering
Item::isVisible() is true if either the item has been marked hidden or
one of its ancestors.

In some cases, kwin may render invisible windows, for example for window
thumbnails.

This change makes rendering code use explicit visibility status when
rendering to ensure that it's still possible to render invisible windows.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
54bbfde2f3 Make SurfaceItemX11 schedule a repaint if the shape changes 2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
94d30c2268 Fix repaint scheduling in Item::setVisible()
If an item disappears, we need a workspace repaint.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
30076f297c effects: Introduce a helper for referencing deleted windows
If an effect is reloaded while it holds deleted references, it's
possible that the closed windows will get stuck in the "zombie" state.

This change introduces EffectWindowDeletedRef helper that can be
used to keep the closed window alive as long as the reference is valid.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
00ae7d3893 effects/slide: Use mass-spring-damper model for animation
If you lift fingers but not swipe them enough to switch to another
virtual desktop, the slide effect will play an animation to move from
the current position in the virtual desktop grid to the current desktop.

However, that animation doesn't feel right, there's something missing.
The slide effect uses a TimeLine to animate switching between virtual
desktops, it's great if the amount of sliding is constant.

This change makes the slide effect use the mass-spring-damper model to
simulate the motion of a spring in order to animate switching between
virtual desktops.

The mass-spring-damper equation is integrated using RK4. If the delta
interval is not multiple of the integration step precisely, the
SpringMotion will perform integration as many times as the integration
step fits into the delta. The leftover will be used for LERP between the
previous and the next integration results.

With the spring animation, the slide animation feels more natural when
you lift fingers. If you switch between virtual desktops without using a
gesture, the slide animation should look almost the same as if it were
implemented with the TimeLine.
2022-05-05 11:30:51 +00:00
Aleix Pol
d1522eb47f Move allowWindowActivation into X11Window
It helps to contextualise the method as it's using several x11-isms,
some of them possible ot abstract.
In any case, the method is only called with X11Window and it's the only
case where it makes sense doing so.
2022-05-05 10:40:27 +00:00
l10n daemon script
fa36628a8b 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"
2022-05-05 01:46:17 +00:00
Martin Flöser
7bececfa2f [scripting] Support shaders in scripted effects
The scripting API is extended to support custom fragment shaders. To
support this a new method addFragmentShader is added taking ShaderTraits
and fragment shader. The GLShader is not exposed, instead a uint id is
provided which maps to the GLShader.

This shader id can be used in the animate and set calls to specify the
shader. The animation object is extended by the "fragmentShader" property.

The shader sources are located in the "shaders" directory of the package
contents.

E.g. the scale effect extended by the shader of the invert effect will
have the following layout:

   package/contents/
   -> code/
     -> main.js
   -> shaders/
     -> invert_core.frag
     -> invert.frag

The adjustment in code are:
 * in constructor to load the shader
    this.shader = effect.addFragmentShader(Effect.MapTexture, "invert.frag");
 * in animations objects of the slots the additions
   fragmentShader: this.shader
 * using the type Effect.Shader

or in full:

        window.scaleInAnimation = animate({
            window: window,
            curve: QEasingCurve.OutCubic,
            duration: this.duration,
            animations: [
                {
                    type: Effect.Scale,
                    from: this.inScale
                },
                {
                    type: Effect.Opacity,
                    from: 0
                },
                {
                    type: Effect.Shader,
                    fragmentShader: this.shader
                }
            ]
        });

The animation settings object supports a "uniform" value which takes the
string name of the uniform. For this uniform the location is resolved
and stored in the meta data of the AnimationEffect. This requires the
type Effect.ShaderUniform.

An example animation:

        window.scaleInAnimation = animate({
            window: window,
            curve: QEasingCurve.Linear,
            duration: this.duration,
            animations: [
                {
                    type: Effect.ShaderUniform,
                    fragmentShader: this.shader,
                    uniform: "uForOpening",
                    from: 1.0,
                    to: 1.0
                }
            ]
        });

Furthermore a new setUniform scriptable method is added to the
ScriptedEffect. This allows to update uniforms when the configuration
changes.

The call takes a generic QJSValue which supports:
 * float
 * array of 2, 3 or 4 components
 * string as color
 * variant as color

An example usage to read a color from the configuration and set it as a
uniform:

    effect.setUniform(this.shaderId,
                      "uEffectColor",
                      effect.readConfig("Color", "white"))
2022-05-04 15:19:47 +00:00
Martin Flöser
47b330ea23 [libkwineffects] Add support for shaders in AnimationEffect
The animate and set calls are extended for an optional GLShader* to
allow specifying a custom shader to use during the animation.

To properly support rendering a complete window in the effect the
AnimationEffect gets based on the DeformEffect. If a shader is used
during the animation the window gets redirected.

For the animation with shaders two new enum values are added to the
AnimationType enum:
 * Shader
 * ShaderUniform

The Shader animation type is for specifying that the animation uses a
shader. During the animation a uniform "animationProgress" is set on the
shader.

The ShaderUniform animation type behaves exactly like the Shader type,
but also animates a user provided uniform. The meta data of the
animation is interpreted as a uniform location for a float uniform and
during the animation this uniform is updated with the interpolated
animation data.
2022-05-04 15:19:47 +00:00
Martin Flöser
7dddf3055b [libkwineffects] Support custom shaders in DeformEffect
For a redirected window a custom shader can be specified to draw the
redirected texture to screen. This is useful for inheriting effects to
customize the rendering.

Two new int uniforms TextureWidth and TextureHeight are added and set
from DeformEffect when rendering the texture.
2022-05-04 15:19:47 +00:00
Vlad Zahorodnii
f1f512791e Fix updating fullscreen geometry restore
Currently, fullscreen geometry restore is computed from maximized
geometry restore. However, the latter is set only when the window is
maximized.

Also, updateGeometryRestoresForFullscreen() can be called when the
window has not been moved. Avoid updating geometry restore if the output
has not been changed.
2022-05-04 12:37:50 +00:00
Vlad Zahorodnii
f51db012f2 effects/desktopgrid: Make sure that the screen is rendered correctly when animation reaches the end
If the animation reaches the end, desktop grid may render the screen
incorrectly. Make sure that PAINT_SCREEN_BACKGROUND_FIRST and flags as
such are set even if animation has reached the end.

Also, while on this, simplify the paintWindow() method by removing
redundant effect status checks.
2022-05-04 08:45:15 +00:00
Vlad Zahorodnii
2da599c670 effects/desktopgrid: Make termination code less error prone
The desktop grid effect can be deactivated in postPaintScreen() without
delaying finish().
2022-05-04 08:45:15 +00:00
l10n daemon script
e9d1def1ba 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"
2022-05-04 01:45:48 +00:00
Marco Martin
02171495be dynamically load effects that support edge activation
effects can specify in their json file "X-KWin-Border-Activate":true
and will be listed in the edge menus.

Don't hardcode desktop grid and overview in the kcms
2022-05-03 16:54:36 +00:00
Vlad Zahorodnii
0c69ce50ac effects/slide: Fix panels losing blurred background when gesture is active
At the moment, if user switches between virtual desktops using a
gesture, panels will loose blurred background because WindowForceBlurRole
is not set.

This change refactors setup code so the slide effect always forces blur
and background contrast when sliding between virtual desktops using a
gesture or animation.
2022-05-03 17:04:29 +03:00
Vlad Zahorodnii
4513b4830f effects/slide: Use an enum to describe current state 2022-05-03 17:04:25 +03:00
Marco Martin
4cb3ab09ed Realtime screen edges gestures for scripted effects
Possibility to implement realtime screenedges gestures in scripted effects,
implement it in the windowsaperture show desktop effect.
* Expose registerRealtimeScreenEdge to JavaScript, the callback will be
a JS function.
* Add the concept of freezeInTime() in the animation js bindings,
it will either create an animation frozen at a given time or freeze a running animation
that can be restored and ran to completition at any time
* add an edges property only for showdesktop as it's not directly on the effect configuration
2022-05-03 13:43:38 +00:00
Xaver Hugl
46bbe4ff0c backends/drm: don't rely on test commits producing a buffer
When DrmPipeline::commitPipelines returns false without creating a test
buffer, we'd crash.

CCBUG: 453320
2022-05-03 08:14:53 +00:00
l10n daemon script
be5cd1b38e 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"
2022-05-03 01:49:38 +00:00
Xaver Hugl
8d3de947af backends/drm: re-create gamma ramps if necessary when switching crtcs
The gamma ramp size of different crtcs is not guaranteed to be the same,
so the gamma blob may need to be re-created
2022-05-02 17:40:25 +02:00
Xaver Hugl
b5aebc83ee backends/drm: fix gamma ramps with legacy
With legacy, gamma ramps wouldn't be calculated from the color transformation,
which made them not be applied.

BUG: 453070
2022-05-02 17:39:19 +02:00
l10n daemon script
74aff4b088 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"
2022-05-02 01:40:40 +00:00
l10n daemon script
6d8a303138 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"
2022-05-01 01:53:58 +00:00
Méven Car
e97e6e4068 XWayland::Primary: Fix unused warnings 2022-04-30 19:49:29 +02:00
Vlad Zahorodnii
50b3d1d063 Make EffectsHandler use cached active effects list in blocksDirectScanout()
When the scene checks whether any active effect blocks direct scanout,
m_activeEffects is already populated.
2022-04-30 17:03:27 +03:00
Vlad Zahorodnii
2b9adf279e Cancel interactive desktop switching if desktop has not changed
If desktop wrapping is disabled and user swipes to left but there's no
desktop to left, the slide effect can get stuck active because there's
no desktopChanged() nor desktopChangingCancelled() signal emitted.

This change makes the VirtualDesktopManager explicitly cancel
interactive desktop switching session if the current desktop has not
changed.
2022-04-30 12:41:45 +00:00
Xaver Hugl
3c9d209344 backends/drm: fix mode updates with generated modes
DrmOutput::updateModes was called unnecessarily every time, because the
mode list the driver modes was compared against contained generated modes
2022-04-30 11:10:06 +00:00
Xaver Hugl
d50c9b8cb6 backends/drm: initialize layers earlier
With how layers are initialized before this commit, the atomic commit in
DrmOutput::updateModes can cause segfaults.
2022-04-30 10:46:14 +00:00
Aleix Pol
87e72506b8 Add support for KGlobalAccelInterfaceV2::keyReleased
To be able to implement the XdgDesktopPortal for GlobalShortcuts, we
need to let kglobalaccel know when a shortcut is not deactivated
anymore.
2022-04-30 07:24:50 +00:00
Aleix Pol
9a31b0d727 x11: trigger shortcuts when releasing rather than pressing
This way we can issue a keyboard grab without problems
2022-04-30 07:24:50 +00:00
Aleix Pol
1f443301ed x11: Add debug info when grabs fail 2022-04-30 07:24:50 +00:00
l10n daemon script
90d38017da 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"
2022-04-30 01:41:28 +00:00
Vlad Zahorodnii
55f0ccc0fe plugins/screencast: Avoid Window::addRepaintFull()
It will be dropped.
2022-04-29 18:29:16 +00:00
Xaver Hugl
aa432e5947 outputconfigurationinterface: don't crash if mode is invalid
When the client makes the request, the compositor may have already
destroyed the mode object.

BUG: 453042
FIXED-IN: 5.24.5
2022-04-29 17:38:08 +00:00
Vlad Zahorodnii
3cec7e63e9 Drop Window::setClientShown()
It's unused.
2022-04-29 19:09:51 +03:00
Vlad Zahorodnii
2fdb55b199 Rename InternalWindow::internalWindow() to InternalWindow::handle()
internalWindow->handle() reads better than internalWindow->internalWindow()
2022-04-29 17:47:41 +03:00
Vlad Zahorodnii
5ee044e6fc Some client/toplevel -> window 2022-04-29 17:47:39 +03:00
Vlad Zahorodnii
106fb66cd0 Make Scene::createStackingOrder() more efficient
Currently, there's a separate pass to filter out windows not ready for
compositing or windows that must be invisible. That has two issues: we
could merge that pass with the pass that populates stacking_order and
"windows" can detach.
2022-04-29 13:46:49 +00:00
Vlad Zahorodnii
066ac3200a backends/libinput: Rework Device getter
libinput_device_get_user_data() can be used to get the associated Device
object with libinput_device. That way, we won't need to maintain a
private list of all input devices.
2022-04-29 12:47:34 +00:00
Vlad Zahorodnii
eb058a4a2a Merge ThumbnailItemBase and WindowThumbnailItem 2022-04-29 14:13:36 +03:00
Vlad Zahorodnii
953cf452a3 Implement DesktopThumbnailItem as a collection of window thumbnails
The main motivation behind this change is to refactor scene code in
order to allow us set WindowItem visibility upfront before compositing
starts.
2022-04-29 14:13:32 +03:00
Méven Car
96e82a3631 plasmawindowmanagement: Fix some warnings 2022-04-29 06:21:05 +00:00
l10n daemon script
143d803f7b 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"
2022-04-29 01:43:22 +00:00
Vlad Zahorodnii
16af4bf437 Remove redundant window filter calls
If the window filter rejects a window, that window won't be in the
stacking_order and henceforth won't be painted, so finalDrawWindow()
does extra work of checking again if the window is accepted.
2022-04-28 13:56:13 +00:00
Xaver Hugl
05877a8321 backends/drm: reduce "max bpc" to what is actually used
This prevents triggering a bug in the BenQ GW2765 monitor, and should
in theory have no downsides.

BUG: 449906
FIXED-IN: 5.24.5
2022-04-28 02:32:11 +02:00
Vlad Zahorodnii
d24f908720 Move EffectWindow and SceneWindow to Deleted
It simplifies finishCompositing() function.
2022-04-27 16:43:24 +00:00
Xaver Hugl
b522bbc8fc backends/drm: fix build with HAVE_GBM_BO_GET_FD_FOR_PLANE=0 2022-04-27 15:33:04 +00:00
Vlad Zahorodnii
000f3d839f Ensure that Workspace::deletedRemoved() is emitted while there's scene window
Effects may perform cleanup when a deleted window is removed. If that
happens and the SceneWindow is accessed, kwin may crash.

The Scene processes Workspace::deletedRemoved() before effects.

In order to fix dereferencing null pointer, this change makes the Window
destroy its associated SceneWindow.
2022-04-27 18:14:16 +03:00
Vlad Zahorodnii
892059cd23 Rename Window::effect_window to Window::m_effectWindow 2022-04-27 18:14:16 +03:00
Vlad Zahorodnii
fd453537c5 Drop Platform::screenSize()
It's effectively unused.
2022-04-27 06:49:26 +00:00
l10n daemon script
c8a151d4f1 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"
2022-04-27 01:44:50 +00:00
Xaver Hugl
5730dc624b colors/colortransformation: add license header 2022-04-26 20:39:36 +02:00
Xaver Hugl
1365a76f3b manage ColorPipelineStages with unique_ptr 2022-04-26 16:20:47 +00:00
Xaver Hugl
14e7afcb4e color management: refactor and move to its own directory
The pipeline stages are also now properly managed, which should prevent
use-after-free errors.

BUG: 453026
2022-04-26 16:20:47 +00:00
Xaver Hugl
68a54a67b8 backends/drm: enable format modifiers by default
Format modifiers enable the graphics hardware to be much more efficient,
especially when it comes to multi-gpu transfers. With the issues regarding
bandwidth limits now solved, enable them by default to make all supported
systems benefit from them.

CCBUG: 452397
CCBUG: 452219
2022-04-26 17:03:19 +02:00
Xaver Hugl
916f1f4ea8 backends/drm: prune format modifiers when tests fail
When explicit modifiers are used, it can happen that Mesa chooses modifiers that make
the display hardware hit bandwidth limits. In that case, atomic tests fail and the
outputs don't work, or KWin may even crash.
In order to work around that, DrmGpu now removes the used modifier whenever an atomic
test fails, and tries to find a working combination of outputs and modifiers.
2022-04-26 17:03:02 +02:00
Vlad Zahorodnii
cd0430303b Fix potential null dereference in LockScreenFilter
input()->findToplevel() may return null.
2022-04-26 12:49:30 +00:00
Vlad Zahorodnii
f9b7d5298b Fix testModifierOnlyShortcut
If a window is destroyed before the frame is presented, the window
pointer will be dangling.

In order to make kwin handle that case correctly, the window is captured
using a QPointer.
2022-04-26 15:16:42 +03:00
Xaver Hugl
e7959b9693 backends/drm: don't expose DrmPipeline state as a public member
While having all state be public is great for avoiding the boilerplate that
comes with setters and getters, it also exposes more state than necessary
to the rest of the backend and makes it more error-prone if more than one
part of the state needs to be changed at the same time.
2022-04-26 07:43:37 +00:00
Vlad Zahorodnii
f7452fb4c5 Allow WindowThumbnailItem work also with override redirect windows
WindowThumbnailItem doesn't depend on features that are available only
with managed window.

By making WindowThumbnailItem work with all kinds of windows, its code
is easier to work with and refactor.
2022-04-26 06:48:09 +00:00
Vlad Zahorodnii
c773649377 Simplify EffectHandler::findWindow(uuid) implementation
With Workspace::findToplevel() code paths in findWindow() can be
unified.
2022-04-26 06:34:02 +00:00
l10n daemon script
beecf8c9d4 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"
2022-04-26 01:42:26 +00:00
Xaver Hugl
945eef58fe OutputMode: use uint32_t for the refresh rate 2022-04-25 21:54:17 +02:00
Vlad Zahorodnii
175037d9d1 Prefer the term "window" over "client" in Workspace 2022-04-25 11:33:55 +00:00
Nils Fenner
4bb276aa93 Minor clean up in KWin::Window
References #81
2022-04-25 08:26:59 +00:00
l10n daemon script
3030a85694 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"
2022-04-25 01:51:27 +00:00
Alexander Lohnau
3324400672 Port KWin scripts KCM to new install location
Task: https://phabricator.kde.org/T14517
2022-04-24 09:58:34 +00:00
Alexander Lohnau
719e97194d Port KWin Scripts KCM to QML
Task: https://phabricator.kde.org/T7289
2022-04-24 09:58:34 +00:00
l10n daemon script
be9781d0c5 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"
2022-04-24 01:40:58 +00:00
Xaver Hugl
9ed87a4e23 backends/drm: support common display modes
BUG: 448398
2022-04-23 23:29:57 +02:00
Xaver Hugl
a343af674b backends/drm: fix damage tracking for virtual outputs 2022-04-23 10:51:09 +00:00
Vlad Zahorodnii
3de377e461 Rename XwaylandClient to XwaylandWindow 2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
4b91c6163f Rename XdgShellClient to XdgShellWindow
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
a21aa839b1 Rename X11Client to X11Window
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
f0f829bc5b Rename WaylandClient to WaylandWindow
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
3cdee2f24a Rename LayerShellV1Client to LayerShellV1Window
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
fb4607f5a6 Rename InternalClient to InternalWindow
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
48b951201a Rename InputPanelV1Client to InputPanelV1Window
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
l10n daemon script
b935bca22f 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"
2022-04-23 01:44:53 +00:00
Vlad Zahorodnii
0ef12b69a1 plugins/screencast: Avoid damaging full screen on rotated outputs
Not sure what that check is for, but things should work as expected even
without it.
2022-04-22 20:03:20 +00:00
Volker Krause
5368537981 Fix Qt6 build regressions 2022-04-22 18:10:26 +00:00
Nils Fenner
b491aeb9ae Rename AbstractClient to Window 2022-04-22 17:39:12 +00:00
Fushan Wen
2e7364ddde WindowHeap: Hide window icon and label when excluded
This makes the opening animation of Window View from task manager less rigid.
2022-04-22 16:20:43 +00:00
Xaver Hugl
99761901ee backends/drm: don't check the test buffer if we don't need one
BUG: 452572
2022-04-22 15:17:01 +00:00
Xaver Hugl
941bae2810 backends/drm: fail atomic tests gracefully when buffer allocations fail
This should fix the crash. However, it's still unclear to me why allocations
fail in the first place

CCBUG: 452572
2022-04-22 15:17:01 +00:00
Vlad Zahorodnii
2b7fa206e8 Refactor Output information initialization
Instead of passing all possible field values to the initialize()
function, pass all relevant data in a struct. With designated
initializers, it's more readable and makes code more comprehensible.

The general goal is to split Output's data in two categories - general
information about the output (e.g. edid) and mutable state (position,
mode, etc).
2022-04-22 14:36:41 +00:00
Fushan Wen
c4a0f20f4a
effects/windowview: Fix "Unable to assign [undefined] to int"
animationDuration is not defined in WindowViewEffect. Use
heap.animationDuration instead.
2022-04-22 21:13:43 +08:00
Vlad Zahorodnii
31c069ebf3 wayland: Let ecm_add_qtwayland_server_protocol_kde() work with targets
Makes CMakeLists.txt code a bit safer.
2022-04-22 12:38:41 +00:00
Vlad Zahorodnii
a4a2ee0428 Refactor output mode abstractions
With this, the drm backend will be able to associate drmModeModeInfo
with Output's modes, which can be useful if there are several modes with
the same resolution and refresh rate but different flags.
2022-04-22 11:17:11 +00:00
Vlad Zahorodnii
6b4daeddc9 src/xwl -> src/xwayland
It makes naming more consistent, we use "wayland" more frequently than
"wl".
2022-04-22 13:09:51 +03:00
Vlad Zahorodnii
b64f95b703 Integrate kwaylandserver
This makes KWin switch to in-tree copy of KWaylandServer codebase.

KWaylandServer namespace has been left as is. It will be addressed later
by renaming classes in order to fit in the KWin namespace.
2022-04-22 12:27:33 +03:00