Commit graph

22759 commits

Author SHA1 Message Date
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
Arjen Hiemstra
d7fd53e9b0 Correct bottom left corner when placing a bottom toplevel input panel
`bottomLeft()` is affected by the same issue as anything else using
bottom, that is, it is off by 1. So instead use top() + height() for the
bottom edge.
2022-07-12 22:43:56 +01:00
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.
2022-07-12 22:43:56 +01:00
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.
2022-07-12 22:43:56 +01:00
David Edmundson
36f7bae36a Revert "inputpanel: Compensate the 1px difference in height for panel position"
This reverts commit 8d588f165c.
2022-07-12 22:31:38 +01:00
Rodney Dawes
8d588f165c inputpanel: Compensate the 1px difference in height for panel position
It seems there is a 1px offset in the availableArea height, so compensate
by subtracting an extra pixel from the input panel height, to avoid a gap
below the panel.

Fixes https://invent.kde.org/teams/plasma-mobile/issues/-/issues/150
2022-07-12 14:34:10 -04:00
Vlad Zahorodnii
64f811107e scenes/opengl: Remove unused includes 2022-07-12 17:49:41 +03:00
Vlad Zahorodnii
86f741ebe7 scenes/qpainter: Remove unused includes 2022-07-12 17:47:02 +03:00
Vlad Zahorodnii
02bfc8ecae scripting: Port from obsolete Screens 2022-07-12 12:22:18 +00:00
Vlad Zahorodnii
7d00766629 backends/drm: Make drm backend not touch output configuration if all outputs are disabled
This behavior was added in order to fix a crash reported in bug report
442990. However, the analysis was not 100% correct, kwin failed to
create a placeholder because the relevant check was incorrect. The drm
backend was checking the list of all connected outputs rather than the
list with enabled outputs to decide whether to create a placeholder output.

As a safety measure the proposed behavior makes sense, however the drm
backend is not the right layer to implement it. If the last enabled
output is disconnected, kscreen should view it as a new output
setup and re-enable outputs in order to ask user what desired output
configuration should be.
2022-07-12 09:54:50 +00:00
Vlad Zahorodnii
694c32cf2c Fully port EffectsHandler from Screens
This port the remaining bits in EffectsHandler from Screens. It does
make sense to deprecate or remove workspace geometry bits in
libkwineffects as the interpretation of the workspace layout is very
effect-specific, e.g. as in the slide effect.
2022-07-12 10:40:23 +03:00
Vlad Zahorodnii
79e0051b04 autotests: Port more tests from obsolete Screens 2022-07-12 07:05:45 +00:00
l10n daemon script
8d08c31de0 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-12 01:49:58 +00:00
ivan tkachenko
e9ad2b530b
[kcm/kwindesktop] Bump QML imports & fix JavaScript code style 2022-07-11 21:52:30 +03:00
ivan tkachenko
4f419afe30
[kcm/kwindesktop] Emit rowsChanged signal to fix default state highlighting
Without this, the rowsChanged signal wasn't emitting at startup, so the
binding `highlight: kcm.desktopsModel.rows !== 2` didn't work correctly.

FIXED-IN: 5.24.7 5.25.3 5.26
2022-07-11 21:52:25 +03:00
Xaver Hugl
0d302d5c66 backends/drm: also check for properties in DrmPipeline::needsModeset
Otherwise we may be missing situations where a modeset is needed

BUG: 455814
2022-07-11 14:31:55 +00:00
Vlad Zahorodnii
8f18dc5b7d Make Item::repaints() not guess repaints
The guessed repaint region is not optimal on wayland. Second, if it's a
new output, it's expected that there will be already a scene repaint
that covers all items on the given output so items don't need to provide
redundant repaint region.
2022-07-11 14:21:53 +03:00
l10n daemon script
c442f582a3 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-11 01:48:31 +00:00
Xaver Hugl
2d43f3eee2 backends/drm: handle disconnected but not removed connector objects properly
The kernel doesn't disable connector objects that represent physical ports
when the output gets removed. If KWin tries to change the output configuration
without explicitly disabling the connector, atomic commits can fail.
2022-07-10 11:55:57 +00:00
Alexander Lohnau
e96b9ba499 Improve docs for creating KWin effects
- use kcoreaddons_add_plugin CMake macro, the other one is KWin internal
- reference embedded json metadata in section about macros
- Provide codesnippet to json metadata
- Do not explicitly define plugin id in metadata, instead we can derive it from the library name
2022-07-10 10:05:55 +00:00
l10n daemon script
b97d12efc0 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-10 01:51:16 +00:00
l10n daemon script
19fb451be2 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-09 01:50:01 +00:00
Xaver Hugl
5451c7e0db windowview: handle windows from other virtual desktops better
Sometimes windows on other desktops are higher in the stacking order,
which causes them to unexpectedly jump above windows from the current
desktop in the effect.

To fix that, the z index is adjusted to be higher for windows on the active
virtual desktop, and windows from other desktops get reduced opacity in the
beginning of the animation
2022-07-08 17:03:16 +00:00
David Edmundson
c49620658f Create large enough atlas texture for decorations
When we render individual component of a decoration into an atlas we
ceil the positions for the individual component parts so they don't risk
overlapping. See SceneOpenGLDecorationRenderer::render

This isn't done when we set the overall texture height. This can cause
the bottommost part of the atlas (the right edge) to go out of view.

BUG: 453745
2022-07-08 12:34:22 +00:00
David Edmundson
06db7fc7ff Map XdgSurface to XdgWMBase instances properly
xdg_wm_base is a global that with a single instance in our high level
wrapper. Our surface wrapper needs to get the xdg_wm_base::Resource
instance on occastion.

Currently we go via wl_client for the mapping, but this breaks down
should a client bind wm_base twice.

BUG: 456349
2022-07-08 11:57:57 +00:00
Rodney Dawes
6af5a5e651 inputmethod: If KWIN_IM_SHOW_ALWAYS variable is set, show the keyboard
To allow for easier testing in development and for debugging purposes, when
the KWIN_IM_SHOW_ALWAYS environment variable is set, treat it as allowing
the keyboard to be shown, even when not using touch input.
2022-07-07 15:15:28 -04:00