Commit graph

20890 commits

Author SHA1 Message Date
Xaver Hugl
dea33cb311 backends/drm: consider zero modes as failure
If there's no modes, we can't use the output
2022-02-28 17:26:29 +00:00
Xaver Hugl
6bd6ad9d59 backends/drm: let DrmGpu handle mode changes
Doing a test is not sufficient for mode changes

BUG: 450804
2022-02-28 17:26:29 +00:00
Xaver Hugl
907cf72bb0 backends/drm: only update modes if actually necessary
This prevents some unneeded modesets
2022-02-28 17:26:29 +00:00
Xaver Hugl
72d9711e5d backends/drm: fix recording with direct scanout
BUG: 450943
2022-02-28 17:27:44 +01:00
Kai Uwe Broulik
1256ab4b84 scripting: Build generic scripting KCM only with KWIN_BUILD_KCMS
Without scripting KCM there is no access to script configuration either

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-24 21:29:53 +00:00
Kai Uwe Broulik
4a14ac51ed effects: Build effect config only with KWIN_BUILD_KCMS
Without effects KCM there is no access to effect configuration either

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-24 21:29:53 +00:00
Aleix Pol
4c9c5f9fd5 inputmethod: fix placing the virtual keyboard at the bottom
We should use the output area as the margin size as where to position
rather than the panelSize.

This ensures that the keyboard ends up in the right place right above
the panels.
2022-02-24 18:11:45 +01:00
Laurent Montel
cf6cc51651 Allow to use new kauth includes 2022-02-24 07:14:23 +01:00
Vlad Zahorodnii
aaa07f0605 Revert "Remove mysterious s_cursorUpdateBlocking boolean flag in pointer_input.cpp"
This reverts commit 3d0bdc56a4.

seat->setFocusedPointerSurface() before notifyPointerMotion() is needed
to prevent sending a motion event that's outside the previously focused
surface.

BUG: 449273
2022-02-23 22:03:27 +02:00
Kai Uwe Broulik
d54723cbf2 Add KWIN_BUILD_SCREENLOCKER option
Allows to build KWin without lockscreen support and thus drops the
kscreenlocker dependency.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 14:39:25 +01:00
Kai Uwe Broulik
5db527a053 effects/mousemark: Port away from KPluralHandlingSpinBox
It's the only user of KTextWidgets in the entire repository.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 13:48:43 +01:00
Kai Uwe Broulik
8f21921843 effects: Don't call load() from KCM constructor
It is automatically called (and documented as such) by KCModule
after the constructor is run.

This avoids calling a virtual method from the constructor.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 11:47:32 +00:00
Kai Uwe Broulik
aef8ba8d1a Port KComboBox to QComboBox
None of the features it adds ontop of `QComboBox` are used.

Allows to drop the dependency on KCompletion.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 11:28:47 +00:00
Kai Uwe Broulik
ad4bbba08a kwinrules: Use KWindowSystem::isPlatformX11()
No need to use QX11Info if we already have KWindowSystem

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 11:36:37 +01:00
Kai Uwe Broulik
7e16130eea effects/overview: Don't link against KF5::Completion
None of its classes are used in this effect.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:27:31 +00:00
Kai Uwe Broulik
3aa23093e2 effects: Explicitly link against CoreAddons
Don't rely on another framework to pull it in.
It's where `KPluginFactory` lives.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:27:31 +00:00
Kai Uwe Broulik
2591afc7e7 effects: Remove unused KAboutData includes
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:27:31 +00:00
Xaver Hugl
b530a5b66d backends/drm: fix layer destruction
Layers need to release their resources whenever the render backend gets
replaced.
2022-02-22 14:52:52 +01:00
Xaver Hugl
a04bdf2355 backends/drm: port DrmPipeline and DrmGpu to use layers
Instead of having the render backends manage layers, have DrmGpu and DrmPipeline
do it. This makes it possible to unify code paths for leased and normal
outputs, remove some redirection and have more freedom with assigning layers
to screens.
2022-02-22 14:52:52 +01:00
Xaver Hugl
cdac2690d1 backends/drm: port layers to DrmDisplayDevice 2022-02-22 14:52:52 +01:00
Xaver Hugl
dd198461ea backends/drm: introduce DrmDisplayDevice
DrmDisplayDevice is a new parent class for both normal and lease outputs,
which makes it possible to simplify a few things
2022-02-22 14:52:52 +01:00
Xaver Hugl
ddb6dadfc2 backends/drm: port qpainter to layers 2022-02-22 14:52:52 +01:00
Vlad Zahorodnii
153d5965f8 wayland: Remove unpolish() calls
It's leftover after the times when widget style was using wayland
connection. Breeze had to destroy all wayland resources before
terminating the internal connection.
2022-02-22 07:36:47 +00:00
Xaver Hugl
b063031313 backends/drm: block input with the placeholder output
This is to prevent the user from accidentally changing application state
while they don't have an output connected
2022-02-21 20:11:38 +00:00
Vlad Zahorodnii
4326d3f029 effects/blur: Avoid shrinking unrelated opaque regions
Currently, the blur effect will shrink an opaque region even if it
doesn't intersect m_currentBlur.

This ensures that the blur effect won't do a stupid thing such as
clipping the opaque region of the desktop window.
2022-02-21 16:02:46 +00:00
Vlad Zahorodnii
e27ecfe88d Remove excessive damage region clipping
We already try to ensure that the surface damage is within render target
bounds. Avoid clipping surface damage in render backend, which is a bit
excessive task and perhaps it should be done an abstraction level above.
2022-02-21 15:30:30 +00:00
Vlad Zahorodnii
05de198c41 scene: Check SurfacePixmap's alpha channel to determine if surface is translucent
If the main surface is translucent (e.g. it contains only the drop
shadow) but its subsurface is opaque, the "window->isOpaque()" check
will produce a false positive.
2022-02-21 14:48:01 +00:00
Vlad Zahorodnii
ae3dc3f3c6 effects/colorpicker: Pick color in paintScreen()
It's not guaranteed that there will be current render target in
postPaintScreen() as all painting have been completed. paintScreen() is
a much safer place to pick color.
2022-02-21 14:34:49 +00:00
Vlad Zahorodnii
6d20b977ab effects/screenshot: Capture screenshot in paintScreen()
It's not guaranteed that there will be current render target in
postPaintScreen() as all painting have been completed. Furthermore,
even the docs of the postPaintScreen() function indicate that no
painting should be done there, you can do only cleanup things, e.g.
schedule a repaint, etc. paintScreen() is a much safer place to
capture screenshot.
2022-02-21 14:34:49 +00:00
Alex Richardson
24eee2df7c Cast via uintptr_t when converting between integers and pointers
When casting from integer to pointer, promoting the integer to (u)intptr_t
will ensure that the resulting type can be converted to a pointer without
problems. These two casts changed in this commit trigger a warning when
building for CHERI-enabled architectures such as Arm Morello. This is not
just limited to CHERI, the cast from xcb_pixmap_t (uint32_t) to void*
should also be flagged by -Wint-to-void-pointer-cast when using Clang,
however, it appears that warning only handles C-style casts, and not
reinterpret_cast (https://github.com/llvm/llvm-project/issues/53964).
2022-02-21 13:27:29 +00:00
Vlad Zahorodnii
dd6d0b22cc Port software cursor to RenderLayer
Software cursor has always been a major source of problems. Hopefully,
porting it to RenderLayer will help us with that.

Note that the cursor layer is currently visible only when using software
cursor, however it will be changed once the Compositor can allocate
a real hardware cursor plane.

Currently, software cursor uses graphics-specific APIs (OpenGL and
QPainter) to paint itself. That will be changed in the future when
rendering parts are extracted from the Scene in a reusable helper.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
8739258f2f Drop Platform::isPerScreenRenderingEnabled()
At this point, it's safe to assume that only X11 has weird rendering
model, which stands in the way of making rendering abstractions nice and
intuitive, so let's check operation mode. If OperationModeX11 is
dropped, this will also simplify finding X11-specific code in kwin.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
5933a21641 Introduce render layers
This is the first tiny step towards the layer-based compositing in kwin.
The RenderLayer represents a layer with some contents. The actual
contents is represented by the RenderLayerDelegate class.

Currently, the RenderLayer is just a simple class responsible for
geometry, and repaints, but it will grow in the future. For example,
render layers need to form a tree.

The next (missing) biggest component in the layer-based compositing are
output layers. When output layers are added, each render layer would
have an output layer assigned to it or have its output layer inherited
from the parent.

The render layer tree wouldn't be affected by changes to the output
layer tree so transition between software and hardware cursors can be
seamless.

The next big milestone will be to try to port some of existing kwin
functionality to the RenderLayer, e.g. software cursor or screen edges.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
65ccfd336f Add dummy OutputLayer type
It's needed to make repaint scheduling in render layers simple.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
203d7b3b8a Move direct scanout management to Compositor
The responsibilities of the Scene must be reduced to painting only so we
can move forward with the layer-based compositing.

This change moves direct scanout logic from the opengl scene to the base
scene class and the compositor. It makes the opengl scene less
overloaded and allows to share direct scanout logic.
2022-02-21 09:33:59 +00:00
Alex Richardson
886173cabe Reduce ifdefs in Workspace::supportInformation()
All of these preprocessor constants are defined to 0 or 1, so we can use
a ternary expression instead of `#if+#else`.
2022-02-20 21:08:07 +00:00
Aleix Pol
52c9eef122 kwin_wrapper: properly handle SIGTERM signals
QCoreApplication is not signal trap safe, use KSignalHandler to do it
properly.
2022-02-19 02:11:43 +00:00
Xaver Hugl
e9db27d05d backends/drm: ignore enabled state of outputs for the lifetime of layers
A buffer is needed for atomic tests before the output is actually enabled

BUG: 450501
CCBUG: 450358
2022-02-18 18:13:48 +01:00
Kai Uwe Broulik
6c803088da inputmethod: Remove unused references to KStatusNotifierItem
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-18 16:20:50 +01:00
Vlad Zahorodnii
0213661a7c wayland: Rework Xcursor theme loading
Xcursor loading code has hardcoded search paths, in order to take into
account distros installing app data in a different location,
libwayland-cursor sets the ICONDIR to the icon directory computed based
on the install prefix.

However, that won't work with gitlab CI because it relocates binaries. A
more robust way to find cursors would be to use QStandardPaths to find
all the icon directories on the system.

Another advantage of using own cursor loading code is that it allows us
to reuse cursor images that are symlinks. For example, with
breeze_cursors, almost half of the files in the cursors directory are
symlinks.

The main disadvantage of this approach is that we would have to keep the
search paths up to date. However, on the hand, there are not that many
of them, e.g. ~/.icons, ~/.local/share/icons, /usr/share/icons,
/usr/local/share/icons. The last three are implicitly handled by the
QStandardPaths.
2022-02-18 09:59:39 +00:00
Xaver Hugl
7faa2587de backends/drm: fix overscan
Somehow its use got lost in the 5.24 development cycle
2022-02-17 19:41:52 +00:00
Aleix Pol
b1c1603c8c inputmethod: Fix read setting
It's specified as a Path in the kcfg file and the KCM will replace the
/home path into $HOME, and I imagine it may do some others likethat.

BUG: 450430
2022-02-17 15:53:15 +00:00
Arjen Hiemstra
03a3ae666c Use the minimum of workspace area size and panel size for input method placement
Rather than assuming the input panel to always be less than or equal to
the maximized area, ensure it is. This ensures that the input panel gets
placed correctly when there maximized area is smaller, like when there's
a panel on the side.

Additionally, don't skip the entire positioning code when "m_output" is
empty, to avoid the placement not happening when Kickoff is open.
2022-02-17 14:50:24 +00:00
David Edmundson
aab395f07b Check lockscreen status for fullscreen effects
Whilst global shortcuts are blocked by grabbing the keyboard, user set
up manual scripts can still invoke a global action.

Given we already have code to deactivate when locking it makes sense to
also prevent activation.

BUG: 450331
2022-02-17 13:01:57 +00:00
Vlad Zahorodnii
1b4f3960fd effects/contrast: Use QGuiApplication::instance() instead of qApp
qApp is defined differently depending on whether QCoreApplication,
QGuiApplication, or QApplication is included.

Use QGuiApplication::instance() to improve code readability.

CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
9cca0a6f85 effects/blur: Use QGuiApplication::instance() instead of qApp
qApp is defined differently depending on whether QCoreApplication,
QGuiApplication, or QApplication is included.

Use QGuiApplication::instance() to improve code readability.

CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
4acae79d54 effects/startupfeedback: Add Qt::Widgets dependency
BUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
2ff9093604 effects/desktopgrid: Port to QStyleHints
Let's us avoid making the desktop grid effect depend on qtwidgets.

CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
d6b3b57ba1 effects/zoom: Remove QApplication include
CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
81d6631733 effects/presentwindows: Remove QApplication include
CCBUG: 450359
2022-02-17 07:22:25 +00:00