Commit graph

20479 commits

Author SHA1 Message Date
Xaver Hugl
4dec21d8e4 backends/drm: remove unused user data 2021-12-13 08:32:33 +00:00
nerdopolis turfwalker
37c3e0d158 Fix crash on simpledrm 2021-12-13 08:02:58 +00:00
Vlad Zahorodnii
09b8f5d838 effects/overview: Animate window icon opacity
This looks better.
2021-12-13 03:53:31 +00:00
Alexander Lohnau
901cc62d28 Remove unused code for loading task switcher KCM
For all the task switchers on my system there is no KCM installed:

```bash
rg 'X-KDE-ParentComponents=(PlasmaXLight|org.kde.breeze.desktop|org.kde.breezedark.desktop|org.kde.breezetwilight.desktop|org.kde.breeze.desktop|org.kde.breezedark.desktop|org.kde.breezetwilight.desktop|org.kde.plasma.mycroft.bigscreen|small_icons|big_icons|compact|text|present_windows|thumbnail_grid|thumbnails|informative)'
```

As the docs state, this is only for buildin effects. Which means it is internal API.
Also I consider the choice of displaying a KCM *or* the preview odd, IMHO the preview
is the most important part.

I stumbled upon this when reviewing the metadata files as part of the preparation
for https://phabricator.kde.org/T14564.

Also this way of plugin loading is discouraged for performance reasons, because all the
plugins from the namespace have to be reopened to get their metadata.
2021-12-11 09:39:55 +01:00
l10n daemon script
92d3345310 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"
2021-12-11 01:41:35 +00:00
Vlad Zahorodnii
1f798485b9 effects/scale: Tune animation params
Use standard easing curves in animations. OutCubic for the intro
animation and the InCubic for the outro animation.

Hidden opacity options were removed because I don't think they are
needed anymore. I made the starting opacity 0.4 to make the animation
look closer to what it would have been with an ease-out curve without
realizing it.
2021-12-10 16:51:54 +02:00
Vlad Zahorodnii
acea685b04 autotests: Replace output management test with a more useful test
The output management test checks the implementation of output
management capabilities in the virtual backend, which is not helpful.

This change replaces it with a more useful test that verifies how
windows are placed after an output change.
2021-12-10 13:06:40 +02:00
Vlad Zahorodnii
ea7779de42 autotests: Fix TestXdgShellClientRules
TestXdgShellClientRules implicitly assumes that the kwinrc config is
referenced only by the RuleBook object.

However, after changing the default placement policy in the
WaylandTestApplication, that's no longer the case. The kwinApp() object
now also holds a reference to the main config file. Because of that,
previous window rules leak to next tests, which breaks them.

In order to address that issue, this change makes TestXdgShellClientRules
open a separate config and wipe it clean after each test run. Not great,
but there doesn't seem to be other way around with current KSharedConfig
api.
2021-12-10 11:21:04 +02:00
Vlad Zahorodnii
eb080395ef backends/drm: Fix stuck cursors
Currently, if you move the cursor really fast between two outputs, there
may be stuck cursor on the previous output.

We need to query the old cursor visibility status before updating the
cursor position, otherwise the drm backend may not schedule an update to
move the cursor offscreen.
2021-12-10 06:24:21 +00:00
Vlad Zahorodnii
f51ad0897f effects/screentransform: Don't read kscreen effect's config
It's fine to have the animation duration hardcoded to 250ms. The main
issue with reading kscreen effect's config is that it adds inter-effect
dependencies, which is simply not worth the trouble.
2021-12-09 20:38:34 +00:00
Vlad Zahorodnii
bdc7ee649b effects/overview: Use out cubic easing curve consistently
The intro and the outro animations are very short and they usually
affect all windows on the screen. Windows have to travel a lot and in
very short time, this doesn't look.

Similar to other windows, this change makes the overview effect use the
out cubic curve for window movements (even though the HIG suggests us
using the InOutCubic easing curve). That way, user will look at
flatter parts of the easing curve more, i.e. the windows would move less
chaotically and simply jump to their target position.

Similar to the WindowHeap, this change makes the overview effect use the
out cubic everywhere else so the intro and the outro animations look
coherent.

Another advantage of the OutCubic easing curve is that it makes the
overview effect look more responsive and subtle.
2021-12-09 17:34:38 +00:00
Xaver Hugl
6ce0cc987d input: set tablet cursor hotspot 2021-12-09 17:09:12 +00:00
Vlad Zahorodnii
f308447cc2 plugins/screencast: Enable alpha channel for window streams
It appears like a dozen of applications that provide window
screencasting feature don't support BGR video format, only BGRA and BGRx.
2021-12-09 16:20:23 +00:00
Xaver Hugl
2817e7581f backends/drm: fix legacy cursor 2021-12-09 15:48:58 +00:00
Julius Zint
9537ea6d16 Use SmoothPixmapTransform when drawing cursor
This solves the pixelated look of the cursor under wayland, if the
scaling is set to a fractional value.
2021-12-09 16:04:31 +01:00
Vlad Zahorodnii
ab9bfb2993 wayland: Port to ServerSideDecorationInterface::preferredMode()
Currently, the wayland server updates the server side decoration mode,
which is counter-intuitive, because it doesn't cache the last preferred mode.

With ServerSideDecorationInterface::preferredMode(), it can be simpler.
2021-12-09 16:03:48 +02:00
Vlad Zahorodnii
da53d26543 autotests: Pass parent object as last argument to createXdgToplevelSurface() and createXdgPopupSurface()
It's more common to see the parent object being the last argument in Qt
and this way you won't need to specify nullptr parent explicitly if the
xdg-popup or the xdg-toplevel surface doesn't need to be configured
implicitly, which makes tests slightly easier to read.
2021-12-09 11:03:59 +00:00
Xaver Hugl
b526b35e9d backends/drm: refactor legacy cursor
This commit does away with the special handling of the legacy cursor and
makes it be applied directly in DrmPipeline, using the same state as the
atomic cursor and without dirty flags.
2021-12-09 10:05:16 +01:00
Xaver Hugl
7e2bd5a773 backends/drm: refactor DrmPipeline
Split out more things from commitPipelines, and split out the legacy stuff
into a separate file
2021-12-08 21:39:38 +01:00
Vlad Zahorodnii
358b45a4f2 Remove some no longer relevant KWIN_UNIT_TEST ifdefs 2021-12-08 16:29:55 +00:00
Vlad Zahorodnii
7b1bbf6e0a autotests: Drop effect loader tests
Effect loading is already tested using integration tests, for example
the maximize test verifies that the maximize effect is loaded _and_ it
actually does something useful when a window is maximized or restored,
testScriptedEffectLoader only verifies that the effect is loaded, which
is less helpful than what integration tests provide us.

But perhaps the main problem with these tests is that they require us
building a mockverse around them. This litters code with ifdef
preprocessor directives and makes changing such code a living nightmare.

Another problem with these two tests is that they cannot use OpenGL
because it means mocking OpenGL, which we obviously not going to do.
With integration tests, it's not a problem.

The bottom line is that unit tests can be useful but they make life
notoriously difficult when it comes to testing components that depend on
other components.
2021-12-08 16:29:55 +00:00
Xaver Hugl
494ef1c930 backends/drm: port cursors to atomic
The cursor being set out-of-band with atomic commits creates problems
because it can create false positive for atomic tests, if the cursor
state gets changed in between an atomic test and its matching commit.

This commit also ports the cursor to a swapchain instead of only one
image. This is not strictly required but may prevent artifacts and
will be needed for future optimisations.
2021-12-08 17:06:02 +01:00
Vlad Zahorodnii
53e3e87681 autotests: Make decoration mode change tests more robust
Currently, kwin expects that the xdg-decoration is installed before the
initial commit. However, decoration tests do that after the initial
commit, which makes testMaximizeAndChangeDecorationModeAfterInitialCommit()
silently pass.

On a second look, it seems that the xdg-decoration spec is okay with the
xdg-decoration being created after the first commit (as long as it's
done before the surface is mapped). This needs to be fixed separately.

CCBUG: 445259
2021-12-08 13:05:37 +00:00
Vlad Zahorodnii
b82897ce73 scripting: Register Options singleton
Context properties don't work with QML effects. At the moment, no effect
needs to access the options object, but it makes the QML API consistent.
The workspace is already a singleton type.
2021-12-08 09:10:19 +00:00
Vlad Zahorodnii
29a85e830c scripting: Fix type of KWinComponents.Workspace
Currently, the workspace.clients property doesn't work in declarative
scripts because wrong workspace wrapper is used.
2021-12-08 10:39:48 +02:00
Vlad Zahorodnii
5b04aa3ebe scripting: Print QQmlComponent errors
This makes it easier to spot errors in declarative scripts.
2021-12-08 10:38:24 +02:00
Vlad Zahorodnii
0765a08cc8 effects/overview: Remove premature optimization in ExpoLayout::calculateWindowTransformationsNatural()
The natural geometry can live in a different coordinate space than the
target area. Remove the premature optimization so the cell is properly
placed if the two are in different coordinate spaces.
2021-12-07 10:22:42 +00:00
Vlad Zahorodnii
a5028ab5c5 effects/overview: Make ExpoLayout agnostic about coordinates space where natural geometry is
Currently, the ExpoLayout wants the natural geometry to be in the local
coordinate space because of the default layout mode.

With the natural layout, the ExpoLayout will run a simple loop that
repels overlapping cells.

Once no two items overlap, the items will be scaled down based on their
bounding rectangle and the target area.

The problem is that the ExpoLayout includes the area where items will be
eventually placed when computing the bounding rectangle, which can
result in a sort of a bug where almost all windows are shifted to one
side of the screen, which is not at 0,0.

This change removes the target area from the bounding rect math so the
coordinate space where natural geometry is specified is irrelevant.

It fixes the issue where windows can be shifted to one side of the
screen after adding or removing a window. It also makes the ExpoLayout
API more simpler on the QML side and ensures that no relayouting will be
performed if only the position of the WindowHeap changes.
2021-12-07 10:22:42 +00:00
Vlad Zahorodnii
97160c9b90 autotests: Add a test that checks one possible corner case during xdg-toplevel initialization
If the preferred decoration mode changes after the initial commit but
before the surface is mapped, there's a chance that kwin can send a bad
configure event, it's been the case in the past. Add a test to prevent
such cases go unnoticed.
2021-12-07 09:50:19 +00:00
Vlad Zahorodnii
9cc80d7468 wayland: Resize the client to last requested client size if decoration is destroyed
If the decoration is destroyed before the window is mapped, kwin can
respond with a configure event that has 0x0 size. New tests check that
problematic case.

BUG: 444962
2021-12-07 09:50:19 +00:00
Fushan Wen
53e903a0b7 Drop warpXcbOnSurfaceLeft()
Xwayland didn't generate a leave event when changing pointer
focus. It was fixed in 1.19.
2021-12-07 09:22:41 +00:00
Vlad Zahorodnii
b96fa8a840 scripting: Add convenience DesktopBackgroundItem type
It's more ergonomic than creating a Repeater.
2021-12-07 08:05:49 +00:00
Carl Schwan
c0447c3681 Make activity popup menu consistent with VD menu
Instead of using a custom widget use normal widget

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-12-06 15:39:17 +00:00
Columbariu s
621c06deda screencast: Fix format announced with SHM enum format
Kwin announces a format with alpha when Dma-Bufs are available, even
when the texture doesn't contain any. This results in clients segfault
when trying to access the buffer assuming a maxsize wrt. the announced
format by ways of dimensions and bpp.

This patch moves the format masking to affect the Dma-Buf transport
only.
2021-12-06 04:02:01 +01:00
Vlad Zahorodnii
2b628ea412 backends/drm: Mark frame failed if presenting null buffer
If eglSwapBuffers() fails, there won't be a buffer and so we need to
mark the frame as failed. Otherwise, the screen can be frozen.

eglSwapBuffers() can fail if some effect calls makeOpenGLContext()
between RenderBackend::beginFrame() and RenderBackend::endFrame(), which
is the case with the zoom effect. It can set wrong draw surface in
ZoomEffect::recreateTexture()

BUG: 445412
2021-12-03 08:06:37 +00:00
Nicolas Fella
84c45b9fd7 [kcms/effectsmodel] Port away from KPluginInfo 2021-12-03 07:31:06 +00:00
xinbo wang
44285de0e1 fix: touch down to close popup window.
when a popup window is shown,use touch to operation window or
touch to move client,the popup window not be closed and be showing state.
2021-12-03 07:09:46 +00:00
Alexander Lohnau
bd17ca0110 kwinscripts kcm: Port to new KPluginWidget class
Task: https://phabricator.kde.org/T12265
2021-12-03 06:15:34 +00:00
Vlad Zahorodnii
4d7f1d1358 wayland: Rename wayland_fd arg to wayland-fd
This make argument naming consistent, for example we have xwayland-fd
arg, which has a dash instead of underscore.
2021-12-02 16:03:10 +02:00
David Edmundson
f4b870977b Re-enable systemd managed kwin
This was blocked on environment variables issues which are now resolved
2021-12-02 13:25:50 +00:00
David Edmundson
b3f5f9764f [kwin_wrapper] Sync kwin env after spawning 2021-12-02 13:25:50 +00:00
Vlad Zahorodnii
bf7bdf0be8 Setup touchpad shortcuts and input event filters only on Wayland
They work only on Wayland.
2021-12-01 10:59:32 +02:00
Vlad Zahorodnii
88d423ddcf Unify focus abstractions for internal and wayland windows
This simplifies focus related logic a bit. Instead of differentiating
between wayland and internal window focus, simply maintain window focus
that works both with regular wayland windows as well as the ones created
by kwin.
2021-12-01 10:23:55 +02:00
Vlad Zahorodnii
aba9440780 Move AbstractClient::isInternal() to Toplevel 2021-12-01 10:23:55 +02:00
Ismael Asensio
2797c64eea kcm/tabbox: Make the preview show desktop if the option is selected
The thumbnail that represents the "desktop" in the switcher preview
is taken from the default wallpaper, and it will update automatically
as it changes in future versions of Plasma.

The current one is also added along the other thumbnails as a fallback.

BUG: 309401
FIXED-IN: 5.24
2021-11-30 22:18:23 +01:00
Vlad Zahorodnii
356fff9920 autotests: Fix testScreens
Currently, the test doesn't pass due to Xwayland encountering a protocol
error.

That protocol error occurs because the xdg-output is destroyed before
the wl_output.

This change moves the ownership of the xdg-output to wl-output so they
are destroyed together.
2021-11-30 19:10:54 +02:00
Xaver Hugl
8d08306c48 backends/drm: support dmabuf-feedback
dmabuf-feedback allows the compositor to give the clients better feedback on what
formats and modifiers they should use, and for which device they should allocate.
This way they can reallocate for scanout whenever the compositor tells them to,
which makes direct scanout work for a lot more devices and applications.
2021-11-30 10:46:06 +00:00
Vlad Zahorodnii
3d0bdc56a4 Remove mysterious s_cursorUpdateBlocking boolean flag in pointer_input.cpp
From what I can tell, it's not really needed.
2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
e44eeaafcf Remove redundant updateFocusMousePosition() call
InputDeviceHandler will call it when needed.
2021-11-30 10:23:54 +00:00
Vlad Zahorodnii
d3342c6897 Append "pointer" to AbstractClient::{enterEvent,leaveEvent}
KWin handles several types of pointing input devices, e.g. mice,
tablets, etc.

As is, enterEvent and leaveEvent are very ambiguous. This change
prepends "pointer" to those methods to make it explicit that they handle
pointer enter/leave events.
2021-11-30 10:23:54 +00:00