The previous implementation added noise in linear space, which resulted in
the effect becoming more pronounced on black backgrounds. This patch
changes the process to be applied in perceptual space, by making the noise
addition pass a separate draw call and disabling GL_FRAMEBUFFER_SRGB during
that.
After this change, noise will look much more suppressed and almost never
grainy. This change also changes the range of the noise from
[-strength..strength) to [0..strength), as blending can only be either
additive or subtractive. As a result, users might need to ramp up their
noise parameter after this change.
v2: Add more explanation around the draw call.
v3: Fix noise not fading out with the fade out effect.
v4: Restore an accidentally removed comment.
v5: Add CCBUG.
v6: Rebase.
v7: Fix a formatting issue.
CCBUG: 409620
Originally, there was ShellClient class that was the predecessor to
WaylandClient subclasses. If the main surface is unmapped, the
corresponding instance of ShellClient would be kept around. That had
been changed with the introduction of XdgToplevelClient and
XdgPopupClient.
Since ShellClient had been kept alive even if the corresponding surface
were unmapped, it did make sense to setup window management integration
when the surface is mapped.
However, this also means that plasma will not know about initially
minimized windows.
Since unmapped windows are handled differently now, we can setup window
management after the client performs the initial commit. If the main
surface is unmapped, the XdgToplevelClient object will be destroyed and
with it, the window management integration.
Currently, ExpoLayout delays layout updates by using a singleshot timer
(primarily due to the author of the effect not being aware of
QQuickItem::polish() and QQuickItem::updatePolish()).
This change makes ExpoLayout schedule layout updates using QtQuick's
native item polish machinery, which gets triggered before rendering and
thus we can batch more geometry updates.
In addition to that, this change simplifies the initialization code in
ScreenView by making the fact that ExpoLayout is arranged right before
rendering internal to the WindowHeap type.
As all outputs from secondary GPUs are in the same map as the ones from
the primary GPU, EglMultiBackend::findBackend always returned the
primary backend. To fix that, search in secondary backends first
This is to prevent hitting the case where there are no any outputs.
Ideally, it shouldn't matter in which order outputs are added or
removed, but the Workspace and AbstractClient subclasses don't work
with true headless mode. If there are no outputs, kwin can crash.
Due to the screen edges test not being an integration test, it's very
hard to change output related code in libkwin. screens.cpp needs to have
a few ifdefs to successfully compile.
This change rewrites the screen edges test as an integration test in
order to allow us using other components of kwin in screens.cpp and
screenedge.cpp without ifdef guards.
It's not a one-to-one port.
With the new output query algorithm, position of an output may not align
with its xinerama index. This can be problem on x11 as some protocols,
e.g. startup feedback, use xinerama indices to identify outputs.
Technically, the RandR specification doesn't say that CRTCs are stored
in the xinerama order, it only mentions that the first CRTC corresponds
to the primary output. However, such assumption was made by kwin prior
to output query changes, this change merely restores that behavior.
Active output is a window management concept. It indicates what output
new windows have to be placed on if they have no output hint. So
Workspace seems to be a better place for it than the Screens class, which
is obsolete.
This allows us to drop obsolete Screens class.
Currently, the Screens class is a thin wrapper around platform outputs +
some extra tracked state, e.g. active output, workspace geometry, etc.
This is a little helper that can be very convenient with our transition
from int-based screen ids to AbstractOutput.
As is, the main issue with int screen ids is that they are extremely
dynamic.
Instead of crashing because a nullptr property gets accessed, use
an explicit error message and ignore the offending object. This also
acts as documentation
With AbstractOutput being used more heavily, it makes sense to have
something like Screens::number() in the Platform class. As is, the steps
to get an output for a given point are awkward - first, get the screen
id, then use the screen id to get the output.
With the new virtual desktop model, we have an issue where the old
code that uses desktop() needs to be ported to desktops().
However, using no desktop() is better as we don't need to deal with
cases where a window can be on several desktops, which can be annoying
sometimes.
This change removes the desktop arg in electricBorderMaximizeGeometry()
and ports it to a Workspace::clientArea() overload that requires no
desktop.
Under the hood, Workspace::clientArea() still uses desktop(), but it
could also use a different strategy to compute the client area if the
window is on several virtual desktops, e.g. intersect client area on
every virtual desktop.
There's no need to guard the code, gbm and drm format definitions
are the same. Using GBM_BO_FORMAT_* even caused bugs, as that is
an enum and not a proper format identifier.
BUG: 441253
It's confusing to have two signals (virtualScreenGeometryChanged() and
screenGeometryChanged()) that indicate the same thing.
This change ports parts of kwin from the screenGeometryChanged() signal
to the virtualScreenGeometryChanged() signal with the main motivation to
drop the former.
The virtualScreenGeometryChanged() signal was chosen as the replacement
for the consistency sake with EffectsHandler's virtualScreenGeometry and
virtualScreenSize properties.
Currently, the EffectsHandler has two signals that are emitted when the
combined geometry of all outputs change - virtualScreenGeometryChanged()
and screenGeometryChanged(). Having two signals is most likely a
historical artifact.
This change untangles the screenGeometryChanged() signal from the
Workspace and makes it the same as the virtualScreenGeometryChanged()
signal.
Currently, there are a couple of issues with output querying on X11:
(a) if an output is changed, for example its transform has been changed,
then all outputs will be destroyed and created again
(b) it's possible to encounter the case where the platform has no
outputs. The X11Platform destroys all outputs, then queries new
outputs. The Workspace and AbstractClient sub-classes handle having
no outputs very poorly! It's even possible to hit a crash.
With this change, outputs will be queried similar to how it's done on
Wayland.
The current duration is 300ms, which is inappropriate for two reasons:
1. It's too slow
2. It doesn't match one of the standard durations. The effect should
ideally use those durations directly, but if this is not possible
for technical reasons, it should use the effective value of one of
those durations. Units.longDuration is 200ms which is the most
appropriate one to use here.
Therefore, change the animation duration from 300ms to 200ms to match
the standard Units.longDuration duration.
BUG: 441308
FIXED-IN: 5.23
This makes it easier to spot if the effect is activated while there is
only one maximized window.
Note that anchors.margins cannot be used unfortunately as it won't take
effect until the ExpoLayout item is fully constructed. It may take a
couple of cycles for the geometry to settle down, which makes reasoning
about how the effect works difficult.
BUG: 312146
Once an animation starts due to property change, it cannot be easily
re-targeted. This can cause undesired animation jumps if a property
changes during startup (for example from 0 to its final value).
With this change, the window heap's animation will be disabled until
the effect starts the intro animation.
The ExpoLayout delays relayouting for optimization purposes. However,
this means that new geometry will be available only after returning to
the event loop.
This change delays starting the intro animation so it can be started
with new geometries.
It's confusing to have globalPos() and geometry() as both can return the
same information.
This change drops globalPos() function as it's not used outside the
AbstractWaylandOutput class and renames setGlobalPos() to moveTo() to
avoid having a setter without matching getter.
According to the Qt documentation, if an item overrides the
geometryChanged() method, it must call the base class method.
QQuickItem::geometryChanged() is responsible for emitting signals such
as xChanged(), yChanged(), etc.
It's the same as the currentDesktop except that it's a VirtualDesktop
object.
The main advantage of the currentVirtualDesktop property is that it
doesn't change if a virtual desktop is added or removed in the middle.
It also makes dealing with virtual desktop changes easier.
With the new virtual desktops model, a window can be on several virtual
desktops. Currently, scripts have no any way to get the list of desktops
the window is on. This change addresses that.
Currently, window thumbnails may be placed behind the panel, which
doesn't look good.
With this, the window heap will cover the same area as the maximize
area.
This makes the WindowHeap more robust to layout changes. Currently, the
main issue with it is that thumbnails will be misplaced if the heap's
scene position changes.
Kirigami.ScenePosition automagically keeps track of the item's scene pos.
If a window is on several virtual desktops, Workspace::switchWindow()
will not work as expected because AbstractClient::desktop() returns the
id of the last virtual desktop.
Since the active window is most likely on the current virtual desktop,
we can use that for filtering out irrelevant windows.
The new overloads take the client (as context) and the desired screen id
or a point and return the client area.
The main motivation behind this change is to make the transition to the
new virtual desktop model where a window can be on several desktops less
painful.
In the recent refactor we made it so environment variables got synced to
the Application::processStartupEnvironment.
It then seemed safe and cleaner to remove the qputenv calls, but this
was not the case. It regressed the unit tests on CI and kglobalaccel
which is another path where kwin spawns clients.
Syncs the primary selection from wayland to X and from X to wayland.
Instead of doing it through the internal connection like the clipboard,
this sets/reacts to changes in SeatInterface::prrimarySelection directly.
BUG:422426
FIXED-IN:5.23
This effect is meant to be as a replacement for the present windows and
the desktop grid effect. It is written using QML.
So far, this effect implements only the basic features of the present
windows effect. Desktop management features will be added later.
CCBUG: 295775
CCBUG: 303438
This allows changing the type of desk to QVector<VirtualDesktop *>.
Based on the dont_activate flag, Workspace::sendClientToDesktop() will
try to focus the window if it's moved to the current virtual desktop.
In order to implement that, it needs to know whether the window has been
on the current desktop. c->isOnDesktop(desk) is a much sophisticated way
to do that.
Workspace::takeActivity() forces the modal dialog and its parent window
to be on the same virtual desktop. It uses int-based desktop ids for
that purpose.
This change ports the relevant parts of Workspace::takeActivity() to the
VirtualDesktop object.
This way if kwin_wayland crashes we don't need to ensure that new
environment variables need to get synced across the new env.
This fixes an issue where spawning an xwayland application from a
wayland window that survives a crash would fail.
By moving the logic here we no longer need to wait for kwin_wayland to
start before starting plasmashell or even ksmserver as all environment
variables are set. As long as the wrapper is ready we can continue
starting and clients will just block on connect.
That should still allow for both a lot of optimisations both for speed
and cleaning up the startplasma-wayland scripts.
This will be addressed in follow up patches.
Use of kwin_wayland directly with xwayland is still supported for
testing.
The initial goal of kwin_wrapper was that it would set up all relevant
environment variables that will be used by the clients of kwin.
This meant having to cache old variables before we overrode them and
pass additional settings to the backends for the old wayland_display. It
works, but with X11 about to move too ends up being unnecessarily
complex. In hindsight it's easier for kwin to have the environment
represent the platform it is currently on, and have kwin explicitly set
variables in the QProcessEnvironment of the session it forks itnto.
This patch is changed so that we set the wayland socket name used by the
wrapper explicitly which is then used by the process environment kwin
uses for the main session.
If a window is on several desktops, AbstractClient::desktop() will
return the id of the last desktop.
For example, if a window is on virtual desktops A and B, the desktop()
function will return the id of desktop B. This can be the culprit for
bugs such as window snapping not working as expected when moving a
window on virtual desktop A, e.g.
- moved window is on desktops A, and C. desktop() returns the id of C
- snap candidate (l) is on desktops A, and B. desktop() returns the id
of B
Even though the snap candidate window and the moved window are both on
the same desktop (A), the moved window won't be snapped because the
desktop() function returns garbage values.
To fix that, the workspace needs to check whether the window is on the
current desktop.
For what it's worth, that's also how the workspace handles windows being
on multiple activities.
This patch has one behavioral change - raiseOrLowerClient() will not
work if the client is not on the current virtual desktop.
However, raiseOrLowerClient() can be called only in two cases:
* user triggers the raise or lower shortcut for the active client. Since
the active client is on the current virtual desktop, it's not an issue
* an x11 window restacks itself. It makes no sense if an x11 window
restacks itself while it's inactive or not on current virtual desktop.
Also, the Opposite restack mode is rarely used, some window managers
don't even bother implementing it. So, having such a constraint should
not be a problem.
The main reason for not allowing raiseOrLowerClient() for windows that
are not on the current virtual desktop is that a window can be on
multiple virtual desktops. If a window is on A and B virtual desktops,
the only logical option is to toggle stacking position if the window is
on the current desktop. It's the only viable option as kwin does not
maintain per virtual desktop stacking order.
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.
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.
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.
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.
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.
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.