Commit graph

22934 commits

Author SHA1 Message Date
Xaver Hugl
f50547de1e backends/drm: manage drm objects with std::unique_ptr
Also makes the connector detection code a bit more readable
2022-07-18 14:26:26 +00:00
Xaver Hugl
affa7386f8 backensd/drm: manage gpus with std::unique_ptr 2022-07-18 14:26:26 +00:00
Xaver Hugl
32c2ae15a4 backends/drm: manage drm properties with std::unique_ptr 2022-07-18 14:26:26 +00:00
Vlad Zahorodnii
aa739c59cf wayland: Make mapping from xinerama indices to Output correct
We assume that outputs in kwinApp()->platform()->enabledOutputs() are
stored in the xinerama order. However, this is not the case on Wayland
and it's not going to be changed because it increases the complexity.

This change makes Workspace::xineramaIndexToOutput() use Xinerama
extension API to map a xinerama index to the associated Output object.

With this, Xwayland applications will be able to put on outputs as
expected.

Note that xinerama indices are not cached because
Workspace::xineramaIndexToOutput() is not used in any hot code path. If
that changes, xinerama indices can be cached. The cache must be
invalidated whenever we get screens changed notify event from RANDR.
2022-07-18 13:52:58 +00:00
Vlad Zahorodnii
5a8beacd2b Drop Platform::findOutput()
Please, don't use integer ids to identify outputs!
2022-07-18 13:52:58 +00:00
Vlad Zahorodnii
fc58fbaa71 Add conversion helpers between xinerama indices and output objects
Currently, we implicitly assume that enabled outputs are stored in the
xinerama order, but with ongoing refactorings, it's easy to break that
assumption. Also, we are not going to change the DRM backend so it
stores enabled outputs in the xinerama order.

This change adds xinerama index conversion helpers in order to reduce
the number of potential regressions with output refactorings.
2022-07-18 13:52:58 +00:00
Vlad Zahorodnii
4790916fb1 x11: Fix shading with non-zero border
There was a geometry change that fixed mixing the next and current
geometries. While it did fix issues on wayland, it broke window shading
on x11 because of an obscure resize() call.

That obscure resize() had a side-effect that ensures m_clientGeometry
has the right value so the next time the window is unshaded,
implicitSize() will return a good value.

In order to make window size computation more robust, this change makes
X11Window compute the natural frame size based on cached size in
m_client, which shouldn't change when the window is shaded.

However, given how buggy window shading is and how difficult it is to
make it work right, I think that it's better to deprecate window shading
and remove it in some future release.

BUG: 450582
2022-07-18 11:39:06 +00:00
Vlad Zahorodnii
64c71a37a0 backends/virtual: Use #pragma once 2022-07-18 08:36:04 +00:00
Vlad Zahorodnii
f80a14d4f6 backends/virtual: Make render backend naming consistent 2022-07-18 08:36:04 +00:00
Vlad Zahorodnii
5bf1332df5 backends/wayland: Use #pragma once 2022-07-18 08:36:04 +00:00
Vlad Zahorodnii
a56b09ab9d backends/wayland: Make render backend naming consistent 2022-07-18 08:36:04 +00:00
Vlad Zahorodnii
6db530bfde backends/x11: Use #pragma once 2022-07-18 08:36:04 +00:00
Vlad Zahorodnii
8dd719e4e2 backends/x11: Make render backend naming consistent 2022-07-18 08:36:04 +00:00
Nate Graham
a0c8d4b24d WindowHeap: expand size of highlight
Currently, the highlight effect is not very visible because it only
barely peeks out of the window thumbnail. We can make it bigger by
making it peek out a little bit more, and also by including the window
title and icon (when visible) within it.

BUG: 454842
2022-07-17 02:55:01 +00:00
l10n daemon script
131b9d226a SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2022-07-17 01:46:18 +00:00
Nate Graham
722cc87016 Use old id for "Peek at Desktop" to preserve existing shortcus
This code uses the DEF() macro which silently re-uses an untranslated
version of the string as the ID in the config file. So anytime you
change the text, a new entry will be created in the config flil and
users will lose any custom shortcut mappings.

To avoid this, use the DEF2() macro instead, which allows defining the
ID and the user-facing translated name differently.
2022-07-15 15:52:18 +00:00
Xaver Hugl
636b411b31 backends/drm: don't crash if importing a texture fails
CCBUG: 456500
2022-07-15 13:42:48 +00:00
Aleix Pol
c8c1b05661 Remove unnecessary constructor 2022-07-15 14:58:42 +02:00
Aleix Pol
39f45ad70f WaylandOutput: Remove unused rendered attribute 2022-07-15 14:58:42 +02:00
Vlad Zahorodnii
885e9acb6e Drop ApplicationWaylandAbstract
We gain nothing with it. XCB setup logic in the Xwayland server has to
be moved to the workspace layer anyway. For example, this move of
responsibilities will be needed to support running more than just one
instance of Xwayland. Architecture-wise, it would be cleaner too.

Unfortunately, it breaks encapsulation of the Application, but this can
be taken care later.
2022-07-15 12:18:03 +00:00
Kishore Gopalakrishnan
ed128064e3 Swapping desktops: only swap windows on current activity.
In the desktop grid effect, dragging an empty area of a desktop to
another desktop swaps all windows on the two desktops. This change makes
sure that this matches only windows in the current activity.

Was earlier fixed in
1e0b0c881e
, but the bug was reintroduced by the QML rewrite.

BUG: 386769
2022-07-15 08:26:08 +00:00
Vlad Zahorodnii
b167f67362 autotests: Use less QRectF::toRect() 2022-07-15 07:56:07 +00:00
Nate Graham
e801819a2d Rename "Show Desktop" to "Peek at Desktop" in UI strings
Companion to https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1036
2022-07-14 17:36:04 +00:00
awed potato
717e17d578 Default RollOverDesktops (AKA "navigation wraps around") to false
Having RollOverDesktops false is more intuitive and "natural" for
new users, who may be disoriented by virtual desktop navigation
wrapping around (especially for small numbers of virtual desktops)
and not find the setting to change it very easily.
2022-07-14 14:21:40 +00:00
David Edmundson
862aae9d35 Drop uneeded toPoint
outputAt has an overload
2022-07-14 11:39:00 +00:00
David Edmundson
0c5da45cfc Drop multiple point rounding in input code
Input is floating but was rounded when we entered kwin logic.
This is no longer needed after more floating point support was added to
the core.
2022-07-14 11:39:00 +00:00
Arjen Hiemstra
2138a43392 Properly set m_size when updating SurfacePixmap{Wayland,Internal}
Otherwise the size() getter in the base class outputs an invalid size
and we can't really use it.
2022-07-14 11:34:45 +02:00
Arjen Hiemstra
2f4fa23e61 Use normalized UV coordinates for SurfaceItem
Relying on the texture matrix to normalize means we multiply every UV
coordinate with 1/scale, which leads to floating point errors and thus
errors in the UV coordinates. Instead, if we calculate normalized
coordinates directly we avoid floating point error and get proper UV
coordinates.

Longer term the plan is to make all UV coordinates normalized and get
rid of the CoordinateType altogether.
2022-07-14 11:34:45 +02: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
Bharadwaj Raju
1527a0cf13 Don't use Plasma-themed icons in Present Windows
BUG: 455368
2022-07-14 08:01:51 +00:00
Vlad Zahorodnii
d6646d25d0 Remove unused screens.h includes 2022-07-14 09:51:18 +03:00
Ismael Asensio
6914c81324 TabBox: Fix loading a different switcher after one has failed
We need to reset the QML Item on failure or trying to load a
different switcher afterwards will pick a wrong codepath and
also fail.

BUG: 445455
FIXED-IN: 5.25.4
2022-07-14 00:15:13 +02:00
Vlad Zahorodnii
9e61f5039e Remove some Screens::count() usages
Screens is obsolete, use Platform::enabledOutputs().
2022-07-13 21:51:03 +00:00
Xaver Hugl
7f04ea578f backends/drm: handle broken legacy drivers better
Some legacy drivers either don't accept gbm buffers suitable for cursors,
or don't handle them properly. In order to work around that, always do a
CPU import with legacy and use dumb buffers instead.

BUG: 453860
CCBUG: 456306
2022-07-13 21:10:19 +02:00
Vlad Zahorodnii
e09ca74295 wayland: Make workspace responsible for creating Screens
The Screens object is created by Workspace on X11. This change makes X11
and Wayland behave more similar. As is, the Screens is a helper for
window management code, don't use it in backends. Note that the X11 backend
already uses the Screens, it needs to be addressed individually.
2022-07-13 17:54:35 +00:00
Xaver Hugl
137cd9c031 xdgshell: don't allow applet popups to be moved 2022-07-13 17:00:34 +00:00
Vlad Zahorodnii
5be18da8ac backends/virtual: Remove unused includes 2022-07-13 16:01:46 +00:00
Vlad Zahorodnii
728e369a4d backends/virtual: Remove eglSwapBuffers() call
It's noop, we use EGL_MESA_platform_surfaceless.
2022-07-13 16:01:46 +00:00
Vlad Zahorodnii
b442c1e81b qpa: Port from Screens 2022-07-13 15:42:27 +00:00
Arjen Hiemstra
8284740cdf InputMethodTest: Only create the windowAddedSpy when actually needed
We don't really care about the window showing up until we're calling
showInputPanel, but since Workspace::windowAdded is triggered for any
window that gets added, the test sometimes fails because count() is 2
instead of 1. To avoid that, only create the spy when it's actually
relevant instead of all the way at the start before any other setup is
done.
2022-07-13 15:24:19 +00:00
Xaver Hugl
c050716a3b wayland/drmlease: correct DrmLeaseDeviceV1Interface::setDrmMaster 2022-07-13 12:27:54 +00:00
Xaver Hugl
9ac3c64d4c wayland/drmlease: split up DrmLeaseV1Interface::deny 2022-07-13 12:27:54 +00:00
Xaver Hugl
919b56e9a2 drmlease: send device done event correctly 2022-07-13 12:27:54 +00:00
Vlad Zahorodnii
71bfbe815c backends/virtual: Manage VirtualQPainterLayer using std::unique_ptr 2022-07-13 11:07:18 +00:00
Vlad Zahorodnii
26d4a06818 backends/virtual: Port from Screens 2022-07-13 11:07:18 +00:00
Vlad Zahorodnii
b3d3ca8c0f backends/drm: Remove unused screens.h includes 2022-07-13 10:21:44 +00:00
Arjen Hiemstra
a4fe17653f Remove alignment requirements from data in vertex/index buffers
We now rely on auto-vectorisation to generate the appropriate SSE or
other instruction set code. We can also assume that takes care of
handling any alignment requirements and thus remove the need for manual
alignment things.
2022-07-13 09:25:12 +00:00
Arjen Hiemstra
5287422f46 Add unroll hint to inner loop in WindowQuads::makeInterleavedArrays
The inner loop here has a fixed size and unrolling it allows better
vectorization. Both GCC and clang recognise the `#pragma GCC unroll`
directive.
2022-07-13 09:25:12 +00:00
Arjen Hiemstra
a95b556868 Drop custom SSE code from WindowQuads::makeInterleavedArrays
Both GCC and Clang do auto vecrization these days and testing shows that
that actually produces faster code, so dropping the SSE stuff makes
things both simpler and faster.
2022-07-13 09:25:12 +00:00
ivan tkachenko
0c8d87f9d4
[kwineffects] Fix wrong object being passed as a QQuickItem* context
Without this patch the following warning is issued:

    Could not convert argument 1 at
        onTriggered@file:///usr/share/kpackage/kcms/kcm_kwin_effects/contents/ui/Effect.qml:129
        onClicked@file:///usr/lib/qml/org/kde/kirigami.2/templates/SwipeListItem.qml:485
    Passing incompatible arguments to C++ functions from JavaScript is dangerous and deprecated.
    This will throw a JavaScript TypeError in future releases of Qt!
2022-07-13 10:53:42 +03:00