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.
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.
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.
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.
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.
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.
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.