Commit graph

1795 commits

Author SHA1 Message Date
Vlad Zahorodnii
6510fe6e5d scene: Fix SurfaceItem::bufferTransform()
The wayland spec is not quite clear about the transforms, but the buffer
transform indicates a transform from wl_surface to wl_buffer or compositor
global coordinate space to composited buffer.

On the other hand, SurfaceItem assumes that the order is vice versa.
2024-01-09 17:42:09 +00:00
Vlad Zahorodnii
c970d3261b core: Add OutputTransform::FlipY convenience aliases
`flip-y | rotate-N` transforms are equivalent to `flip-x | rotate-N`.
However, it is not intuitive to express transforms that flip the y axis
via flip-x transforms. This change adds convenience aliases to improve
code readability and keep code intuitive, which is going to be needed in
order to drop TextureTransforms flags.
2024-01-09 17:42:09 +00:00
Vlad Zahorodnii
9039612c20 core: Rename OutputTransform enums 2024-01-09 17:42:09 +00:00
Vlad Zahorodnii
47017d19de core: Make flip transform first
The wayland spec says we must flip first. FWIW it also matches how
kms processes reflect-x and reflect-y.
2024-01-09 17:42:09 +00:00
Vlad Zahorodnii
1905f7586e core: Change winding order of OutputTransform
Wayland spec says we must rotate counterclockwise.
2024-01-09 17:42:09 +00:00
Vlad Zahorodnii
e6853a9109 core: Add OutputTransform::map(QPointF,QPoint) 2024-01-09 17:42:09 +00:00
Vlad Zahorodnii
a9b01a68b8 core: Add OutputTransform::map(QRect,Size) overloads
These can be useful in case a QRect needs to be mapped. One could
convert the QRect into a QRectF and then back to QRect, but given that
these conversion helpers are present in rendering hot paths, it would
be great to be more efficient and also potentially loosing precision
because of floating point arithmetic.
2024-01-09 17:42:09 +00:00
Vlad Zahorodnii
98a1b5098a core: Add OutputTransform::toMatrix() 2024-01-09 17:42:09 +00:00
zhang yu
cbb95f5649 quit tile window when it is maxied in wayland env 2024-01-09 07:10:58 +00:00
Aleix Pol Gonzalez
df3e894c1a wayland: Install display.h
It's needed to properly access KWin::effects->waylandDisplay().

Signed-off-by: Georg Leugner <georg.leugner@mbition.io>
2024-01-08 23:06:43 +00:00
Xaver Hugl
6832aee3a2 autotests: add very basic ColorDescription mapping test 2023-12-22 20:25:44 +01:00
Stefan Hoffmeister
33beb28b5f autotests/drm: Fix connector_type_id usage 2023-12-22 18:39:21 +01:00
Vlad Zahorodnii
b3b43acc60 autotests: Slightly reduce line width in TestOutputTransform 2023-12-19 17:08:13 +02:00
Xaver Hugl
50346b6e37 core: Introduce OutputTransform::combine()
Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2023-12-19 17:08:13 +02:00
Vlad Zahorodnii
71326cc91c autotests: Add OutputTransform test 2023-12-19 08:30:38 +00:00
Vlad Zahorodnii
d733daf772 Drop dead code 2023-12-15 08:57:11 +00:00
Vlad Zahorodnii
dd9e04fb18 Fix -Wdeprecated-declarations 2023-12-01 12:06:48 +02:00
Bharadwaj Raju
e5753ea336 Make autohide screen edges use the same activation delay setting as other edges
Makes it possible to easily target things in a window near your panel edge,
without bringing up your panel.

The `m_client` condition this MR removes appears to have been added solely to make autohiding panels appear instantly. See c4140d6f4e.

BUG: 267277
2023-12-01 08:09:35 +00:00
Vlad Zahorodnii
784d48ef52 Port away from deprecated KConfigBase::group() api 2023-11-28 10:02:03 +00:00
Aleix Pol Gonzalez
b853de3d29 Allow building KWin without KGlobalAccel
Signed-off-by: Falko Becker <falko.becker@mbition.io>
2023-11-27 17:07:28 +01:00
Kai Uwe Broulik
5c96c38e39 Support kill prompt for XdgTopLevelWindows
Instead of killing the window without asking, show the kill prompt
like it's done for X11 windows.

The window in question is exported through XDG foreign so the kill
helper can parent itself to it, and an activation token is also provided.

Also, the more contemporary desktop file name is now used for
identification rather than window class.

A no-display desktop file is installed for the kill helper so that it
can get a proper window icon and suppress startup notification.
2023-11-27 14:10:15 +00:00
Kai Uwe Broulik
2b868edb9e xdgshell: Use killPingTimeout option
This makes it consistent with the timeout used on X11.

The current ping timeout was also generally quite short, causing apps
to desaturate for brief moments when they were busy e.g. starting up
or loading large files.
2023-11-27 14:10:15 +00:00
Nicolas Fella
8ec88aa3bf Adjust to renamed activities libraries 2023-11-23 21:48:01 +01:00
Jonathan Esk-Riddell
cc4eac4c85 Port to renamed kwayland
https://invent.kde.org/plasma/kwayland/-/merge_requests/107  use renamed kwayland
2023-11-23 19:34:24 +00:00
Nicolas Fella
e7942c3485 Implement bounce keys on Wayland
Bouce keys suppresses additional key presses during a given interval

This is used by people with motor impairments or bad keyboards

It works by remembering the last input timestamp for a key

If an event's timestamp is too close to the last timestamp for that key the event is rejected

BUG: 474752
2023-11-23 13:07:35 +00:00
Vlad Zahorodnii
b33c5d9fbb autotests: Prevent sticky keys leaking to other tests 2023-11-23 12:19:31 +00:00
Jarek Janik
ba7875bec2 testStackingOrder: wrap Test::XdgToplevel in a unique_ptr in all tests 2023-11-23 09:53:55 +00:00
Jarek Janik
8e92345840 Add test for BUG: 477262 2023-11-23 09:53:55 +00:00
Nicolas Fella
d4127d07fd Implement locking sticky keys on Wayland
When pressing a latched modifier a second time lock it

When pressing a locked modifier release it

BUG: 464452
2023-11-23 08:17:00 +00:00
Vlad Zahorodnii
2ff0fc26a4 Merge EffectWindow::{windowMinimized,windowUnminimized}
The main motivation is to match the Window API.
2023-11-21 18:20:02 +00:00
Vlad Zahorodnii
4faad8bd49 effects.h -> effecthandler.h 2023-11-20 15:47:36 +00:00
Xaver Hugl
da80ed4318 autotests/drm: handle the DRM_IOCTL_MODE_RMFB ioctl 2023-11-20 13:33:54 +00:00
Vlad Zahorodnii
961bd00919 Move WindowVertex,WindowQuad,RenderGeometry out of effects.h
These are core scene abstractions and don't belong in effects.h.
2023-11-20 14:05:52 +02:00
Vlad Zahorodnii
86084d118c libkwineffects/ -> effect/ 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
8566cb3735 Move effectloader.h to libkwineffects/ 2023-11-16 15:51:39 +02:00
Vlad Zahorodnii
36021b12a7 Drop redundant "kwin" prefix in some filenames 2023-11-16 13:37:50 +00:00
Vlad Zahorodnii
15b47ce7fc Merge EffectsHandlerImpl and EffectsHandler 2023-11-15 15:21:50 +02:00
Vlad Zahorodnii
a5546f1450 Drop some unused kwineffects.h includes 2023-11-15 14:41:42 +02:00
Vlad Zahorodnii
56e384e527 Extract TimeLine into its own header 2023-11-15 12:02:50 +00:00
Xaver Hugl
ee146d33b9 libkwineffects: move files out to more fitting places 2023-11-14 17:03:40 +01:00
Vlad Zahorodnii
79d5a70c01 wayland: Make SurfaceInterface::{frameRendered,takePresentationFeedback} not touch subsurface tree
This gives us greater flexibility and in general more cleaner code.
2023-11-14 14:58:40 +00:00
Xaver Hugl
7bf38e54bf wayland: implement presentation time 2023-11-13 14:25:26 +01:00
David Edmundson
4f9531ad77 Support SecurityContextManagerV1
This allows KWin to securely identify the client for a given connection,
without relying on the process name.

This patch does not do anything meaningful with the application ID other
than store it.

This first version does not support kwin restarts, it can come
afterwards.

Testing done:
With latest flatpak, running `WAYLAND_DEBUG=1 flatpak run org.telegram.desktop |& grep security`
shows that flatpak itself bound the security context, and the client did not see it advertised.
2023-11-13 09:51:28 +00:00
Xaver Hugl
15d6d8c336 wayland/surface: add the output a surface is on the most 2023-11-07 20:23:06 +01:00
Xaver Hugl
28c27609a4 xdgshellwindow: enforce a minimum size for clients
It doesn't make sense for a window to become 1x1 pixels small. When we have
server side decorations we also know that the decoration takes a lot of
space, so this commit enforces a bigger minimum size for decorated windows

BUG: 469237
2023-11-06 14:55:57 +00:00
David Edmundson
c711997d31 Revert "Temporarily disable testXkb and testX11Window"
This reverts commit 6bad553f05
2023-11-06 09:52:31 +00:00
Vlad Zahorodnii
4449375967 autotests: Adjust testXkb to correct Hyper key mappings
By default, hyper keys are interpreted as meta keys. However, due to
a Qt bug, it had been incorrectly mapped.

Commit b45b9090c3b66d541f57f8d049c22247f8c115ca in qtbase repo fixed it,
so the test needs adjustments.
2023-11-06 09:45:29 +00:00
Vlad Zahorodnii
0f5e719b61 wayland: Fix none keyboard interactivity in LayerShellV1Window
Window::acceptsFocus() is not taken into account when a window is
activated using Workspace::activateWindow(). The main reason is because
of different input models on X11.

Instead, Window::takeFocus() should check itself if the window accepts
focus.
2023-11-06 08:07:32 +00:00
Arjen Hiemstra
6bad553f05 Temporarily disable testXkb and testX11Window
These prevent merging
2023-10-31 20:35:26 +00:00
Vlad Zahorodnii
8fbf287254 libkwineffects: Port to VirtualDesktop
This makes effects api consistent with the scripting api. In addition to
that, VirtualDesktop objects are more stable.
2023-10-26 07:21:49 +00:00
Xaver Hugl
8d25550c22 backends/drm: support applying icc profiles with color management
While applications are still restricted to sRGB, this allows working on sRGB
content on displays with a wide color gamut as the whole profile gets applied,
instead of just the VCGT.

CCBUG: 439135
2023-10-25 15:34:21 +02:00
Vlad Zahorodnii
d7b1661e08 Merge libkwineffects into libkwin
libkwineffects was introduced when kwin used to be an executable. It
provided an api to implement effects and shielded from the technical
quirks in kwin.

Over the time, kwin internals had been split and abstractions were
refactored so they can be consumed in scripts or plugins. Besides that,
new ways to implement extensions have been introduced, which use
kwin's internal abstractions.

On the other hand, effects continue using libkwineffects specific apis.
This has a few issues: qtquick effects use both apis and it bites us,
duplicating same apis.

The best solution so far is to merge libkwineffects with libkwin, and
replace libkwineffects abstractions with libkwin abstractions, e.g.
EffectScreen -> Output, etc. This change takes care of adjusting libs.

Obviously, the main disadvantage of doing so is that binary effects
have to be recompiled every time new libkwin is released. But it's
already the case with libkwineffects too.
2023-10-25 12:46:12 +00:00
Vlad Zahorodnii
3bed991941 Link KI18n with libkwin privately 2023-10-25 12:46:12 +00:00
Aki Sakurai
115ea7454b Send tablet events to every bound wl_resource
Some apps, notably Tablet KCM, will rebind the tablet interface and consume all events that should be sent to the GUI toolkit.
This commit sends events to every consumer and also stores the latest cursor indexed by wl_client instead of wl_resource.
BUG:473126
2023-10-24 11:22:27 +00:00
Alexander Lohnau
0d3b017b23 Avoid QtDBus module include in commonly used headers
Because all of QtCore and QtDBus is no longer pulled in, a few placed had to get explicit includes
2023-10-22 13:45:28 +00:00
Kai Uwe Broulik
3eb90b2c60 Adjust to KDecoration init API returning a bool
Will allow a fallback to client-side decoration when KDecoration init fails.
2023-10-22 10:52:42 +02:00
Laurent Montel
bc6116c5a7 There's no QVector anymore, QList is the QVector in Qt6 2023-10-19 13:43:53 +00:00
Alexander Lohnau
43174a9771 Remove X-Plasma-MainScript from C++ codepaths 2023-10-16 16:12:43 +00:00
Nicolas Fella
39fe6cd286 Remove window type from internal window and window system plugin
This is only set from KWindowSystem::setType(), which is unused on Wayland
2023-10-16 14:41:53 +00:00
Vlad Zahorodnii
5246d3924f wayland: Destroy ClientConnection immediately
With QObject::deleteLater(), the client object can unexpectedly outlive
the expected lifetime as in 03d0a226fb.
2023-10-09 06:32:14 +00:00
Vlad Zahorodnii
7e99ab9438 Build wayland tests with same build options as other tests 2023-10-06 11:21:00 +00:00
Vlad Zahorodnii
7d56aa3687 Merge wayland tests with other tests
This makes wayland tests organization consistent with other kwin tests.
2023-10-06 11:21:00 +00:00
Vlad Zahorodnii
9e10394db1 Move window specific signals from EffectsHandler to EffectWindow
This makes the api of EffectWindow more similar to the api of Window. It
also makes more sense to keep such signals in EffectWindow. In the future,
the effect window can be dropped in favor of the window.
2023-10-06 07:05:37 +00:00
Xaver Hugl
ae84480fbf outputconfigurationstore: add new config system
Instead of an external service (like KScreen) storing and restoring output configurations,
with this commit KWin takes over that responsibility. This allows it to, among other things,
generate appropriate configs for new sets of outputs immediately, and take KWin-internal information
about outputs into account when generating them.

CCBUG: 474021
CCBUG: 469653
CCBUG: 466342
CCBUG: 470863
CCBUG: 466556
BUG: 466208
BUG: 455082
BUG: 457430
2023-10-05 20:29:04 +02:00
Vlad Zahorodnii
dc6dba231d Port away from KWayland's server-decoration implementation 2023-09-25 06:42:02 +00:00
Vlad Zahorodnii
6029a68433 backends/fakeinput: Implement fake-input v5 2023-09-22 12:48:18 +00:00
Vlad Zahorodnii
d6e94163f5 backends/fakeinput: Implement fake input protocol in backend
The interface is redundant now since there's an abstract input backend
abstraction.
2023-09-22 11:08:26 +03:00
Vlad Zahorodnii
15ed4f393e wayland: Simplify startup of compositor
At the moment, the wayland compositor has to handle the case of having
no workspace. This should be unnecessary and it creates a pesky cycling
dependency between Workspace and Compositor.

Given that the Workspace acts more like a container and kwin starts
accepting client connections after starting compositing, it's possible
to create the Workspace earlier and simplify the start() function a bit.
2023-09-20 12:50:15 +00:00
Vlad Zahorodnii
de36fe82e8 wayland: Integrate KWaylandServer classes into KWin namespace 2023-09-15 16:31:15 +03:00
Vlad Zahorodnii
8bf2318800 wayland: Drop "_interface" from filenames
The cpp files in the wayland directory are named after protocol names.
"_interface" does not contribute anything new.
2023-09-15 13:13:43 +00:00
Vlad Zahorodnii
67dcf53e80 autotests: Add more test cases in LayerShellV1WindowTest::testPlacementArea 2023-09-11 05:53:19 +00:00
Vlad Zahorodnii
7d626363e4 autotests: Remove old kernel checks
CI runners have been upgraded.
2023-09-10 10:14:18 +03:00
Xaver Hugl
32ae9dd7d1 libkwineffects: rename major and minor methods
There's "major" and "minor" defines that can get implicitly included, for
example with musl libc. To prevent that from breaking compilation, rename
the methods
2023-09-09 14:44:53 +00:00
Vlad Zahorodnii
6dd6e176e3 Move X11Compositor and WaylandCompositor in their own files 2023-09-08 09:49:40 +03:00
Vlad Zahorodnii
14ab38b596 composite.h -> compositor.h 2023-09-08 09:48:59 +03:00
Vlad Zahorodnii
9cf6011ba4 autotests: Don't be so paranoid about compositing type
In many cases it's irrelevant, what we care about is whether given effect
is loaded and performs its function. So remove these paranoid checks
except the tests where it's important to use OpenGL compositing.
2023-09-08 09:48:16 +03:00
Xaver Hugl
e401f3ff11 libkwineffects: drop gallium detection
It's not used anywhere
2023-09-07 21:13:16 +02:00
Xaver Hugl
6d35a27f90 libkwineffects: drop checks for GLSL and NPOT
Instead, creating contexts that miss these features should fail directly,
making KWin fall back to software rendering.
While this commit also drops workarounds for broken drivers that do software
emulation for features we need, such workarounds belong into these drivers and
the user can still manually turn off compositing if needed.
2023-09-07 21:13:16 +02:00
Xaver Hugl
ed02051a4a libkwineffects: move x server version query to xcb utils 2023-09-07 21:13:16 +02:00
Xaver Hugl
a5df88b0de libkwineffects: move linux kernel version query out of GLPlatform
It has nothing to do with OpenGL
2023-09-07 21:13:15 +02:00
Xaver Hugl
e0c7878357 libkwineffects: move version into its own files 2023-09-07 21:11:11 +02:00
Xaver Hugl
5ce02c6811 libkwineffects: drop limited glsl detection
It's not actually used anywhere
2023-09-07 16:41:22 +02:00
Xaver Hugl
27f90476b4 libkwineffects: rename kwingl* files to gl* 2023-09-07 16:41:22 +02:00
Mikhail Vinogradov
82be16df29 Try to refresh textInput active focus status 2023-09-04 08:45:43 +00:00
Xaver Hugl
1c18d11206 backends/drm: replace drmModeAtomicCommit with a custom implementation
drmModeAtomicCommit does additional allocations and sorting that KWin doesn't
use or need
2023-08-30 10:46:58 +00:00
Vlad Zahorodnii
dee8a3b3a7 Clear decoration focus when window closes
If the window closes, we need to reset the focused decoration object.

BUG: 473244
2023-08-30 09:28:03 +00:00
David Edmundson
10ed34bc9d Avoid painting unchanged scene layers
Currently when we move the mouse the one render loop triggers a repaint.
When the cursor layer needs a new update we end up in the compositor
repainting the main content.

Even though painting should mostly no-op it still goes through all
existing items and effects to collect damage, still potentially making
the GL context current which could stall. A waste when we know we
haven't got anything to do. It's enough to cause noticable mouse lag on
some hardware.

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2023-08-28 11:38:18 +00:00
Alexander Lohnau
40be656eed Adjust to changed signature of kcoreaddons_target_static_plugins
Depends on https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/360
2023-08-27 12:09:56 +02:00
Vlad Zahorodnii
d25574e7c6 Merge Window::userCanSetFullscreen() with Window::isFullscreenable() 2023-08-24 07:29:02 +00:00
Vlad Zahorodnii
346d4413a1 Remove boolean trap in Window::setFullScreen()
In most cases, it doesn't matter because a window is made fullscreen by
user. In a few places, the user arg is incorrectly set to false.
2023-08-24 07:29:02 +00:00
Xaver Hugl
44937136cd backends: record GPU render time
This should make it much less likely for KWin to miss frames
2023-08-23 10:51:19 +00:00
Xaver Hugl
02b996cf9c platformsupport/scenes/opengl: add opengl render query class 2023-08-23 10:51:19 +00:00
Xaver Hugl
0ab928c9ac backends/libinput: enable tap to click and tap-and-drag by default 2023-08-22 14:17:23 +00:00
Kai Uwe Broulik
410ca44e6e XdgPopupWindow: Reposition for non-reactive positioners
Ensures that e.g. context menus move about with their parents when they
get moved around.

However, as per spec don't re-constrain the window when its positioner
is non-reactive. This change calculates the offset from its parent window
once initially and places the window relative to that whenever the parent
moves.

Only when the positioner is reactive, will it recalculate the placement fully.

BUG: 461994
2023-08-21 11:17:18 +00:00
Xaver Hugl
74f10d0cdf port most uses of the reset(new ...) pattern to std::make_unique 2023-08-11 15:58:15 +02:00
Antonio Russo
5502ce9a9c placeSmart: Properly track width and height
`Placements::placeSmart` searches for an optimal position for windows, attempting to minimize overlap.  The core of this algorithm tracks the
client's height and width in `ch` and `cw`, which have been adjusted by -1. This simplifies logic determining the bottom and right points of a
window when you are starting at the top and left points.

However, this decision requires adjusting that number by +1 when doing the opposite: determining the top and left points when you start with
the bottom and right points.

placeSmart cycles through window locations, searching for acceptable nooks and crannies to fit a window in, nicely.  It begins by checking
for places to put the top left corner of the window which abut another constraint.  If that fails, it then tries to place the bottom right
abutting a constraining feature.

After finding a suitable bottom (or right) location, the top (or left) location must be determined, requiring the -1 adjustment to be undone.

This patch adds that +1 back in.

# The bug it solves

This error can be seen by opening a bunch of windows that are placed using the "Minimal Overlapping" rule.  The open space on the screen will be tiled from left to right, and then top to bottom in the windows.  Once no more windows can be placed like that, the next window will be placed at the extreme bottom-right corner.  However, it will be one pixel too low and one pixel too far to the right---if you try to move the window, it will "snap" to the correct spot.

This single pixel may seem minor or even irrelevant, but when you use the "Present Windows" desktop effect on a multiple-monitor setup, this one pixel will cause the window to show up on both monitors.
2023-08-07 07:14:18 +00:00
Xaver Hugl
7d02bc17d6 backends/drm: rework how atomic commits are tracked
Pending buffers for drm planes and crtcs are no longer tracked in the planes
and crtcs themselves, but instead in a DrmCommit object that is used as
the user data for the pageflip handler. This way multiple commits can be
pending at the same time without causing conflicts, and the handling of
pending buffers is simplified as well.
2023-07-27 12:30:19 +02:00
Xaver Hugl
87444f6ce3 backends/drm: offload atomic commits to a separate thread
This separate thread submits commits as late as possible, so that until
immediately before vblank the cursor position can still be updated, reducing
its latency and opening the door for more optimizations.
2023-07-26 13:44:36 +02:00
Laurent Montel
b823747c3b Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-15 08:40:49 +00:00
Vlad Zahorodnii
6cd56d5192 wayland: Implement cursor-shape-v1
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/194
2023-07-12 11:22:11 +03:00
Laurent Montel
86c6238cfa Don't use QtTest => use QTest + missing include 2023-07-04 10:38:21 +00:00
Aleix Pol Gonzalez
49a76ea772 Install KWaylandServer headers
There are use cases for the headers to be used, e.g. when implementing
wayland-specific workflows from an Effect.
In order to be able to use these, we also need to expose libkwin to be
imported as it carries the interfaces' symbols.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2023-07-04 08:22:43 +00:00
Vlad Zahorodnii
88ade3a409 Extract reusable egl swapchain bits
EGL rendering has some duplicated bits, so this change extracts
them to reduce code duplication.
2023-07-01 12:22:28 +00:00
Vlad Zahorodnii
3bd5e91226 Extract reusable qpainter swapchain bits
QPainter rendering has some duplicated bits, so this change extracts
them to reduce code duplication.
2023-07-01 12:22:28 +00:00
Vlad Zahorodnii
16cc0f5ebb autotests: Make test framework a static lib again
Static plugins being linked with shared libraries doesn't work smoothly.
POSITION_INDEPENDENT_CODE target property needs to be set for
every such plugin. However, there can be targets that we have no control
over, which need POSITION_INDEPENDENT_CODE to be set too. Asking such
projects to add this property and them refusing to do so would be
reasonable because kwin's entire static plugin pipeline is weird.

The test framework was made a shared library because kwin build
directory used to get really big (in 10s of gigabytes).

Due to the -fPIC issues, this change makes the test framework a static
lib again. Obviously, this brings back the big build directory problem.
But, it's not as terrible as it used to be. With this change, kwin build
directory is a couple of gigabytes in debug build, which is a lot but
not as bad as it used to be before.
2023-06-23 08:01:03 +00:00
Vlad Zahorodnii
3698127bc6 Drop InputConfig
The InputConfig was introduced to handle tests that don't have valid
kwinApp object. Those tests have been either reworked or dropped, so
let's drop the InputConfig to tidy the config stuff.
2023-06-21 10:48:50 +00:00
Vlad Zahorodnii
84c7d3cf4b autotests: Remove cursor.cpp from test framework sources
It's included because of InputConfig, but we don't need to include
cursor.cpp for this purpose.
2023-06-21 10:48:50 +00:00
Xaver Hugl
480f857d29 outputconfigurationstore: don't handle laptop lid closing yet
Interactions with KScreen cause settings to be reset to the default when the lid
gets closed, so handling lid closing in KWin needs to wait until KScreen no longer
writes configs

BUG: 471282
2023-06-21 11:05:42 +02:00
Vlad Zahorodnii
d6a384627b autotests: Let drm test use host primary node to allocate buffers 2023-06-19 22:43:01 +03:00
Vlad Zahorodnii
082301920e backends/drm: Port to GraphicsBuffer
This change ports the drm backend to the GraphicsBuffer and
GraphicsBufferAllocator.

The main motivation is to unify graphics buffer abstractions across
various backends and to prepare it for output layers, which could be
nicer if we could have direct control over the buffers.
2023-06-19 22:42:58 +03:00
Vlad Zahorodnii
712fd3396c Sync EffectsHandler::windowAdded with Workspace::windowAdded
This change makes the EffectsHandler emit the windowAdded signal as soon
as the Workspace::windowAdded signal is received and minimize the
difference between the states observed in kwin core and effects.
2023-06-16 06:41:12 +00:00
Vlad Zahorodnii
23f533aa52 autotests: Skip ScreencastingTest::testOutputCasting when running in ci
The test is flaky. We work around it by passing --repeat until-pass, but
lately even it doesn't help us with this issue.

So skip the test when running it inside KDE CI for a few months until
it gets a newer kernel.
2023-06-14 11:01:03 +00:00
Aleix Pol
fbbaab3eaf kcm/decoration: Allow specifying the kcm separately from the decoration
It makes decorations lighter as they don't need to bundle its
configuration logic.
Deprecates the kcmodule property in favour of kcmoduleName which instead
of assuming that the kcm is local to the plugin, it provides the plugin
name to find and load.
2023-06-13 12:20:21 +02:00
Vlad Zahorodnii
b90ae2f8fc Move window hiding logic to Window
The window hiding logic is mostly the same both in X11 and Wayland
windows, so let's move it in Window to share the same code.
2023-06-06 13:58:44 +00:00
David Edmundson
3ea701743e screen edge: Emit cleanup signals if needed on teardown
The Effects API has one signal screenEdgeApproaching with effects
monitoring the last signal to stay in sync.

If an Edge is destroyed whilst visible, effects currently do not get
notified and it can stay there forever.

This patch emits screenEdgeApproaching if appropriate with a factor of 0
when an edge is destroyed.

BUG: 403354
2023-05-25 09:59:00 +00:00
Vlad Zahorodnii
ebf6bd3a33 autotests: Move plasmashell bits from testMoveResizeWindow to testPlasmaSurface
Move the plasmashell specific bits to testPlasmaSurface so it's all
encapsulated and easy to drop in the future.
2023-05-23 18:00:50 +00:00
Vlad Zahorodnii
1c87a804f0 autotests: Port testShowingDesktop to layer-shell 2023-05-23 18:00:50 +00:00
Vlad Zahorodnii
05695d7f1b autotests: Avoid binding plasmashell global in tests that don't use it 2023-05-23 18:00:50 +00:00
Vlad Zahorodnii
2aba3deca4 wayland: Drop screen edge support in XdgToplevelWindow
Use kde_screen_edge_v1 + layer surface instead.
2023-05-23 13:02:14 +00:00
Vlad Zahorodnii
cdb8887a15 wayland: Drop strut support in XdgToplevelWindow
Use layer_surface.set_exclusive_zone instead.
2023-05-23 13:02:14 +00:00
Vlad Zahorodnii
9d0bb1bff7 autotests: Remove incorrect test
StrutsTest::testLeftScreenSmallerBottomAligned() used to pass because
one of the previous tests changes the maximize policy to maximize.

A window will be maximized only if it's larger than the maximize area
but smaller than the screen area. That's not the case and the test makes
an incorrect assumption about how X11Windows are placed.
2023-05-23 13:02:14 +00:00
Vlad Zahorodnii
6b2f46ca1f autotests: Remove unused outputbackend.h includes 2023-05-23 11:42:32 +03:00
Vlad Zahorodnii
cab0765947 autotests: Use layer-shell based panels 2023-05-23 10:48:31 +03:00
Vlad Zahorodnii
83261fc82a wayland: Implement kde-screen-edge-v1
It's needed to port the plasma panel to the layer shell protocol.
2023-05-19 13:36:38 +00:00
Ismael Asensio
2449b58974 tiles: Adjust padding between windows
Make the total padding between windows equal to the padding against the
screen borders by applying just half of it on the common borders.

Adjust tests accordingly.

BUG: 469720
FIXED-IN: 5.27.6
2023-05-17 23:18:59 +02:00
Aleix Pol
d6b07b313f libkwineffects: Stop including xcb/xcb.h everywhere
Provide a kwinxcb.h header file instead that offers the xcb-specific bits
from that API. It helps keep kwin effects disconnected from XCB.
2023-05-15 18:59:46 +00:00
Vlad Zahorodnii
223b01f9e7 wayland: Reevaluate layer shell window layer
Currently, if the layer shell surface's layer changes, the Window's
layer is not synchronized with it.
2023-05-15 08:32:37 +00:00
Xaver Hugl
8229573e63 autotests/drm: add a test for doing modesets
And fix an issue preventing it from working
2023-05-10 16:29:54 +00:00
Vlad Zahorodnii
dbce106031 wayland: Grab the contents of cursor scene 2023-05-10 15:40:59 +03:00
Vlad Zahorodnii
3d5b5844d0 Drop Cursor::image()
Use CursorSource::image() instead.

Cursor caching in the ScreenCastStream has been changed so
QImage::cacheKey() is not being used. This is rather a preparation for
making kwin grab the contents of the cursor scene.
2023-05-10 11:56:20 +00:00
Xaver Hugl
f60bcfb646 handle laptop lid closing in KWin
Instead of KScreen turning the display off, do that in KWin directly
2023-05-09 15:18:33 +00:00
Xaver Hugl
6e9d5c2cc3 autotests: directly call setVirtualOutputs 2023-05-09 15:18:33 +00:00
Vlad Zahorodnii
1d1ccc3770 autotests: Rework _KDE_NET_WM_SCREEN_EDGE_SHOW test 2023-05-09 08:16:53 +00:00
Vlad Zahorodnii
e6b5cf283e core: Batch pointer input device events
This change introduces InputDevice::pointerFrame(). The main motivation
behind it is to allow batching multiple pointer events within a single
event frame.

BUG: 454428
2023-05-05 10:27:08 +00:00
Vlad Zahorodnii
1f2a060a5e autotests: Remove WAYLAND_ONLY leftovers 2023-05-03 11:40:01 +00:00
Vlad Zahorodnii
0a82f33db5 Drop XCB_ICCCM_FOUND checks
Qt requires xcb-icccm 0.3.9. On the other hand, 0.3.9 contains all the
types and functions used by kwin, so remove the corresponding
XCB_ICCM_FOUND checks to simplify the code.
2023-05-03 11:40:01 +00:00
Vlad Zahorodnii
076493cc05 autotests: Improve running time of testPointerInput 2023-05-03 11:21:53 +00:00
Vlad Zahorodnii
7b6eca612e Stop quick tile combine timer when activating a window
The quick tile test waits 1s to ensure that the quick tile combine timer
is not active. On the other hand, if the active window changes, it makes
sense to reset quick tile combine status. That also lets us get rid of
the QTest::qWait() in QuickTilingTest::testShortcut().
2023-04-28 14:30:49 +00:00
Andreas Cord-Landwehr
258e9d8426 Extend GLX switch to check if QtGui was being built with GLX plugin
Even though epoxy with GLX may be present, Qt's native interface only
exposes GLX API when it was being built with GLX support.
2023-04-27 18:29:51 +00:00
Vlad Zahorodnii
5a42d0ac0e autotests: Drop testDontCrashNoBorder
The test used to verify that kwin doesn't crash when ShellClient sets
new geometry. ShellClient used to access decoration borders without
checking whether decoration() is null.

On the other hand, we've added a bunch of new test cases in
testXdgShellWindow, so let's remove this one. If the bug is back, that
test will fail.
2023-04-24 10:13:58 +00:00
Xaver Hugl
e7c803b7e5 backends/drm: store drm properties directly in drm objects
This makes it possible to ensure type safety for enums, as each drm property
object can have its own type now, and it reduces the amount of typing needed
to access properties
2023-04-23 14:09:29 +02:00
Xaver Hugl
adc5104e2a autotests/drm: disable tests to work around FreeBSD CI issues
The tests don't do anything platform specific, so test only on Linux
until the cause of the problems is found
2023-04-23 14:09:29 +02:00
Vlad Zahorodnii
111e98d24a autotests: Remove render node check in testPointerInput
The test doesn't require OpenGL anymore.
2023-04-22 20:28:59 +03:00
Vlad Zahorodnii
e3bc9e8ac6 autotests: Allow running lockscreen test with software rendering
The test needs OpenGL in order to ensure that the window view effect is
loaded and it registers a screen edge. On the other hand, we could
register a screen edge ourselves and thus allow running the test on
freebsd.
2023-04-22 16:45:40 +00:00
Vlad Zahorodnii
959bb661af autotests: Drop testBufferSizeChange
testXdgShellWindow already tests intricate subsurface size changes. The
surface pixmaps are handled differently now too, so the test is not
useful as it used to be 4 or 5 years ago.
2023-04-22 15:03:19 +00:00
Vlad Zahorodnii
c54a324e99 autotests: Make PointerInputTest::testUnfocusedModifiers() less flaky
While 50ms is enough on dev machines, CI runners can be more loaded and
some events can arrive after more time.
2023-04-22 15:01:20 +00:00
Vlad Zahorodnii
e0da725533 autotests: Fix Test::waitForWindowDestroyed
Before Deleted merge, it used to be equivalent to waiting until the
window is closed.

This fixes tests waiting until the window closing animation completes
and the Window object is destroyed.
2023-04-22 13:55:29 +00:00
Vlad Zahorodnii
9852748a84 autotests: Use software rendering in testPointerInput
testPointerInput requires OpenGL compositing because it wants to test
cursor push back in the window view effect and the window view effect is
available only if OpenGL is supported.

On the other hand, ScreenEdgesTest::testPushBack() already tests similar
scenario, so let's drop relevant test in testPointerInput to allow
running it when using software rendering.
2023-04-22 13:10:11 +00:00
Vlad Zahorodnii
c693450976 backends/virtual: Port to gbm
The virtual backend uses the surfaceless platform. On the other hand, we
move in a direction where the graphics buffer type is explicit, which
creates issues for the virtual backend.

This change ports the virtual backend to gbm so we could manually
allocate dmabuf buffers in order to unify buffer handling in kwin.

Its main drawback is that you won't be able to use the virtual backend
on setups without render nodes. On the other hand, given that the
compositor is meaningless without clients being able to share buffers
with it, it's reasonable to require some way to create and export prime
buffers.
2023-04-22 15:09:59 +03:00
Vlad Zahorodnii
15f6c910be autotests: Fix crash
If a test case is skipped, there will be no input devices.
2023-04-22 09:15:24 +00:00