Commit graph

19765 commits

Author SHA1 Message Date
Vlad Zahorodnii
f5a883dc17 Port virtual desktops user action menu to VirtualDesktop
VirtualDesktop objects are more reliable than int-based desktop ids.
2021-08-16 15:00:01 +00:00
Xaver Hugl
566223b190 platforms/drm: fix crashing debug operator 2021-08-16 14:58:34 +00:00
Xaver Hugl
26dff99f78 platforms/drm: explicit modifiers
IN_FORMATS contains information about which buffer formats can be
scanned out with a given drm plane. Using these plane-specific
format+modifier combinations as well as explicit modifiers in
general can yield bandwidth and performance improvements,
especially in multi-gpu systems.
2021-08-16 16:56:32 +02:00
Vlad Zahorodnii
19cc22102c Change VirtualDesktop::id type from QByteArray to QString
This removes a lot of UTF-16 - UTF-8 conversions.
2021-08-16 16:15:57 +03:00
Vlad Zahorodnii
7f883fa724 Make EGL_KHR_surfaceless_context mandatory
We use surfaceless contexts with internal windows. We also require
the EGL_KHR_surfaceless_context extension for making context current
without outputs.

Arguably, we could use pbuffers, but since mainstream drivers (Mesa and
NVIDIA) support surfaceless contexts, the extra complexity doesn't buy
us anything.
2021-08-16 10:56:46 +00:00
Vlad Zahorodnii
4af9674f17 Revert "screenshot: Reuse GLTexture::toImage"
This reverts commit ac16bef409.

It causes crashes and color channels seem to be swapped.

GLTexture::toImage() needs more work before it can be used in the
screenshot effect, or maybe dropped.
2021-08-16 12:28:40 +03:00
David Edmundson
46980c0bb4 Fix crash in nested wayland backend on startup
In a recent refactor screens are only created when our xdg_surface has
been acked. This leaves a window where m_waylandCursor is null and
events are still being processed.
2021-08-16 08:09:42 +00:00
Vlad Zahorodnii
2a04a3d42c Remove Platform::sceneEglContext()
It's unused.
2021-08-16 08:08:31 +00:00
Vlad Zahorodnii
e315b0f9fe Remove Platform::sceneEglConfig()
With per-screen rendering, every output may have different EGLConfig.
Having a single global EGLConfig doesn't work out well.

This change removes Platform::sceneEglConfig(). It's used primarily to
create the global share context. In hindsight, the global share context
can be created without EGLConfig as it's never made current.

EGL_NO_CONFIG_KHR is part of EGL_KHR_no_config_context extension, which
is supported by both Mesa and NVIDIA driver so it should be safe to make
it mandatory.
2021-08-16 08:08:31 +00:00
Vlad Zahorodnii
bc7b28bb65 Fix a typo
At this point, desktop() is -1 since the client hasn't been moved to any
virtual desktop yet.

It seems like checking desktop() is a typo. It makes more sense to check
desktopId.
2021-08-16 06:32:43 +00:00
Vlad Zahorodnii
7f04d730e6 Make WindowRules::checkDesktop take a list of desktops
This ports relevant apis in WindowRules to the VirtualDesktop class.

If the client has no desktop rule, the desktop list that has been passed
to the checkDesktops() function will be returned.

If the client has a desktop window rule, the checkDesktop() function
will return a list with a single VirtualDesktop object or none if the
window is forced to be on all virtual desktops.
2021-08-16 06:32:43 +00:00
Vlad Zahorodnii
8e8fc55b0b Simplify desktop check in AbstractClient::setOnAllDesktops() 2021-08-16 06:31:59 +00:00
Vlad Zahorodnii
86fa79c33b Use more Toplevel::isOnCurrentDesktop() 2021-08-16 06:31:59 +00:00
Vlad Zahorodnii
43d773730d Unify virtual desktop removal handling on X11 and Wayland
On X11, a window can be only on a single virtual desktop or all, so the
platform specific code paths are not needed.
2021-08-16 06:31:59 +00:00
Vlad Zahorodnii
7f1baf66f9 Port some code away from AbstractClient::setDesktop() to AbstractClient::setDesktops()
The main motivation behind this change is to reduce the number of usages
of int-based virtual desktop apis. int-based desktop ids are highly
unreliable. For example, if a new virtual desktop is inserted in the
middle or removed in the middle, the desktop ids will change. This makes
working with virtual desktops code more challenging due to its behavior.
This is not an issue with VirtualDesktop objects.
2021-08-16 06:31:59 +00:00
Manuel Stoeckl
2aa3ed0005 Use texture unpacking for QImage uploads when possible
This change avoids unnecessary copying of QImage data when updating
textures using QImages that have non-ARGB32_Premultiplied formats.

There are three cases where texture unpacking can not be done/is
not worth doing: if GLES is used, and the extension for unpacking
subimages is not supported; if the entire image is being updated;
or if a format conversion needs to be done, in which case only the
region to update will have its format converted, and the resulting
image can be passed directly to glTexSubImage2d without setting
unpacking parameters.
2021-08-16 06:30:59 +00:00
l10n daemon script
214a318811 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"
2021-08-16 01:12:48 +00:00
Ismael Asensio
7dc1bf29bc kconf_update: Install the scripts that remove deprecated effects
Otherwise they cannot be found by kconf_update
2021-08-14 13:14:40 +02:00
l10n daemon script
d6f16882ff 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"
2021-08-14 01:18:16 +00:00
Méven Car
c5907e8f36 Fix a few compile warnings 2021-08-13 20:56:45 +02:00
Vlad Zahorodnii
3982f8399f Remove some redundant addWorkspaceRepaint() calls
These repaints were added to fix visual artifacts that appear when
shadow is removed, but since items schedule repaints when needed, we can
remove these two.
2021-08-13 06:28:18 +00:00
Vlad Zahorodnii
ec8a9f7cf7 Add isOnDesktop() overload that takes VirtualDesktop
int-based desktop ids are unreliable, but VirtualDesktop are not. So far
virtual desktop objects aren't used widely in kwin, but it's a good start.
2021-08-13 06:27:46 +00:00
Vlad Zahorodnii
a7cb034513 Simplify Toplevel::isOnDesktop() and Toplevel::isOnAllDesktops()
Wayland- and X11-specific code paths are not needed.

If the window is on all virtual desktops, Toplevel::desktops() will be
an empty list.

If the window is on a particular virtual desktop, Toplevel::desktops()
will contain that desktop. On X11, the desktops list can have at most
only one item.
2021-08-13 06:27:46 +00:00
Xaver Hugl
724f9a5db0 Correct check for when VRR should be active
The old calculation ignored the render time and safety margin of the
frame scheduling algorithm, which makes VRR activate properly only when
the refresh rate is much lower than the maximum refresh rate.
2021-08-12 20:38:45 +00:00
Vlad Zahorodnii
ef9d541487 Remove unused XCB includes in toplevel.h
Damage handling has been moved to SurfaceItemX11.
2021-08-12 20:57:17 +03:00
Vlad Zahorodnii
363177f36f Remove unused markedAsZombie signal 2021-08-12 17:52:24 +00:00
Vlad Zahorodnii
7e9c6587db Remove scene window traces in scene items
This further decouples scene items from scene windows. The SurfaceItem
still needs to access the underlying window, I would like to re-iterate
over that later.

With this change, it will be possible to introduce WindowItem factory
function in the Toplevel class.
2021-08-12 17:52:24 +00:00
Vlad Zahorodnii
a13fd02ea8 Remove virtualdesktops.h include in toplevel.h
toplevel.h is included in many places. Changing virtualdesktops.h may
trigger rebuild of all kwin.

With this change, only cpp files that use virtualdesktops.h will need to
be recompiled.
2021-08-12 17:23:15 +00:00
Vlad Zahorodnii
f71686894d Remove unused includes in x11client.h 2021-08-12 17:23:15 +00:00
Vlad Zahorodnii
a848fb6374 Remove input.h include in toplevel.h
It's unused.
2021-08-12 17:23:15 +00:00
Vlad Zahorodnii
0197d770ab Drop Toplevel::transparentRect()
It can be computed via other means (Toplevel::frameMargins()) and its
name is confusing. It specifies the inner decoration rect.
2021-08-12 17:22:49 +00:00
Aleix Pol
ac16bef409 screenshot: Reuse GLTexture::toImage
Cleans the code a bit. It also makes use of the more performant
Qt::Format_RGBA8888_Premultiplied, which is nice to come by.
2021-08-12 16:00:52 +00:00
Aleix Pol
1473466ef7 inputmethod: Remove the SNI entirely
It can be replaced with an ad-hoc plasmoid that gets to be a bit more
specific and interactive.
2021-08-12 16:00:15 +00:00
Vlad Zahorodnii
ad4f183a76 x11: Drop support for _NET_WM_FRAME_OVERLAP
The main idea behind _NET_WM_FRAME_OVERLAP is to extend the borders of
the server-side decoration so the application can draw on top of it. It
was inspired by similar feature in Windows.

However, _NET_WM_FRAME_OVERLAP is basically unused. Neither GTK nor Qt
support it and I have never seen any application that uses it.

At the moment, kwin is the only compositing window manager that supports
_NET_WM_FRAME_OVERLAP. Neither mutter nor compiz nor compton and so on
support it.

Since _NET_WM_FRAME_OVERLAP is practically unused, there's no point for
keeping supporting it.

This change shouldn't affect any existing app as _NET_WM_FRAME_OVERLAP
atom is not listed in _NET_SUPPORTED.
2021-08-12 11:44:40 +00:00
Vlad Zahorodnii
4ca287641f wayland: Destroy xdg shell clients when corresponding roles are about to be destroyed
This ensures that surface role objects can be still accessed when either
XdgToplevelClient or XdgPopupClient is destroyed. As far as I know, it
doesn't cause any problems right now, but this makes resource destruction
handling consistent, we tend to perform cleanup in aboutToBeDestroyed
signal slots.
2021-08-12 13:03:35 +03:00
Manuel Stoeckl
51d82fc6e5 Replace an old workaround for alpha-only shadows
SceneOpenGLShadow::prepareBackend used to use QImage::Format_Indexed8,
plus a special code path in GLTexture, to create single-channel OpenGL textures.
Now that Qt supports QImage::Format_Alpha8, this workaround can be removed.
2021-08-11 23:32:18 -04:00
l10n daemon script
4ab4f928f0 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"
2021-08-12 01:14:37 +00:00
Vlad Zahorodnii
4912c7cfa2 scenes/opengl: Calculate item transforms differently
Currently, a vertex coordinate is transformed first, then mapped to
the global screen coordinates. This causes a problem if a transform
is applied to the top-most item and child items are not at (0, 0).
For example, scaled windows may have popping out sub-surfaces, etc.

With this change, the item transforms will be computed differently. For
example, if the parent item is transformed, a child's transform will
look as follows

  [Parent's translation][Parent's transform][Child's translation]

instead of

  [Parent's translation][Child's translation][Parent's transform]

In the future, I'd like to get rid of the Item::setTransform() call in
OpenGLWindow::performPaint() and have either AnimationEffect or
libkwineffects call Item::setTransform().

BUG: 440201
2021-08-11 19:43:31 +03:00
David Edmundson
60255fd7a9 Teardown view before QQuickRenderControl
Deleting QQuickWindow will force any remaining runnables to complete.
This is important for any items (such as our new ThumbnailItem) that
deletes resources in queued cleanups.

We need to invoke this manually whilst we still have an active render
control with a valid context, otherwise remaining runnables will no-op.

We also then want to manually delete our scene contents before the view
so they're not orphaned temporarily.

This fixes a memory leak observed with the new Overview effect.
2021-08-11 07:31:53 +00:00
Vlad Zahorodnii
fdb1914a83 wayland: Wire in surface mapped state
If a sub-surface should be considered unmapped, make the corresponding
item invisible.

Note that this must apply only to sub-surfaces. Whether the main surface
should be visible is up to kwin. It may want to play an animation when
the toplevel surface is unmapped, etc.
2021-08-11 06:41:00 +00:00
Manuel Stoeckl
aa386896f1 Rename QImage to GL format conversion table
Also expand the comment describing it.
2021-08-10 14:21:48 +00:00
Manuel Stoeckl
b440be5bd2 Avoid converting images when updating GLTexture
In GLTexture::update, reuse the mechanism from the GLTexture(QImage, ...)
constructor to upload QImage data directly when the QImage format
has compatible GL format and type codes. Before this change, all QImage
formats other than ARGB32_Premultiplied required a format conversion.
2021-08-10 14:21:48 +00:00
Manuel Stoeckl
9be3513348 platforms/wayland: Delay setup until first configure
As per the xdg-shell specification, the compositor can only attach
a wl_buffer to an xdg_surface once the compositor has sent an
xdg_surface.configure event. Previously, there was a race condition
in which WaylandOutput objects were added/enabled on creation, making
it possible for the EglWaylandOutputs to be set up and for
EglWaylandBackend to draw a frame (thereby attaching a buffer), all
before the xdg_surface.configure configure event was received.
Compositors other than kwin would then send an unconfigured buffer
error and close the connection.

This commit avoids the problem by not marking the WaylandBackend
ready for use until all the output surfaces constructed at startup
have received their initial configure event. (In practice, this
takes one additional roundtrip.)
2021-08-10 14:21:12 +00:00
Alexander Volkov
1bf901cfbf Use c++ version of True to make sure it will compile
kwin fails to build for me because of missing 'True'.
Besides, 'true' is used in other places.
2021-08-10 10:46:07 +00:00
Nicolas Fella
050b4945ce [kcms/decoration] Try loading decoration KCMs without plugin keyword
We're porting away from using plugin keywords (and have done that for
the breeze and oxygen decoration). However to allow that we need to
adjust the loading code.

Keep the old codepath for compatibility.

BUG: 440786
2021-08-10 10:14:24 +00:00
Fabian Vogt
11c7e7a64d scenes/opengl: Avoid blending for entirely opaque SurfaceItems
Blending is quite expensive especially with software rendering.
In the case of Firefox on Wayland, it uses a ARGB8888 buffer but marks the
entire surface as opaque, so the alpha channel can be ignored.

CCBUG: 440386
2021-08-09 06:52:12 +00:00
Xaver Hugl
1041ef8275 platforms/drm: introduce virtual outputs
When the last output gets disconnected, create a virtual output as a
placeholder until we have access to a physical output again. While
this placecholder never gets rendered to, with virtual outputs in
general that is possible (with gbm and qpainter atm) and can be done
for future use cases like wireless displays.

CCBUG: 420160
CCBUG: 438839
2021-08-07 17:18:40 +02:00
l10n daemon script
f7e2f5504a 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"
2021-08-07 01:15:04 +00:00
Vlad Zahorodnii
1dae29175f kwineffects: Fix potential image detaching
QImage is implicitly shared. However, methods such as QImage::bits() may
detach. In order to avoid the detach, one either needs make the image
const or use QImage::constBits() method.

Currently, the GLTexture class uses QImage::bits() all over the place.
It prevents implicit detaching by storing images in const variables. Such
code is fragile. Adding an intermediate (optional) conversion step may
result in odd performance regressions.
2021-08-06 07:20:54 +00:00
l10n daemon script
f4c0e19935 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"
2021-08-06 01:16:36 +00:00