101 Commits (master)

Author SHA1 Message Date
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.
12 months ago
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.
1 year ago
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.
1 year ago
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.
1 year ago
Vlad Zahorodnii 6b2f46ca1f autotests: Remove unused outputbackend.h includes 1 year ago
Vlad Zahorodnii cab0765947 autotests: Use layer-shell based panels 1 year ago
Xaver Hugl 6e9d5c2cc3 autotests: directly call setVirtualOutputs 1 year ago
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.
1 year ago
Vlad Zahorodnii c91b90c58a Tidy Window::windowClosed() signal
"window" is redundant, so remove it. Also remove the original window
argument to improve the API consistency.
2 years ago
Vlad Zahorodnii 2f56cdc3fe Replace Deleted with Window where possible
With this, Window and Deleted can be interchanged, which makes merging
the two easier.
2 years ago
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.
2 years ago
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.
2 years ago
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
2 years ago
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.
2 years ago
David Edmundson 29b456ff25 Autotests: Use a helper method to create X11 connection 2 years ago
Xaver Hugl 58fdbbc444 autotests/integration: test restoration of window states on moveresize cancel 2 years ago
Vlad Zahorodnii 12acd9bb78 autotests: Port away from OutputBackend::setInitialWindowSize() 2 years ago
Vlad Zahorodnii b830d408af core: Rename Platform to OutputBackend 2 years ago
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.
2 years ago
Vlad Zahorodnii 9d53f2d29c autotests: Add missing setVirtualOutputs calls 2 years ago
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.
2 years ago
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.
2 years ago
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.
2 years ago
Xaver Hugl 8955a2420e replace all uses of QScopedPointer with std::unique_ptr 2 years ago
Xaver Hugl 0d704b8913 placement: move singleton to Workspace 2 years ago
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.
2 years ago
Vlad Zahorodnii b167f67362 autotests: Use less QRectF::toRect() 2 years ago
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.
2 years ago
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.
2 years ago
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.
2 years ago
Vlad Zahorodnii 79e0051b04 autotests: Port more tests from obsolete Screens 2 years ago
Vlad Zahorodnii 22e5c8a260 autotests: client -> window 2 years ago
Vlad Zahorodnii 175037d9d1 Prefer the term "window" over "client" in Workspace 2 years ago
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.
2 years ago
Nils Fenner b491aeb9ae Rename AbstractClient to Window 2 years ago
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.
2 years ago
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
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
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.
3 years ago
Vlad Zahorodnii 73949dba91 autotests: Fix MoveResizeWindowTest 3 years ago
Nate Graham c1fb405b8d Rename "pack" actions for clarity
The English word "pack" is not really the correct word for these
actions, and does not succeed in communicating what they will do. Since
the actions simply move the active window as far as it will go in the
specified direction, the actions can be renamed to say that instead.

Also rename the action names in the code to match their new UI text for
clarity.
3 years ago
Vlad Zahorodnii 82dd480196 autotests: Fix testMoveResize
"2" is a copy paste typo, the expected number of outputs is 1.
3 years ago
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.
3 years ago
Vlad Zahorodnii 543145e76f autotests: Port common screen check preamble to AbstractOutput 3 years ago
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.
3 years ago
Vlad Zahorodnii b08807cc36 autotests: current abstract output 3 years ago
Vlad Zahorodnii 9a7ab8a62e Rework async geometry updates
Window management features were written with synchronous geometry
updates in mind. Currently, this poses a big problem on Wayland because
geometry updates are done in asynchronous fashion there.

At the moment, geometry is updated in a so called pseudo-asynchronous
fashion, meaning that the frame geometry will be reset to the old value
once geometry updates are unblocked. The main drawback of this approach
is that it is too error prone, the data flow is hard to comprehend, etc.

It is worth noting that there is already a machinery to perform async
geometry which is used during interactive move/resize operations.

This change extends the move/resize geometry usage beyond interactive
move/resize to make asynchronous geometry updates less error prone and
easier to comprehend.

With the proposed solution, all geometry updates must be done on the
move/resize geometry first. After that, the new geometry is passed on to
the Client-specific implementation of moveResizeInternal().

To be more specific, the frameGeometry() returns the current frame
geometry, it is primarily useful only to the scene. If you want to move
or resize a window, you need to use moveResizeGeometry() because it
corresponds to the last requested frame geometry.

It is worth noting that the moveResizeGeometry() returns the desired
bounding geometry. The client may commit the xdg_toplevel surface with a
slightly smaller window geometry, for example to enforce a specific
aspect ratio. The client is not allowed to resize beyond the size as
indicated in moveResizeGeometry().

The data flow is very simple: moveResize() updates the move/resize
geometry and calls the client-specific implementation of the
moveResizeInternal() method. Based on whether a configure event is
needed, moveResizeInternal() will update the frameGeometry() either
immediately or after the client commits a new buffer.

Unfortunately, both the compositor and xdg-shell clients try to update
the window geometry. It means that it's possible to have conflicts
between the two. With this change, the compositor's move resize geometry
will be synced only if there are no pending configure events, meaning
that the user doesn't try to resize the window.
3 years ago
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.
3 years ago