1244 Commits (3b80380ba7077b316487ff3315df1b92c21878f0)

Author SHA1 Message Date
Aleix Pol 2c6821fdca autotests: Fix InputMethodTest
We now will only be getting the input method panel when there's an
enabled surface.
3 years ago
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.
3 years ago
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
3 years ago
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.
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 5420e11bd4 Make AbstractClient::titlebarPosition() return Qt::Edge
Conceptually, it's an edge, the titlebar can't be in a window corner.
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 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.
3 years ago
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.
3 years ago
Ismael Asensio e655dc7b42 autotests/xdgTestClientRules: Add helper function setWindowRule()
Reduces ~700 lines of the same code boilerplate to simplify the tests
and prevent mistakes.
3 years ago
Xaver Hugl 6a99bfd2f4 make software cursors work per output 3 years ago
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.
3 years ago
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.
3 years ago
Vlad Zahorodnii 4bd9708503 autotests: Fix PointerInputTest::testDecoCancelsPopup()
We need to ack configure event that wants to change deco mode.
3 years ago
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
3 years ago
Matt Scheirer 6287ab16f4 [libinput] Add support for display mapping 3 years ago
Matt Scheirer a719ceab4a [libinput] Persist device calibration & orientation 3 years ago
Vlad Zahorodnii ec8f4140c3 autotests: Add no border window rule tests 3 years ago
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.
3 years ago
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.
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 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.
3 years ago
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
3 years ago
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.
3 years ago
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
3 years ago
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.
3 years ago
Vlad Zahorodnii 57f8faeb41 autotests: Fix TestPluginEffectLoader
PluginEffectLoader was changed so that it queries and loads all effects
immediately.
3 years ago
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"
3 years ago
Vlad Zahorodnii dc3d0444e4 Drop Screens::displaySize()
It's the same as the workspace geometry, i.e. the bounding geometry of
all outputs.
3 years ago
Alexander Lohnau 66352bfc87 Utilize KCoreAddons infrastructure for static plugins 3 years ago
Vlad Zahorodnii f1e96676ef Remove boolean trap in AbstractClient::isShown()
Check shaded state where needed.
3 years ago
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.
3 years ago
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
3 years ago
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.
3 years ago
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.
3 years ago
Xaver Hugl c01c15f241 AbstractClient: split up hideClient into hide and show
This makes the purpose of the method call more clear
3 years ago
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.
3 years ago
Vlad Zahorodnii 94de28bfbe Move input backends in their own directory 3 years ago
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.
3 years ago
Vlad Zahorodnii 4a62716bbb autotests: Fix TestXdgShellClientRules 3 years ago
Vlad Zahorodnii 73949dba91 autotests: Fix MoveResizeWindowTest 3 years ago
Vlad Zahorodnii 26e185a6e3 autotests: Fix QuickTilingTest 3 years ago
Vlad Zahorodnii c09a03a927 Drop Platform::touchPointCount()
It can be accessed directly in the touch input device handler.
3 years ago
Andrey Butirsky e4e920d895 [testBorderlessMaximizedWindow] add touch to the test
BUG: 411884
3 years ago
Andrey Butirsky 83ece2e2a8 unit test for focusing loss problem on maximize
BUG: 411884
3 years ago
Vlad Zahorodnii 252ba9e005 autotests: Use less Screens::size(int)
The same info can be retrieved from AbstractOutput::geometry().size().
3 years ago
Vlad Zahorodnii 15520888d9 kwineffects: Drop numScreens property
The screen count can be retrieved by checking the number of items in the
EffectHandler.screens property.

The replacement for the numberScreensChanged signal are the screenAdded
and the screenRemoved signals.

The main motivation behind this change is to clean up the screens api
and reduce the number of usages of the Screens class.
3 years ago
Vlad Zahorodnii 701902fbec effects: Port effects from int screens ids to EffectScreen
EffectScreen objects are better as they are more stable and we avoid int
screen ids in kwin core.
3 years ago
Alexander Lohnau dffbfcc9f7
Fully port away from KPluginLoader 3 years ago
Alexander Lohnau e431b453b6
Port away from KPluginLoader::findPlugins 3 years ago