Commit graph

1854 commits

Author SHA1 Message Date
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
Vlad Zahorodnii
b001741634 autotests: Add tests that check geometry restore after sending a window to another output 2022-09-14 11:01:34 +03:00
Vlad Zahorodnii
0dc4293059 autotests: Add basic test cases for testing placement tracker 2022-09-14 10:19:20 +03:00
Vlad Zahorodnii
7b7a179396 autotests: Add more test cases in OutputChangesTest
It adds more test cases in OutputChangesTest, particularly swapping
outputs.

Swapping outputs is an interesting case because outputs can temporarily
overlap so workspace()->outputAt() can return wrong output and the
window is going to stick to wrong output.
2022-09-14 06:17:58 +00:00
Vlad Zahorodnii
9c56adf8f2 autotests: Hopefully stabilize testInputMethod 2022-09-12 08:32:06 +00:00
Vlad Zahorodnii
d1de19e212 Make Workspace process batched output updates
Currently the Workspace processes output updates as they occur, e.g.
when the drm backend scans connectors, the Workspace will handle
hotplugged outputs one by one or if an output configuration changes the
mode of several outputs, the workspace will process output layout
updates one by one instead of handling it in one pass. The main reason
for the current behavior is simplicity.

However, that can create issues because it's possible that the output
layout will be temporarily in degenerate state and features such as
sticking windows to their outputs will be broken.

In order to fix that, this change makes the Workspace process batched
output updates. There are several challenges - disconnected outputs have
to be alive when the outputsQueried signal is emitted, the workspace
needs to determine what outputs have been added or removed on its own.
2022-09-12 08:03:48 +00:00
Vlad Zahorodnii
e0945886ed Rename Platform::screensQueried() to Platform::outputsQueried()
It makes the vocabulary consistent. We use the word "output" more than
"screen."
2022-09-12 08:03:48 +00:00
Vlad Zahorodnii
38600a6235 Revert "Merge gesture structs/enums"
This reverts commit d29c7a6c2b.

It was pushed with unreviewed changes and not fully resolved issues.
2022-09-11 13:14:11 +03:00
Vlad Zahorodnii
db1ec66eb1 Revert "Move gesture direction to base class"
This reverts commit 634182d489.

It was pushed with unreviewed changes and not fully resolved issues.
2022-09-11 13:14:10 +03:00
Vlad Zahorodnii
e3df43c701 Revert "Add new gestures and improve naming clarity in gesture.h"
This reverts commit bc15b72e3d.

It was pushed with unreviewed changes and not fully resolved issues.
2022-09-11 13:14:08 +03:00
Vlad Zahorodnii
d23781d87a Revert "Clarify interface and improve documentation in gesture"
This reverts commit 6c0ed14800.

It was pushed with unreviewed changes and not fully resolved issues.
2022-09-11 13:14:02 +03:00
Vlad Zahorodnii
74da80763f Revert "Rename GestureDirection to GestureType"
This reverts commit 5de6c507db.

It was pushed with unreviewed changes and not fully resolved issues.
2022-09-11 13:13:37 +03:00
Eric Edlund
5de6c507db Rename GestureDirection to GestureType 2022-09-11 00:09:44 +00:00
Eric Edlund
6c0ed14800 Clarify interface and improve documentation in gesture
Separate trigger progress and semantic progress in gesture.
Move effect activation and desktop switching over to semantic progress.
Allow semantic progress to exceed 1 for overshoot in animations.
2022-09-11 00:09:44 +00:00
Eric Edlund
bc15b72e3d Add new gestures and improve naming clarity in gesture.h
I've added VerticalAxis, HorizontalAxis, DirectionlessSwipe and BiDirectionalPinch gestures directions.
These are all combinations of other gesture directions that semantically work well together.
I've implemented these gestures as well as changed some labels and improved documentation,

Also,
Add vector signal to SwipeGesture
2022-09-11 00:09:44 +00:00
Eric Edlund
634182d489 Move gesture direction to base class 2022-09-11 00:09:44 +00:00
Eric Edlund
d29c7a6c2b Merge gesture structs/enums
- Now only 1 GestureDirection enum
- Now only 1 registerGesture() call
- The 4 kinds of gesture (Pinch/Swipe) and (Touchpad/Touchscreen) in globalshortcuts.h/cpp are merged into 1 GestureShortcut
- Change from range to set of finger counts in gestures

No behavior should change, just a refactor.
2022-09-11 00:09:44 +00:00
Vlad Zahorodnii
33827bbdbe autotests: Fix internal connection teardown
This might be the root cause of random ASAN errors in testQuickTiling.

From commit 617291c6974d232ee99c4c49e891ce16863e3d6e:

The internal EventQueue is a child of the registry object. This means
that after the registry is destroyed, all proxy objects in that event
queue are going to have invalid reference to it, which is not a problem
as long as the wl_display_dispatch() function is not called.

The wl_display_dispatch() function uses wl_proxy's queue reference to
enqueue incoming events to that queue.

Unfortunately, during teardown, the internal ConnectionThread may
dispatch events right after the registry object has been destroyed,
which can lead to a crash.

In order to fix the crash, we need to destroy all proxy objects and only
after that we can destroy the event queue. It's okay if wayland events
are dispatched in between.

i.e. the EventQueue object must be destroyed last to ensure avoid hitting
dangling pointers.
2022-09-08 10:16:35 +00:00
Vlad Zahorodnii
e40bdc9016 autotests: Simplify tearing down ConnectionThread
It should be enough to call QObject::deleteLater() and wait until the
connection thread stops spinning its event loop.
2022-09-08 10:00:20 +00:00
Marco Martin
31d1f885ce Restore the crossfade effect
This enables again the crossfade between the old window picture and the new one in the maximize and morphingpopup effects.
It does that with the OffScreenEffect redirect() feature.

BUG:439689
BUG:435423
2022-09-07 10:16:36 +00:00
Vlad Zahorodnii
d2fb4147fc Move multi-purpose code in its own directory
Things such as Output, InputDevice and so on are made to be
multi-purpose. In order to make this separation more clear, this change
moves that code in the core directory. Some things still link to the
abstraction level above (kwin), they can be tackled in future refactors.
Ideally code in core/ should depend either on other code in core/ or
system libs.
2022-09-06 11:21:40 +03:00
Vlad Zahorodnii
a295db01d9 autotests: Make mapping between KWin::Output and wl_output more robust
Use wl_output.name to find the wl_output for the given server side
output. This way the order in which wl_output globals are announced
won't matter.
2022-09-06 06:47:43 +00:00
Vlad Zahorodnii
e97e520175 Move placement policy enum in KWin namespace
Other policy enums are declared in options.h so let's do the same for
placement policy. Besides consistency, another advantage of moving the
enum in kwin namespace is that the enum could be forward declared.
2022-09-05 14:11:42 +00:00
Vlad Zahorodnii
82c09653aa Move xcursortheme.{h,cpp} to utils/
utils/ seems like a better place for this helper.
2022-09-02 11:06:49 +00:00
Arjen Hiemstra
345736735e Add a fallback path for input when there is no text-input
An application that does not support text-input has no way of
communicating with the input method, so even if you show the input
method the application receives nothing. As a fallback, instead send
fake key events so the application still gets something at least.

The key events are synthesised based on the text string that the
input method sends, which may result in things that do not actually
correspond to real keys. Unfortunately I do not see a way around that.

CCBUG: 439911
2022-09-01 14:41:51 +00:00
Xaver Hugl
245eb822c7 autotests/xdgshellwindow: remove timeout for outputEnteredSpy
The timeout makes the test fail wrongly sometimes and isn't needed. Instead
assume the window always gets placed on the first output
2022-09-01 06:43:09 +00:00
Vlad Zahorodnii
070f63c451 Drop Screens::geometry() and Screens::size()
Currently, the main user of these two functions is the X11 standalone
platform.

This change ports that code to Workspace::geometry(), which is not great
but the X11 backend already depends on the Workspace indirectly via the
Screens. Not sure if it's worth making the standalone X11 backend track
the xinerama rect internally.
2022-08-27 13:51:37 +03:00
Vlad Zahorodnii
a5ac7cf0ae scripting: Port ClientModel V2 from Screens 2022-08-27 09:21:44 +00:00
David Redondo
80d28499e1 libinput/device: Use button mapping that is used in input handling for supported buttons
Fixes and prevents inconsistencies between those.
2022-08-24 08:44:31 +00:00
Kai Uwe Broulik
3646620430 utils: Introduce RamFile class for memfd
This class can be used to create an anonymous file, for instance
to pass data between compositor and clients, through means of a
file descriptor, as is done in various Wayland protocols, notably
the keymap exchange.

It also implements sealing the file, so that it can be shared
between multiple clients without them being able to modify it.

If supported, memfd_create is used, otherwise a `QTemporaryFile`
is used.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-08-19 15:26:22 +02:00
Xaver Hugl
cdf777663d autotests/integration: use std::unique_ptr for wayland surfaces 2022-08-18 11:54:30 +02:00
Xaver Hugl
02f9978489 autotests/pointer_input: add test for moving fullscreen windows 2022-08-16 14:05:20 +02:00
Vlad Zahorodnii
ca6f84dad6 Rework how wl_output and kde-output-device are created
Create wl_outputs only for outputs in Workspace.
2022-08-11 17:17:47 +03:00
Vlad Zahorodnii
b9c00ba90d Create color manager after workspace 2022-08-10 10:17:30 +00:00
Vlad Zahorodnii
e24ee60bb2 autotests: Remove Test::initWaylandWorkspace()
It reduces the amount of boilerplate code and makes startup sequence in
autotests similar to the one in kwin_wayland.
2022-08-09 08:17:18 +00:00
Xaver Hugl
039dd96f8d xwaylandinterface: move global to Application 2022-08-08 09:16:22 +00:00
Volker Krause
86abf8dbc3 Use a non-deprecated enum value for "no key" 2022-08-06 07:21:41 +00:00
Xaver Hugl
8955a2420e replace all uses of QScopedPointer with std::unique_ptr 2022-08-04 12:30:09 +00:00
Xaver Hugl
76fbffb40b screenlockerwatcher: move singleton to Application 2022-08-02 21:37:41 +00:00
Xaver Hugl
497a78b7cf tabbox: move global to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
43b78e40d8 screens: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
9439e7719d screenedge: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
719147952d rulebook: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Xaver Hugl
0d704b8913 placement: move singleton to Workspace 2022-08-02 21:37:41 +00:00
Vlad Zahorodnii
c3d5c3db1d x11: Add a helper to get the default screen
Since the screen number is well-known, we can look up the default
screen on demand. Note that xcb_get_setup() is pretty cheap as it
simply returns a const pointer to pre-allocated data.
2022-07-29 14:15:12 +00:00
Vlad Zahorodnii
a198516871 Drop Platform::enabledOutputs()
At the moment, a platform should provide two output lists - one that
lists all available outputs, and the other one that contains only
enabled outputs. In general, this amounts to some boilerplate code and
forces backends to be implemented in some certain way, which sometimes
is inconvenient, e.g. if an output is disabled or enabled, it will be
simpler if we only change Output::isEnabled(), otherwise we need to
start accounting for corner cases such as the order in which
Output::isEnabled() and Platform::enabledOutputs() are changed, etc.
2022-07-27 09:22:10 +00:00
David Edmundson
2073415f91 Ensure size is valid after maximising
In X11 when a window is maximised if the client is unable to fufill the
space provided we centre align the window.

With the new floating point geometry behaviour of centreing changes.
Instead of a 1 pixel gap at the top, we get a 0.5 pixel gap either side.
When we get into the codepath to "fix" the window in `closeHeight` we
only move the top, giving us an invalid buffer size.

We don't really want to change the logic here; on xwayland with the
scaling opt-out path it's feasible for a floating sized logical size to
still be representable. This code rounds to the native unit after all
the logic has taken effect.
2022-07-27 08:43:23 +00:00
Aleix Pol
27f24d1449 input: Introduce a outputArea property for tablet devices
It's important for tablet devices to be able to specify to which section
of the display we'll be fitting the tablet. This setting allows to
specify this by providing some options that will do so relative to the
output size.

CCBUG: 433045
2022-07-25 23:29:07 +00:00
Vlad Zahorodnii
cf3fe003e6 Move ownership of Session to Application
The Session can be useful not only to the platform backend but also
input backends and for things such as vt switching, etc. Therefore it's
better to have the Application own the Session.
2022-07-24 19:14:26 +03:00
Xaver Hugl
ff0e89b030 backends/x11/standalone: rename files to be more consistent 2022-07-24 13:05:13 +00:00
Vlad Zahorodnii
045da603a4 Make backends part of libkwin
Platform backends are provided as plugins. This is great for
extensibility, but the disadvantages of this design outweigh the
benefits.

The number of backends will be limited, it's safe to say that we will
have to maintain three backends for many years to come - kms/drm,
virtual, and wayland. The plugin system adds unnecessary complexity.

Startup logic is affected too. At the moment, platform backends provide
the session object, which is awkward as it starts adding dependencies
between backends. It will be nicer if the session is created depending
on the loaded session type.

In some cases, wayland code needs to talk to the backend directly, e.g.
for drm leasing, etc. With the plugin architecture it's hard to do that.
Not impossible though, we can approach it as in Qt 6, but it's still
harder than linking the code directly.

Of course, the main disadvantage of shipping backends in a lib is that
you will need to patch kwin if you need a custom platform, however such
cases will be rare.

Despite that disadvantage, I still think that it's a step in the right
direction where the goal is to have multi-purpose backends and other
reusable components of kwin.

The legacy X11 standalone platform is linked directly to kwin_x11
executable, while the remaining backends are linked to libkwin.
2022-07-23 11:52:42 +00:00
Vlad Zahorodnii
e179d9cea1 Load plugins after Workspace is created
The original intention behind creating plugins before the workspace was
to handle the case where kwin_wayland may need to wait until outputs are
available. However, since things have changed a lot in that regard,
plugins can be loaded after the workspace now.

The main benefit behind this is that plugins can be simpler, they won't
need to track when the workspace is created.

On X11, plugins are already loaded after the workspace is instantiated.
2022-07-22 11:28:21 +00:00
Xaver Hugl
b6cf576efa move DecorationBridge singleton into Workspace 2022-07-21 15:24:57 +02:00
Xaver Hugl
1cf2205283 move Activities singleton into Workspace 2022-07-21 15:24:51 +02:00
Xaver Hugl
9337f145d5 move InputMethod singleton to Application 2022-07-21 15:16:40 +02:00
Vlad Zahorodnii
4bfb0acc17 Make Workspace track managed outputs
This change adjusts the window management abstractions in kwin for the
drm backend providing more than just "desktop" outputs.

Besides that, it has other potential benefits - for example, the
Workspace could start managing allocation of the placeholder output by
itself, thus leading to some simplifications in the drm backend. Another
is that it lets us move wayland code from the drm backend.
2022-07-21 08:43:50 +00:00
Vlad Zahorodnii
c7af7adda6 x11: Hard-code 0 default screen
The screen number matters only on multi-head setups.
2022-07-20 11:37:57 +00:00
Vlad Zahorodnii
5a8beacd2b Drop Platform::findOutput()
Please, don't use integer ids to identify outputs!
2022-07-18 13:52:58 +00:00
Vlad Zahorodnii
885e9acb6e Drop ApplicationWaylandAbstract
We gain nothing with it. XCB setup logic in the Xwayland server has to
be moved to the workspace layer anyway. For example, this move of
responsibilities will be needed to support running more than just one
instance of Xwayland. Architecture-wise, it would be cleaner too.

Unfortunately, it breaks encapsulation of the Application, but this can
be taken care later.
2022-07-15 12:18:03 +00:00
Vlad Zahorodnii
b167f67362 autotests: Use less QRectF::toRect() 2022-07-15 07:56:07 +00:00
David Edmundson
7292af3d04 Use floating geometry throughout
With fractional scaling integer based logical geometry may not match
device pixels. Once we have a floating point base we can fix that. This
also is
important for our X11 scale override, with a scale of 2 we could
get logical sizes with halves.

We already have all input being floating point, this doubles down on it
for all remaining geometry.

- Outputs remain integer to ensure that any screen on the right remains
aligned.
 - Placement also remains integer based for now.
- Repainting is untouched as we always expand outwards
 			   (QRectF::toAdjustedRect().
 - Decoration is untouched for now
 - Rules are integer in the config, but floating in the adjusting/API
This should also be fine.

At some point we'll add a method to snap to the device pixel
grid. Effectively `round(value * dpr)  / dpr` though right now things
mostly work.

This also gets rid of a lot of hacks for QRect right and bottom which
are very
confusing.

Parts to watch out in the port are:
 QRectF::contains now includes edges
QRectF::right and bottom are now sane so previous hacks have to be
removed
 QRectF(QPoint, QPoint) behaves differently for the same reason
 QRectF::center too

In test results some adjusted values which are the result of
QRect.center because using QRectF's center should behave the same to the
user.
2022-07-14 10:04:46 +01:00
Vlad Zahorodnii
e09ca74295 wayland: Make workspace responsible for creating Screens
The Screens object is created by Workspace on X11. This change makes X11
and Wayland behave more similar. As is, the Screens is a helper for
window management code, don't use it in backends. Note that the X11 backend
already uses the Screens, it needs to be addressed individually.
2022-07-13 17:54:35 +00:00
Arjen Hiemstra
8284740cdf InputMethodTest: Only create the windowAddedSpy when actually needed
We don't really care about the window showing up until we're calling
showInputPanel, but since Workspace::windowAdded is triggered for any
window that gets added, the test sometimes fails because count() is 2
instead of 1. To avoid that, only create the spy when it's actually
relevant instead of all the way at the start before any other setup is
done.
2022-07-13 15:24:19 +00:00
Arjen Hiemstra
78c8ebc345 Make MoveResizeWindowTest::testResizeForVirtualKeyboard data-driven
This allows us to easily expand the things the test tests for and allows
testing some corner cases more properly.
2022-07-12 22:43:56 +01:00
Arjen Hiemstra
083437d487 Don't use QRect::bottom when applying virtual keyboard geometry
Bottom is unreliable because of "historical reasons" in Qt. So don't use
bottom, instead calculate the proper height and top manually.
2022-07-12 22:43:56 +01:00
David Edmundson
36f7bae36a Revert "inputpanel: Compensate the 1px difference in height for panel position"
This reverts commit 8d588f165c.
2022-07-12 22:31:38 +01:00
Rodney Dawes
8d588f165c inputpanel: Compensate the 1px difference in height for panel position
It seems there is a 1px offset in the availableArea height, so compensate
by subtracting an extra pixel from the input panel height, to avoid a gap
below the panel.

Fixes https://invent.kde.org/teams/plasma-mobile/issues/-/issues/150
2022-07-12 14:34:10 -04:00
Vlad Zahorodnii
79e0051b04 autotests: Port more tests from obsolete Screens 2022-07-12 07:05:45 +00:00
Vlad Zahorodnii
fa78de6219 kwineffects: Strip ScreenPaintData of transforms
ScreenPaintData provides a way to transform the painted screen, e.g.
scale or translate. From API point of view, it's great. It allows
fullscreen effects to transform the workspace in various ways.

On the other hand, such effects end up fighting the default scene
painting algorithm. For example, just have a look at the slide effect!
With fullscreen effects, it's better to leave to them the decision how
the screen should be painted. For example, such approach is taken in
some wayland compositors, e.g. wayfire, and our qtquick effects already
operate in similar fashion.

Given that, strip the ScreenPaintData of all available transforms. The
main motivation behind this change is to improve encapsulation of item
painting code and simplify model-view-projection code in kwin. It will
also make the job of extracting item code for sharing purposes easier.
2022-07-06 11:10:54 +00:00
Vlad Zahorodnii
a6d72d3f60 wayland: Introduce IdleDetector
The IdleDetector is an idle detection helper. Its purpose is to reduce
code duplication in our private KIdleTime plugin and the idle wayland
protocol, and make user activity simulation less error prone.
2022-06-29 20:27:50 +03:00
Laurent Montel
c83568dfdd GIT_SILENT: remove extra ';' 2022-06-23 13:43:09 +02:00
Xaver Hugl
a38a44cb2a libinput: use std::unique_ptr for events 2022-06-21 17:50:49 +00:00
Rachel Mant
fd18401dbf Introduced a new setting for the task switcher - OrderMinimizedMode - and implemented the tabbox logic for it 2022-06-14 07:57:01 +00:00
David Edmundson
419c0b81fd Support an alternative harcoded scale for X
Anything in xcb_ structs are always in X local, all member variables
aside from buffers are in kwin local space.

This patch ignores a few paths that are not relevant on wayland.
2022-06-07 11:58:26 +01:00
Luca Carlon
da0dd1e367 Support new AppletPopup window type
See the discussion in https://invent.kde.org/frameworks/plasma-framework/-/merge_requests/500.

BUG: 411462
BUG: 332512
FIXED-IN: 5.25
2022-05-27 21:49:37 +00:00
Xaver Hugl
615cd352fb add autotest for touchscreen gestures 2022-05-27 17:49:59 +00:00
Vlad Zahorodnii
f3b291bce0 Make TimeLine API ergonomic with presentation timestamps
Currently, if you want to use TimeLine, you need to track the last
presentation timestamp which boils down to carrying some boilerplate
code.

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

Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2473>
2022-05-26 17:10:07 +00:00
Vlad Zahorodnii
572a0904d8 autotests: Register ElectricBorder type
QSignalSpy yells about it.

Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2460>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2460>
2022-05-25 08:40:24 +00:00
David Edmundson
c36ecacf1c Wait for lockscreen to actually be started before running lock tests
Firstly we weren't waiting for a signal at all, we are relying on events
being processed externally which is wrong.

Secondly ScreenLocker::KSldApp::self()->lockState() is tri-state;
unlocked, acquiring, locked. This gets compressed to a boolean where
acquiring and locked are the same.

If we run the tests whilst we're still acquiring the lock screen we can
call unlocked before we've finished locking. The greeter might then be
shown afterwards triggering a re-lock. It's a confused state.
2022-05-19 19:26:28 +00:00
Kai Uwe Broulik
a2c91f9434 backends/x11: Cleanup KWinXRenderUtils and move it to eglx11common
The XRender backend has been removed, leaving most of KWinXRenderUtils unused.

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

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-05-19 12:10:18 +00:00
Vlad Zahorodnii
3b46067fc1 autotests: Force OpenGL compositing in testPointerInput
Window View effect requires OpenGL compositing.
2022-05-19 11:28:47 +00:00
Vlad Zahorodnii
4c05db3c30 Simplify Workspace::addWaylandWindow()
I believe this is a relic from the past when we used not to destroy
the ShellClient when the associated surface is unmapped.
2022-05-17 16:38:47 +00:00
Xaver Hugl
0b27ce4d34 Make touchscreen gestures realtime 2022-05-11 15:08:43 +00:00
Vlad Zahorodnii
63a866d98c Make WindowItem handle opacity
This change makes the WindowItem track the opacity and schedule a
repaint. It further decouples the legacy scene from code window
abstractions.

It's an API breaking change. WindowPaintData no longer can make windows
more opaque. It only provides additional opacity factor.
2022-05-11 09:42:35 +00:00
Vlad Zahorodnii
1d699a703d autotests: presentwindows -> windowview 2022-05-09 10:56:35 +00:00
Vlad Zahorodnii
def99b1a7c Update WindowItem's visibility
With this, the WindowItem will know whether it's actually visible. As
the result, if a native wayland window has been minimized, kwin won't
try to schedule a new frame if just a frame callback has been committed.

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

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

EffectWindow::refVisible() doesn't replace EffectWindow::refWindow() but
supplements it. refVisible() only ensures that a window will be kept
visible while refWindow() ensures that the window won't be destroyed
until the effect is done with it.
2022-05-05 12:21:26 +00:00
Marco Martin
4cb3ab09ed Realtime screen edges gestures for scripted effects
Possibility to implement realtime screenedges gestures in scripted effects,
implement it in the windowsaperture show desktop effect.
* Expose registerRealtimeScreenEdge to JavaScript, the callback will be
a JS function.
* Add the concept of freezeInTime() in the animation js bindings,
it will either create an animation frozen at a given time or freeze a running animation
that can be restored and ran to completition at any time
* add an edges property only for showdesktop as it's not directly on the effect configuration
2022-05-03 13:43:38 +00:00
Vlad Zahorodnii
2fdb55b199 Rename InternalWindow::internalWindow() to InternalWindow::handle()
internalWindow->handle() reads better than internalWindow->internalWindow()
2022-04-29 17:47:41 +03:00
Vlad Zahorodnii
5ee044e6fc Some client/toplevel -> window 2022-04-29 17:47:39 +03:00
Vlad Zahorodnii
066ac3200a backends/libinput: Rework Device getter
libinput_device_get_user_data() can be used to get the associated Device
object with libinput_device. That way, we won't need to maintain a
private list of all input devices.
2022-04-29 12:47:34 +00:00
Vlad Zahorodnii
22e5c8a260 autotests: client -> window 2022-04-27 12:45:46 +00:00
Vlad Zahorodnii
c519f2d126 autotests: Port KWinFrameworkIntegration from source vars to target based apis 2022-04-25 13:12:21 +00:00
Vlad Zahorodnii
175037d9d1 Prefer the term "window" over "client" in Workspace 2022-04-25 11:33:55 +00:00
Vlad Zahorodnii
4b91c6163f Rename XdgShellClient to XdgShellWindow
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
a21aa839b1 Rename X11Client to X11Window
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
3cdee2f24a Rename LayerShellV1Client to LayerShellV1Window
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Vlad Zahorodnii
fb4607f5a6 Rename InternalClient to InternalWindow
The word "client" means different things in wayland and kwin. Use a
better word to refer to windows.
2022-04-23 07:55:51 +00:00
Nils Fenner
b491aeb9ae Rename AbstractClient to Window 2022-04-22 17:39:12 +00:00
Vlad Zahorodnii
6b4daeddc9 src/xwl -> src/xwayland
It makes naming more consistent, we use "wayland" more frequently than
"wl".
2022-04-22 13:09:51 +03:00
Vlad Zahorodnii
b64f95b703 Integrate kwaylandserver
This makes KWin switch to in-tree copy of KWaylandServer codebase.

KWaylandServer namespace has been left as is. It will be addressed later
by renaming classes in order to fit in the KWin namespace.
2022-04-22 12:27:33 +03:00
Xaver Hugl
f6eee463ba Make lcms2 a hard dependency
When we do more color management stuff we'll need it in more places,
making it a hard requirement reduces the amount of needed ifdefs and
should make adding color management features a little simpler.
2022-04-20 12:21:38 +02:00
Nils Fenner
aaa429ee0a Merge Toplevel into AbstractClient
References issue #81
2022-04-18 07:42:11 +00:00
Ismael Asensio
75d71a1c1a AbstractClient: Re-check screen rules on screen enabled
BUG: 409979
FIXED-IN: 5.25
2022-04-16 16:02:12 +00:00
Vlad Zahorodnii
8e7a8c5a11 Rename AbstractOutput to Output
AbstractOutput is not so Abstract and it's common to avoid the word
"Abstract" in class names as it doesn't contribute any new information.
It also significantly reduces the line width in some places.
2022-04-15 17:49:49 +03:00
Vlad Zahorodnii
09782bcf11 autotests: Use more fully qualified KWayland::Client types
This is needed to make "Output" identifier less ambiguous.
2022-04-15 17:49:49 +03:00
Vlad Zahorodnii
b376865f52 Rename WaylandOutputConfig to OutputConfiguration 2022-04-15 14:49:02 +00:00
Vlad Zahorodnii
d43dac8f8d Merge AbstractWaylandOutput with AbstractOutput 2022-04-15 14:49:02 +00:00
Eric Edlund
26a4f75944 Implement desktopSwitching() interface for realtime animations
Added this interface to the VirtualDesktopManager. Realtime touchpad gestures update the interface to allow for mac os style desktop switching.
Also makes gestured switching use natural direction.

BUG: 185710
2022-04-15 00:09:52 +00:00
Vlad Zahorodnii
3534b6afee Remove input processing functions in Platform
Input event flow has been refactored so all input events originate from
input devices.

The X11 backend uses InputRedirection so make it forward events to
relevant input device handlers.
2022-04-14 17:29:51 +03:00
Vlad Zahorodnii
4790408423 Run clang-format again
Some people either don't have clang-format installed or disable the
commit hook.
2022-04-14 13:58:03 +03:00
Vlad Zahorodnii
2ac1f9b7d3 kwineffects: Expose internalId 2022-04-13 19:06:11 +00:00
Vlad Zahorodnii
efd43f97e6 Drop Scene::qpainterRenderBuffer() 2022-04-13 10:16:16 +00:00
Ismael Asensio
5fdf271c32 tests/rules: Port from X11 virtual desktop indexes
Improve and adapt the autotests to the use the new Wayland `desktops`
API instead of relaying on the X11 fallback methods.
2022-04-11 16:24:50 +00:00
Ismael Asensio
cb55532135 test/rules: Ensure we destroy the test window on cleanup
This avoids crashing when a test fails
2022-04-11 14:21:57 +00:00
Ismael Asensio
cb877595b2 tests/rules: Rename member variables 2022-04-11 12:11:34 +02:00
Ismael Asensio
32b529a694 tests/rules: Reduce code duplication
Reduce the code duplication and boilerplate to create and destroy
the test clients by making the related variables class members.

Handle special cases using an extensible flag mechanism.
2022-04-11 12:11:34 +02:00
Volker Krause
972534eb3c Adapt to changes in the Qt6 QPA API
As a pleasant surprise this turned out much easier than anticipated,
all the API is still there, just moved to Qt::GuiPrivate.
2022-04-08 14:19:56 +00:00
Vlad Zahorodnii
601ef328df Drop more legacy Workspace.clientArea() overloads
With this change, the Workspace would provide clientArea() overloads
that take only AbstractOutput and VirtualDesktop. integer ids are
obsolete as they are unstable.
2022-03-29 17:34:41 +00:00
Vlad Zahorodnii
e293972eaa Run clang-tidy with -checks=readability-braces-around-statements fixit
This fixes style issues in old code.
2022-03-28 10:54:11 +00:00
Xaver Hugl
8914a6c50e add global touchscreen gestures
Swipe with three fingers
- left to switch to the previous virtual desktop
- right to switch to the next virtual desktop
- up and down to toggle the overview

CCBUG: 439925
2022-03-27 19:09:04 +02:00
Vlad Zahorodnii
7096e3ead8 Run clang-format
The .clang-format file is based on the one in ECM except the following
style options:

 - AlwaysBreakBeforeMultilineStrings
 - BinPackArguments
 - BinPackParameters
 - ColumnLimit
 - BreakBeforeBraces
 - KeepEmptyLinesAtTheStartOfBlocks
2022-03-25 13:25:15 +02:00
Volker Krause
2a171e5fa8 Adapt build system to also support building against Qt6 2022-03-25 08:26:49 +00:00
Eric Edlund
1f8a65c434 Rename DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer
This constant is now DEFAULT_UNIT_SCALE_DELTA.
This makes more sense now that we're using realtime gestures.
2022-03-23 09:49:35 +00:00
David Edmundson
2a6746a921 XWayland:split connection and process spawning
These are two conceptually different tasks that were intertwined.
On it's own it doesn't accomplish anything but is an important refactor
for longer term goals, namely:

- moving xwayland into kwin_wayland_wrapper with our wayland restart
handling support
- having multiple X connections

Behaviour should be the same.
2022-03-22 16:25:12 +00:00
Vlad Zahorodnii
563e372440 autotests: Fix DBusInterfaceTest with KWIN_BUILD_ACTIVITIES=OFF
X11-specific code path was overlooked in
79a4733dc5.
2022-03-22 13:28:18 +02:00
Vlad Zahorodnii
3c945358fc Revert "Implement desktopSwitching() interface for realtime animations"
This reverts commit c7c1ac78ea.

This change was merged prematurely.
2022-03-19 18:30:41 +02:00
Vlad Zahorodnii
91632bd030 Revert "Refactor DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer"
This reverts commit a508a8c6db.

It didn't go through code review process.
2022-03-19 18:29:39 +02:00
Eric Edlund
a508a8c6db Refactor DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer
This constant is not DEFAULT_UNIT_SCALE_DELTA.
This makes more sense now that we're using realtime gestures.
2022-03-19 10:06:01 -04:00
Eric Edlund
c7c1ac78ea Implement desktopSwitching() interface for realtime animations
Added this interface to the VirtualDesktopManager. Realtime touchpad gestures update the interface to allow for mac os style desktop switching.
2022-03-19 13:19:54 +00:00
Julius Zint
39160e7dbd Remove no_xdg_runtime_dir_test
[6/6] Make autotests create fake input devices

This test was the only one where input() could return a nullptr. With
this test removed, autotests can now expect input() to always return a
sane valid value and are therefor simpler to write.

That test belongs in kwayland-server anyway and kwayland-server's test
suite already tests that starting without XDG_RUNTIME_DIR is a no-no
thing
2022-03-17 08:35:40 +00:00
Julius Zint
270a963350 Migrate all autotest input simulation functions
[5/6] Make autotests create fake input devices

Migrate all input simulation functions from kwinApp()->platform()->...
to the their counter part in the Test namespace.
2022-03-17 08:35:40 +00:00
Julius Zint
93305f6041 Add all required input simulation methods
[4/6] Make autotests create fake input devices

This translates all required input simulating methods from
kwinApp()->platform()->... to seperate functions in the Test namespace.
2022-03-17 08:35:40 +00:00
Julius Zint
33487c06d6 Add all three VirtualInputDevices for autotests
[3/6] Make autotests create fake input devices

This commit adds back all three VirtualInputDevices for simulating
keyboard, touch and pointer input events from autotests.
2022-03-17 08:35:40 +00:00
Julius Zint
3134198a30 Move VirtualInputDevice to autotests
[1/6] Make autotests create fake input devices

The goal of this patch set is simulating user input in unit tests via
InputDevices and no longer use the Platform to fake input. This matches
more closely with how input is processed when running a full plasma
wayland session, i.e. with the DRM and libinput backends.
2022-03-17 08:35:40 +00:00
Vlad Zahorodnii
79a4733dc5 autotests: Fix TestDbusInterface with KWIN_BUILD_ACTIVITIES=OFF 2022-03-16 12:36:18 +00:00
Volker Krause
57e0119d23 Adapt to Qt6's removal of Qt::X11Extras 2022-03-16 06:45:42 +00:00
Eric Edlund
5cf8db26ec Changes to GestureRecognizer and gestures 2022-03-15 13:29:05 +00:00
Volker Krause
eee16b01a4 Port away from deprecated QWheelEvent position methods
Those are gone in Qt6 (unlike similarly named methods for other
event types).
2022-03-13 12:23:22 +00:00
Volker Krause
51250cfb4a Use | rather than + for combining QFlags
The plus operator is no longer available for flags in Qt6.
2022-03-13 10:00:54 +00:00
Aleix Pol
e043f2262f inputmethod: Fix the test
We should account for keyboards that are not full screen (unlike
maliit). It shouldn't make a difference for maliit.
2022-03-09 13:24:26 +00:00
Kai Uwe Broulik
a55ea639a1 autotests: Guard tabbox_test by KWIN_BUILD_TABBOX
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-03-03 14:34:10 +00:00
Vlad Zahorodnii
0f448a83d9 autotests: Test moving pointer between windows 2022-03-03 13:45:47 +00:00
Alex Richardson
d789ecc6d1 Use #cmakedefine01 for all KWIN_BUILD_* macros
This ensures that we get a warning if the config header is not included
instead of compiling the code as if it was disabled. Interestingly, some
checks already used #if KWIN_BUILD_*, so those were generating -Wundef
warnings when the feature is disabled. Commit 886173cab assumed that all
those features were already 01, so this unbreaks the build if any of the
features is disabled.

Fixes: 886173cab ("Reduce ifdefs in Workspace::supportInformation()")
2022-02-28 18:59:04 +00:00
Kai Uwe Broulik
d54723cbf2 Add KWIN_BUILD_SCREENLOCKER option
Allows to build KWin without lockscreen support and thus drops the
kscreenlocker dependency.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 14:39:25 +01:00
Vlad Zahorodnii
153d5965f8 wayland: Remove unpolish() calls
It's leftover after the times when widget style was using wayland
connection. Breeze had to destroy all wayland resources before
terminating the internal connection.
2022-02-22 07:36:47 +00:00
Vlad Zahorodnii
0213661a7c wayland: Rework Xcursor theme loading
Xcursor loading code has hardcoded search paths, in order to take into
account distros installing app data in a different location,
libwayland-cursor sets the ICONDIR to the icon directory computed based
on the install prefix.

However, that won't work with gitlab CI because it relocates binaries. A
more robust way to find cursors would be to use QStandardPaths to find
all the icon directories on the system.

Another advantage of using own cursor loading code is that it allows us
to reuse cursor images that are symlinks. For example, with
breeze_cursors, almost half of the files in the cursors directory are
symlinks.

The main disadvantage of this approach is that we would have to keep the
search paths up to date. However, on the hand, there are not that many
of them, e.g. ~/.icons, ~/.local/share/icons, /usr/share/icons,
/usr/local/share/icons. The last three are implicitly handled by the
QStandardPaths.
2022-02-18 09:59:39 +00:00
Vlad Zahorodnii
158f1db513 autotests: Drop TestXdgShellClient::testWindowOpensLargerThanScreen()
With the xdg_toplevel.configure_bounds support, the compositor is
finally able to tell the client the maximum recommended window size.

That approach allows us to keep the compositor side simple and it
prevents (as long as the app is well behaved) annoying visual glitches
such as mapping window with one size and then quickly resizing it to
the final size.
2022-02-16 08:23:55 +00:00
Ismael Asensio
f055efc941 tests/xdgshellclient_rules: Add tests for screen rules
There are two operations failing currently, so we QEXPECT_FAIL
them for now:
- A new client is not moved to the screen set by the rule
   (Wayland only). Affects Apply, Force and Remember
- Disabling and enabling an output will not move the client
   to the Forced screen (On X11 and Wayland, BUG:409979)
2022-02-14 17:15:19 +00:00
Michail Vourlakos
bc145b614c support kdecoration2 blurregion
--use kdecoration2 blurred regions to adjust blur effect appropriately when
needed

CCBUG:395725

Requires: https://invent.kde.org/plasma/kdecoration/-/merge_requests/17
2022-02-09 21:00:07 +00:00
Vlad Zahorodnii
6a0430eaa0 Fix builtin effects not loading
The api of kcoreaddons_target_static_plugins() has changed so static
plugins must be linked with kwin_x11 and kwin_wayland directly.
2022-02-06 01:29:41 +02:00
Vlad Zahorodnii
77f712d3a7 Fix tracking of geometry restore with electric maximize
If the user wants to move a tiled window, but changes their mind and
tiles the window back to the previous position, the geometryRestore()
will be corrupted because initialMoveResizeGeometry() is the same as the
geometry of the window in the tiled mode.

This change fixes tracking of the geometry restore by precomputing the
geometry restore when starting interactive move. That way, if the window
is untiled and tiled again without release left pointer button, the
geometry restore will be set to the correct value in setQuickTileMode().

This change also adjusts the test suite so such a subtle case won't be
broken again without noticing it.
2022-02-03 16:01:45 +00:00
Vlad Zahorodnii
fde0e243d9 wayland: Let user set "no border" property in more cases
It can also be applied to client-side decorations. As long as the
compositor can ask the client to use some specific decoration mode, the
"no border" property can be set.
2022-01-31 15:55:25 +00:00
Vlad Zahorodnii
6432f29e9f autotests: Remove unused screenedge.h include 2022-01-25 21:16:51 +02:00
Vlad Zahorodnii
5ee8389705 autotests: Remove unused screens.h includes 2022-01-25 21:13:30 +02:00
Vlad Zahorodnii
09fa095039 Drop unused Screens::intersecting() 2022-01-25 17:56:40 +00:00
Vlad Zahorodnii
e2a393ce2d Move utils.h file to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
0e1d65d5a2 Move opengl context attribute builders to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
293b2244ac Move xcbutils to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
b9b7357086 wayland: Fix getting the last configure event
If there's only one configure event that changes the position of the
window and it gets acknowledged but no buffer is attached yet, and a new
configure is sent, then the ConfigurePosition flag won't be inherited
by the new configure event and the window will be misplaced.

In order to fix that, this change makes XdgSurfaceClient pop the last
acknowledged configure event from the m_configureEvents list only when
it's about to be applied for sure.

BUG: 448856
2022-01-24 18:55:25 +00:00
Vlad Zahorodnii
b572aadfd5 wayland: Allow setting "no border" flag even without xdg decoration
Historically, noBorder() was used for two things:

* as a substitute for AbstractClient::isDecorated()
* to determine whether the AbstractClient should have a decoration

With async decoration updates refactoring, a few things around
noBorder() have changed, which exposed an existing bug in the handling
of borderless maximized windows.

It's possible to have a case where an initially maximized window makes
an xdg_toplevel.set_maximized request before the initial commit, but
creates the decoration object after the initial commit.

Since XdgToplevelClient::userCanSetNoBorder() would return false when
maximize() is called in XdgToplevelClient::initialize(), m_userNoBorder
won't be updated and therefore the window can end up having a server
side decoration.

Previously, it wasn't the case because kwin would do nothing if the
decoration is installed and its preferred mode changes after the initial
commit but before the surface is mapped. With async decoration fixes,
kwin would react as expected, which unfortunately has exposed the bug.

The root cause of the problem is the fact that noBorder() is overloaded,
which makes it error-prone.

This patch changes how the noBorder property is treated. Now, it only
indicates whether the compositor wants the window to have no borders. If
noBorder() is true, it means that the compositor doesn't want the window
to have a server-side decoration; on the other hand, if noBorder() is
false, it doesn't imply that the window should have a decoration.

BUG: 448740
2022-01-21 14:59:42 +00:00
Vlad Zahorodnii
b0af657821 Silence -Wself-assign-overloaded with clang 2022-01-21 12:25:12 +00:00
Aleix Pol
2c6821fdca autotests: Fix InputMethodTest
We now will only be getting the input method panel when there's an
enabled surface.
2022-01-19 11:38:03 +00:00
Aleix Pol
f509f34dbd autotests: Update property before updating
This opens an event loop which creates race conditions on m_context if
we receive a deactivate.
2022-01-19 11:38:03 +00:00
Vlad Zahorodnii
ab824959f6 Fix geometryRestore() handling with maximize quick tile mode
geometryRestore() is no longer updated after mapping the window, so
setQuickTileMode() has to update geometryRestore() explicitly to the
correct value.

With this change, geometryRestore() will be updated as follows:

* if the window is tiled, geometryRestore() is valid, nothing to do
* the window has been dragged to the top edge, set geometryRestore() to
  the geometry that the window had when starting move
* otherwise, use the current move resize geometry
2022-01-17 13:02:48 +00:00
Vlad Zahorodnii
ef3ba9b4e8 autotests: Make QuickTilingTest not expect a configure event after starting move
No configure event is sent after starting interactive move anymore, but
QuickTilingTest has not been adjusted to the new behavior.
2022-01-17 13:02:48 +00:00
Vlad Zahorodnii
0c78da0e3a wayland: Make fullscreen and maximize mode not affect interactive resize
dontInteractiveMoveResize() was added to workaround kwin sending bad
configure events when double clicking mpv to make it fullscreen.

With async geometry updates fixed, dontInteractiveMoveResize() can be
finally removed.

Another reason to remove dontInteractiveMoveResize() is that it can make
kwin crash with a debug build. For example, if you enable resizing
maximized windows in breeze decoration settings and resize a maximized
window, kwin would eventually crash in
the AbstractClient::handleInteractiveMoveResize() function because neither
isInteractiveMove() nor isInteractiveResize() return true.
2022-01-17 08:38:03 +00:00
Vlad Zahorodnii
5420e11bd4 Make AbstractClient::titlebarPosition() return Qt::Edge
Conceptually, it's an edge, the titlebar can't be in a window corner.
2022-01-04 15:57:42 +00:00
Vlad Zahorodnii
dbee0573c4 Lock clientStepUserMovedResized to move resize geometry changes
On Wayland, the move resize geometry and the frame geometry are
completely out of sync.

This change synchronizes emitting of the clientStepUserMovedResized
signal to the move resize geometry changes.

It simplifies code of InternalClient and XdgSurfaceClient, and makes
adding support for other shell surface protocols easier as there's less
boilerplate stuff that you would need to take care of.
2022-01-04 07:36:42 +00:00
Vlad Zahorodnii
fcf0b4796f Drop geometry tip
It's not practical, regular users don't care about window geometry. One
could argue that it can be useful for creating window rules, but window
rules kcm pulls relevant properties from kwin.

If needed, one can reimplement this feature as a QtQuick script that creates
an overlay window positioned above the window that is being interactively
moved or resized.
2022-01-04 07:36:42 +00:00
Weng Xuetian
ca7298a325 Ensure modifier change is forwarded after the key sending to input method.
Same as real hardware wl_keyboard, key should be sent before modifier
change. For example, Left Ctrl press and release should produce
key events in the order of Control_L and Control+Control_L.
2022-01-02 03:26:23 +00:00
Ismael Asensio
e655dc7b42 autotests/xdgTestClientRules: Add helper function setWindowRule()
Reduces ~700 lines of the same code boilerplate to simplify the tests
and prevent mistakes.
2021-12-29 21:03:11 +01:00
Xaver Hugl
6a99bfd2f4 make software cursors work per output 2021-12-28 18:42:29 +00:00
Weng Xuetian
8a2f64fbe1
Do not call setActive(true) when request input panel to show
Observed in kdevelop, that isEnabled() could be false when switching
between different tabs with Ctrl+Tab. But Qt may still call show()
if you click on the texteditor widget. This leads to isEnabled == false but
setActive(true) is called. This causes kdevelop in a usable state because
keyboard grab will be created and no key event will reach application
because isEnabled == false. Under normal circumstances, key will reach
widget first and triggers another text_input_v2 enable to make input
method work properly.
2021-12-27 21:34:06 -08:00
Weng Xuetian
c074e2eb42 Try our best to convert preedit styling to text-input-v3 cursor range.
text-input-v3 does not have preedit styling, instead, it can only
specify the range of cursor. Try to keep track of any
highlight/selection style range and combine them together. If it matches
the cursor position, use it as the cursor range.
2021-12-27 06:32:31 +00:00
Vlad Zahorodnii
4bd9708503 autotests: Fix PointerInputTest::testDecoCancelsPopup()
We need to ack configure event that wants to change deco mode.
2021-12-15 17:14:25 +02:00
Vlad Zahorodnii
acb0683e0d wayland: Properly handle async xdg-decoration updates
Currently, if a window switches between SSD and CSD, it is possible to
encounter a "corrupted" state where the server-side decoration is wrapped
around the window while it still has the client-side decoration.

The xdg-decoration protocol fixes this problem by saying that decoration
updates are bound to xdg_surface configure events.

At the moment, kwin sort of applies decoration updates immediately. With
this change, decoration updates will be done according to the spec.

If the compositor wants to create a decoration, it will send a configure
event and apply the decoration when the configure event is acked by the
client. In order to send the configure event with a good window geometry
size, kwin will create the decoration to query the border size but not
assign it to the client yet. As is, KDecoration api doesn't make
querying the border size ahead of time easy. The decoration plugin can
assign arbitrary border sizes to windows as it pleases it. We could change
that, but it effectively means starting KDecoration3 and setting existing
window deco ecosystem around kwin on fire the second time, that's off the
table.

If the compositor wants to remove the decoration, it will send a
configure event. When the configure event is acked and the surface is
committed, the window decoration will be destroyed.

Sync'ing decoration updates to configure events ensures that we cannot
end up with having both client-side and server-side decoration. It also
helps us to fix a bunch of geometry related issues caused by creating
and destroying the decoration without any surface buffer attached yet.

BUG: 445259
2021-12-15 12:47:27 +00:00
Matt Scheirer
6287ab16f4 [libinput] Add support for display mapping 2021-12-13 18:53:23 +00:00
Matt Scheirer
a719ceab4a [libinput] Persist device calibration & orientation 2021-12-13 18:53:23 +00:00
Vlad Zahorodnii
ec8f4140c3 autotests: Add no border window rule tests 2021-12-13 15:28:54 +00:00
Vlad Zahorodnii
acea685b04 autotests: Replace output management test with a more useful test
The output management test checks the implementation of output
management capabilities in the virtual backend, which is not helpful.

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

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

In order to address that issue, this change makes TestXdgShellClientRules
open a separate config and wipe it clean after each test run. Not great,
but there doesn't seem to be other way around with current KSharedConfig
api.
2021-12-10 11:21:04 +02:00
Vlad Zahorodnii
da53d26543 autotests: Pass parent object as last argument to createXdgToplevelSurface() and createXdgPopupSurface()
It's more common to see the parent object being the last argument in Qt
and this way you won't need to specify nullptr parent explicitly if the
xdg-popup or the xdg-toplevel surface doesn't need to be configured
implicitly, which makes tests slightly easier to read.
2021-12-09 11:03:59 +00:00
Vlad Zahorodnii
7b1bbf6e0a autotests: Drop effect loader tests
Effect loading is already tested using integration tests, for example
the maximize test verifies that the maximize effect is loaded _and_ it
actually does something useful when a window is maximized or restored,
testScriptedEffectLoader only verifies that the effect is loaded, which
is less helpful than what integration tests provide us.

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

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

The bottom line is that unit tests can be useful but they make life
notoriously difficult when it comes to testing components that depend on
other components.
2021-12-08 16:29:55 +00:00
Vlad Zahorodnii
53e3e87681 autotests: Make decoration mode change tests more robust
Currently, kwin expects that the xdg-decoration is installed before the
initial commit. However, decoration tests do that after the initial
commit, which makes testMaximizeAndChangeDecorationModeAfterInitialCommit()
silently pass.

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

CCBUG: 445259
2021-12-08 13:05:37 +00:00
Vlad Zahorodnii
97160c9b90 autotests: Add a test that checks one possible corner case during xdg-toplevel initialization
If the preferred decoration mode changes after the initial commit but
before the surface is mapped, there's a chance that kwin can send a bad
configure event, it's been the case in the past. Add a test to prevent
such cases go unnoticed.
2021-12-07 09:50:19 +00:00
Vlad Zahorodnii
9cc80d7468 wayland: Resize the client to last requested client size if decoration is destroyed
If the decoration is destroyed before the window is mapped, kwin can
respond with a configure event that has 0x0 size. New tests check that
problematic case.

BUG: 444962
2021-12-07 09:50:19 +00:00
Arjen Hiemstra
e5ca5df0c5 autotests: Use a shared library for the integration test framework
Ever since the effects were changed to static, each test of the
integration tests includes all the effects. The result of this is that
when doing a debug build each test is now 60MiB or more. With the amount
of tests, this results in ~8 GiB of diskspace used just for KWin's
binary output directory, which is rather excessive.

Since the tests all share a common framework library, we can change that
library to a shared library and that way avoid linking all the effects
into each test.

Most of this is shuffling around some link libraries in the integration
test CMakeLists, however, I needed to export the Xwayland class as it is
used by one of the tests but wasn't exported.
2021-11-29 14:04:54 +00:00
Vlad Zahorodnii
57f8faeb41 autotests: Fix TestPluginEffectLoader
PluginEffectLoader was changed so that it queries and loads all effects
immediately.
2021-11-29 10:29:51 +02:00
Vlad Zahorodnii
dcd9a7b9ea autotests: Use Smart placement by default
Many tests were written with the smart placement in mind and fail now
because the default placement policy was changed to "centered"
2021-11-29 09:54:52 +02:00
Vlad Zahorodnii
dc3d0444e4 Drop Screens::displaySize()
It's the same as the workspace geometry, i.e. the bounding geometry of
all outputs.
2021-11-26 10:32:55 +02:00
Alexander Lohnau
66352bfc87 Utilize KCoreAddons infrastructure for static plugins 2021-11-24 10:48:51 +00:00
Vlad Zahorodnii
f1e96676ef Remove boolean trap in AbstractClient::isShown()
Check shaded state where needed.
2021-11-24 08:11:35 +00:00
Vlad Zahorodnii
ec5950aedb Rename EffectQuickScene to OffscreenQuickScene
EffectQuickScene is not used strictly by effects, aurorae decorations
use it too to render window decorations.

This change renames the EffectQuickView/Scene to
OffscreenQuickView/Scene to clear up the naming scheme.
2021-11-23 09:53:18 +00:00
Vlad Zahorodnii
0b56711bf4 Make ServiceType irrelevant when searching for binary effects
Since binary effects are installed in their own directory, checking
service type is redundant. Also, KPluginMetaData::serviceTypes() has
been deprecated.

Task: https://phabricator.kde.org/T14483
2021-11-13 09:27:58 +00:00
Vlad Zahorodnii
6d0cca5c7f Move all dirty region scene repaint scheduling to Scene
The Compositor contains nothing that can potentially get dirty and need
repainting.

As is, the advantages of this move aren't really noticeable, but it
makes sense with multiple scenes.

Backend parts are far from ideal, they can be improved later on as we
progress with the scene redesign.
2021-11-11 11:33:04 +02:00
Vlad Zahorodnii
48f943bd75 Introduce explicit base render backend type
The main idea behind the render backend is to decouple low level bits
from scenes. The end goal is to make the render backend provide render
targets where the scene can render.

Design-wise, such a split is more flexible than the current state, for
example we could start experimenting with using qtquick (assuming that
the legacy scene is properly encapsulated) or creating multiple scenes,
for example for each output layer, etc.

So far, the RenderBackend class only contains one getter, more stuff will
be moved from the Scene as it makes sense.
2021-11-11 08:55:29 +00:00
Xaver Hugl
c01c15f241 AbstractClient: split up hideClient into hide and show
This makes the purpose of the method call more clear
2021-11-08 14:19:05 +00:00
Vlad Zahorodnii
d89501a079 Move platform backends to backends directory
This improves file organization in kwin by putting backends in a single
directory.

It also makes easier to discover kwin's low level components for new
contributors because the plugins directory may come as the last place to
look for. When one hears "plugin", the first thing that comes to mind is
regular plugins, not low level backends.
2021-11-02 09:02:41 +00:00
Vlad Zahorodnii
94de28bfbe Move input backends in their own directory 2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
ef72bae42f Introduce base InputDevice class
The main motivation behind this change is to prepare input abstractions
for virtual input devices so the wl_seat can properly advertise caps or
the cursor getting properly mapped/unmapped when a fake pointer is
added/removed on a system without a hardware mouse connected.

With this, there are three abstractions - InputDevice, InputBackend, and
InputRedirection.

An InputDevice represents an input device such as a mouse, a keyboard, a
tablet, etc. The InputBackend class notifies the InputRedirection about
(dis-)connected devices. The InputRedirection manages the input devices.

Such design allows to unify the event flow for real and virtual input
devices.

There can be several input backends active. For example, the libinput
backend and an input backend that provides virtual input devices, e.g.
libeis or org_kde_kwin_fake_input.
2021-11-01 16:27:16 +02:00
Vlad Zahorodnii
4a62716bbb autotests: Fix TestXdgShellClientRules 2021-10-31 22:22:29 +02:00