Commit graph

1195 commits

Author SHA1 Message Date
Xaver Hugl
8f27ee0cb8 input: remove hasAlphaNumericKeyboard method
It's completely unreliable
2024-02-12 18:19:23 +01:00
Vlad Zahorodnii
b1908949d0 autotests: Use ShapeCursorSource to load reference cursor images in testPointerInput 2024-02-07 08:46:20 +00:00
Vlad Zahorodnii
c9c84b6859 Prefer cursor shape names from the CSS W3C specification
There is a mix of cursor shape names from the CSS W3C specification and
non-spec ones, which is confusing when deciding what cursor shapes need
aliases in Cursor::cursorAlternativeNames().
2024-02-07 08:35:52 +00:00
Vlad Zahorodnii
aac5d562fb Drop "<N>" window caption suffix
The current implementation of the `<N>` suffix is still buggy and its
benefits are doubtful. One could argue that visual aids such as window
thumbnails or highlighting the windows are better. On its own, these
numbers don't have strong connections to the windows and can change on
a whim.
2024-02-05 11:10:53 +02:00
Xaver Hugl
67b1a88466 autotests/integration: re-enable lid closed output changes test
KWin is handling the lid switch now
2024-02-02 01:59:36 +01:00
Vlad Zahorodnii
e23cb52a16 wayland: Add windows when readyForPainting changes
A window is added to the workspace when it's mapped. It's assumed that
the first Window::windowShown signal indicates that. But it's not
entirely true. For example, if setHidden(false); setHidden(true); are
called in succession, the window will be marked as ready for painting
even though it isn't.

The Window::readyForPaintingChanged() signal fixes that. It's emitted
when the window is actually mapped.
2024-01-29 12:35:10 +02:00
Vlad Zahorodnii
2d399e93f0 Relax constraints for screen edges reserved by windows
At the moment, if the workspace extends or shrinks by an output, the
hidden panel will be shown. It doesn't make sense in all cases.

Furthermore, no screen edge will be reserved if the layer surface has
some margins.

To address that, allow "floating" panels reserve screen edges and also
make kwin try harder to preserve window edges if the output layout
changes.

CCBUG: 448420
2024-01-29 11:14:15 +02:00
Vlad Zahorodnii
1eb95982dc autotests: Disable outline in breeze
Some our tests assume that with "none" border size, the decoration has
no borders. When breeze paints an outline, that's not the case.
2024-01-29 11:04:05 +02:00
Vlad Zahorodnii
b21229e59a wayland: Implement closeable window rule
BUG: 443129
2024-01-29 10:57:29 +02:00
Vlad Zahorodnii
1b6aa65ee5 autotests: Add layer_surface_v1.set_exclusive_edge test cases 2024-01-26 13:55:13 +02:00
Vlad Zahorodnii
9cdf19c657 autotests: Add keypad global shortcuts test 2024-01-24 13:20:58 +00:00
Aleix Pol
fd7a67d92e screencasting_test: Declaring the metatype is unnecessary now 2024-01-21 11:17:49 +00:00
Aleix Pol
0ce01ac30f screencasting: Fix CI
It seems on the CI the dataFrame is null at times
2024-01-19 14:05:51 +00:00
Aleix Pol
0b36919b7c screencasting_test: Adapt to KPipeWire change 2024-01-19 01:41:47 +01:00
Vlad Zahorodnii
da4f4d7e69 Rename UnmanagedLayer to OverlayLayer
The UnmanagedLayer layer is used for placing overlay content so
rename it to match how it's used in practice.
2024-01-18 13:13:55 +00:00
Vlad Zahorodnii
5c4acbdddd Introduce layer window rule
The new window rule allows to overwrite the stack layer. It can be
useful on wayland to force picture-in-picture surfaces (which are
xdg-toplevels at the moment) to be placed above fullscreen windows.
Keep above flag is unsuitable because fullscreen windows are placed
higher "above" windows.

CCBUG: 466016
2024-01-17 23:05:53 +00:00
Nate Graham
e963ae09cc screenedge: reduce default activation delay
Currently there is a 150ms delay before screen edge actions and
hotcorners are triggered; the cursor has to spend that much time there
before they'll activate. This is good for preventing accidental
activations, but also prevents and delays deliberate activations, which
are likely to be more annoying for the user.

To alleviate this, the delay is reduced to 75ms, which still prevents
most of the accidental activations in my testing, while making
deliberate activations faster and easier.
2024-01-17 14:52:05 +00:00
Jie Liu
1a1eaee13f Only precompute the geometry restore when m_interactiveMoveResize.initialQuickTileMode is None
If the user wants to move a tiled window but changes their mind and tiles the window back to the previous
position, quickTileGeometryRestore() will return an error value beacause m_electricMaximizing is true and
the m_electricGeometryRestore is the same as the geometry of the window in the last tiled mode.

Now the geometry restore of the tiled window is true when starting interactive move, so we no longer need
to precompute it.

Changes for testQuickTilingPointerMove:

We need to attach a new image after the tiling window, so that updateElectricGeometryRestore can obtain
the same framegeometry as the framegeometry obtained during actual runtime.

Now testQuickTilingPointerMove can detect the error:If the user wants to move a tiled window but changes
their mind and tiles the window back to the previous position, quickTileGeometryRestore() will return an
error value beacause m_electricMaximizing is true and the m_electricGeometryRestore is the same as the
geometry of the window in the last tiled mode.

Signed-off-by: Jie Liu <liujie01@kylinos.cn>
2024-01-17 01:03:27 +00:00
Vlad Zahorodnii
af39179446 Break show desktop mode if a new window is added
BUG: 479424
2024-01-15 15:41:57 +00:00
Vlad Zahorodnii
359f36d6ab autotests: Add a test to verify that show desktop mode quits after activating a window 2024-01-15 15:41:57 +00:00
Weng Xuetian
1fd5a6555e
inputmethod: Ensure InputPanelV1Window is always within the screen
Currently when input panel is using overlay mode and the cursor rectangle
is below or above the screen area, the input panel may be placed off the
screen. The change ensure it is always placed within the screen area
using similar math like xdg_popup's slide_y constrain.
2024-01-13 22:39:15 -08:00
Vlad Zahorodnii
66b1462cf8 xwayland: Make xinerama index -> Output mapping more robust with fractional scaling
xdg-output-v1 uses the fractional geometry, so also use it when mapping
a xinerama screen index to an Output.
2024-01-10 15:18:48 +00:00
zhang yu
cbb95f5649 quit tile window when it is maxied in wayland env 2024-01-09 07:10:58 +00:00
Vlad Zahorodnii
dd9e04fb18 Fix -Wdeprecated-declarations 2023-12-01 12:06:48 +02:00
Bharadwaj Raju
e5753ea336 Make autohide screen edges use the same activation delay setting as other edges
Makes it possible to easily target things in a window near your panel edge,
without bringing up your panel.

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

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

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

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

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

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

This is used by people with motor impairments or bad keyboards

It works by remembering the last input timestamp for a key

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

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

When pressing a locked modifier release it

BUG: 464452
2023-11-23 08:17:00 +00:00
Vlad Zahorodnii
2ff0fc26a4 Merge EffectWindow::{windowMinimized,windowUnminimized}
The main motivation is to match the Window API.
2023-11-21 18:20:02 +00:00
Vlad Zahorodnii
4faad8bd49 effects.h -> effecthandler.h 2023-11-20 15:47:36 +00:00
Vlad Zahorodnii
86084d118c libkwineffects/ -> effect/ 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
8566cb3735 Move effectloader.h to libkwineffects/ 2023-11-16 15:51:39 +02:00
Vlad Zahorodnii
36021b12a7 Drop redundant "kwin" prefix in some filenames 2023-11-16 13:37:50 +00:00
Vlad Zahorodnii
15b47ce7fc Merge EffectsHandlerImpl and EffectsHandler 2023-11-15 15:21:50 +02:00
Vlad Zahorodnii
a5546f1450 Drop some unused kwineffects.h includes 2023-11-15 14:41:42 +02:00
Xaver Hugl
ee146d33b9 libkwineffects: move files out to more fitting places 2023-11-14 17:03:40 +01:00
David Edmundson
4f9531ad77 Support SecurityContextManagerV1
This allows KWin to securely identify the client for a given connection,
without relying on the process name.

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

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

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

BUG: 469237
2023-11-06 14:55:57 +00:00
David Edmundson
c711997d31 Revert "Temporarily disable testXkb and testX11Window"
This reverts commit 6bad553f05
2023-11-06 09:52:31 +00:00
Vlad Zahorodnii
0f5e719b61 wayland: Fix none keyboard interactivity in LayerShellV1Window
Window::acceptsFocus() is not taken into account when a window is
activated using Workspace::activateWindow(). The main reason is because
of different input models on X11.

Instead, Window::takeFocus() should check itself if the window accepts
focus.
2023-11-06 08:07:32 +00:00
Arjen Hiemstra
6bad553f05 Temporarily disable testXkb and testX11Window
These prevent merging
2023-10-31 20:35:26 +00:00
Vlad Zahorodnii
8fbf287254 libkwineffects: Port to VirtualDesktop
This makes effects api consistent with the scripting api. In addition to
that, VirtualDesktop objects are more stable.
2023-10-26 07:21:49 +00:00
Vlad Zahorodnii
3bed991941 Link KI18n with libkwin privately 2023-10-25 12:46:12 +00:00
Alexander Lohnau
0d3b017b23 Avoid QtDBus module include in commonly used headers
Because all of QtCore and QtDBus is no longer pulled in, a few placed had to get explicit includes
2023-10-22 13:45:28 +00:00
Kai Uwe Broulik
3eb90b2c60 Adjust to KDecoration init API returning a bool
Will allow a fallback to client-side decoration when KDecoration init fails.
2023-10-22 10:52:42 +02:00
Laurent Montel
bc6116c5a7 There's no QVector anymore, QList is the QVector in Qt6 2023-10-19 13:43:53 +00:00
Alexander Lohnau
43174a9771 Remove X-Plasma-MainScript from C++ codepaths 2023-10-16 16:12:43 +00:00
Nicolas Fella
39fe6cd286 Remove window type from internal window and window system plugin
This is only set from KWindowSystem::setType(), which is unused on Wayland
2023-10-16 14:41:53 +00:00
Vlad Zahorodnii
9e10394db1 Move window specific signals from EffectsHandler to EffectWindow
This makes the api of EffectWindow more similar to the api of Window. It
also makes more sense to keep such signals in EffectWindow. In the future,
the effect window can be dropped in favor of the window.
2023-10-06 07:05:37 +00:00
Xaver Hugl
ae84480fbf outputconfigurationstore: add new config system
Instead of an external service (like KScreen) storing and restoring output configurations,
with this commit KWin takes over that responsibility. This allows it to, among other things,
generate appropriate configs for new sets of outputs immediately, and take KWin-internal information
about outputs into account when generating them.

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

Given that the Workspace acts more like a container and kwin starts
accepting client connections after starting compositing, it's possible
to create the Workspace earlier and simplify the start() function a bit.
2023-09-20 12:50:15 +00:00
Vlad Zahorodnii
de36fe82e8 wayland: Integrate KWaylandServer classes into KWin namespace 2023-09-15 16:31:15 +03:00
Vlad Zahorodnii
8bf2318800 wayland: Drop "_interface" from filenames
The cpp files in the wayland directory are named after protocol names.
"_interface" does not contribute anything new.
2023-09-15 13:13:43 +00:00
Vlad Zahorodnii
67dcf53e80 autotests: Add more test cases in LayerShellV1WindowTest::testPlacementArea 2023-09-11 05:53:19 +00:00
Vlad Zahorodnii
7d626363e4 autotests: Remove old kernel checks
CI runners have been upgraded.
2023-09-10 10:14:18 +03:00
Xaver Hugl
32ae9dd7d1 libkwineffects: rename major and minor methods
There's "major" and "minor" defines that can get implicitly included, for
example with musl libc. To prevent that from breaking compilation, rename
the methods
2023-09-09 14:44:53 +00:00
Vlad Zahorodnii
6dd6e176e3 Move X11Compositor and WaylandCompositor in their own files 2023-09-08 09:49:40 +03:00
Vlad Zahorodnii
14ab38b596 composite.h -> compositor.h 2023-09-08 09:48:59 +03:00
Vlad Zahorodnii
9cf6011ba4 autotests: Don't be so paranoid about compositing type
In many cases it's irrelevant, what we care about is whether given effect
is loaded and performs its function. So remove these paranoid checks
except the tests where it's important to use OpenGL compositing.
2023-09-08 09:48:16 +03:00
Xaver Hugl
a5df88b0de libkwineffects: move linux kernel version query out of GLPlatform
It has nothing to do with OpenGL
2023-09-07 21:13:15 +02:00
Xaver Hugl
27f90476b4 libkwineffects: rename kwingl* files to gl* 2023-09-07 16:41:22 +02:00
Mikhail Vinogradov
82be16df29 Try to refresh textInput active focus status 2023-09-04 08:45:43 +00:00
Vlad Zahorodnii
dee8a3b3a7 Clear decoration focus when window closes
If the window closes, we need to reset the focused decoration object.

BUG: 473244
2023-08-30 09:28:03 +00:00
Alexander Lohnau
40be656eed Adjust to changed signature of kcoreaddons_target_static_plugins
Depends on https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/360
2023-08-27 12:09:56 +02:00
Vlad Zahorodnii
d25574e7c6 Merge Window::userCanSetFullscreen() with Window::isFullscreenable() 2023-08-24 07:29:02 +00:00
Vlad Zahorodnii
346d4413a1 Remove boolean trap in Window::setFullScreen()
In most cases, it doesn't matter because a window is made fullscreen by
user. In a few places, the user arg is incorrectly set to false.
2023-08-24 07:29:02 +00:00
Kai Uwe Broulik
410ca44e6e XdgPopupWindow: Reposition for non-reactive positioners
Ensures that e.g. context menus move about with their parents when they
get moved around.

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

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

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

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

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

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

This patch adds that +1 back in.

# The bug it solves

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

This single pixel may seem minor or even irrelevant, but when you use the "Present Windows" desktop effect on a multiple-monitor setup, this one pixel will cause the window to show up on both monitors.
2023-08-07 07:14:18 +00:00
Laurent Montel
b823747c3b Add explicit moc includes to sources for moc-covered headers
* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
2023-07-15 08:40:49 +00:00
Vlad Zahorodnii
6cd56d5192 wayland: Implement cursor-shape-v1
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/194
2023-07-12 11:22:11 +03:00
Laurent Montel
86c6238cfa Don't use QtTest => use QTest + missing include 2023-07-04 10:38:21 +00:00
Aleix Pol Gonzalez
49a76ea772 Install KWaylandServer headers
There are use cases for the headers to be used, e.g. when implementing
wayland-specific workflows from an Effect.
In order to be able to use these, we also need to expose libkwin to be
imported as it carries the interfaces' symbols.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2023-07-04 08:22:43 +00:00
Vlad Zahorodnii
16cc0f5ebb autotests: Make test framework a static lib again
Static plugins being linked with shared libraries doesn't work smoothly.
POSITION_INDEPENDENT_CODE target property needs to be set for
every such plugin. However, there can be targets that we have no control
over, which need POSITION_INDEPENDENT_CODE to be set too. Asking such
projects to add this property and them refusing to do so would be
reasonable because kwin's entire static plugin pipeline is weird.

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

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

BUG: 471282
2023-06-21 11:05:42 +02:00
Vlad Zahorodnii
712fd3396c Sync EffectsHandler::windowAdded with Workspace::windowAdded
This change makes the EffectsHandler emit the windowAdded signal as soon
as the Workspace::windowAdded signal is received and minimize the
difference between the states observed in kwin core and effects.
2023-06-16 06:41:12 +00:00
Vlad Zahorodnii
23f533aa52 autotests: Skip ScreencastingTest::testOutputCasting when running in ci
The test is flaky. We work around it by passing --repeat until-pass, but
lately even it doesn't help us with this issue.

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

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

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

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

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

Adjust tests accordingly.

BUG: 469720
FIXED-IN: 5.27.6
2023-05-17 23:18:59 +02:00
Vlad Zahorodnii
223b01f9e7 wayland: Reevaluate layer shell window layer
Currently, if the layer shell surface's layer changes, the Window's
layer is not synchronized with it.
2023-05-15 08:32:37 +00:00
Vlad Zahorodnii
dbce106031 wayland: Grab the contents of cursor scene 2023-05-10 15:40:59 +03:00
Vlad Zahorodnii
3d5b5844d0 Drop Cursor::image()
Use CursorSource::image() instead.

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

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

On the other hand, we've added a bunch of new test cases in
testXdgShellWindow, so let's remove this one. If the bug is back, that
test will fail.
2023-04-24 10:13:58 +00:00
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
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
1f43605329 Drop Workspace::clientList() 2023-03-24 22:28:46 +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
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
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
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