Commit graph

1871 commits

Author SHA1 Message Date
Xaver Hugl
83d797785b backends/drm: wait for pending pageflips before doing a modeset
If we don't, KWin may get a pageflip event for an output that is already
considered as being turned off
2022-03-07 15:13:04 +00:00
Xaver Hugl
1247a7b698 output changes: handle to-be-enabled outputs first
This prevents situations where we have no enabled outputs
2022-03-07 15:13:04 +00:00
Xaver Hugl
2693482d10 platform: check all outputs, not only enabled ones for the enabled flag
Otherwise it will block changes that will disable all currently enabled
outputs but also enable some currently disabled output

CCBUG: 450721
2022-03-07 15:13:04 +00:00
Alexander Lohnau
abcf22b4d6 Clean up defunct version header for kwinscripts kcm 2022-03-06 19:11:01 +01:00
Michail Vourlakos
bcff044c73 [aurorae] - support blurregion from kdecoration2
This is an approach for aurorae engine to publish masks for its decorated windows in order to avoid out of window blurring at the decoration corners. Aurorae themes are now able to specify a **mask** element inside **decoration.svg** file like plasma themes already do. Mask is used afterwards to calculate theme's blur region.


| Before | After |
| ------ | ----- |
|![before](/uploads/26014e79c3d5d45ba12fa5cf62294b1c/before.png)|![after](/uploads/923d7021eaaf322be96b611c73558666/after.png)|

Adjusted Aurorae theme for testing: [ROUNDED-DARK.tar.gz](/uploads/082f60ad4311e3e296b7faeeb7c97dac/ROUNDED-DARK.tar.gz)

BUG:395725
2022-03-06 09:58:11 +00:00
Kai Uwe Broulik
32daab286d Use workspaceLayer as context object
Otherwise the connection isn't severed when the layer is destroyed,
leading to crashes when screen resolution changes.

We don't actually need `this` to access `workspace()`, and we have
a guarded `output` as sender in the other case.
2022-03-04 22:26:38 +01:00
Aleix Pol
b11499d95e Remove AbstractWaylandOutput::isBeingRecorded
It's not being used anywhere
2022-03-04 04:05:24 +01:00
Aleix Pol
4c814590fe Fix textureForOutput for the EglWaylandBackend
Ensure we get our texture from the right output
2022-03-04 02:56:35 +01:00
l10n daemon script
eb760505ac 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-03-04 01:43:35 +00:00
Kai Uwe Broulik
0793c24249 Add KWIN_BUILD_NOTIFICATIONS option
Notifications are really only useful in a setting with a full
shell environment where there is a notification center to display them.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-03-03 15:06:36 +01:00
Vlad Zahorodnii
12ec886ccc Port to SeatInterface::notifyPointer{Enter,Leave} 2022-03-03 13:45:47 +00:00
Manuel Stoeckl
a2b7c09a11 Allow direct uploads of 16-bpc QImage formats
This commit expands the QImage-to-GL formatTable to include entries
for RGBX64, RGBA64_Premultiplied, and Grayscale16 image formats.
Uploading 16-bit-per-channel formats is supported by OpenGL and, with
the GL_EXT_texture_norm16 extension, GLES.
2022-03-03 10:23:31 +00:00
Marco Martin
e00d836708 Force cancel of any drag in progress when Escape is pressed
when escape is pressed when dragging between different clients,
cancelling any drag is compositor's responsibility

BUG:405267
2022-03-03 09:54:18 +00:00
Alex Richardson
d789ecc6d1 Use #cmakedefine01 for all KWIN_BUILD_* macros
This ensures that we get a warning if the config header is not included
instead of compiling the code as if it was disabled. Interestingly, some
checks already used #if KWIN_BUILD_*, so those were generating -Wundef
warnings when the feature is disabled. Commit 886173cab assumed that all
those features were already 01, so this unbreaks the build if any of the
features is disabled.

Fixes: 886173cab ("Reduce ifdefs in Workspace::supportInformation()")
2022-02-28 18:59:04 +00:00
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
Vlad Zahorodnii
7ba68fde8c effects/slidingpopups: Avoid using QApplication
CCBUG: 450359
2022-02-17 07:22:25 +00:00
l10n daemon script
9d33190d0d 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-02-17 01:53:20 +00:00
Kai Uwe Broulik
53473d72e6 kwinglutils: Assert glFenceSync
This really should not fail unless we did something seriously wrong
on our end, such as changing GL context during paintScreen.

If we add an invalid `GLSync` to the queue it can lead to very hard
to debug crashes in seemingly unrelated parts of the rendering
process, when the queue is drained, potentially seconds after the
actual failure that occurred here.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 19:06:15 +00:00
Kai Uwe Broulik
2d56154fe8 kwineffects: Support setting opacity on OffscreenQuickView
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 17:29:06 +00:00
Vlad Zahorodnii
c2e3496888 effects/contrast: Remove paint area tracking
Unlike the blur effect, neighbor pixels don't affect the results of the
contrast effect so it doesn't have to extend the painted area.
2022-02-16 16:22:02 +00:00
Vlad Zahorodnii
d06746fa5c scene: Set render target rect in Scene::paintScreen()
This ensures that the render target rect is set when using qpainter
render backend.
2022-02-16 16:04:29 +00:00
Vlad Zahorodnii
2091cb060f effects/highlightwindow: Fix crash
If a window appears on the screen, the highlight window effect will try
to fast-forward animation to the target state by setting the animation
duration to 0. However, TimeLine doesn't like that because it will
eventually lead to division by zero.

This change makes the highlight window effect fast-forward the
transition to highlight or ghost state by using the complete() function.

BUG: 450323
2022-02-16 15:42:55 +00:00
Vlad Zahorodnii
f59a4d6090 Remove dead code in Platform
Software cursor logic has been moved to Scene.
2022-02-16 13:28:33 +00:00
Kai Uwe Broulik
6ab7119d89 Introduce SharedQmlEngine class
Allows to drop the direct dependency on KDeclarative only used
for `QmlObjectSharedEngine` outside of `KCModuleQML`

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 12:05:38 +00:00
Vlad Zahorodnii
0c3a8e6f29 scene: Make paintScreen() clip the damage region
paintScreen() already tries to ensure that the damage region doesn't go
outside the scene geometry. With this change, it will try to clip the
damage region to the render target rect, which saves us an extra region
intersection and simplifies code that calls paintScreen().
2022-02-16 07:49:47 +00:00
l10n daemon script
648b2a5bf3 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-02-16 01:49:32 +00:00
Vlad Zahorodnii
a3b5266175 Drop Platform::renderLoop()
Having a render loop in the Platform has always been awkward. Another
way to interpret the platform not supporting per screen rendering would
be that all outputs share the same render loop.

On X11, Scene::painted_screen is going to correspond to the primary
screen, we should not rely on this assumption though!
2022-02-15 18:23:52 +02:00
Vlad Zahorodnii
ba000d5a4e scene: Compute projection matrix based on the render target rect
Neither SceneQPainter nor SceneOpenGL have to compute the projection
matrix by themselves. It can be done by the Scene when setting the
projection matrix. The main benefit behind this change is that it
reduces the amount of custom setup code around paintScreen(), which
makes us one step closer to getting rid of graphics-specific paint()
function and just calling paintScreen().
2022-02-15 14:31:28 +00:00
David Redondo
5caa28c1a3 xwayland: Guard against offers arriving after leaving surface
If the XdndEnter message is handled after leaving the current
wayland surface m_visit will be null.
BUG:449644
2022-02-15 12:28:17 +00:00
Vlad Zahorodnii
7a06ae733c kwinglutils: Drop GLRenderTarget::isRenderTargetBound()
Check whether GLRenderTarget::currentRenderTarget() returns non-null
value instead.
2022-02-15 13:31:10 +02:00
Vlad Zahorodnii
f4f83848b0 kwinglutils: Make GLRenderTarget not store GLTexture reference
This allows us to make the GLRenderTarget a bit nicer when using it to
wrap the default fbo as we don't know what the color attachment texture
is besides its size.

This means that the responsibility of ensuring that the color attachment
outlives the fbo is now up to the caller. However, most of kwin code
has been written that way, so it's not an issue.
2022-02-15 13:30:39 +02:00
Vlad Zahorodnii
dcd1e3b87a kwinglutils: Drop GLRenderTarget::setTextureDirty()
It's effectively unused and removing it allows us to get rid of
GLTexture field, which is very useful for abstracting the concept of a
"render target" across OpenGL and QPainter backends.
2022-02-15 13:02:57 +02:00
Vlad Zahorodnii
436187762e kwinglutils: Deprecate GLTexture dirty state tracking
It's currently being used only by the X11 standalone backend. We should
either port the X11 backend to manual dirty state tracking or waiting
until it gets dropped. The main motivation for getting rid of the dirty
state tracking in the GLTexture is that it keeps kwin open for
alternative opengl wrappers, e.g. QOpenGL, and it simplifies GLTexture
code.
2022-02-15 12:58:43 +02:00
Vlad Zahorodnii
e9af67af3e kwineffects: Add GLTexture::render() overload that takes no scissor region
In many cases, we don't care about the scissor region. This change adds
a relevant overload to make code easier to read.
2022-02-15 12:17:59 +02:00
Vlad Zahorodnii
52beb213e7 kwineffects: Make GLRenderTarget and GLVertexBuffer work without global coords and scale
Because the GLRenderTarget and the GLVertexBuffer use the global
coordinate system, they are not ergonomic in render layers.

Assigning the device pixel ratio to GLRenderTarget and GLVertexBuffer is
an interesting api design choice too. Scaling is a window system
abstraction, which is absent in OpenGL or Vulkan. For example, it's not
possible to create an OpenGL texture with a scale factor of 2. It only
works with device pixels.

This change makes the GLRenderTarget and the GLVertexBuffer more
ergonomic for usages other than rendering the workspace by removing all
the global coordinate system and scaling stuff. That's the
responsibility of the users of those two classes.
2022-02-15 12:17:56 +02:00
Vlad Zahorodnii
d92afc849e kwineffects: Forbid most of operations with invalid render targets
This simplifies a lot of things.
2022-02-15 12:06:50 +02:00
Vlad Zahorodnii
383a5cee0b kwineffects: Remove GLRenderTarget::{attachTexture,detachTexture}
They're unused and immutable render targets are easier to handle.
2022-02-15 12:06:50 +02:00
Vlad Zahorodnii
eea94660dc utils: Extract DamageJournal in its own file 2022-02-15 11:38:51 +02:00
Xaver Hugl
dece547a75 backends/drm: refactor surface handling
In order to support layered rendering and tiled outputs KWin needs to be
able to split rendering of outputs into multiple surfaces. This commit
prepares the drm backend for that, by moving most of the code in EglGbmBackend
out to a EglGbmSurface class, which will later be used for overlay surfaces
and rendering to multiple connectors side by side.

In doing that, this commit also cleans up the code a bit, removes a lot of
now unnecessary multi-gpu stuff and potentially makes modesets a little
bit more efficient by re-using resources more often.
2022-02-15 09:12:23 +00:00
Xaver Hugl
9dc4c7309e backends/drm: move damage tracking into DumbSwapchain 2022-02-15 09:12:23 +00:00
Xaver Hugl
5d317641a4 backends/drm: move damage tracking into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
cfdb303012 backends/drm: inline renderFramebufferToSurface
And also remove an unnecessary makeContextCurrent
2022-02-15 09:12:23 +00:00
Xaver Hugl
c498d31aa7 backends/drm: move makeContextCurrent into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
4d0998cfed backends/drm: fix legacy dpms 2022-02-15 08:17:17 +00:00
Vlad Zahorodnii
76dbe9e590 effects/desktopgrid: Remove unused include 2022-02-15 07:21:28 +00:00
Vlad Zahorodnii
e1024d38d1 cmake: Specify link libraries per effect target
This allows to track per effect dependencies more precisely. The main
problem with a library and a comment next to it saying who needs it is
that the comment can get easily outdated.
2022-02-15 07:21:28 +00:00
John Zimmermann
9c65d61b98 utils/serviceutils: compare executablePath against canonical path of exec fields in .desktops
/proc/%/exec always points to the canonical/real path of a binary,
the exec field of a .desktop might contain a symlink and therefore
differ from canonical path.
Explicitely canonicalizing the path in exec prevents this mismatch.
2022-02-14 15:50:24 +01:00
Vlad Zahorodnii
8e05732670 x11: Fix shrinking window size after toggling no border multiple times
The first move() in X11Client::createDecoration() will alter the client
size, which will result in the subsequent resize() incorrectly resizing
to a smaller window size.

In order to fix that issue, this change makes X11Client adjust the
frame geometry atomically after creating or destroying window decoration.

BUG: 449988
2022-02-14 14:00:14 +00:00
Vlad Zahorodnii
c76855520c wayland: Fix maximize mode propagation to decoration
If the window is initially maximized, there won't be any current
decoration when XdgToplevelClient changes the maximize mode, we need to
use m_nextDecoration.

BUG: 450053
2022-02-14 13:41:39 +00:00
Albert Astals Cid
5ddd43958d HighlightWindowEffect: Use the duration parameter 2022-02-14 13:51:02 +01:00
Kai Uwe Broulik
4c0c2cebe6 effects/overview: Add translation domain 2022-02-14 11:36:51 +00:00
Kai Uwe Broulik
2fbc821899 effects: Extract messages from QML files 2022-02-14 11:36:51 +00:00
Vlad Zahorodnii
6182744a2b Add support for xdg_toplevel.configure_bounds()
With the xdg_toplevel.configure_bounds event, the compositor will be
able to indicate the client the maximum desired surface size.

It can be used to prevent mapping too big application windows, etc.
2022-02-14 10:42:32 +00:00
Kai Uwe Broulik
88e36d0b04 Fix build without Qt session manager
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-14 07:58:47 +00:00
Kai Uwe Broulik
7beb3f6ec6 Fix build without tabbox
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-14 07:58:47 +00:00
Vlad Zahorodnii
3da9e017a0 cmake: Use target-based ecm_qt_declare_logging_category()
This makes CMakeLists.txt code depend less on variables.
2022-02-14 07:29:15 +00:00
l10n daemon script
ead073b0cc 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-02-14 01:42:49 +00:00
Aleix Pol
ad0a35882e inputmethod: Also open the inputm method panel with a pen
BUG: 449888
2022-02-14 00:24:30 +00:00
Nicolas Fella
a2ebad760f Implement services in our QPA
This is required for QDesktopServices to work.

Use QGenericUnixServices like the xcb and wayland QPA

BUG: 446144
2022-02-13 00:41:10 +01:00
Nicolas Fella
77ec43d5e1 Don't force QT_QPA_PLATFORM=wayland
We're setting this env variable because earlier we used it to force kwin to use its special QPA so we need to change that back to something sensible.

However setting it to Wayland breaks apps that ship their own Qt with missing or broken Wayland support.

Set it to be empty instead. Well-behaved Qt apps will use Wayland regardless because of XDG_SESSION_TYPE.

BUG: 450000
2022-02-12 13:57:19 +00:00
Vlad Zahorodnii
a4bb3896bf Schedule workspace repaint when window leaves current desktop
When a window leaves the current virtual desktop, we need to schedule a
workspace repaint so the compositor repaints the old region of the
window on the current desktop.

In hindsight, the scene graph must schedule a repaint, but it's not
doable with the current effects api, it will be changed with future
refactoring changes.

BUG: 444172
2022-02-12 12:06:00 +00:00
l10n daemon script
d7ee3f1221 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-02-12 01:43:02 +00:00
Aleix Pol
c9715a828d Initialize the KSldApp after we connect
In some cases, initialize() will emit an aboutToLock() signal that we
need to catch. Otherwise LockOnStart finds its m_waylandFd=-1
2022-02-11 16:35:17 +00:00
Alexander Lohnau
e70ec569e3 Fix loading of effect if plugin defined X-KDE-Library
Otherwise we get the filename to the library and not the KPackage.

The plugin having this set is most likely a leftover, because KPackage plugins
to not need to define a library.

BUG: 449881
2022-02-11 15:40:42 +00:00
Vlad Zahorodnii
712dbc4122 wayland: Fix mispositioned decoration tooltips
QPlatformScreen::virtualSiblings() must return a list of screens on the
virtual desktop, otherwise QToolTip will use
QGuiApplication::primaryScreen() instead of looking up the screen where
the decoration tooltip must be shown using QDesktopWidget::screenNumber().

BUG: 432860
2022-02-11 10:08:19 +00:00
David Edmundson
12427932de Make openGL context current when recording frame triggered by cursor move
recordFrame requires an openGL context. This is typically done after a
frame is rendered, but when we send a frame after a cursor move this is
not guaranteed.

BUG: 448162
2022-02-11 09:24:12 +00:00
Jan Blackquill
c0cb349cb8 effects/DesktopGrid: use delta, not absolute time for MotionManager
Despite the argument naming, the input for WindowMotionManager::calculate is supposed to be a
delta, not an absolute time. Giving it a delta fixes the PresentWindows in the DesktopGrid.

BUG: 443971
2022-02-11 09:04:30 +00:00
Julius Zint
43bcd57853 Fix window decoration quads in OpenGL scene
The quads for the left and right window decorations were broken in
3b4d55837. The problem is only visible for window decorations with more
than one color.
2022-02-11 08:15:37 +00:00
l10n daemon script
97dde989c3 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-02-11 01:45:31 +00:00
Aleix Pol
725d61877c screencast: have our streams provide SPA_META_Header
It can be useful for clients to know what's going on in a specific
stream.
2022-02-10 23:57:09 +00:00
Vlad Zahorodnii
0574a7534a wayland: Make the launcher not restart kwin_wayland if it crashes at shutdown
Currently, if kwin_wayland crashes at shutdown, the launcher can
potentially spawn it again. This change addresses that issue by making
the wrapper ignore the QProcess::finished() signal.
2022-02-10 12:29:54 +00:00
Tobias C. Berner
feffa184fb Add missing errno.h include 2022-02-10 10:14:02 +01:00
Vlad Zahorodnii
c54937b2ad Avoid mixing current and next state
Mixing of current and next state can create all sorts of undefined
behavior, e.g. windows not moving to the desired location or
experiencing issues when tiling a maximized window.

BUG: 449541
2022-02-10 08:43:17 +00:00
Vlad Zahorodnii
3fb6901646 effects/overview: Hide selection rect during dnd
BUG: 448573
2022-02-10 08:15:00 +00:00
Vlad Zahorodnii
ed670377c8 effects/overview: Don't show minimized windows in desktop thumbnails
BUG: 448850
2022-02-10 07:23:30 +00:00
Vlad Zahorodnii
0ad239a92d Fix mouse pointer disappearing after using zoom effect on X11
Currently, the Cursors::currentCursorChanged signal is wired to the
updateCursor() function which calls xcb_xfixes_hide_cursor() or
xcb_xfixes_show_cursor() depending if the cursor is hidden. However, the
currentCursorChanged signal can be emitted if the cursor changed, e.g. a
new pixmap attached, or its visibility status changes.

The zoom effect hides the pointer, but when user hovers ui elements, it
will most likely change and result in more than one xcb_xfixes_hide_cursor()
calls.

It appears like xcb_xfixes_hide_cursor() is implemented as a reference
counter, i.e. if xcb_xfixes_hide_cursor() is called two times, then you
must call xcb_xfixes_show_cursor() two times as well.

This change adds a dedicated signal to indicate whether the cursor is
hidden to avoid calling xcb_xfixes_hide_cursor() multiple times while
the screen is scaled.

BUG: 448537
2022-02-10 07:07:03 +00:00
Michail Vourlakos
bc145b614c support kdecoration2 blurregion
--use kdecoration2 blurred regions to adjust blur effect appropriately when
needed

CCBUG:395725

Requires: https://invent.kde.org/plasma/kdecoration/-/merge_requests/17
2022-02-09 21:00:07 +00:00
Vlad Zahorodnii
c0d0fab049 x11: Prefer kwinApp()->x11RootWindow() over rootWindow() 2022-02-09 19:10:58 +00:00
Vlad Zahorodnii
ec7198ee33 x11: Prefer kwinApp()->x11Connection() over connection()
With connection(), we will look up the x11 connection property on
kwinApp() object, which is less efficient than just calling a method on
the app object.
2022-02-09 19:10:58 +00:00
Vlad Zahorodnii
b62630c8ac Allow applying output changes to disabled outputs in base Platform::applyOutputChanges()
Since the base Platform::applyOutputChanges() implementation only
applies changes to enabled outputs, it's not possible to re-enable a
previously disabled output.
2022-02-09 15:47:35 +00:00
Vlad Zahorodnii
e419faee39 effects/fallapart: Avoid animating windows while there's a fullscreen effect
While there's a fullscreen effect, the fall apart effect should avoid
animating windows as it can corrupt or interfere with the active full
screen effect. This matches behavior of many other animation effects in
kwin.

BUG: 449844
2022-02-09 15:09:58 +02:00
Vlad Zahorodnii
20399e0c42 effects/scale: Make it not grab open and close roles
Otherwise the fall apart effect will refuse to work; the fade effect
already works like that.

BUG: 449832
2022-02-09 11:49:00 +02:00
Xaver Hugl
d0c12ac54d backends/drm: ignore modifier env var if modifiers are not supported
Otherwise we might crash
2022-02-08 20:09:08 +01:00
Vlad Zahorodnii
11175cb05e kcm/screenedge: Fix default value for TabBox.BorderActivate option
The TabBox does not reserve the left screen edge by default.

BUG: 449720
2022-02-08 08:09:25 +00:00
l10n daemon script
1386c4325c 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-02-08 01:45:25 +00:00
Vlad Zahorodnii
bb935aa5de Fix decoration rendering with scale factor < 1
QPainter won't let paint with a device pixel ratio less than 1. There
are used to be workarounds to force a device pixel ratio of 1, but they
were removed with fractional scaling corner fix.

This change makes sure that the decoration renderer forces a device
pixel ratio of 1 if the output's scale factor is less than 1 so
calculated texture coordinates match where window borders are rendered
in the texture atlas.

BUG: 449681
2022-02-07 11:45:31 +00:00
Ben Cooksley
a428630ea4 Purge all references to download.kde.org, replacing them with the correct endpoint of autoconfig.kde.org.
CCMAIL: plasma-devel@kde.org
CCMAIL: distributions@kde.org
2022-02-07 06:12:40 +13:00
Xaver Hugl
569a994644 backends/drm: don't log addFB failure for direct scanout
It can spam the log and isn't really useful

BUG: 449556
FIXED-IN: 5.24
2022-02-06 00:10:14 +00:00
Vlad Zahorodnii
6a0430eaa0 Fix builtin effects not loading
The api of kcoreaddons_target_static_plugins() has changed so static
plugins must be linked with kwin_x11 and kwin_wayland directly.
2022-02-06 01:29:41 +02:00
Xaver Hugl
e8eb55ad2e backends/drm: port away from mode indices
They're error prone and don't really work for changing modes. Having
a current mode in DrmConnector also doesn't work well together with
the transactional style of how DrmPipeline operates
2022-02-05 14:16:18 +00:00
Vlad Zahorodnii
03efdabf26 Unset electric border after interactive move
AbstractClient::setQuickTileMode() no longer updates electric border
mode, which can leave AbstractClient::electricBorderMode() with an old
value at the next interactive move and potentially result in quick
tiling not work if the user decides to untile and then tile the window
again while still holding left button.
2022-02-03 21:51:01 +02:00
Vlad Zahorodnii
185395caab wayland: Simplify xdg-shell's maximize mode implementation
XdgToplevelClient::changeMaximize() will unset quick tile mode after
maximizing the window.
2022-02-03 18:38:25 +00:00
Vlad Zahorodnii
6e26494b4e Compute tile geometry without relying on electric border mode
Quick tiling allows you tile a window so it covers one half or a quarter
of the screen. Electric border is basically interactive flavor of quick
tiling, i.e. it allows you to drag a window to the top screen edge to
maximize it.

Currently, it's confusing that tile geometry is computed based on the
electric border mode.

This change converts electricBorderMaximizeGeometry() in a helper that's
used to compute the tile geometry given the desired mode and output
containing the specified QPoint. With that, setQuickTileMode() won't
need to set electric border anymore, which makes tiling code more
comprehensible, but by not a lot unfortunately.
2022-02-03 18:58:47 +02:00
Vlad Zahorodnii
5cfa4bae77 wayland: Simplify xdg-shell's fullscreen mode implementation
XdgToplevelClient::setFullScreen() won't change the geometry
immediately, so workspace()->updateFocusMousePosition() can be removed.

Also, input handling code takes care of updating the cached mouse
position in the workspace.
2022-02-03 16:23:34 +00:00
Vlad Zahorodnii
77f712d3a7 Fix tracking of geometry restore with electric maximize
If the user wants to move a tiled window, but changes their mind and
tiles the window back to the previous position, the geometryRestore()
will be corrupted because initialMoveResizeGeometry() is the same as the
geometry of the window in the tiled mode.

This change fixes tracking of the geometry restore by precomputing the
geometry restore when starting interactive move. That way, if the window
is untiled and tiled again without release left pointer button, the
geometry restore will be set to the correct value in setQuickTileMode().

This change also adjusts the test suite so such a subtle case won't be
broken again without noticing it.
2022-02-03 16:01:45 +00:00
David Redondo
b1d0928c8e xwayland: Handle drag being cancelled
There was no handling for the drop being cancelled at all, leading to
leaked WlVisit and XtoWlDrag objects. X clients could also be confused
about the state of the drag and for example not being able to start another
drag.
BUG:449362
2022-02-03 14:01:14 +00:00
Xaver Hugl
843cee3d66 Scene: set painted_screen in paintScreen
If it's not set but used by EffectsScreen that can cause crashes
2022-02-03 05:12:24 +01:00
Ismael Asensio
3f29ad6b22 effects/overview: Prevent undesired dragging of desktops bar
Flickable by default allows swiping via click-and-drag or
scrolling with the mousewheel, which is weird when the content
is smaller than the available space.

Inhibit this behavior unless there's a need for scrolling.
2022-02-02 21:22:16 +01:00
Vlad Zahorodnii
4b97bc481e effects/presentwindows: Fix crash
The present windows effect can crash because a null (0) EffectScreen can
be passed to EffectsHandler::clientArea(), which is a bug.

Use EffectsHandler::virtualScreenGeometry() to get the bounding geometry
of all outputs.

BUG: 449508
2022-02-02 19:00:50 +02:00
Vlad Zahorodnii
749cf798ce wayland: Fix spectacle not covering fullscreen windows
The most recently activated window can be an overlay window that covers
all screens. If its center is not at an output with the fullscreen
window, then the fullscreen window's stack position won't be lowered. In
order to fix that, this change makes isActiveFullscreen() use
Toplevel::isOnOutput(), which uses geometry info, to check if both windows
are on the same output.
2022-02-01 19:18:13 +00:00
Severin von Wnuck
5fe9fd13ad Add timestamp to window decoration mouse events
Since 4881dd63 replaced the double click timer for OffscreenQuickView
with a time check, we need to make sure the timestamp from
XInput/libinput is passed on to the actual QMouseEvent.

BUG: 448477
2022-01-31 17:54:28 +00:00