On X11, there's no per screen rendering. The primary screen is specified
as the painted screen. RenderViewport::renderRect() should be used.
BUG: 475799
Some apps, notably Tablet KCM, will rebind the tablet interface and consume all events that should be sent to the GUI toolkit.
This commit sends events to every consumer and also stores the latest cursor indexed by wl_client instead of wl_resource.
BUG:473126
Both MMB and RMB are broken because acceptedPointerTypes doesn't accept
PointerDevice.GenericPointer.
RMB is broken because there's no "desktopView" object.
BUG: 475681
Recent-ish changes meant that the X11 window is kept alive whilst an
effect may be using the window.
This changes the lifetime of the sync alarm. This is problematic in the
case of an XWayland crash, we can assume whilst an X11 client is valid
the X11 connection is also valid, but if a close animation is used the
connection might not be valid when the destructor is called.
If a repaint is scheduled in the prePaintScreen() function, we want
it to be applied in the next frame, not the current one.
Currently, it doesn't work like this because prePaintScreen() runs first
then the Compositor gathers repaints and resets them.
This is important to qtquick effects that use qtquick3d as some items in
qtquick3d schedule repaints for the next frame after synchronizing, i.e.
in OffscreenQuickView::update() which is called in prePaintScreen() by
QuickSceneEffect.
Right now screenshots of windows always have drop shadows. This change
makes the shadows optional. Resolves a 7-year-old bug report in
conjunction with an incoming change to Spectacle.
BUG: 372408
The method is called quite often during KWins lifetime.
Because the pattern is constant, we can reuse the value instead of creating a new regex every time
We always know the data for the single pixel will fit into the buffer, so
it's unnecessary to use the checked variant (which is only available in
OpenGL 4.5)
On Wayland, options don't influence compositing as on X11. For example,
kwin cannot easily switch between compositing modes, etc.
One can still force kwin_wayland to reinitialize compositing by using
the dbus api.
It makes little sense to destroy effects if the animation speed changes.
The effects are written with the assumption that the animation time can
change and therefore they handle this case in reconfigure().
Amends 4d2c9f5d88.
Prior to 4d2c9f5d88, the Compositor used
to force the Options to reload settings when starting compositing.
Unfortunately it was overlooked that Options::animationTimeFactor() can
return an old value when the Options::animationSpeedChanged() signal is
emitted. This change addresses that.
Scripted and builtin effect metadata formats are no longer compatible.
So KPackageLoader doesn't list builtin effects anymore. To address that,
load builtin effect metadata manually.
At the moment, if an effect wants to have a configure button in the
desktop effects kcm, it needs to add X-KDE-PluginKeyword field with
its plugin id. This is confusing.
This change ports scripted effects to X-KDE-ConfigModule, which is more
intuitive than X-KDE-PluginKeyword.
kcm_kwin4_genericscriptedconfig is a special config module that loads
config.ui from KPackage. However, an effect can specify a different
config module in the metadata if kcm_kwin4_genericscriptedconfig doesn't
suit their needs.
QuickSceneEffect can also be instantiated by C++, for example that's
the case with the overview effect. In that case, qmlContext() is not
going to return a valid context because the effect has not been created
by a QQmlEngine. In that case, use the root context as the parent
context.
https://doc.qt.io/qt-6/qhoverevent.html#oldPoshttps://doc.qt.io/qt-6/qhoverevent-obsolete.html#pos
oldPos: On QEvent::HoverEnter events, this position will always be QPoint(-1, -1).
pos: On QEvent::HoverLeave events, this position will always be QPoint(-1, -1).
On the same app, such as Wayland-enabled VS Code, the misgeneration causes the cursor to move to the origin when moving the cursor away from the server side decoration.
There are four usages of this overload, two of them are for the
intentionally disabled "Switch to Next/Previous Desktop" actions and the
rest are for "Switch One Desktop to X" actions. Due to the order they
were added, an empty keybind was set as the default and the actual
keybind is never enabled.
Now there's a QKeySequence argument to this overload, so an unexpected
empty keybind is never added. The two usages of addAction that depend on
this empty keybind behavior now pass in an empty QKeySequence.
BUG: 475748
This commit makes window filtering optional by providing a checkbox
in Desktop Effects > Overview > Overview Configuration KCM. The
referenced bug report describes a bunch of the reasons why people
wanted this option.
BUG: 460710
FIXED-IN: 6.0
with itemChange watching SceneChange is more efficient than connecting
to the windowChanged signal, also this won't arrive during teardown,
aoiding the "destructor already ran" assert.
It would be the case upon lid close which would make KWin crash. Also
adds an assert so in case it happened again we would be able to catch it
easily. It gets applied asynchronously so it needs to be chased down.
In springmotion.cpp for the slide plugin, there are issues when
animations are disabled, namely a black screen flicker.
The flicker is caused by float under/overflow (div-by-0 -> infinity).
This commit fixes that by special-casing an infinite spring constant,
so that the animation immediately jumps to the anchor.
BUG: 472901
EffectWindowImpl affects rather the WindowItem, so move its ownership to
it. This encapsulates compositing setup so it's effectively same as
creating a window item, except some annoyances on X11.
This makes the api of EffectWindow more similar to the api of Window. It
also makes more sense to keep such signals in EffectWindow. In the future,
the effect window can be dropped in favor of the window.
When the xwayland connection gets destroyed, it doesn't get deleted immediately. If the
xwayland scale changes in between WaylandServer::destroyXWaylandConnection and the actual
destruction of the connection, KWin would crash
Instead of an external service (like KScreen) storing and restoring output configurations,
with this commit KWin takes over that responsibility. This allows it to, among other things,
generate appropriate configs for new sets of outputs immediately, and take KWin-internal information
about outputs into account when generating them.
CCBUG: 474021
CCBUG: 469653
CCBUG: 466342
CCBUG: 470863
CCBUG: 466556
BUG: 466208
BUG: 455082
BUG: 457430
This is a companion to
c01b583e53
that enables the above functionality on Wayland. For Xorg, the
functionality is implemented in plasma-desktop in the above commit.
This is useful for the few cases where wheel events are not for
scrolling. For example adjusting the volume in the tray.
In this case having the metadata that the delta is backwards is
important. From a kwin POV it's just proxying the libinput
isNaturalScroll setting to clients.
Tested against "qtbase/examples/widgets/widgets/mousebuttons" with
modified Qt and changing the setting in the UI.
Not mergable until upstream lands.
Relevant link:
https://gitlab.freedesktop.org/whot/wayland/-/merge_requests/1 /
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/183
CCBUG: 442789
With value semantics, the destructor can be called more often than actually
desired, so this commit ports the DrmEglLayerSurface to use unique pointers to
store surface data instead
In order to destroy resources from a context on the secondary GPU, that
context needs to be current. We also want to destroy the context once it's
no longer used, if the GPU is unplugged etc, so this commit uses shared
and weak pointers to manage the lifetime of the contexts
When some displays go to sleep, that can be wrongly detected as a temporary
hotunplug by the driver. In order to not wrongly wake up the system with
such a display, detect that scenario and set the 'new' output to dpms off
again.
BUG: 452553
BUG: 379474
Merges the desktop grid and overview effects together in a new three-state one;
you can switch between them with a certain shortcut or gesture, and you can also
still access either the desktop grid or overview directly.
Default shortcuts are also updated to be Meta+G for Grid, Meta+W for Overview,
Meta+Tab to switch between the three states and Meta+Shift+Tab to cycle in the
opposite direction.
BUG: 474044
BUG: 460661
BUG: 460774
BUG: 456572
BUG: 449601
BUG: 450262
BUG: 449801
BUG: 461510
BUG: 463886
BUG: 459754
BUG: 459749
BUG: 459748
BUG: 459467
FIXED-IN: 6.0
The test fails sometimes with "Tried to add event to destroyed queue".
It does so because the event queue is not destroyed last. See also
33827bbdbe for more details.
With the current vision for how output backends work, the compositor
should take up more responsibilities. There are a few good reasons: some
things just don't make sense to be in backends, to allow sharing code
across backends easier, etc. On the other hand, we have X11, with its
own ways of doing things which are not always compatible with what we
want to do on Wayland.
The goal of this patch is to start splitting the compositor into
platform specific counterparts, with potentially moving X11 compositing
in kwin_x11. The main benefit of this is that we will be able to
push forward with wayland things more freely. Ideally it would be great
if we could make kwin_x11 have its own low level compositing code paths
that are nicely encapsulated in that executable and don't leak into
libkwin abstractions.
The biggest drawback of this approach is that there is going to be some
code duplication between x11 and wayland compositing code paths. But I
expect it to be the case only for a short term until we start landing
more abstractions in kwin_wayland, e.g. render devices, proper output
layer support, etc.
According to 4b686a204250b4416fce79fa55b8a89c5193de38 in kde-workspace,
the support for private colormaps was mainly useful to 8bit displays,
which are relic of time now.
At the moment, the wayland compositor has to handle the case of having
no workspace. This should be unnecessary and it creates a pesky cycling
dependency between Workspace and Compositor.
Given that the Workspace acts more like a container and kwin starts
accepting client connections after starting compositing, it's possible
to create the Workspace earlier and simplify the start() function a bit.
The main motivation behind this change is to encapsulate X11 compositor
implementation to the point that it can be moved from libkwin to
kwin_x11.
There are two options: either get rid of suspend and resume requests, or
add suspend and resume virtual functions in the Compositor. The apps
must definitely not rely on the dbus api, they must use the X11 api.
Compositing suspension api works only on X11 and it's quite obscure,
it's not used by any other KDE component.
So this patch goes for the most simplest option: dropping the requests.
The Shadow no longer owns the texture, so it can be loaded while
compositing is off.
This changes removes the compositing status check to simplify code.
This allows checking if the given override redirect is the composite
overlay window without resorting to platform specific implementation of
Compositor.
Currently, the Workspace is responsible for rerouting
X11Window::blockingCompositingChanged to
X11Compositor::updateClientCompositingBlocking(). It has a few issues:
if the client is initially blocking compositing, it's not going to work
as expected. The second issue is that it creates a coupling between
platform specific compositor implementation and generic Workspace. It's
a blocker for moving X11Compositor to kwin_x11 executable, etc.
implicit sync doesn't work properly with glFlush + KMS and llvmpipe doesn't support
EGL_ANDROID_native_fence_sync either, so we need to wait for rendering to complete
in a blocking fashion.
If somebody else claims the compositing selection, we definitely do not
want to stop compositing. It will also help with encapsulating
X11-specific code and splitting it out in the future.
Config loading is split in two groups: loading compositing config and
loading the rest. They are loaded separately at different times. Some
options are loaded in the Options constructor, some are loaded when compositing
starts, some are loaded when the Workspace is created. It's not easy to
keep track of what loads what and when.
This change simplifies option handling by loading all options in bulk
and decouples Options from OutputBackend and GLPlatform to ensure that
it can safely load options before kwin is fully operational.
Before 885e9acb6e
Application::processStartupEnvironment() returned
QProcessEnvironment::systemEnvironment() which means the current
environment of KWin when this function was called. By setting
InheritFromParent we can replicate this behavior.
This fixes KWin starting processes on X11.
The events we forward to the offscreen QML view are with our own
QPointingDevice instance, which has a devicetype of touch but a null pointerType.
In Qt5 this was enough, but pointerhandlers in qt6 refuse events with an undefined
pointertype, so we have to explicitly set it to finger
BUG:473541
If a transaction entry is removed, the graphics buffer reference will
be dropped and it's possible that the TransactionDmaBufLocker is going
to be destroyed as well.
If that happens, the transaction may remain in the locked state.
At the moment transactions from the same client are applied in the
commit order even if the trasactions affect unrelated surfaces.
This patch desynchronizes transactions affecting unrelated surfaces.
With this, if a client updates two surfaces (as an example, Firefox with
two windows) and one of its surfaces takes longer to render, the other
surface is not going to be slowed down.
Another nice thing is that it removes client from Transaction, which
might be potentially useful to the Workspace for coordinated resize or
something.
This makes unconstraining code more reusable (in case of applet popups
use xdg-positioner too), and in general, it makes sense for better
encapsulation.
Transactions provide a way to apply new surface state to multiple
surfaces atomically.
A transaction can be locked. In which case, it's not going to be applied
until all locks are dropped. For example, this can be used to delay
applying new surface state until the committed buffers become idle.
After introducing SurfaceExtension, SurfaceRole has lost its commit()
function. It serves informative purpose now only.
Shell surface implementations don't have to inherit from SurfaceRole.
By making SurfaceRole act more like a value type, it's possible to fix
role handling in wl_pointer.set_cursor.
There's "major" and "minor" defines that can get implicitly included, for
example with musl libc. To prevent that from breaking compilation, rename
the methods
Since there is now exist the signal right before maximize, use it to
set oldGeometry instead of storing previous values every time with
windowFrameGeometryChanged.
This fixes the effect under Wayland.
Instead, creating contexts that miss these features should fail directly,
making KWin fall back to software rendering.
While this commit also drops workarounds for broken drivers that do software
emulation for features we need, such workarounds belong into these drivers and
the user can still manually turn off compositing if needed.
This commit also drops most of the code around checks for direct rendering. If
direct rendering isn't supported, creating the OpenGL context will now simply fail,
achieving the same effect
In certain cases it can be useful to delay applying a surface commit. As
an example, the compositor may wait until the committed graphics buffer
is ready for reading to avoid stalling its graphics pipeline.
This change introduces basic surface state locking capabilities and
ports some surface extensions to new helpers to manage associated state.
Currently, committed fields are contiguously accumulated. With this, it
will be possible to see what fields have been committed when the
committed() signal is emitted.
It would be nice if xdg-surface and xdg-surface role state are in a
single object so it's easier to stash them. This change refactors
xdg-shell handling to allow that.
xdg-surface state now belongs to xdg-toplevel or xdg-popup state.
It makes no sense to lock that behind an env var. If there's errors those
should always be printed so that we know about them without further investigation
Avoids accidentally triggering an edge when dragging a scroll bar or
text selection all the way to the screen edge.
Special case for moving windows, as you want to be able to drag
a window to an edge to switch virtual desktops.
Compositor::scheduleRepaint() needs some knowledge of the composited
layers, which would be great to get rid of to split wayland and x11
compositing bits.
Display the window caption and class name (safe for the icon) like is done
with the windows themselves.
Eases debugging properties, such as "transientFor".