Commit graph

677 commits

Author SHA1 Message Date
Vlad Zahorodnii
b75f089981 Port Workspace::topClientOnDesktop() to VirtualDesktop
This patch has one behavioral change - raiseOrLowerClient() will not
work if the client is not on the current virtual desktop.

However, raiseOrLowerClient() can be called only in two cases:

* user triggers the raise or lower shortcut for the active client. Since
  the active client is on the current virtual desktop, it's not an issue

* an x11 window restacks itself. It makes no sense if an x11 window
  restacks itself while it's inactive or not on current virtual desktop.
  Also, the Opposite restack mode is rarely used, some window managers
  don't even bother implementing it. So, having such a constraint should
  not be a problem.

The main reason for not allowing raiseOrLowerClient() for windows that
are not on the current virtual desktop is that a window can be on
multiple virtual desktops. If a window is on A and B virtual desktops,
the only logical option is to toggle stacking position if the window is
on the current desktop. It's the only viable option as kwin does not
maintain per virtual desktop stacking order.
2021-08-17 06:23:52 +00:00
Vlad Zahorodnii
a13fd02ea8 Remove virtualdesktops.h include in toplevel.h
toplevel.h is included in many places. Changing virtualdesktops.h may
trigger rebuild of all kwin.

With this change, only cpp files that use virtualdesktops.h will need to
be recompiled.
2021-08-12 17:23:15 +00:00
Aleix Pol
53dcd205c6 inputmethod: Add a test that simulates client switching 2021-07-31 02:10:17 +02:00
Vlad Zahorodnii
964c487d4f wayland: Switch to ClientBuffer
The main motivation behind the split is to simplify client buffer code
and allow adding new features easier, for example referencing the shm
pool when a shm buffer is destroyed, or monitoring for readable linux
dmabuf file descriptors, etc.

Also, a referenced ClientBuffer cannot be destroyed, unlike the old
BufferInterface.
2021-07-23 15:33:38 +00:00
Nicolas Fella
25b85607d0 Port from KPluginLoader::pluginsById to KPluginMetaData::pluginById
The latter gives us only a single plugin which makes the code a bit more concise
2021-07-22 22:59:13 +02:00
Aleix Pol
26fd5d3667 inputmethod: Remove workaround 2021-07-21 13:10:30 +02:00
Aleix Pol
422522d15b inputmethod: Also expose the visibility on dbus
Since we adapted inputmethod to support methods like ibus, the input
method can be active but not have a visible panel.
This includes an extra property that will indicate us if the panel is
visible at any time. This will allow us to properly render the virtual
keyboard hide button in Plasma Mobile (or wherever we need it).
2021-07-21 13:10:30 +02:00
Aleix Pol
abf22570c7 inputmethod: Reduce consecutive activation+deactivation+activation sequences
So far calling setActive(true) would issue a deactivation then another
activation. This sometimes makes maliit crash and we can achieve the
same result just by just issuing a reset.
2021-07-21 13:10:30 +02:00
Aleix Pol
9b5b02c957 kwin tests: Add heplers to access the input panel client and its surface
It's useful when dealing with unit tests for input methods
2021-07-21 13:10:30 +02:00
Vlad Zahorodnii
5d1062f42d autotests: Fix VirtualKeyboardDBusTest
Input method is enabled by default now, adjust the test to that.
2021-06-22 16:28:45 +03:00
Vlad Zahorodnii
46b81be246 autotests: Make SceneQPainterTest more robust to BufferInterface changes
At the moment, the test depends on the implicit client connection flush
in BufferInterface::unref(). It will be highly desirable if that connection
flush is gone as it allows us batching wayland events better. It also
allows us remove a system call from a hot path.
2021-06-19 09:24:16 +00:00
Vlad Zahorodnii
43106b7e5d autotests: Remove SceneOpenGLShadowTest
It's barely readable and it doesn't add any real value.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
de122825fd scenes/qpainter: Remove support for drop-shadows
Drop-shadows with the software render backend impact performance quite
significantly. It also makes it easier to prepare render backends for the
item based design.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
a06690021d Remove OpenGL2Compositing enum
OpenGLCompositing and OpenGL2Compositing enums mean de-facto the same
thing, it's confusing to have them both.
2021-06-09 15:24:22 +00:00
Vlad Zahorodnii
3c2ca184e3 effects: Remove Desktop Cube Animation effect
With the ongoing scene redesign, it needs to be rewritten. However,
given that it is not used widely based on support information from
various bug reports and our available man power is sparse, the most
reasonable thing is to drop the effect, unfortunately.
2021-06-09 08:21:27 +00:00
Vlad Zahorodnii
1b2c7b248b Run clazy with qt-keywords fixit
In C++20, there will be emit() class member, which can conflict with the
emit keyword. Given that, there are plans to enable QT_NO_KEYWORDS by
default in the future.

See also
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
2021-06-08 10:49:42 +03:00
Nicolas Fella
f910b0de97 Use version-less qt DBus macros
They work with both Qt5 and Qt6
2021-05-31 01:00:35 +02:00
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.
2021-05-25 06:17:41 +00:00
Vlad Zahorodnii
e4ec955d88 Remove shadow related bits in Scene::Window 2021-05-19 14:13:47 +03: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
Vlad Zahorodnii
4ba249eee5 wayland: Signal about finished move/resize in destroyClient()
We need to emit the clientFinishUserMovedResized signal to notify
effects such as translucency that the interactive move-resize is
finished. Otherwise, the set() animation won't be cancelled and the
window will get stuck frozen.

BUG: 409376
2021-05-16 10:46:57 +00:00
Vlad Zahorodnii
07c4057180 autotests: Stabilize tests that create Xwayland windows
The order in which Xwayland surfaces are associated with X11 windows is
undefined, meaning that we cannot assume that a newly created X11 window
won't have a surface associated with it already.
2021-05-15 16:16:48 +00:00
Vlad Zahorodnii
b6dd7c5860 autotests: Introduce own idle inhibit v1 helpers
Non-core wrappers in kwayland are deprecated. qtwaylandscanner needs to
be used instead for generating client-side wrappers.
2021-05-14 05:36:08 +00:00
Vlad Zahorodnii
7d0cad07fb autotests: Fix XwaylandInputTest
For some reason, Xwayland doesn't like starting without outputs. If
outputs are added later, it sends bogus EnterNotify and LeaveNotify
events.
2021-05-13 11:44:41 +00:00
Vlad Zahorodnii
0f60cc68a9 autotests: Prefer stackingOrder() over xStackingOrder()
This reduces the number of usages of xStackingOrder(), which simplifies
the reasoning about when it can be marked as dirty.

Since internal windows are now in the regular stack, InternalWindowTest
can use stackingOrder().

As for X11ClientTest, there's no specific reason why it uses the x stack
instead of the regular one.
2021-05-13 04:58:45 +00:00
Vlad Zahorodnii
d78d686690 autotests: Stabilize ActivationTest::testSwitchToWindowMaximized 2021-05-12 20:44:28 +03:00
Vlad Zahorodnii
c9ee2f06db autotests: Fix testActivation
Currently there's a race condition with regards to the first configure
event with the activated state.
2021-05-12 19:21:38 +03:00
Aleix Pol
69b7b523f8 Make MoveResizeWindowTest::testGrowShrink more reliable
We need to make sure that the information from
toplevelConfigureRequestedSpy is in place to be used, otherwise we get
an empty size and it doesn't work.
2021-05-12 10:43:28 +00: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
Aleix Pol
35970686e1 Implement ping on tests
Otherwise there's no pong and we get unnecessary noise.
2021-05-12 10:42:34 +00:00
Aleix Pol
92e0357fef InputMethodTest: provide a process to launch when we need a virtual keyboard
Otherwise it never claims to be active.
2021-05-11 12:47:41 +02:00
Aleix Pol
341ec55c9e InputMethodTest: Use InputMethod::isActive as a way to check if it's activated
Instead of looking for a client, which is a bit more of a hit and miss,
since the client doesn't need to be registered when the test expects it
to.
2021-05-11 12:47:27 +02:00
Aleix Pol
c8a1f48151 GlobalShortcutsTest: No need to make the test longer than it needs to be 2021-05-11 12:38:00 +02:00
Aleix Pol
8cbc03b3be GlobalShortcutsTest: Support running the test without xwayland 2021-05-11 12:38:00 +02:00
Aleix Pol
a977ba3311 GlobalShortcutsTest: Fix testNonLatinLayout
Have it switch back from the Russian layout, otherwise the rest of tests
are run with this one and fail as they produce weird shortcuts.
2021-05-11 12:38:00 +02:00
Vlad Zahorodnii
282e0d1c4d autotests: Port the tests to new xdg-shell helpers 2021-05-11 05:26:51 +00:00
Aleix Pol
8cfa30803b Fix InternalWindowTest::testDismissPopup
We were expecting a tooltip to be closed when clicking its
transientParent, but it's explicitly not something we are after. We
close popups when we click either other clients or the actual client on
the decoration.

This change makes it so we end up clicking another window instead of the
parent one that is unrelated.
2021-05-11 00:05:37 +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
5739603145 autotests: Fix kglobalaccel integration
Starting with 48c3376927e5e9c13377bf3cfc8b0c411783e7f3 in kglobalaccel,
KGlobalAccel won't work in desktop environments other than Plasma.

We need to set XDG_CURRENT_DESKTOP=KDE to ensure that global shortcuts
still work.
2021-05-05 09:16:58 +03:00
Vlad Zahorodnii
a0fc0277a7 wayland: Make fullscreen mode updates async
Currently, the fullscreen state is update synchronously, but it needs to
be done in asynchronous fashion.

This change removes some tests as they don't add any value, testFullscreen()
covers them all.
2021-05-05 06:11:42 +00:00
Vlad Zahorodnii
403a04fe24 wayland: Fix loading of HiDPI cursors
Xcursors don't support hidpi so if a hidpi cursor is needed, kwin will
scale the desired size by the scale factor and ask Xcursor helpers to
load a theme with the given name and the size.

However, the theme loading code doesn't take into account that Xcursor
theme loading helpers may not return cursor sprites of size size * scale
if the theme has no such a size.

For example, if the cursor theme only provides 24, 36, and 48 sizes and
kwin attempts to load cursors of size 48 with a scale factor of 2, we
will get cursors of size 48 instead of 96. Unfortunately, this will
result in the issue where the cursor shrinks when hovering decorations
because kwin doesn't know that the effective scale factor (1) is
different from the requested scale factor (2).

In order to fix loading of HiDPI cursors, we need to approximate the
effective scale factor of every cursor sprite as we load it.
2021-05-03 10:52:25 +03:00
Aleix Pol
050ce24247 inputmethod: Move the input method process into the InputMethod class
Use the control this gives us for stopping the input method process when
we disable.
2021-04-29 11:04:19 +00:00
Vlad Zahorodnii
ac3c09ba75 Remove Platform::areOutputsEnabled()
This flag is redundant. If an output is disabled, the compositor won't
attempt to perform compositing on it.
2021-04-29 10:47:41 +00:00
Xaver Hugl
2aae299eba Fix testScreens 2021-04-26 19:25:50 +00:00
Vlad Zahorodnii
9ad83dafe6 autotests: Fix InputMethodTest
Currently, the test fails because the d-bus api was changed recently.
Use InputMethod::setEnabled() method to enable input method support.
2021-04-23 22:08:29 +03:00
Vlad Zahorodnii
c894956bba autotests: Fix testVirtualKeyboardDBus 2021-04-23 21:40:04 +03:00
Vlad Zahorodnii
9fe53ee062 autotests: Fix DontCrashCursorPhysicalSizeEmpty 2021-04-23 09:55:04 +03:00
Aleix Pol
f1a779d916 tests: clean outputManagement when cleaning interfaces
Otherwise we get crashes trying to access unexisting objects.
2021-04-22 10:16:36 +00:00
Vlad Zahorodnii
ab58171ed8 wayland: Check workspace position after creating decoration
If a decoration is created for an already mapped maximized window, check
the workspace position to ensure that the window still fits the maximize
area.

BUG: 432326
2021-04-07 20:38:05 +00:00
Andrey Butirsky
91f47c9092 fix global shortcuts for non-Latin symbols
Re-use Qt's implementation of handling non-Latin layouts here
For full ASCII range support (Alt+`, etc.) Qt needs to be patched still,
see QTBUG-90611

BUG: 375518
2021-04-05 19:39:06 +00:00