Commit graph

69 commits

Author SHA1 Message Date
Aleix Pol Gonzalez
79dd34b3f9 Do not rely on NETWM for the main Window class
NETWM forces a weird X11 dependency on KWin that doesn't necessarily
match what we want to do. Instead we decouple such a central class in
KWin like it's Window from KWindowSystem X11 support.

Signed-off-by: Falko Becker <falko.becker@mbition.io>
2024-02-20 18:04:06 +00:00
Vlad Zahorodnii
784d48ef52 Port away from deprecated KConfigBase::group() api 2023-11-28 10:02:03 +00:00
Vlad Zahorodnii
a5546f1450 Drop some unused kwineffects.h includes 2023-11-15 14:41: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
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
Xaver Hugl
6e9d5c2cc3 autotests: directly call setVirtualOutputs 2023-05-09 15:18:33 +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
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
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
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 Edmundson
29b456ff25 Autotests: Use a helper method to create X11 connection 2023-02-06 16:02:50 +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
12acd9bb78 autotests: Port away from OutputBackend::setInitialWindowSize() 2022-11-17 14:20:44 +00:00
Vlad Zahorodnii
b830d408af core: Rename Platform to OutputBackend 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
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
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
Xaver Hugl
cdf777663d autotests/integration: use std::unique_ptr for wayland surfaces 2022-08-18 11:54:30 +02: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
8955a2420e replace all uses of QScopedPointer with std::unique_ptr 2022-08-04 12:30:09 +00: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
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
79e0051b04 autotests: Port more tests from obsolete Screens 2022-07-12 07:05:45 +00:00
Vlad Zahorodnii
22e5c8a260 autotests: client -> window 2022-04-27 12:45:46 +00:00
Vlad Zahorodnii
175037d9d1 Prefer the term "window" over "client" in Workspace 2022-04-25 11:33:55 +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
Nils Fenner
b491aeb9ae Rename AbstractClient to Window 2022-04-22 17:39: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
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
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
200223e06e autotests: Prepend KWayland::Client:: to Surface
With a "Surface" type in kwin, KWayland::Client::Surface without fully
specified namespace will conflict with kwin's Surface type.

In some way, it also improves readability as it's clear where Surface
comes from.
2021-09-06 10:42:03 +00:00
Vlad Zahorodnii
543145e76f autotests: Port common screen check preamble to AbstractOutput 2021-08-31 08:16:27 +00:00
Vlad Zahorodnii
7016da39c8 Move active output tracking to workspace
Active output is a window management concept. It indicates what output
new windows have to be placed on if they have no output hint. So
Workspace seems to be a better place for it than the Screens class, which
is obsolete.
2021-08-30 13:28:23 +00:00
Vlad Zahorodnii
b08807cc36 autotests: current abstract output 2021-08-30 13:28:23 +00:00
Vlad Zahorodnii
5bbd21f682 autotests: Port away from deprecated clientArea() overloads 2021-08-25 18:53:53 +00:00
Vlad Zahorodnii
fddbd57d09 Port Workspace::clientArea() to VirtualDesktop
This makes Workspace APIs that take virtual desktops more consistent.
2021-08-25 14:31:30 +00:00
Vlad Zahorodnii
edb7867ee9 Prepend "Interactive" to interactive move resize methods
This is to improve code readability and make it easier to differentiate
between methods that are used during interactive move-resize and normal
move-resize methods in the future.
2021-05-16 13:50:25 +03:00
Aleix Pol
f6c2861b73 strutstest: fix top panel/ivnalid strut 2
The client area is detected as invalid and ignored by
Workspace::updateClientArea.
2021-05-12 10:43:03 +00:00
Vlad Zahorodnii
282e0d1c4d autotests: Port the tests to new xdg-shell helpers 2021-05-11 05:26:51 +00:00
Aleix Pol
a3d32fa836 Ensure we start our tests with wayland already initialised
When debugging modifier_only_shortcut_test in _waylandonly mode I saw
that it was failing, among other things, because some aspects were not
initialised.

This changes every test we have to run the new
Test::initWaylandWorkspace() that calls waylandServer()->initWorkspace()
but also makes sure that WaylandServer::initialized is emitted before we
proceed.
2021-05-10 12:33:43 +00:00
Vlad Zahorodnii
3cdc97a4e9 Avoid converting socket name between QString and QByteArray back and forth
It only contributes overhead.
2020-12-09 15:07:29 +02:00
Vlad Zahorodnii
4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii
1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Vlad Zahorodnii
d1b35f306d Introduce started signal in Application
The new signal is emitted when the Application has fully been initialized.

It allows us to change the startup sequence, for example create workspace
before starting the Xwayland server, without making any adjustments in our
test suit.
2020-07-17 09:10:51 +00:00
Aleix Pol
6abd23ed02 Make it possible to have a separate cursor for the tablet
Summary:
As is KWin only had 1 Cursor which was a singleton. This made it impossible for
us to properly implement the tablet (as in drawing tablets) support and show where
we're drawing.
This patch makes it possible to have different Cursors in KWin, it makes all the
current code still follow the mouse but the tablet can still render a cursor.

Test Plan: Tests pass, been using it and works as well as before but with beautiful tablet cursors.

Reviewers: #kwin, cblack, davidedmundson

Reviewed By: #kwin, cblack, davidedmundson

Subscribers: davidedmundson, cblack, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28155
2020-04-03 01:16:45 +02:00