Commit graph

1854 commits

Author SHA1 Message Date
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
Vlad Zahorodnii
ee31581006 autotests: Remove WAYLAND_ONLY tests
WAYLAND_ONLY will create two tests: one with Xwayland, the other without
Xwayland. This is somewhat wasteful and it results in higher CI times.

On the other hand, Xwayland is started on demand. If a test doesn't need
Xwayland, it won't start.

So let's remove WAYLAND_ONLY in order to lighten kwin on CI resources.
If wayland only tests are needed, we can consider passing the operation
mode to the WAYLANDTEST_MAIN helper, but there aren't such tests afaik.
2023-04-21 14:25:23 +03:00
Xaver Hugl
9915cfc6df wayland: send modifiers to clients under the mouse 2023-04-19 14:19:52 +02:00
Xaver Hugl
57c7eccb32 libkwineffects: extract most useful kwinglplatform bits to a separate class 2023-04-12 15:16:33 +02:00
Vlad Zahorodnii
70353d399d Drop Window::inputGeometry
It's been mostly superseded by Window::hitTest().
2023-03-31 20:44:19 +03:00
Aleix Pol
d0b87a900f screencasting: Add an autotest
Adds an autotest that makes sure a screencasting stream works as
expected.
Adds an optional dependency to KPipeWire only effective to run the test.
2023-03-31 00:19:59 +02:00
Vlad Zahorodnii
712a23bd59 Move Window::desktop to X11Window
Window::desktop() is obsolete. On the other hand, X11 doesn't support
having a window on several virtual desktops, so we still need it. As a
compromise, this change moves it to X11Window instead.
2023-03-30 18:42:28 +00:00
Vlad Zahorodnii
aebc361c45 Drop Window::isOnDesktop(int) 2023-03-30 15:42:31 +00:00
Vlad Zahorodnii
3e766e8d5e Move Window::{frameId,window} to X11Window 2023-03-29 13:18:01 +03:00
Vlad Zahorodnii
dbbcf31d0d x11: Merge Unmanaged into X11Window
Currently, managed and override-redirect windows are split in two types:
X11Window and Unmanaged. While looking at it strictly from type
perspective, this is great. But it creates other problems, e.g. we need
to put shared X11-specific code in the base Window class or mess with
"base" classes.

As an alternative solution, this change merges the Unmanaged class into
the X11Window class and disables some functionality based on the value
of isUnmanaged().

X11Window::manage() is used to create a managed Window. X11Window::track()
is used to create an unmanaged Window.
2023-03-28 18:14:32 +00:00
Vlad Zahorodnii
e31ec802f4 Drop Deleted
Currently, the normal window lifecycle looks as follows: create Window,
wait until it's shown, add it to Workspace, wait until it's closed,
create a Deleted, copy properties from the original window to the
deleted one, destroy the original window, wait until the last deleted
window reference is dropped.

There are a couple of issues with this design: we can't nicely
encapsulate X11 or Wayland specific implementation details if they need
to be accessed for closed windows; manual copying of properties is
cumbersome and error prone and we've had a dozen of cases where effects
worked incorrectly because some properties had not been copied.

The goal of this patch is to drop Deleted and extend the lifetime of the
original window, but with a special state set: Window::isDeleted().

The main danger is that somebody can try to do something with deleted
windows that they should not do, but on the other hand, such code needs
to be guarded with relevant checks too.
2023-03-28 08:31:08 +00:00
Vlad Zahorodnii
a9ad59b32a Improve Workspace::outputAt()
Workspace::outputAt() casts vectors to four rectangle corners and uses
the shortest one to decide which output is the closest to the given
point.

This works poorly on dual monitor setups where on the left side you have
a monitor with landscape orientation and one with portrait orientation
on the right hand side. In that case, outputAt() will prefer the left
monitor even though the right monitor is the closest one if you cast a
perpendicular from the given point to the right monitor.

In order to improve the handling of that case, this change makes
Workspace::outputAt() compute the closest point to the output geometry
rectangle and use the squared distance as the score.
2023-03-25 21:24:59 +00:00
Vlad Zahorodnii
1211d8e3d6 Prefix more kwineffects includes with libkwineffects/ 2023-03-25 21:05:12 +00:00
Vlad Zahorodnii
c5eabfa4d1 tabbox: Drop TabBoxClient
The indirection contributes unnecessary complexity. The usage of
std::weak_ptr and std::shared_ptr complicates the things further, e.g.

![Screenshot_20230325_170226](/uploads/d8b68a9eff47c93c4463bb230b5bbe49/Screenshot_20230325_170226.png)

---

Ideally, same should be done with TabBox and TabBoxHandler, but that can be done in another MR.
2023-03-25 20:46:54 +00:00
Xaver Hugl
67dc0c5c48 backends/drm: restrict common mode generation to drivers that support scaling
Also set the scaling mode property to "full aspect", which should reduce
the number of cases where the feature can cause issues
2023-03-25 18:52:15 +01:00
Vlad Zahorodnii
cf1d66ef59 tabbox: Drop support for _KDE_FIRST_IN_WINDOWLIST
LXR search shows that _KDE_FIRST_IN_WINDOWLIST is not used anywhere in
KDE codebase besides KWin.
2023-03-25 11:14:09 +00:00
Vlad Zahorodnii
1f43605329 Drop Workspace::clientList() 2023-03-24 22:28:46 +00:00
Vlad Zahorodnii
4a1e7df599 tabbox: Drop desktop switching
Tabbox supports two operation modes: switching between windows and
desktops. Switching between windows is more commonly used. Desktop
switching is not exposed in user settings and it requires some advanced
knowledge of kwin's internals to enable it.

On the other hand, over the past years, we've double downed on effects
like desktop grid and overview to provide graphical means to switch
between virtual desktops.

This change drops desktop switching because it's effectively unused to
simplify the tabbox code, which can be very handy for the future
refactorings of window switching.
2023-03-24 22:01:12 +00:00
Vlad Zahorodnii
e88a4e34a3 Remove some include_directories()
It seems we've settled on dir/dir/header.h includes, so let's use them
consistently.
2023-03-23 14:37:48 +02:00
Vlad Zahorodnii
49607b6eab cmake: Tidy scripted effect CMakeLists.txt code 2023-03-21 07:18:27 +00:00
Xaver Hugl
a60d8941b6 port more stuff to standard smart pointers 2023-03-20 14:16:37 +01:00
Xaver Hugl
3e94a3945c src/tabbox: port to standard smart pointers 2023-03-20 14:05:29 +01:00
Xaver Hugl
e83c593fda adapt to kdecoration changes 2023-03-19 15:26:15 +00:00
Vlad Zahorodnii
8f21d444c6 Make Workspace::allClientList() return all windows
Currently windows are scattered in a few separate lists. If you need to
go through the windows, you have to do it piece by piece. On the other
hand, with the overhaul of window types, we've started converging
towards one universal type: Window. Keeping windows in the separate
buckets goes against this design.

Workspace::stackingOrder() already contains all windows. This change
repurposes Workspace::allClientList() from a list of "normal" windows to
all windows, i.e. Workspace::windows(), to be consistent.

There's one API change though. Scripting API will expose other window
types too. This is an intentional change so scripted effects could
operate with all windows. It also matches the current behavior observed
in libkwineffects, which exposes all windows as well.
2023-03-15 11:52:01 +00:00
Xaver Hugl
f433213bd6 backends/drm: simplify how atomic commits are done
Instead of having every DrmProperty store pending values, store the data
for the next commit in a separate and temporary type. This simplifies the
code and makes it possible to do commits in a separate thread
2023-03-15 12:09:12 +01:00
Xaver Hugl
d9077e36c5 backends/drm: use a common base class for property blobs
This simplifies the code a bit and makes more generic handling of blobs
possible
2023-03-14 19:23:17 +01:00
Vlad Zahorodnii
7aa89944d7 Fix -Wambiguous-reversed-operator
`this` must be const to match the const-ness of the other mode.
2023-03-14 17:46:57 +02:00
Vlad Zahorodnii
c91b90c58a Tidy Window::windowClosed() signal
"window" is redundant, so remove it. Also remove the original window
argument to improve the API consistency.
2023-03-14 07:15:56 +00:00
Vlad Zahorodnii
2f56cdc3fe Replace Deleted with Window where possible
With this, Window and Deleted can be interchanged, which makes merging
the two easier.
2023-03-13 14:41:44 +02:00
Vlad Zahorodnii
149db99c6a Make Window ref'able 2023-03-13 14:41:44 +02:00
Vlad Zahorodnii
995d509e45 Allow destroying Deleted immediately
Currently Deleted are destroyed with a delay to avoid dangling pointers
within the middle of painting.

On the other hand, it's reasonable to require not to delete windows when
kwin starts painting the screen.

Over the years, we refactored how deleted windows. They are always
unreferenced after finishing the current frame. So it should be fine to
destroy Deleted immediately now.
2023-03-13 14:41:41 +02:00
Vlad Zahorodnii
4148be0d27 Port to versionless QML module imports
It's more convenient and Qt upstream seems to encourage to use it too,
e.g. example import statements have no version.
2023-03-12 14:18:34 +00:00
Vlad Zahorodnii
18a9b3b25a Adjust to KDecoration API changes 2023-03-12 13:29:36 +00:00
Vlad Zahorodnii
86e1305e80 rules: Make wmclass matching case sensitive
WM_CLASS is case sensitive.
2023-03-10 14:16:32 +00:00
Xaver Hugl
e4938297e6 scene: fix texture inversion with the drm backend
Specify the render target to buffer transformation and take that into
account in effects and when calculating the projection matrix.
2023-03-09 13:22:53 +00:00
Xaver Hugl
2417a0381f backends/drm: port from gbm_surface to a custom swapchain using gbm buffers 2023-03-09 13:22:53 +00:00
Vlad Zahorodnii
c1eca80190 wayland: Remove implicit slide constraint adjustment
Panel sets constraint adjustments so let's remove the implicit slide
constraint adjustment to adhere more closely to the spec.
2023-03-09 13:05:42 +00:00
Natalie Clarius
4f617e90b8 placement: add autotests for cascade if covering 2023-03-08 19:04:57 +00:00
Vlad Zahorodnii
0c0605abb9 Merge Window::minimize and Window::unminimize
Code of Window::minimize() and Window::unminimize() is mostly the same
with the exception of some state checks, so merge the two to tidy the
code.
2023-03-07 12:20:07 +00:00
Vlad Zahorodnii
9720a6ee84 Remove window argument in Window's maximize signals
Either use QObject::sender() or capture the window using a lambda.
2023-03-07 10:31:25 +02:00
Vlad Zahorodnii
b099ad8ade Drop deprecated Qt::AA_UseHighDpiPixmaps
Qt::AA_UseHighDpiPixmaps has no any effect now.

We used to rely on the fact that Qt::AA_UseHighDpiPixmaps is disabled by
default in Qt 5 in kwin_x11. It's not clear what to do about it now.
2023-03-03 08:36:14 +00:00
Vlad Zahorodnii
06d195980b autotests: Drop night color test
It doesn't test anything useful. It's hard to make it test useful things
too due to needing to change the system time. Linking with it also
breaks the encapsulation and it won't work when using MODULE library.
2023-03-01 15:50:10 +00:00
Hannah Kiekens
0543949df7 Enable GLSL for Mali (Lima) / PinePhone devices
Commit 88cf8355 changed the behaviour of Mali (Lima) / PinePhone devices by disabling GLSL
88cf8355 got backported in 5.27.1 and broke PinePhone devices (White rectangle on topright quarter of a black screen)

This patch restores the behaviour of 5.27.0
2023-02-28 21:04:37 +00:00
Vlad Zahorodnii
10df3b0eb0 Remove Qt 5 specific code 2023-02-28 18:30:26 +02:00
Vlad Zahorodnii
d9f5d432be Port to KF6 2023-02-28 18:30:26 +02:00
Vlad Zahorodnii
3809a2712b tabbox: Remove unused arg in DesktopChainManager::addDesktop() 2023-02-25 21:22:40 +00:00
Vlad Zahorodnii
d79a4a1daa Make VirtualDesktopManager::currentChanged pass VirtualDesktop
It fixes the remaining usage of int desktop ids in Workspace, ignoring
Workspace::setInitialDesktop().
2023-02-25 21:22:40 +00:00
Vlad Zahorodnii
ad330924e2 Rename Window::desktopChanged()
We have Window::desktops(), so rename the signal to match it.
2023-02-25 13:15:06 +00:00
Vlad Zahorodnii
282e2dfbde Ensure that the current virtual desktop cannot be null
VirtualDesktopManager::currentChanged() can be emitted with
previousDesktop being null/0. It can happen only on startup. After that,
it's always valid. In order to make the code that uses the
currentChanged signal less trickier, ensure that the current virtual
desktop is initialized when the virtual desktop config is loaded.
2023-02-25 11:50:23 +02:00
Vlad Zahorodnii
03e098204f Port Workspace::sendWindowToDesktop to VirtualDesktop 2023-02-24 10:32:41 +02:00
Vlad Zahorodnii
0dec5e3f20 Merge Window::client{Minimized,Unminimized} with Window::minimizedChanged
This merges Window::clientMinimized() and Window::clientUnminimized()
signals with the Window::minimizedChanged() signal to simplify some
code.

The avoid animation flag has been dropped because its main usage is to
avoid playing animation during window initialization. But it's not possible
to trigger minimize animation at that moment. API-wise it's better to avoid
having such flags too and rely on surface role to decide whether to play a
given animation.
2023-02-23 22:33:26 +00:00
Vlad Zahorodnii
b53621136d Drop Window::desktopPresenceChanged()
This signal exists as a convenience helper, but it's not always emitted
as it's advertised to work. Instead of fixing it, let's drop the signal
to simplify virtual desktop code. Its effects can be accomplished by
monitoring Window::desktopChanged() and VirtualDesktopManager::currentChanged()
signals in effects and scripts where needed.
2023-02-23 22:10:37 +00:00
Vlad Zahorodnii
a2062090eb Rename interactive move resize lifecycle signals
Add the "interactive" word to be consistent and put "started",
"stepped", and "finished" at the end of signal names where they are more
expected.
2023-02-23 11:38:34 +00:00
Vlad Zahorodnii
8bb2d52972 Rename Window::clientMaximizeStateChanged signal
Make it shorter to be more readable.
2023-02-23 09:17:47 +00:00
Vlad Zahorodnii
88c974835c Drop duplicate clientMaximizedStateChanged signal 2023-02-23 09:17:47 +00:00
Xaver Hugl
520fa3042a pointer input: always confine pointer to screens
Checking if the pointer needs to be confined before doing `std::clamp` on
the position is useless and causes problems. With this change, the pointer
will always be confined to exactly the screen, without any fractional offsets.

BUG: 461911
2023-02-22 19:01:22 +00:00
Vlad Zahorodnii
e0062f675d Port away from QRectF::contains()
QRectF::contains() considers right and bottom edges inside the
rectangle, but the relevant code has the opposite expectations.
2023-02-21 19:45:51 +00:00
Xaver Hugl
4cd25cf571 cursor: make position, hotspot and size floating point
This allows all pixel positions to be used on high dpi screens,
and corrects damage tracking with Xwayland cursors

CCBUG: 466094
2023-02-20 21:01:39 +00:00
Vlad Zahorodnii
70a063a34c scripting: Rename ScreenEdgeItem to ScreenEdgeHandler
ScreenEdgeItem is not an item, so rename it to something else. "Handler"
is inspired by QtQuick, e.g. TapHandler.
2023-02-17 13:19:29 +02:00
Vlad Zahorodnii
72b7bda18e scripting: Drop Window.geometry property 2023-02-16 07:42:54 +00:00
Tomasz Paweł Gajc
88cf83554f add support for Lima, V3D, VC4 (based on https://github.com/OpenMandrivaAssociation/kwin/blob/master/kwin-5.21.4-add-support-for-panfrost-driver.patch made by Bernhard Rosenkraenzer) and update list of supported devices for Panfrost 2023-02-15 11:23:02 +00:00
Vlad Zahorodnii
f71ee59a37 Port away from Cursor::setPos()
Use input device specific apis to change the position of the cursor. The
main reason to do so is to break the assumption that Cursor position is
the same as pointer position, which I would like to rely on later to
merge tablet and pointer cursors.
2023-02-13 14:17:10 +02:00
David Redondo
cc4d99aea4 Fix button to Qt::MouseButton mapping
Even though the names seem to match, QtWayland maps button values
to enum values in ascendung order (as it does on X11). The wrong
mapping is usually not a problem because we send the native button
events to clients. However when the Qt names or values are used
for communication between KWin and a client this leads to
misunderstandings.
BUG:465463
FIXED-IN:5.27.1
2023-02-10 09:27:37 +00:00
Vlad Zahorodnii
20487c7cda effects: Drop legacy EffectsHandler::desktopChanged overloads 2023-02-07 18:10:52 +02:00
David Edmundson
2ca4627207 Autotests: Dont warp cursor before X is available kwin side 2023-02-06 16:24:01 +00:00
David Edmundson
466f2fe8ba Launch xwayland on demand
This installs a socket notifier onto our xwayland socket, when a user
connects we launch xwayland. The client then connections once kwin has
established itself as the compositor.

For a full desktop plasma session this patch effectively does nothing
too useful as we still start kcminit and make xrdb calls on startup
which in turn will launch X, but for the same reason this patch should
be harmless now as we're still processing the xrdb calls before any
clients will connect.
2023-02-06 16:24:01 +00:00
David Edmundson
29b456ff25 Autotests: Use a helper method to create X11 connection 2023-02-06 16:02:50 +00:00
Vlad Zahorodnii
271de0ccc6 scripts: Port some scripts to org.kde.kwin v3 qml api 2023-02-03 17:22:16 +00:00
Xaver Hugl
1746af4b02 gesture: use the global direction enums 2023-02-02 16:21:36 +00:00
Xaver Hugl
a9334cb9c6 unify touchpad gesture APIs
There don't need to be separate functions for real time and not real time
2023-02-02 16:21:36 +00:00
Vlad Zahorodnii
e5901070cc Drop support for _KDE_NET_WM_TEMPORARY_RULES
It's an obscure feature, which perhaps not worth putting an effort to
make it work on wayland and x11.
2023-02-02 15:34:24 +00:00
Xaver Hugl
58fdbbc444 autotests/integration: test restoration of window states on moveresize cancel 2023-01-24 11:39:02 +00:00
Xaver Hugl
3d1101d5ff autotests/integration: fix decoration input test 2023-01-18 19:15:29 +01:00
Aleix Pol
a5aaa9e3c4 org.kde.KWin: Expose a window's UUID
Exposes a Window's UUID so that it can be used with other APIs like
window management or screencasting.
2023-01-13 17:51:36 +01:00
Vlad Zahorodnii
9b0758ea71 autotests: Remove weird qwait in pointer input test 2023-01-12 11:40:26 +00:00
Vlad Zahorodnii
7a8bb01323 autotests: Make testStruts quicker
As far as I can tell, there's no reason to add an artificial delay of
50ms, which repeated 100 times accumulates to 5 seconds.
2023-01-12 10:44:31 +00:00
Vlad Zahorodnii
1c3610413d autotests: Make testPlasmaWindow quicker
Before

    Executed in   10.79 secs    fish           external
       usr time    4.85 secs  918.00 micros    4.85 secs
       sys time    0.62 secs  119.00 micros    0.62 secs

After

    Executed in    1.45 secs      fish           external
       usr time  941.63 millis  486.00 micros  941.14 millis
       sys time  578.99 millis   62.00 micros  578.93 millis
2023-01-12 10:08:43 +00:00
Vlad Zahorodnii
9751aca548 autotests: Make testNoGlobalShortcuts quicker 2023-01-12 09:49:40 +00:00
Vlad Zahorodnii
f04ad754ce autotests: Make testX11Window quicker
Before

    Executed in   17.39 secs      fish           external
       usr time  422.91 millis    1.92 millis  420.99 millis
       sys time  586.41 millis    0.22 millis  586.19 millis

After

    Executed in    1.23 secs      fish           external
       usr time  395.63 millis    0.00 millis  395.63 millis
       sys time  228.55 millis    2.13 millis  226.42 millis
2023-01-12 09:23:43 +00:00
Vlad Zahorodnii
e689ab5ebd autotests: Make testSlidingPopups quicker
The test waits longer than needed to determine whether effects stopped
playing animations

Before

    Executed in   22.41 secs      fish           external
       usr time  997.42 millis  722.00 micros  996.70 millis
       sys time  744.81 millis   79.00 micros  744.73 millis

After

    Executed in    9.71 secs      fish           external
       usr time  894.42 millis    1.03 millis  893.38 millis
       sys time  689.80 millis    0.11 millis  689.69 millis
2023-01-12 07:48:54 +00:00
Vlad Zahorodnii
773d8c61b1 autotests: Reduce execution time of testLockScreen
testLockScreen uses !eventSpy.wait() expression to check whether the
given signal is emitted. QSignalSpy::wait()'s default timeout is 5s,
which is too much. We don't need to wait that much, in fact, even
wl_display_sync() would suffice. In either case, let's pass explicit
timeout of 10ms which should be good enough.

Before

    Executed in   60.49 secs    fish           external
       usr time    3.92 secs    1.03 millis    3.92 secs
       sys time    2.29 secs    0.16 millis    2.29 secs

After

    Executed in   19.38 secs    fish           external
       usr time    1.64 secs  347.00 micros    1.64 secs
       sys time    1.15 secs   54.00 micros    1.15 secs
2023-01-11 21:39:30 +00:00
Xaver Hugl
00c0f29f8e autotests/drm: add test that verifies extending output lifetimes works 2022-12-30 14:53:45 +00:00
Xaver Hugl
f6b6d3051b use std::chrono::microseconds for time in input events 2022-12-21 21:07:15 +01:00
Vlad Zahorodnii
6c71bfd800 scene: Rename Scene to WorkspaceScene
Currently, the Scene class is used to represent the contents of the
Workspace so rename it to match its usage.
2022-12-21 11:49:07 +02:00
Vlad Zahorodnii
f7a8635b10 Move scene related bits into src/scene/ directory
We've got quite a few scene related files, move them in a directory to
group related code together.
2022-12-16 19:15:35 +00:00
David Edmundson
c4b134da8d Implement wp-fractional-scale-v1
This allows clients to provide buffers at native resolutions when
fractional scaling is used.

Virtual backend is adjusted to support scales as floats
2022-12-12 12:16:18 +00:00
Natalie Clarius
0053c782a1 quick tiling: find target output by direction 2022-12-08 18:59:44 +00:00
Natalie Clarius
b6412454c2 placement: remove cascaded placement policy
becomes redundant with cascade-if-covering for zero-cornered placement
2022-12-02 14:05:32 +00:00
Marco Martin
e4507861f7 Custom quick tiling with configuration ui
* Allow to do quick tiling to custom tile geometries, windows will be snapped to tiles when dragged with the shift modifier pressed.
* Tile geometries are screen specific.
* The global shortcut Meta+T will trigger a fullscreen configuration ui as a QML effect for the tiles which allows to add, remove and resize tiles
* UI and behavior is a bit similar to the Windows Fancy Zones addon: https://docs.microsoft.com/en-us/windows/powertoys/fancyzones
* Its main scope is to help the workflow with very big monitors, especially ultra wide ones, where most application don't make sense maximized to the full screen (eventually also support games to be full screened to a given tile instead of the whole screen)
* it should get also some bindings for scripting, as its ain goal is not to replicate other popular tiling window managers, but should give the popular kwin tiling scripts to have a more robust infrastructure
* it will eventually get support for a set of predefined layouts, but this is for a second phase

BUG: 438788
2022-12-01 14:39:22 +00:00
Xaver Hugl
a054093580 qAbs -> std::abs 2022-11-22 09:27:23 +00:00
Xaver Hugl
681368d4cc VirtualDesktopManager: clean up API a bit
Using templates brings nothing except complexity here
2022-11-18 23:35:31 +01:00
Vlad Zahorodnii
64a6a70b3e autotests: Use fewer Window::clientPos() 2022-11-18 16:31:37 +00:00
Vlad Zahorodnii
12acd9bb78 autotests: Port away from OutputBackend::setInitialWindowSize() 2022-11-17 14:20:44 +00:00
Xaver Hugl
34aa734c7b plugins: use more std::unique_ptr 2022-11-15 15:28:37 +00:00
Xaver Hugl
435873a19b autotests/drm: add more test cases for mode generation 2022-11-10 16:07:52 +00:00
Vlad Zahorodnii
b830d408af core: Rename Platform to OutputBackend 2022-11-10 10:10:28 +02:00
Vlad Zahorodnii
72883df2aa core: Move workspace bits from Platform to Application
Platform will become OutputBackend so some workspace bits, e.g. the
effects handler, have to move a layer above.
2022-11-10 10:10:28 +02:00
Vlad Zahorodnii
482741499d autotests: Reduce the number of "using namespace KWayland::Client"
KWayland::Client has ambiguous type names such as "Compositor" or
"Output". Use full types to improve code readability.
2022-11-08 13:34:58 +00:00
Vlad Zahorodnii
d257da0a00 Use StrutRects to represent restricted areas
This saves us some StrutRects -> QRegion conversions and it might be
useful for floating point struts.
2022-11-03 13:53:41 +00:00
Xaver Hugl
3d9618316b autotests/integration: add more cases to OutputChangesTest 2022-11-02 17:58:29 +00:00
Vlad Zahorodnii
a235cd6d26 build: Hardcode kwin name
We use KWIN_NAME, KWIN_INTERNAL_NAME_X11 and KWIN_INTERNAL_WAYLAND
properly only in a few places. In other, we use hardcoded names.

Let's not bother and hardcode kwin names everywhere rather than have one
foot in and one foot out, it's simpler.
2022-11-02 10:21:23 +00:00
Vlad Zahorodnii
1801421080 Forward declare Xkb in keyboard_input.h 2022-11-02 09:21:55 +00:00
Vlad Zahorodnii
89607dfebd qAsConst -> std::as_const
We started using std::as_const() in some parts of kwin, so let's use it
everywhere for the code consistency sake.
2022-11-01 16:52:01 +02:00
Vlad Zahorodnii
b0d04895cc build: Link testOpenGLContextAttributeBuilder with epoxy::epoxy 2022-10-31 21:27:30 +00:00
Vlad Zahorodnii
7fffe99328 build: Add -Wno-unused-parameter compiler option
Due to being a compositor, kwin has to conform to some certain
interfaces. It means a lot of virtual functions and function tables to
integrate with C APIs. Naturally, we not always want to use every
argument in such functions.

Since we get -Wunused-parameter from -Wall, we have to plumb those
unused arguments in order to suppress compiler warnings at the moment.

However, I don't think that extra work is worth it. We cannot change or
alter prototypes in any way to fix the warning the desired way. Q_UNUSED
and similar macros are not good indicators of whether an argument is
used too, we tend to overlook putting or removing those macros. I've
also noticed that Q_UNUSED are not used to guide us with the removal no
longer needed parameters.

Therefore, I think it's worth adding -Wno-unused-parameter compiler
option to stop the compiler producing warnings about unused parameters.
It changes nothing except that we don't need to put Q_UNUSED anymore,
which can be really cumbersome sometimes. Note that it doesn't affect
unused variables, you'll still get a -Wunused-variable compiler warning
if a variable is unused.
2022-10-31 15:50:37 +00:00
Xaver Hugl
3d7e926c94 autotests/drm: add autotest for common modes 2022-10-31 12:49:25 +00:00
Aleix Pol
8417492781 Include org.freedesktop.locale1 support
Makes it possible to follow the dbus service for locale configuration,
making it possible to have third parties integrate with Plasma.

This is done opt-in for now, it can be adopted generally in the future,
if necessary.
2022-10-30 23:03:55 +01:00
Vlad Zahorodnii
9774eacbbe Remove ServiceTypes info
Binary plugins don't need it. KPackage packages have "KPackageStructure"
property instead.
2022-10-28 06:58:44 +00:00
Vlad Zahorodnii
6b253074f3 autotests: Drop testSceneQPainter
The entire approach behind that test is wrong. Even slight changes in
one pixel can make the test fail. There's no human-friendly way to
determine what the difference between reference and actual frames are.
The reference frame is generated in code rather than from an image on
the disk, which makes the tests even more error-prone.

The test is flaky too and constantly blocks merging patch submissions.

We need a different way to test rendering results, not what
testSceneQPainter currently does. Normally, I would say that we need
to add such an infrastructure before dropping the test, but it makes the
merging process so inconvenient and the test doesn't really bring any
value, it tests really basic cases which are noticeable right away after
launching kwin.
2022-10-26 14:08:38 +00:00
Vlad Zahorodnii
a4cb0e7fd8 Forward declare QAction in src/input.h 2022-10-26 07:04:47 +00:00
Vlad Zahorodnii
daa351a398 Remove KGlobalAccel bits from Platform
With the addition of KGlobalAccel::globalShortcutActiveChanged(),
there's a way to monitor all triggered actions without adding any
boilerplate code.

This change removes the KGlobalAccel bits from the Platform class. This
reduces the amount of boilerplate code; currently we need to be careful
about ensuring that Platform::setupActionForKGlobalAccel() is called.
Another reason behind this change is to simplify the api of Platform and
remove things that don't have anything to do with outputs.
2022-10-26 07:04:47 +00:00
John Brooks
a1191bea18 wayland: Fix missing relative motion events
Use isNull on QSizeF to check for a zero delta instead of comparing it
with a default-constructed QSizeF, which in practice initializes to
(-1.0,-1.0). This caused relative motion events to be omitted if the
delta happened to be equal to (-1.0,-1.0), causing mouse jumping in some
applications.

BUG: 444510

Signed-off-by: John Brooks <john@fastquake.com>
2022-10-25 08:18:45 +00:00
Weng Xuetian
84f54e9ffa Implement a enableRequested signal for text-input-v3
The signal will be emitted if text-input-v3 applies a new enable state
if it's already enabled.

In Gtk's implementation, sending text_input_v3.enable for the second
time has the similar semantics of text-input-v2.showInputPanel. Try to
connect them together and add corresponding test.

See also: a95cfb1c45/gtk/gtkimcontextwayland.c (L555)
2022-10-25 04:34:26 +00:00
Kai Uwe Broulik
1393f524ff test_utils: Test whether mmap PROT_WRITE fails
Writing is what our guard is supposed to prevent, let's try to mmap it
for writing. It seems FreeBSD still allows PROT_READ for sealed-for-writing
mmaps.
2022-10-24 19:02:36 +02:00
Xaver Hugl
7da79f5ec4 autotests/integration: make inputmethodtest more realstic
When text input gets enabled, the sequence should be
1. enable
2. request to show the panel
3. panel gets added and shown

And showing the panel again after hiding is an important case to cover as
well.
2022-10-24 10:53:57 +00:00
Vlad Zahorodnii
5a227bf69d Make Compositor responsible for locking compositing type
It's something that Compositor cares, not necessarily the output backend.
2022-10-24 08:02:27 +00:00
Xaver Hugl
d628cc90fa autotests/drm: use std::vector instead of malloc 2022-10-23 22:14:13 +00:00
Vlad Zahorodnii
638edf9bd6 autotests: Fix testXkb in Qt 6 build
The mapping between XKB_KEY_XF86MyComputer and Qt::Key_Launch0 has
been fixed in qt 6, so we need to adjust the test.
2022-10-23 09:11:04 +00:00
Vlad Zahorodnii
fdfa2ad403 autotests: Reorder keys in the test table in testXkb
It's easier to read.
2022-10-23 09:11:04 +00:00
Vlad Zahorodnii
64dc8d7cfe autotests: Fix testGlobalShortcuts in Qt 6 build
QXkbCommon fails to map `Ё` to `~` when pressing `Shift+grave` and
sequenceEdit seems to have focus now.

On the other hand, does it make sense to bind global shortcuts with key
sequences such as "Shift+`"? The system settings doesn't even allow typing
in such key sequences.
2022-10-23 08:41:34 +00:00
Vlad Zahorodnii
774426d2ad autotests: Fix testXwaylandInput in Qt 6 build
The test fails because of type mismatches between QPoint and QPointF, Qt
5 is not so strict about this.
2022-10-23 00:26:54 +03:00
Vlad Zahorodnii
13d88081d3 Change type of Window.wmCommand and Window.wmClientMachine to QString 2022-10-22 13:38:36 +00:00
Vlad Zahorodnii
adbcb6a1a0 Change type of Window.desktopFileName to QString 2022-10-22 13:38:36 +00:00
Vlad Zahorodnii
aa838e1c02 Change type of Window.resourceName, Window.resourceClass, and Window.windowRole to QString
testDbusInterface fails with Qt 6 build because QCOMPARE detects the
type difference between QString and QByteArray.

Since these properties being byte arrays has caused reasonable amount of
discomfort, let's make them QStrings. It will fix the test and make some
scripted effect code more cleaner.
2022-10-22 13:38:36 +00:00
Volker Krause
346ac6f32b Add Qt 6 FreeBSD CI 2022-10-22 12:34:49 +00:00
Vlad Zahorodnii
583b7b4df9 autotests: Fix PointerInputTest in Qt 6 build
PointerInputTest::testWarpingBetweenWindows() compares
QVariant(QPointF) with QPoint. While this works in Qt 5, Qt 6 seems to
take the type into account when comparing the two.
2022-10-21 22:28:33 +00:00
Vlad Zahorodnii
6e5267551e autotests: Fix TestXdgShellWindow in Qt 6 build
TestXdgShellWindow::testPointerInputTransform() compares
QVariant(QPointF) with QPoint. While this works in Qt 5, Qt 6 seems to
take the type into account when comparing the two.
2022-10-22 00:45:12 +03:00
Weng Xuetian
90df07157b Fix potential race condition when text input state change and focus change happened at the same time
In some cases, stateCommitted may fire after a new surface being focused
and in correctly set input method to be inactive. This can be reproduced
by switch client between an active text input v3 client and text input
v2 client.
2022-10-21 19:14:41 +00:00
Vlad Zahorodnii
495e127d07 autotests: Fix windowquadlist with Qt 6
In Qt 6, container.count() returns a qsizetype, on the other hand
expectedCount is int. That type difference makes QTEST panic.
2022-10-21 17:26:47 +00:00
Xaver Hugl
a587e426f8 add autotest for the drm platform 2022-10-21 17:54:55 +02:00
Vlad Zahorodnii
ae01354638 autotests: Remove invalid cases in testScreens
The Workspace requires at least one output and no output has 0x0 size.

This fixes a crash in confineToBoundingBox() where qBound() asserts that
the min value is less than the max value, in our case the x coordinate
of the left edge of the workspace is less than the x coordinate of the
right edge of the workspace.
2022-10-21 17:03:59 +03:00
Vlad Zahorodnii
de3aa69c1e Fix some tests not building with Qt 6
Client-side wrappers for input-method-unstable-v1 fail to build because
wl_keyboard_interface is referenced in the header file generated by
wayland-scanner.

Unfortunately, qt6_generate_wayland_protocol_client_sources() forces
--include-core-only argument, this is addressed in Qt 6.4.1, but in
meanwhile let's ship a copy of Qt6WaylandClientMacros.cmake file until
the required Qt version is out.
2022-10-20 09:37:00 +00:00
Vlad Zahorodnii
7734676aa1 autotests: Drop DontCrashCursorPhysicalSizeEmpty
wl_cursor is no longer used to load cursors on server side so the test
is irrelevant now.
2022-10-20 06:18:30 +00:00
Vlad Zahorodnii
187f556f85 Drop Screens 2022-10-19 13:29:39 +00:00
Vlad Zahorodnii
c147340878 wayland: Add support for high resolution scrolling
In libinput 1.19, three new pointer axis events were added in order to
provide support for high-resolution scrolling.

LIBINPUT_EVENT_POINTER_AXIS is de-facto deprecated and new users of
libinput should use instead SCROLL_WHEEL, SCROLL_FINGER, and
SCROLL_CONTINUOUS.

Discrete deltas were replaced with v120 delta values. 120 corresponds to
a single discrete delta. Smaller values correspond to "partial" wheel
ticks.

https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/72
2022-10-11 14:04:13 +03:00
Vlad Zahorodnii
eedbde464e utils: Drop updateXTime() 2022-10-11 06:43:25 +00:00
Xaver Hugl
e482556d58 screenedge: modernize some code 2022-10-07 14:50:10 +02:00
Vlad Zahorodnii
9d53f2d29c autotests: Add missing setVirtualOutputs calls 2022-10-06 18:04:35 +00:00
Vlad Zahorodnii
2048e40d19 autotests: Extend OutputChangesTest with more cases
This change extends the OutputChangesTest so it also covers the cases
where a maximized and a fullscreen window is moved back to its original
output when it's hotplugged.
2022-10-04 15:21:00 +00:00
Xaver Hugl
a056ef3f56 autotests: fix InputMethodTest 2022-09-24 20:21:48 +00:00
Vlad Zahorodnii
106d061255 autotests: Remove WaylandTestApplication::continueStartupWithScreens step
Makes startup sequence similar to the one in kwin_wayland.
2022-09-15 06:56:13 +00:00
Vlad Zahorodnii
6d3f00e82c autotests: Remove QVERIFY(signalSpy.isValid())
We use the PMF syntax so the isValid() check is unnecessary as the
compiler will notify about wrong signal at compile time. It makes
writing autotests feel less boilerplaty.
2022-09-14 09:21:29 +00:00