Commit graph

20805 commits

Author SHA1 Message Date
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
158f1db513 autotests: Drop TestXdgShellClient::testWindowOpensLargerThanScreen()
With the xdg_toplevel.configure_bounds support, the compositor is
finally able to tell the client the maximum recommended window size.

That approach allows us to keep the compositor side simple and it
prevents (as long as the app is well behaved) annoying visual glitches
such as mapping window with one size and then quickly resizing it to
the final size.
2022-02-16 08:23:55 +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
Kai Uwe Broulik
00f2dc1d88 Remove KIconThemes dependency
It has been unused since 7706e17d but was left in CMakeLists.txt

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-15 08:43:15 +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
Ismael Asensio
f055efc941 tests/xdgshellclient_rules: Add tests for screen rules
There are two operations failing currently, so we QEXPECT_FAIL
them for now:
- A new client is not moved to the screen set by the rule
   (Wayland only). Affects Apply, Force and Remember
- Disabling and enabling an output will not move the client
   to the Forced screen (On X11 and Wayland, BUG:409979)
2022-02-14 17:15:19 +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