Commit Graph

19805 Commits (e729478d099272be447a555af4e3c546e2ef927e)

Author SHA1 Message Date
Aleix Pol e729478d09 plasma-window-management: Support new activation concepts 2021-08-20 07:05:34 +00:00
Vlad Zahorodnii 1eb0c09292 scripting: Make ClientFilterModel take VirtualDesktop 2021-08-20 06:54:27 +00:00
Vlad Zahorodnii 5419e3df4a scripting: Introduce workspace.currentVirtualDesktop property
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.
2021-08-20 06:54:27 +00:00
Vlad Zahorodnii 9a2a1c0435 scripting: Add desktops property to AbstractClient
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.
2021-08-20 06:54:27 +00:00
Vlad Zahorodnii fc52531f44 effects/overview: Make the window heap cover the maximize area
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.
2021-08-19 16:35:28 +00:00
David Redondo bc17d0aebd xwl: Use direct way of syncing clipboard
Like the primary selection, sync the clipboard directly without
doing any roudntrips through the internal connection.
2021-08-19 14:59:13 +00:00
Vlad Zahorodnii 66d74f4398 effects/overview: Use Kirigami.ScenePosition
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.
2021-08-19 14:27:19 +00:00
Vlad Zahorodnii ba0f5981bf Port Workspace::slotWindowToDesktop*() to VirtualDesktop 2021-08-19 11:08:32 +00:00
Vlad Zahorodnii b85edc08d2 Port Workspace::switchWindow() to VirtualDesktop
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.
2021-08-19 11:08:32 +00:00
Vlad Zahorodnii 7937aa78ef Port X11 desktop user actions menu to VirtualDesktop
It's mostly identical to the virtual desktop user actions menu on
Wayland.
2021-08-19 11:08:32 +00:00
Vlad Zahorodnii d5c2518973 Add Workspace::clientArea() that take no desktop
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.
2021-08-19 10:49:40 +00:00
David Edmundson 2b88432b17 Export our nested environment to kwin's env
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.
2021-08-19 09:17:43 +00:00
David Redondo 6104dc50cf xwl: Sync primary selection
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
2021-08-19 06:46:23 +00:00
David Redondo fddb83200f Fix typo
GIT_SILENT
2021-08-19 06:46:23 +00:00
Vlad Zahorodnii 4f66cd4c78 effects/overview: Make expo layout spacing configurable
This allows setting "hidpi-aware" spacing on X11.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii 6132329c2c Add Overview effect
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
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii 30da8f497c scripting: Draw window thumbnails with drop shadows 2021-08-19 06:30:55 +00:00
Vlad Zahorodnii c66f38ba7d kwineffects: Add properties to EffectScreen
This allows exposing EffectScreen to effects that use js or qml.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii 9675da6325 kwineffects: Allow specifying render window for EffectQuickView
QtQuick can use the render window to compute the device pixel ratio for
the managed QQuickWindow.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii c51de0f370 wayland: Don't track last focused internal window
QGuiApplication::focusWindow() can be used instead.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii dd6a60beea qpa: Implement QPlatformWindow::requestActivateWindow() 2021-08-19 06:30:55 +00:00
Vlad Zahorodnii c79d7f56dd kwineffects: Disable OpenGLContext sharing check in EffectQuickView
On Wayland, QOpenGLContext::shareContext() will always return null even
if the newly created context has a share context.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii b32592f54e kwineffects: Allow disabling automatic frame scheduling in EffectQuickView 2021-08-19 06:30:55 +00:00
Vlad Zahorodnii 212090d990 Add Toplevel.stackingOrder property
This primarily targets QML scripts.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii 2b06957f6f scripting: Register Workspace singleton type 2021-08-19 06:30:55 +00:00
Vlad Zahorodnii 5435865329 scripting: Introduce ClientModel V3
ClientModel V3 is much easier to extend and maintain than the one in V2.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii cecf2ee7a1 scripting: Move old ClientModel in V2 namespace 2021-08-19 06:30:55 +00:00
Ismael Asensio f6f027aa10 kcm/kwindecoration: Fix window thumbnail sizes
Caused by a stray `units` context property that no longer exists.
2021-08-18 23:07:30 +02:00
Vlad Zahorodnii 1fbd99b572 Simplify Workspace::sendClientToDesktop()
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.
2021-08-18 06:40:50 +00:00
Xaver Hugl 2e0336681f platforms/drm: consider KWIN_DRM_DEVICES for hotplugged gpus 2021-08-17 19:23:35 +02:00
David Edmundson ff99100ec5 Fix build 2021-08-17 13:17:27 +01:00
Vlad Zahorodnii 0c0118f5e8 Port Workspace::takeActivity() to VirtualDesktop
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.
2021-08-17 11:16:16 +00:00
David Edmundson ad6ff56468 [kwin_wrapper] Port kwin_wrapper to not block
Functionally the same, but will be useful for some pending startup
changes where we have other operations.
2021-08-17 09:42:19 +01:00
David Edmundson f541d851ed [kwin_wrapper] Transfer ownership of Xwayland socket creation and Xauthority to the wrapper
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.
2021-08-17 09:41:57 +01:00
David Edmundson 9692b49219 [kwin_wrapper] pass the wayland socket name via arguments rather than the env
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.
2021-08-17 07:00:08 +00:00
Vlad Zahorodnii 9962a9fe59 Consider only windows on current desktop when snapping them
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.
2021-08-17 06:24:19 +00:00
Vlad Zahorodnii 7c8d9c5b1c Port FocusChain to VirtualDesktop 2021-08-17 06:23:52 +00:00
Vlad Zahorodnii 42f2afd80d Port Workspace::findDesktop() to VirtualDesktop 2021-08-17 06:23:52 +00:00
Vlad Zahorodnii b75f089981 Port Workspace::topClientOnDesktop() to VirtualDesktop
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.
2021-08-17 06:23:52 +00:00
Ismael Asensio 76e74d7660 [kcm/kwinrules] Adapt width to new breeze style spinboxes
Also port from a stray `units` context property.
2021-08-16 15:12:34 +00:00
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