Commit graph

984 commits

Author SHA1 Message Date
Tatsuyuki Ishi
c193efc962 blur: add noise in perceptual space
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
2021-09-01 21:42:56 +00:00
Méven Car
0a2c511489 Wayland: Add support for protocol kde-output-device_v2, allow to detect drm mode changes
CCBUG: 407058
2021-09-01 13:37:43 +00:00
Vlad Zahorodnii
03b64331f2 wayland: Remove special input method case in XdgToplevelClient
Input method surfaces have input_panel_surface role, so the special case
for input method windows can be dropped.
2021-09-01 10:26:16 +00:00
Vlad Zahorodnii
99e208e30f wayland: Always setup window management for xdg-shell clients
kscreenlocker uses the layer-shell protocol, so the special lock screen
case can be removed.
2021-09-01 10:26:16 +00:00
Vlad Zahorodnii
1717de8a59 Port XdgToplevelClient::updateShowOnScreenEdge() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
cdd3f96fe1 Port X11Client::fullscreenMonitorsArea() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
26e470b7ff Port screenContainsPos() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
25a6515e05 Port AbstractClient::checkQuickTilingMaximizationZones() to AbstractOutput 2021-09-01 10:10:24 +00:00
Vlad Zahorodnii
8b85fdcedf wayland: Setup window management integration on initial commit
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.
2021-08-31 23:42:07 +00:00
Carson Black
63b16cdf9d Increased edge margins 2021-09-01 01:33:51 +02:00
Aleix Pol
0b74aa62c9 Support PlasmaWindowInterface::sendToOutput 2021-08-31 21:25:18 +00:00
Xaver Hugl
a3cbaf48dc platforms/drm: fix modifier env variable
Like the name suggests, modifiers were meant to be enabled by default
2021-08-31 16:30:03 +00:00
Vlad Zahorodnii
d70cfadf96 platforms/drm: Fix outputDisabled signal
The outputDisabled() signal must be emitted **after** removing the
output from a list of enabled outputs.
2021-08-31 16:02:19 +00:00
Vlad Zahorodnii
b0c26cc424 effects/overview: Layout window thumbnails in updatePolish()
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.
2021-08-31 12:51:29 +00:00
Vlad Zahorodnii
683bf20168 Port ScreenEdges away from Screens 2021-08-31 11:17:46 +03:00
Vlad Zahorodnii
cbaf39e270 Port the remaining usages of Screens::geometry(i) in Workspace to AbstractOutput 2021-08-31 09:45:20 +03:00
Vlad Zahorodnii
9bf6e2bd68 Port Workspace::supportInformation() to AbstractOutput 2021-08-31 09:41:22 +03:00
Vlad Zahorodnii
1b2e8437ac Use precomputed workspace geometry in Workspace::initializeX11()
When initializeX11() is called, the workspace geometry is known, so it
doesn't need to be computed again.
2021-08-31 09:35:27 +03:00
Vlad Zahorodnii
e198727e15 Drop Toplevel::isOnScreen()
It's unused. Its replacement is Toplevel::isOnOutput().
2021-08-31 05:45:55 +00:00
l10n daemon script
96c6f964e6 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-31 01:29:11 +00:00
Xaver Hugl
85a6dc3cad platforms/drm: correct multi-gpu mistake
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
2021-08-30 23:00:19 +02:00
Vlad Zahorodnii
89d49b4d5d platforms/virtual: Add new outputs before removing old outputs
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.
2021-08-30 15:08:52 +00:00
Vlad Zahorodnii
f8ad513648 Unvirtualize property getters in Screens
MockScreens is gone so property getters in Screens can be regular
methods now.
2021-08-30 14:46:00 +00:00
Vlad Zahorodnii
8fd1914f83 Port Edge to Platform::outputAt() 2021-08-30 14:46:00 +00:00
Vlad Zahorodnii
901e479482 autotests: Rewrite testScreenEdges as an integration test
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.
2021-08-30 14:46:00 +00:00
Xaver Hugl
42b516b567 fix drag and drop raise with Xwayland windows
They shouldn't be raised immediately. The same strategy as with
Wayland native clients should be used.

BUG: 440534
2021-08-30 16:31:28 +02:00
Xaver Hugl
f4d63bb8ed platforms/drm: first emit outputDisabled, then remove output
The current behavior is in contradiction to the description of
Platform::outputDisabled
2021-08-30 16:24:25 +02:00
Xaver Hugl
dbf4a59527 platforms/drm: prevent having zero outputs at any time
Instead of updating all outputs first, create the placeholder output
before the last output gets removed.
2021-08-30 16:24:08 +02:00
Vlad Zahorodnii
2696030b00 Port AbstractClient::setQuickTileMode() to output() 2021-08-30 13:58:52 +00:00
Vlad Zahorodnii
8a93a33b96 x11: Make sure that outputs are stored in xinerama order
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.
2021-08-30 13:28:53 +00:00
Vlad Zahorodnii
7016da39c8 Move active output tracking to workspace
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.
2021-08-30 13:28:23 +00:00
Vlad Zahorodnii
16bc522bfc Rename Workspace::setCurrentOutput() to switchToOutput() 2021-08-30 13:28:23 +00:00
Vlad Zahorodnii
813804d5a0 x11: Port X11Output::setGammaRamp() to Application::x11Connection()
It's faster.
2021-08-30 12:16:24 +00:00
Vlad Zahorodnii
96830d2295 x11: Simplify X11Output::geometry()
There is a separate type for placeholder x11 outputs, so X11Output can
return its geometry without performing any checks.
2021-08-30 12:16:24 +00:00
Vlad Zahorodnii
9dfccfc95c Port some of kwin to Workspace::geometry() 2021-08-30 12:26:16 +03:00
Vlad Zahorodnii
71aeb5528a Cache workspace geometry in Workspace
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.
2021-08-30 12:26:14 +03:00
Vlad Zahorodnii
d9686a0caa Avoid using Screens in Workspace::updateClientArea()
Use AbstractOutput for consistency sake.
2021-08-30 12:17:08 +03:00
Vlad Zahorodnii
acb5c04fae Drop Workspace::clientArea(clientAreaOption opt, const Toplevel *window, int screen)
It's unused.
2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
b80fbe6fb0 Merge WindowRules::checkScreen() and WindowRules::checkOutput() 2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
a1f1039b58 Store AbstractOutput in Toplevel
Since AbstractOutput is used more than int screen ids in kwin, it's
worth storing AbstractOutput for better performance.
2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
6ca411a84a Port AbstractClient::sendToScreen() to AbstractOutput 2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
22649137d6 Port FocusChain to AbstractOutput 2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
02a9457bbc Port Workspace::clientUnderMouse() to AbstractOutput 2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
e0c941109c Allow setting current AbstractOutput 2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
507c5140b7 Port Workspace::topClientOnDesktop() to AbstractOutput 2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
95e5f5fc1a Introduce Toplevel::output()
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.
2021-08-29 21:55:07 +00:00
Ismael Asensio
77325dbb79 kcm/rules: Port KCM loading to KPluginMetadata
Passing just the plugin name to the KCM loader has been
deprecated in 5.85. This just affects the standalone loading of
the KCM via the window menu.
2021-08-29 13:13:33 +02:00
l10n daemon script
216233c2ec 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-29 01:20:37 +00:00
Xaver Hugl
0054d825c4 platforms/drm: directly check for required properties
Instead of crashing because a nullptr property gets accessed, use
an explicit error message and ignore the offending object. This also
acts as documentation
2021-08-27 20:25:18 +00:00
Vlad Zahorodnii
5a1b98d148 Allow passing Toplevel to Workspace::clientArea()
This allows us to re-use the same code path for alive and deleted
windows.
2021-08-27 19:33:47 +00:00
Vlad Zahorodnii
d228829abb Introduce Platform::outputAt()
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.
2021-08-27 21:51:05 +03:00
Vlad Zahorodnii
1dc749333e Remove desktop argument in AbstractClient::electricBorderMaximizeGeometry()
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.
2021-08-27 15:12:59 +00:00
Vlad Zahorodnii
e5f6039a68 Remove desktop() usage in Workspace::activateClient()
Explicitly make the last virtual desktop current. This improves code
readability and gets rid of a desktop() usage.
2021-08-27 15:12:25 +00:00
Xaver Hugl
d6de38c1d6 platforms/drm: use drm formats instead of gbm formats
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
2021-08-27 11:56:36 +00:00
Xaver Hugl
092660613a platforms/drm: fix legacy mode
CCBUG: 441253
2021-08-27 11:50:02 +00:00
Vlad Zahorodnii
fff32f64e6 effects: Drop EffectsHandler::screenGeometryChanged()
It's confusing to have two signals (virtualScreenGeometryChanged() and
screenGeometryChanged()) that indicate the same thing.
2021-08-27 09:23:33 +00:00
Vlad Zahorodnii
ff87b33a8a Port away from EffectsHandler::screenGeometryChanged() to EffectsHandler::virtualScreenGeometryChanged()
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.
2021-08-27 09:23:33 +00:00
Vlad Zahorodnii
894ed68ff4 effects: Wire EffectsHandler::screenGeometryChanged() to Screens::geometryChanged()
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.
2021-08-27 09:23:33 +00:00
Vlad Zahorodnii
6c62f12bc1 effects/overview: Specify effect chain position
The present windows effect specifies a chain position of 70. Do the
same in the overview effect.
2021-08-27 12:02:35 +03:00
Vlad Zahorodnii
bd6d04b417 x11: Pass the output name to X11Output constructor
The output name is static, i.e. it cannot change, so there's no point
for having a setter.
2021-08-27 08:23:22 +00:00
Vlad Zahorodnii
a8810e0c33 x11: Rework how X11 outputs are queried
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.
2021-08-27 08:23:22 +00:00
Nate Graham
205fb923cb [effects/overview] Speed up animation
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
2021-08-26 16:15:39 +00:00
Vlad Zahorodnii
0931e4f8cc effects/overview: Pad screen borders in qml
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
2021-08-26 19:11:27 +03:00
Vlad Zahorodnii
028421c4d7 effects/overview: Disable animations until started
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.
2021-08-26 19:11:27 +03:00
Vlad Zahorodnii
8e0264d034 effects/overview: Delay starting 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.
2021-08-26 19:11:27 +03:00
Xaver Hugl
83ccfbb571 platforms/drm: exit more cleanly if we can't find a buffer config 2021-08-26 16:10:26 +00:00
Xaver Hugl
ef48c247e6 platforms/drm: re-add some logging for egl configs
But only print it when KWin can't find a fitting config

CCBUG: 441253
2021-08-26 17:38:58 +02:00
Vlad Zahorodnii
035d0077dc Remove AbstractWaylandOutput::internal()
It's unused.
2021-08-26 17:16:35 +03:00
Vlad Zahorodnii
8d422f3005 Remove globalPos() in AbstractWaylandOutput
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.
2021-08-26 16:35:41 +03:00
Vlad Zahorodnii
d841733ed8 effects/overview: Call base QQuickItem::geometryChanged() in ExpoLayout
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.
2021-08-26 08:34:59 +00:00
Ahmad Samir
2c2469f991 Fix clazy warning: Use QString() multi-arg
No need to use arg(QString::number(int )), when arg() already has a int
overload.

Also replace "endl" with "Qt::endl".

GIT_SILENT
2021-08-25 20:09:55 +00:00
Vlad Zahorodnii
ac7eb252f1 Remove Workspace::hasClient() micro-optimization
Workspace::hasClient(X11Client *) is unused and not worth optimizing as
it doesn't appear in any hot path.
2021-08-25 18:54:45 +00:00
Vlad Zahorodnii
c5d22b68b6 wayland: Simplify startup sequence
If there are no outputs, the drm backend will create a placeholder
output, so continueStartupWithScreens() can be removed.
2021-08-25 18:54:19 +00:00
Vlad Zahorodnii
78b5330824 Drop VirtualDesktopManager::name()
It's confusing to have two ways to query the same information.
2021-08-25 20:12:07 +03:00
Vlad Zahorodnii
ad6039c7c3 Remove unused Workspace::clientArea() overload 2021-08-25 15:14:27 +00:00
Aleix Pol
30959c2efb Include a transform effect
It should be used to decorate changes on the display like rotation.
2021-08-25 14:44:03 +00:00
Aleix Pol
9a4bbdf226 Make it possible for an effect to render a screen
Useful in case it needs the contents of the screen but they can't be
blitted, as the state of the framebuffer is unknown.
2021-08-25 14:44:03 +00:00
Aleix Pol
4d1f30301b Make KWin::TimeLine::progress() public
This way we can have animations that act slightly different in different
parts of the animation
2021-08-25 14:44:03 +00:00
Aleix Pol
24cc93ec5b effects: Allow exposing an EffectScreen::transform
This way an effect can know the transformation that is applied on a
display.
2021-08-25 14:44:03 +00:00
Aleix Pol
34cfc6680b effects: Include signals notifying about outputs changing 2021-08-25 14:44:03 +00:00
Xaver Hugl
5cc5d81cea guard gbm version for gbm_bo_get_fd_for_plane 2021-08-25 14:39:35 +00:00
Vlad Zahorodnii
a234e5aaf4 Forbid passing "-1" as screen to Workspace::clientArea()
This simplifies Workspace::clientArea() implementation. Also, it will be
very handy with transition from int-based screens to AbstractOutput.
2021-08-25 14:31:30 +00:00
Vlad Zahorodnii
fddbd57d09 Port Workspace::clientArea() to VirtualDesktop
This makes Workspace APIs that take virtual desktops more consistent.
2021-08-25 14:31:30 +00:00
Vlad Zahorodnii
5b3c87f105 Rename LayerShellV1Client::output() to desiredOutput()
This is to avoid hitting bugs if the Toplevel class gains an output
property. The new name also better describes what the function returns.
2021-08-25 13:58:49 +00:00
Xaver Hugl
1be65e818c Port screenId based rendering methods to AbstractOutput 2021-08-25 13:53:33 +02:00
Xaver Hugl
e6cab81b53 platforms/drm: multi-gpu buffer import with modifiers 2021-08-25 13:30:49 +02:00
Aleix Pol
35ec9b87a7 Port away from KPluginMetaData::instantiate
It's deprecated according to the documentation, QPluginLoader works just
as well (it's what kcoreaddons was using anyway).
2021-08-25 10:46:40 +00:00
Vlad Zahorodnii
7ffd72cbfa Decouple activation feedback from window management 2021-08-25 09:35:57 +00:00
l10n daemon script
e227e93792 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-25 01:15:54 +00:00
David Edmundson
2fb52274d0 Only try to deactivate overview whilst activate
BUG: 441325
2021-08-24 21:45:17 +02:00
Xaver Hugl
fbff8636b9 platforms/drm: fix gpu removal
As soon as m_backends.removeOne(*it) returns, "it" no longer
points to the same value.

CCBUG: 441372
2021-08-24 12:36:44 +00:00
l10n daemon script
6f6944058b 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-24 01:20:52 +00:00
Ahmad Samir
731564f04d Fix clazy warnings: potential Qt containter detaches in range-for loops
GIT_SILENT
2021-08-23 23:03:06 +00:00
Ahmad Samir
9f41691684 fix clazy warning: Pass a context object as 3rd connect parameter
GIT_SILENT
2021-08-23 23:02:46 +00:00
Xaver Hugl
1e572a4299 platforms/drm: make debug logging less verbose 2021-08-23 21:53:21 +00:00
l10n daemon script
5246408660 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-23 01:27:10 +00:00
l10n daemon script
76d1de48a8 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-22 01:17:35 +00:00
Xaver Hugl
1490215f0d effects/overview: exit on background click
BUG: 441301
2021-08-21 22:08:04 +02:00
l10n daemon script
17b161213c 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-21 01:16:14 +00:00
Alexey Varfolomeev
6336bb71ba No symbolic icons 2021-08-20 19:34:28 +00:00
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