Commit graph

1225 commits

Author SHA1 Message Date
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
Vlad Zahorodnii
7f04d730e6 Make WindowRules::checkDesktop take a list of desktops
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.
2021-08-16 06:32:43 +00:00
Vlad Zahorodnii
8e8fc55b0b Simplify desktop check in AbstractClient::setOnAllDesktops() 2021-08-16 06:31:59 +00:00
Vlad Zahorodnii
86fa79c33b Use more Toplevel::isOnCurrentDesktop() 2021-08-16 06:31:59 +00:00
Vlad Zahorodnii
43d773730d Unify virtual desktop removal handling on X11 and Wayland
On X11, a window can be only on a single virtual desktop or all, so the
platform specific code paths are not needed.
2021-08-16 06:31:59 +00:00
Vlad Zahorodnii
7f1baf66f9 Port some code away from AbstractClient::setDesktop() to AbstractClient::setDesktops()
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.
2021-08-16 06:31:59 +00:00
Manuel Stoeckl
2aa3ed0005 Use texture unpacking for QImage uploads when possible
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.
2021-08-16 06:30:59 +00:00
l10n daemon script
214a318811 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-16 01:12:48 +00:00
l10n daemon script
d6f16882ff 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-14 01:18:16 +00:00
Méven Car
c5907e8f36 Fix a few compile warnings 2021-08-13 20:56:45 +02:00
Vlad Zahorodnii
3982f8399f Remove some redundant addWorkspaceRepaint() calls
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.
2021-08-13 06:28:18 +00:00
Vlad Zahorodnii
ec8a9f7cf7 Add isOnDesktop() overload that takes VirtualDesktop
int-based desktop ids are unreliable, but VirtualDesktop are not. So far
virtual desktop objects aren't used widely in kwin, but it's a good start.
2021-08-13 06:27:46 +00:00
Vlad Zahorodnii
a7cb034513 Simplify Toplevel::isOnDesktop() and Toplevel::isOnAllDesktops()
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.
2021-08-13 06:27:46 +00:00
Xaver Hugl
724f9a5db0 Correct check for when VRR should be active
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.
2021-08-12 20:38:45 +00:00
Vlad Zahorodnii
ef9d541487 Remove unused XCB includes in toplevel.h
Damage handling has been moved to SurfaceItemX11.
2021-08-12 20:57:17 +03:00
Vlad Zahorodnii
363177f36f Remove unused markedAsZombie signal 2021-08-12 17:52:24 +00:00
Vlad Zahorodnii
7e9c6587db Remove scene window traces in scene items
This further decouples scene items from scene windows. The SurfaceItem
still needs to access the underlying window, I would like to re-iterate
over that later.

With this change, it will be possible to introduce WindowItem factory
function in the Toplevel class.
2021-08-12 17:52:24 +00:00
Vlad Zahorodnii
a13fd02ea8 Remove virtualdesktops.h include in toplevel.h
toplevel.h is included in many places. Changing virtualdesktops.h may
trigger rebuild of all kwin.

With this change, only cpp files that use virtualdesktops.h will need to
be recompiled.
2021-08-12 17:23:15 +00:00
Vlad Zahorodnii
f71686894d Remove unused includes in x11client.h 2021-08-12 17:23:15 +00:00
Vlad Zahorodnii
a848fb6374 Remove input.h include in toplevel.h
It's unused.
2021-08-12 17:23:15 +00:00
Vlad Zahorodnii
0197d770ab Drop Toplevel::transparentRect()
It can be computed via other means (Toplevel::frameMargins()) and its
name is confusing. It specifies the inner decoration rect.
2021-08-12 17:22:49 +00:00
Aleix Pol
ac16bef409 screenshot: Reuse GLTexture::toImage
Cleans the code a bit. It also makes use of the more performant
Qt::Format_RGBA8888_Premultiplied, which is nice to come by.
2021-08-12 16:00:52 +00:00
Aleix Pol
1473466ef7 inputmethod: Remove the SNI entirely
It can be replaced with an ad-hoc plasmoid that gets to be a bit more
specific and interactive.
2021-08-12 16:00:15 +00:00
Vlad Zahorodnii
ad4f183a76 x11: Drop support for _NET_WM_FRAME_OVERLAP
The main idea behind _NET_WM_FRAME_OVERLAP is to extend the borders of
the server-side decoration so the application can draw on top of it. It
was inspired by similar feature in Windows.

However, _NET_WM_FRAME_OVERLAP is basically unused. Neither GTK nor Qt
support it and I have never seen any application that uses it.

At the moment, kwin is the only compositing window manager that supports
_NET_WM_FRAME_OVERLAP. Neither mutter nor compiz nor compton and so on
support it.

Since _NET_WM_FRAME_OVERLAP is practically unused, there's no point for
keeping supporting it.

This change shouldn't affect any existing app as _NET_WM_FRAME_OVERLAP
atom is not listed in _NET_SUPPORTED.
2021-08-12 11:44:40 +00:00
Vlad Zahorodnii
4ca287641f wayland: Destroy xdg shell clients when corresponding roles are about to be destroyed
This ensures that surface role objects can be still accessed when either
XdgToplevelClient or XdgPopupClient is destroyed. As far as I know, it
doesn't cause any problems right now, but this makes resource destruction
handling consistent, we tend to perform cleanup in aboutToBeDestroyed
signal slots.
2021-08-12 13:03:35 +03:00
Manuel Stoeckl
51d82fc6e5 Replace an old workaround for alpha-only shadows
SceneOpenGLShadow::prepareBackend used to use QImage::Format_Indexed8,
plus a special code path in GLTexture, to create single-channel OpenGL textures.
Now that Qt supports QImage::Format_Alpha8, this workaround can be removed.
2021-08-11 23:32:18 -04:00
l10n daemon script
4ab4f928f0 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-12 01:14:37 +00:00
Vlad Zahorodnii
4912c7cfa2 scenes/opengl: Calculate item transforms differently
Currently, a vertex coordinate is transformed first, then mapped to
the global screen coordinates. This causes a problem if a transform
is applied to the top-most item and child items are not at (0, 0).
For example, scaled windows may have popping out sub-surfaces, etc.

With this change, the item transforms will be computed differently. For
example, if the parent item is transformed, a child's transform will
look as follows

  [Parent's translation][Parent's transform][Child's translation]

instead of

  [Parent's translation][Child's translation][Parent's transform]

In the future, I'd like to get rid of the Item::setTransform() call in
OpenGLWindow::performPaint() and have either AnimationEffect or
libkwineffects call Item::setTransform().

BUG: 440201
2021-08-11 19:43:31 +03:00
David Edmundson
60255fd7a9 Teardown view before QQuickRenderControl
Deleting QQuickWindow will force any remaining runnables to complete.
This is important for any items (such as our new ThumbnailItem) that
deletes resources in queued cleanups.

We need to invoke this manually whilst we still have an active render
control with a valid context, otherwise remaining runnables will no-op.

We also then want to manually delete our scene contents before the view
so they're not orphaned temporarily.

This fixes a memory leak observed with the new Overview effect.
2021-08-11 07:31:53 +00:00
Vlad Zahorodnii
fdb1914a83 wayland: Wire in surface mapped state
If a sub-surface should be considered unmapped, make the corresponding
item invisible.

Note that this must apply only to sub-surfaces. Whether the main surface
should be visible is up to kwin. It may want to play an animation when
the toplevel surface is unmapped, etc.
2021-08-11 06:41:00 +00:00
Manuel Stoeckl
aa386896f1 Rename QImage to GL format conversion table
Also expand the comment describing it.
2021-08-10 14:21:48 +00:00
Manuel Stoeckl
b440be5bd2 Avoid converting images when updating GLTexture
In GLTexture::update, reuse the mechanism from the GLTexture(QImage, ...)
constructor to upload QImage data directly when the QImage format
has compatible GL format and type codes. Before this change, all QImage
formats other than ARGB32_Premultiplied required a format conversion.
2021-08-10 14:21:48 +00:00
Manuel Stoeckl
9be3513348 platforms/wayland: Delay setup until first configure
As per the xdg-shell specification, the compositor can only attach
a wl_buffer to an xdg_surface once the compositor has sent an
xdg_surface.configure event. Previously, there was a race condition
in which WaylandOutput objects were added/enabled on creation, making
it possible for the EglWaylandOutputs to be set up and for
EglWaylandBackend to draw a frame (thereby attaching a buffer), all
before the xdg_surface.configure configure event was received.
Compositors other than kwin would then send an unconfigured buffer
error and close the connection.

This commit avoids the problem by not marking the WaylandBackend
ready for use until all the output surfaces constructed at startup
have received their initial configure event. (In practice, this
takes one additional roundtrip.)
2021-08-10 14:21:12 +00:00
Alexander Volkov
1bf901cfbf Use c++ version of True to make sure it will compile
kwin fails to build for me because of missing 'True'.
Besides, 'true' is used in other places.
2021-08-10 10:46:07 +00:00
Nicolas Fella
050b4945ce [kcms/decoration] Try loading decoration KCMs without plugin keyword
We're porting away from using plugin keywords (and have done that for
the breeze and oxygen decoration). However to allow that we need to
adjust the loading code.

Keep the old codepath for compatibility.

BUG: 440786
2021-08-10 10:14:24 +00:00
Fabian Vogt
11c7e7a64d scenes/opengl: Avoid blending for entirely opaque SurfaceItems
Blending is quite expensive especially with software rendering.
In the case of Firefox on Wayland, it uses a ARGB8888 buffer but marks the
entire surface as opaque, so the alpha channel can be ignored.

CCBUG: 440386
2021-08-09 06:52:12 +00:00
Xaver Hugl
1041ef8275 platforms/drm: introduce virtual outputs
When the last output gets disconnected, create a virtual output as a
placeholder until we have access to a physical output again. While
this placecholder never gets rendered to, with virtual outputs in
general that is possible (with gbm and qpainter atm) and can be done
for future use cases like wireless displays.

CCBUG: 420160
CCBUG: 438839
2021-08-07 17:18:40 +02:00
l10n daemon script
f7e2f5504a 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-07 01:15:04 +00:00
Vlad Zahorodnii
1dae29175f kwineffects: Fix potential image detaching
QImage is implicitly shared. However, methods such as QImage::bits() may
detach. In order to avoid the detach, one either needs make the image
const or use QImage::constBits() method.

Currently, the GLTexture class uses QImage::bits() all over the place.
It prevents implicit detaching by storing images in const variables. Such
code is fragile. Adding an intermediate (optional) conversion step may
result in odd performance regressions.
2021-08-06 07:20:54 +00:00
l10n daemon script
f4c0e19935 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-06 01:16:36 +00:00
Xaver Hugl
7879450cdf platforms/drm: work around tigerlake bug
CCBUG: 440361
2021-08-05 12:25:54 +00:00
Vlad Zahorodnii
e94fbcd853 Copy shape region to Deleted
Currently, the shape region is not copied to the Deleted. If either
SurfaceItemX11 or SurfaceItemXwayland needs to build quads for a shaped
window, it won't be able to do so properly because the corresponding
x11 window is long time gone.

If the shape region changes before the window is unmapped, you may still
see visual artifacts. Unfortunately, the only way to fix that bug is to
switch to wayland.

BUG: 440001
BUG: 438458
BUG: 435378
2021-08-05 06:03:11 +00:00
l10n daemon script
d47b27f9cd 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-05 01:15:06 +00:00
Alexander Lohnau
e34d8bbed6 Consistently name kpackage structures
This will allow kpackage to load the structures by their path.

Task: https://phabricator.kde.org/T14757
Conceptually the same direction as https://phabricator.kde.org/T14499.
2021-08-04 18:42:31 +00:00
Alexander Lohnau
9fe294776d Define new KPackageStructure property in kpackage structures
Task: https://phabricator.kde.org/T14563
2021-08-04 18:42:31 +00:00
Alexander Lohnau
370f0c0b22 Clean up unneeded service type definitions in kpackage structures
Task: https://phabricator.kde.org/T14483
2021-08-04 18:42:31 +00:00
Xaver Hugl
81136a0448 platforms/drm: drop unused methods 2021-08-04 15:06:43 +02:00
l10n daemon script
7db6ea0c15 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-04 01:15:43 +00:00
Aleix Pol
896880be96 Revert "Fix compile issue in https://bugs.kde.org/show_bug.cgi?id=440372"
https://invent.kde.org/plasma/kwin/-/merge_requests/1220

This reverts commit 44ad9437c4 because it
breaks build:
platforms/x11/common/eglonxbackend.cpp:224:66: error: cannot initialize a parameter of type 'EGLNativeWindowType' (aka 'unsigned long') with an rvalue of type 'xcb_window_t *' (aka 'unsigned int *')
        surface = eglCreateWindowSurface(eglDisplay(), config(), &window, nullptr);
                                                                 ^~~~~~~
2021-08-03 18:09:04 +02:00
nerdopolis turfwalker
44ad9437c4 Fix compile issue in https://bugs.kde.org/show_bug.cgi?id=440372 2021-08-03 08:28:04 -04:00
l10n daemon script
b90d92a8fb 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-03 01:15:25 +00:00
Andrey Butirsky
998bbf4eba fix wrong cursor hotspot under Wayland on VMs 2021-08-02 09:03:07 +00:00
David Edmundson
47e38b7141 Disconnect frame renders when ThumbnailItem has no window
It is perfectly valid to have a case where an item exists but has no
window. During these times the item will never be rendered.

Rather than guard in updateOffscreenTexture, it's more economical to
disable the frame rendering in the first place. Especially as then it's
easy to extend to item visibility.

BUG: 440318
2021-08-02 08:43:27 +00:00
l10n daemon script
cf9c60a0c0 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-02 01:12:21 +00:00
Xaver Hugl
2e473a21fb platforms/drm: small logging improvements 2021-08-01 23:26:49 +02:00
l10n daemon script
d2aac8cb05 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-01 01:21:11 +00:00
David Redondo
3b9ffdfbf6 Revert "Do not pass input to windows that are not painted"
This reverts commit 09f786a209.
2021-07-30 17:08:48 +02:00
David Redondo
09f786a209 Do not pass input to windows that are not painted
Passing input to windows that we do not paint is confusing as what happens
is different from what is visible on the screen.
2021-07-30 16:22:37 +02:00
l10n daemon script
141f627413 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-07-30 01:11:30 +00:00
l10n daemon script
ac438d6bb3 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-07-29 01:15:05 +00:00
Aleix Pol
475993db70 kscreen effect: Work per screen
Makes it possible to apply the dpms settings per screen instead of
applying it to all of them, which is wrong at many levels.
Will be even more important with other effects like rotation.
2021-07-28 10:57:27 +00:00
Alex Richardson
ed57ac39e2 Convert the KPackage plugin metadata to .json 2021-07-28 11:09:38 +01:00
Nate Graham
9f00c29c67 [kcmkwin/kwinrules] Port OverlaySheet headers to use title: property
This was added to Kirigami in
https://invent.kde.org/frameworks/kirigami/-/merge_requests/314
and simplifies and standardizes the creation of simple text-based
headers in OverlaySheet. This commit ports the KWin Rules KCM to
use it.
2021-07-27 15:17:41 -06:00
David Edmundson
beedf2be71 Fix minor typo 2021-07-27 13:20:24 +01:00
David Edmundson
0c6a8e7b88 Avoid setting crash count to 0 when restarted
If kwin is explicitly restarted (kwin_wayland --replace) we reset the
crash count so that you can run it more than 10 times without exiting to
the logout screen.

Resetting to 0 causes a issue as that triggers ksplash to be shown
again.

BUG: 434489
2021-07-27 12:18:29 +00:00
David Edmundson
ec9c2c3e68 Port kwin_wayland_wrapper to Qt/C++
We inintially created the wrapper to be light so avoided the QtCore
dependency and did it all in C.

In hindsight changing requirements means we want to add several more
features in here. The first step is to port to a more readable language
and toolkit.
2021-07-27 12:18:29 +00:00
l10n daemon script
5317ca9da0 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-07-27 01:25:25 +00:00
Vlad Zahorodnii
ca301d1914 Drop Scene::ImageFilterType
It's unused, GL_LINEAR filter is used by default now.
2021-07-26 14:56:21 +00:00
Vlad Zahorodnii
cb219da766 Remove screenGeometryChanged() in OpenGLBackend and QPainterBackend
The screenGeometryChanged() function is very X11-specific. On Wayland,
it's effectively unused.
2021-07-26 14:55:54 +00:00
Vlad Zahorodnii
4ecb00889c scene: Move overlay window resizing to backends
The concept of an overlay window is not universal, it's X11 specific.
2021-07-26 14:55:54 +00:00
Vlad Zahorodnii
e171555f2d Remove stray friend class 2021-07-26 16:25:02 +03:00
David Redondo
d84198f3b8 Set component display name for touchpad and keyboard shortcuts
Otherwise they appear as "KWin" in the settings when we want them
to be "Touchpad" and "Keyboard Layout Switcher".
BUG:440259
FIXED-IN:5.23
2021-07-26 10:37:48 +02:00
Vlad Zahorodnii
d4c7486fe1 Remove Q_UNUSED
damage is used.
2021-07-26 08:40:41 +03:00
Vlad Zahorodnii
3ab2ea40c4 Remove mask arg in Scene::paintScreen()
Render backends don't pass anything to the scene.
2021-07-25 09:59:04 +03:00
Vlad Zahorodnii
d2b6d7ee59 platforms/wayland: Add support for buffer age in qpainter backend 2021-07-25 09:59:04 +03:00
Vlad Zahorodnii
1cbf232b98 platforms/wayland: Report correct damage to host compositor
damageHistory.first() is the previous damage region, we need to report
the current instead.
2021-07-25 09:59:04 +03:00
Vlad Zahorodnii
e087b2ce2f platforms/drm: Add buffer age support in qpainter backend
Currently, the entire screen will be repainted when using the qpainter
render backend. With this change, kwin will repaint only the dirty parts
on the screen.
2021-07-25 09:59:00 +03:00
Vlad Zahorodnii
603db353a3 scenes/qpainter: Avoid setting brush in paintBackground()
Calling QPainter::setBrush() without saving the current state, produces
mysterious black rectangles around clip region rects.
2021-07-24 16:32:16 +03:00
Vlad Zahorodnii
501298b0e0 Introduce DamageJournal helper 2021-07-24 16:32:13 +03:00
Vlad Zahorodnii
2fe102768a Remove QPainterBackend::needsFullRepaint()
A better alternative is to return the damage region in the beginFrame()
function. This way, the render backend can force full screen repaints or
indicate what parts of the buffer needs to be repainted (for buffer age)
2021-07-24 14:54:17 +03:00
Vlad Zahorodnii
4abbb6f0d6 Make OpenGLBackend and QPainterBackend QObjects
Almost all their subclasses are QObjects. This simplifies the class
hierarchy by making OpenGLBackend and QPainterBackend qobjects.
2021-07-24 11:30:13 +03:00
Vlad Zahorodnii
d543c0dff6 Remove unused mask param in QPainterBackend::endFrame()
It is unused and it is not a good idea to pass Scene's mask to the
render backend as it results in higher coupling between Platform and
Scene.
2021-07-23 20:42:59 +00:00
Nicolas Fella
a317a3f6bc Remove unused include 2021-07-23 19:51:11 +02:00
Vlad Zahorodnii
85654236d7 Fix build 2021-07-23 18:45:54 +03:00
Vlad Zahorodnii
964c487d4f wayland: Switch to ClientBuffer
The main motivation behind the split is to simplify client buffer code
and allow adding new features easier, for example referencing the shm
pool when a shm buffer is destroyed, or monitoring for readable linux
dmabuf file descriptors, etc.

Also, a referenced ClientBuffer cannot be destroyed, unlike the old
BufferInterface.
2021-07-23 15:33:38 +00:00
Andrey Butirsky
95e954da30 [tabbox] prevent dangling popups when switching on Wayland
If some popups of active window present, there was glitches on switching
such as stale popups or the popup happened below window.
Dismissing all the popups solves the problem.

BUG: 431046
2021-07-23 12:12:03 +00:00
Andrey Butirsky
b45f5c3a66 fix No globalshortcuts with popup grab
BUG: 431046
2021-07-23 12:12:03 +00:00
Nicolas Fella
25b85607d0 Port from KPluginLoader::pluginsById to KPluginMetaData::pluginById
The latter gives us only a single plugin which makes the code a bit more concise
2021-07-22 22:59:13 +02:00
Aleix Pol
05f3939cf1 inputmethod: Use the command as the availability metric 2021-07-22 20:12:54 +02:00
Aleix Pol
278da74eab inputmethod: Add a property to tell whether an input method is running 2021-07-22 17:42:53 +02:00
Vlad Zahorodnii
f431b6ad96 wayland: Cache last surface-to-buffer matrix
If window quads need to be generated after the wl_surface is destroyed,
the SurfaceItemWayland::mapToBuffer() function will return wrong values.

In order to fix that, we need to store the last surface-to-buffer matrix
in SurfaceItem.
2021-07-22 06:26:00 +00:00
l10n daemon script
068c1d4970 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-07-22 01:15:50 +00:00
Nicolas Fella
2faff3b1d0 [kcms/kwinoption] Remove obsolete desktop files and factory registrations
These appear to be remnants from a time where the current tabs were individual KCMs.

Remove some unneeded stuff and convert the only relevant registration to the normal K_PLUGIN_FACTORY macro
2021-07-21 19:42:45 +00:00
Nicolas Fella
cff33e7e40 [GenericScriptedConfig] Remove unused parameter
The passed value is always the same and never used
2021-07-21 19:42:15 +00:00
Nicolas Fella
55c6de1790 [kcms/effects] Remove unneeded X-KDE-PluginKeyword 2021-07-21 21:15:26 +02:00
Nicolas Fella
2f9adf4715 [effectsmodel] Simplify generic config plugin loading
We know exactly which plugin we want to load

No need to go through findPlugins()
2021-07-21 16:10:19 +02:00
Aleix Pol
422522d15b inputmethod: Also expose the visibility on dbus
Since we adapted inputmethod to support methods like ibus, the input
method can be active but not have a visible panel.
This includes an extra property that will indicate us if the panel is
visible at any time. This will allow us to properly render the virtual
keyboard hide button in Plasma Mobile (or wherever we need it).
2021-07-21 13:10:30 +02:00
Aleix Pol
abf22570c7 inputmethod: Reduce consecutive activation+deactivation+activation sequences
So far calling setActive(true) would issue a deactivation then another
activation. This sometimes makes maliit crash and we can achieve the
same result just by just issuing a reset.
2021-07-21 13:10:30 +02:00
Aleix Pol
638174ae09 inputmethod: Make sure the menu is only created when we create the SNI
It always does the same anyway, this way we make sure we don't leak
2021-07-21 13:10:30 +02:00
Aleix Pol
0169bca6e0 inputmethod sni: return early for readability 2021-07-21 13:10:29 +02:00
Michal Malý
d2ceea83b7 (Wayland) Allow moving windows from one virtual desktop to another with a single action 2021-07-21 10:43:58 +00:00
Vlad Zahorodnii
b344afd8cd wayland: Fix glitchy steam during interactive resize
Xwayland windows have two geometry types that are used during rendering
- wl_surface's geometry and x11 window's geometry. Unfortunately, it's
not possible just ignore the x11 window geometry because the window may
have a custom shape region. Pixels outside the shape region can have
arbitrary values; it's not guaranteed that the area outside the shape
region will be transparent.

In some cases, the x11 window geometry can be larger than the wl_surface
rect. That breaks repaint logic as the SurfaceItemXwayland can draw
outside the bounding rect.

Specifically, this issue can be seen while resizing Steam interactively.
Another example is where a video game enters fullscreen mode. I
occasionally see that Red Dead Redemption II window leaves a ghost after
itself when it switches to fullscreen mode.

It's not a perfect solution, but on the other hand, it doesn't look like
there's a better way to handle this due to the fact that there are two
conflicting geometry sources.
2021-07-20 05:33:53 +00:00
l10n daemon script
f14350e1bb 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-07-20 01:17:06 +00:00
Vlad Zahorodnii
d29954ae33 scripting: Make QTimer constructible
If a QObject is exposed to js using QJSEngine::newQMetaObject(), a new
instance of it can be made only with constructors exposed by Q_INVOKABLE

At the moment, QTimer's constructor is not Q_INVOKABLE, so code such as
`const timer = new QTimer()` will not work.

BUG: 439630
FIXED-IN: 5.22.4
2021-07-19 12:14:16 +03:00
Vlad Zahorodnii
73bfe648ef wayland: Notify Qt about activated/deactivated windows
Currently, internal windows are not marked as active. This breaks focus
logic in QtQuick.
2021-07-19 06:40:06 +00:00
Vlad Zahorodnii
a3e192837b wayland: Force decoration update
If the client had created an xdg-toplevel-decoration and has called the
set_mode() request with csd before the initial configure event is sent,
we still need to send an xdg-toplevel-decoration configure event with
csd mode.
2021-07-19 06:39:37 +00:00
Vlad Zahorodnii
9e5cb836a3 scripting: Provide hidpi window thumbnails 2021-07-16 17:11:46 +00:00
Xaver Hugl
97f8bfac5c platforms/drm: where necessary, disconnect CRTCs after VT switch 2021-07-16 17:19:26 +02:00
Xaver Hugl
f9f474d7e4 platforms/drm: fix property updating
A wrong index caused some properties to contain wrong values
2021-07-16 16:34:40 +02:00
Xaver Hugl
afcef2a6f8 platforms/drm: fix crash with secondary GPUs and buffer age
CCBUG: 433107
2021-07-15 11:42:57 +00:00
Vlad Zahorodnii
7863f3dc31 Add NOTIFY to toplevel x/y/width/height properties
Currently, when using Toplevel's x, y, width, and height properties in
qml, a bunch of warnings will be printed about missing NOTIFY.
2021-07-14 12:32:14 +03:00
Vlad Zahorodnii
64f7c03083 wayland: Emit geometryChanged signal if transform changes
If the output transform changes, the geometry may change as well;
otherwise qpa may not call QWindowSystemInterface::handleScreenGeometryChange()
with the corresponding platform screen.
2021-07-13 10:06:30 +00:00
Vlad Zahorodnii
adac3b8646 scripting: Guard against the case where a window is destroyed after changing visibility
If the visiblityChanged signal is emitted and then the window is
immediately destroyed, the slot will still be executed because the
connection has type of Qt::QueuedConnection.
2021-07-13 12:50:56 +03:00
Aleix Pol
23129c09ce SceneOpenGL2::paintCursor make sure the OpenGL context is current
Instead of painting right away when Cursors::currentCursorChanged is
emitted, mark as dirty and call again when paintCursor is called.

BUG: 439134
2021-07-12 13:15:29 +00:00
Xaver Hugl
2977ae8e37 platforms/drm: don't take the rotation property for granted
Should fix the crash on the pinephone
2021-07-12 14:28:38 +02:00
Xaver Hugl
3c28a78956 Fix build 2021-07-10 23:54:08 +02:00
Xaver Hugl
303132ae0f platforms/drm: update plane properties before updating outputs
Seems like some drivers change the properties in the time it takes to
initialize the scene
2021-07-10 21:18:37 +02:00
Xaver Hugl
b23dfd55ac platforms/drm: optimize cursor setting 2021-07-10 21:18:37 +02:00
Xaver Hugl
5ad0d18476 platforms/drm: update properties on VT switch and failing commits 2021-07-10 21:18:37 +02:00
Xaver Hugl
586efe94d4 platforms/drm: Introduce DrmPipeline
DrmPipeline is now what contains all the thing related to drm calls,
instead of DrmOutput. This allows for some more flexibility and tidies
the code up a bit. Additionally instead of rolling back changes if
presentation fails, changes are directly tested with atomic test only
commits.
2021-07-10 21:18:33 +02:00
Xaver Hugl
92726372f4 platforms/drm: simplify deleted output handling 2021-07-10 20:13:01 +02:00
Xaver Hugl
c89961a4e2 platforms/drm: save modelist in DrmConnector 2021-07-10 20:13:01 +02:00
Xaver Hugl
ee4b4fc9a3 platforms/drm: refactor presentation in gbm backend 2021-07-10 20:13:01 +02:00
Xaver Hugl
da71d218c8 platforms/drm: refactor the gbm surface 2021-07-10 20:13:01 +02:00
Xaver Hugl
4b5571163e inputmethod: save enabled state 2021-07-10 17:47:45 +00:00
Xaver Hugl
fe11219a0c improve gesture recognition
In order to not make misdetections with sub-pixel movements the gesture
recognizer completely ignored those. This fails however when you move
your fingers very slowly, so instead accumulate the delta and only use
it for direction detection if it's high enough.
2021-07-09 20:28:04 +00:00
Aleix Pol
eb62dbb9c5 Allow the KScreenEffect to work on Wayland
Makes it possible for wayland systems to show a dimming effect when a
display dpms is off.
2021-07-09 12:39:42 +02:00
Aleix Pol
1012adeaf7 Add support to DPMS to the Wayland Backend
Moves the DpmsInputEventFilter to libkwin, so that it can be used by
other backends other than DRM.
This mostly helps develop features around DPMS.
2021-07-09 02:41:26 +02:00
Xaver Hugl
caa8c8fd45 platforms/drm: always populate atomic req with connector props
If we don't then overscan and underscan are never applied
2021-07-08 16:14:25 +00:00
Xaver Hugl
4d8ae93f06 platforms/drm: fix underscan
The enums belong to "underscan", not to "underscan hborder".
The aspect ratio also needed correction
2021-07-08 16:14:25 +00:00
Vlad Zahorodnii
be6c33458f wayland: Allow placing sub-surfaces below their parent
According to the spec, if the wl_subsurface.place_below request is
called with the parent surface, the sub-surface must be placed below the
parent surface.

BUG: 438808
2021-07-08 06:55:38 +00:00
Vlad Zahorodnii
4ebe5d32b4 scene: Introduce z-property
This allows placing child items below their parent item by setting
negative Z values.
2021-07-08 06:55:38 +00:00
Vlad Zahorodnii
2a1f9f1646 wayland: Switch to SurfaceInterface::{below,above} 2021-07-08 06:55:38 +00:00
Xaver Hugl
a1847f77f1 platforms/drm: only show cursor on dpms on if not hidden
While always calling showCursor isn't a problem for when there's no
pointing device as the cursor image is empty in that case, it can
cause a temporarily stuck cursor image when it's supposed to be
hidden because of touch input
2021-07-07 21:05:49 +02:00
Xaver Hugl
925ff96401 platforms/drm: support underscan 2021-07-07 15:03:39 +02:00
David Redondo
5fe6de699c Handle when a xdg-toplevel changes its min or max size
We previously never emitted maximiziableChanged() meaning we never
synced the state to the decoration.
BUG:439578
2021-07-07 14:17:36 +02:00
David Edmundson
e35ed5088a [rules] Allow setting WindowType to KDE specific window type OSD
An example use case is allowing a user to write rules to put firefox
Picture in picture windows above fullscreen users

CCBUG: 439573
2021-07-07 10:32:29 +00:00
Vlad Zahorodnii
8b1e2fd50e kcmkwin/compositing: Remove Crisp scale method
The OpenGL backend now supports only smooth and accurate scale methods.
2021-07-06 12:34:59 +00:00
Vlad Zahorodnii
95adc883aa scenes/opengl: Use GL_LINEAR also on X11
We've been using GL_LINEAR on Wayland for a couple of years, and it has
caused us no issues. For the consistency sake, let's do the same on X11.
2021-07-06 12:34:59 +00:00
Andrey Butirsky
8da06a0bdb fix Meta key randomly stops opening Plasma launcher menu
BUG: 391322
2021-07-06 10:43:52 +00:00
Vlad Zahorodnii
1e1ad82f3b Remove unused geometry setters in Item
Originally, only x, y, width, and height property setters were used. A
bit later "position" and "size" helper setters were added to simplify
code in SurfaceItem sub-classes. It seems like setX(), setY(), setWidth(),
and setHeight() are unused now, so remove them.
2021-07-05 20:55:30 +03:00
Vlad Zahorodnii
db6b4c9c2e Update parent item's bounding rect explicitly
If the parent's bounding rect may change, call its update method
explicitly. This way the code is more readable as there is less
signal-slot magic.
2021-07-05 20:53:08 +03:00
Vlad Zahorodnii
fb276dbdd2 scene: Avoid discarding quads in more cases 2021-07-05 13:54:47 +00:00
Aleix Pol
0a1a4d362b tablet: Update the cursor as the surface changes
The tablet protocol offers us the cursor in a surface. This patch makes
sure we connect to the surface so that we can also refresh the
representation if the client submits a change.

BUG: 437777
2021-07-05 13:23:03 +00:00
Aleix Pol
d706d98e86 cursor: remove unused attribute 2021-07-05 13:23:03 +00:00
Vlad Zahorodnii
29ff0d30ad x11: Fix BadDamage warning
The XDamageDestroy has a weird requirement saying that it can be called
as long as the X11 window is still valid. On the other hand, one could
argue that it is more intuitive if the damage handle becomes inert if the
associated window is destroyed. Unfortunately, that's not the case and
as git history shows, it's an easy way to shoot yourself in the foot, we
had the exact warning many years ago.

The problem with the XDamageDestroy API is that it is simply unreliable
given the asynchronous nature of communication between kwin and xorg.

Anyway, with X11 sunsetting, let's destroy the damage handle only when
the X11 window is unmapped and not bother too much about it.
2021-07-05 13:22:07 +00:00
Erik Kurzinger
770875a76e platforms/drm: check wl_eglstream buffers before attaching
If a wl_eglstream buffer is attached to a surface, but then later a different
type of buffer, such as a dmabuf, is attached to the same surface, kwin will
mistakenly keep trying to acquire frames from the EGLStream associated with the
previous buffer. This can happen if an Xwayland window is made full-screen
causing it to switch to the flipping presentation path, for instance. The
result is that the window contents will no longer be updated.

Instead, the eglstream backend's loadTexture and updateTexture functions should
first pass the buffer to eglCreateStreamAttribNV. If it fails with
EGL_BAD_STREAM_KHR, that indicates it is indeed a wl_eglstream, and that we've
already associated a server-side EGLStream with it in attachStreamConsumer, so
we can proceed as usual. If it fails with EGL_BAD_ACCESS, though, that
indicates it is not a wl_eglstream and we should fall back to the parent class
which handles attaching other buffer types. If it doesn't fail at all, that
means the client tried to attach a new wl_eglstream to a surface without first
attaching the stream consumer. There's not really a great way to handle this,
so just re-use the previous EGLStream.
2021-07-05 11:13:24 +00:00
Vlad Zahorodnii
a1c6e2584a x11: Re-use Qt's EGLDisplay
This is to ensure that both kwin and Qt use the same EGLDisplay. Note
that the native context handle can have no display, however it's very
unlikely to happen.
2021-07-05 09:14:09 +00:00
Vlad Zahorodnii
9f6b5ea44f x11: Call eglGetPlatformDisplayEXT() without attrs
There are EGL implementations that will refuse to create a context if
the share context belongs to other EGLDisplay. Currently, that's the
case on some platforms.

If eglGetPlatformDisplayEXT() is called with the same parameters, it'll
return the same EGLDisplay. The main motivation behind this change is to
ensure that both kwin and Qt share the same EGLDisplay, QtXCB calls
eglGetPlatformDisplayEXT() without any additional args.

If EGL_PLATFORM_X11_SCREEN_EXT is not specified via attrs, the EGL
implementation will use the default screen, which is the same as
m_x11ScreenNumber.
2021-07-05 09:14:09 +00:00
Vlad Zahorodnii
12b14779ba x11: Gracefully handle failed compositing initialization
X11Platform includes NoCompositing in supported compositing types.
Therefore, Q_UNREACHABLE() cannot be used.
2021-07-05 11:53:26 +03:00
Vlad Zahorodnii
8b8669eece scene: Avoid discard quads when only position changes
Since the quads are in the item local coordinate space now, it is okay
not to discard cached quads if only the item position changes.
2021-07-04 16:12:33 +00:00
Vlad Zahorodnii
c6ffdf4f7f kwineffects: Remove WindowQuad::uvAxisSwapped
Since makeSubQuad() uses bilinear interpolation, the flag to indicate
whether UV-coordinates are swapped is redundant.
2021-07-04 16:12:06 +00:00
Aleix Pol
8386a8bb66 tablet+libinput: do not crash if there's a tablet event without a client
It triggers if you start with your pen on the tablet while starting
kwin.
2021-07-02 23:50:57 +02:00
Aleix Pol
c8a37ef27f tablet: use the right scope for the variable 2021-07-02 20:54:57 +02:00
Aleix Pol
df9978d6a1 tablet: no need to forward the cursorChanged signal
It's already emitted by updateCursor, so we were doing it twice.
2021-07-02 20:54:45 +02:00
Xaver Hugl
f54d7a2697 xdgshellclient: fix moveresize with touch and CSD
When moveresize is done with touch we need to use the current touch
point and not the mouse position.

BUG: 438283
CCBUG: 431489
2021-07-01 13:13:07 +00:00
Xaver Hugl
a4dcfbfb31 input: fix touch input getting borked on quick tile
The decorationPressId never gets reset as the decoration isn't below the
touch point anymore after the quick tile, so if we have no decoration
under the touch point reset the decorationPressId to -1.

CCBUG: 430560
2021-07-01 13:11:41 +00:00
David Edmundson
893f95eed8 Guard against null compositor in thumbnail item
If compositing is disabled, compositor will be null.

We hit a path where we could destroyOffscreenTexture when the
compositing is disabled then again when the Thumbnail is destroyed. In
this case we query Compositor::self()->scene() and crash.
2021-07-01 12:38:57 +01:00
l10n daemon script
f53cf9d71e 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-06-30 01:21:12 +00:00
David Redondo
b4150e3eb5 Fix build 2021-06-29 10:32:06 +02:00
Xaver Hugl
2ecce63d93 platforms/drm: don't crash if drmModeGetConnector fails
I don't think this is the cause of 439208, where it's likely only a
side effect of some other issue; should be guarded against anyways.

CCBUG: 439208
2021-06-28 20:13:36 +00:00
l10n daemon script
a333b87f74 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-06-28 01:30:05 +00:00
Xaver Hugl
6260c03548 platforms/drm: don't create modeset dumb buffer for import gpu
When the EglStreamBackend is used for the secondary GPU we don't need
the modesetting dumb buffer.
2021-06-25 10:08:36 +00:00
Emilio Cobos Álvarez
14b70e5e77 wayland: Set cursor surface outputs. 2021-06-25 08:58:28 +00:00
Xaver Hugl
7e96f09670 platforms/drm: use correct size for soft rotation 2021-06-25 00:46:32 +02:00
Vlad Zahorodnii
3427143017 Improve thumbnail item integration
Currently, thumbnail items are rendered by kwin. This means that qtquick
code cannot do things such as applying shader effects to window thumbnails
or simply draw custom controls on top of thumbnails.

With this change, task switchers and qml extensions will be able to
place their own contents on top of thumbnails and apply custom effects
to them.

In order to integrate window thumbnails, a window is rendered on kwin
side using its own opengl context. A fence is inserted in the command
stream to ensure that the qtquick machinery doesn't start using the
offscreen texture while there are still rendering commands being executed.

Thumbnails are rendered into offscreen textures as we don't have full
control over when qtquick windows render their contents and to work around
the fact that things such as VAOs can't be shared across OpenGL contexts.

WindowThumbnailItem and DesktopThumbnailItem act as texture providers.
2021-06-23 17:46:05 +03:00
Vlad Zahorodnii
172c541cad x11: Use global share context
This is needed to share window thumbnails between kwin's scene graph and
qtquick.
2021-06-23 17:45:48 +03:00
Vlad Zahorodnii
8ed364337b scenes/opengl: Allow setting external global share context
This is needed to initialize global share context on X11.
2021-06-23 17:45:48 +03:00
Vlad Zahorodnii
fac33750f9 effects: Remove shape property
It's unused and the advantages of keeping it are outweighed by the
disadvantages - the returned value is dependant on the window type.

If you need to draw a drop-shadow that matches the shape of the window
or something along that line, render the window into an offscreen
texture and sample the alpha channel in a fragment shader.
2021-06-23 11:21:51 +00:00
Xaver Hugl
80a7362efc platforms/drm: refactor post processing bits
Putting the OpenGL post processing rotation into its own class cleans
the EglGbmBackend code up a bit and adds post processing rotation for
the EglStreamBackend
2021-06-22 16:35:42 +00:00
Vlad Zahorodnii
b482226d6c wayland: Implement activities window rule
BUG: 439022
2021-06-22 13:48:05 +00:00
Vlad Zahorodnii
4206d8bd9c Remove unused include 2021-06-22 11:45:44 +03:00
Vlad Zahorodnii
da169ee2d9 Replace QRegExp usages with QRegularExpression
QRegExp is deprecated in favor QRegularExpression. It's potentially an
api breaking change as QRegularExpression has a different pattern syntax.
2021-06-22 08:35:10 +00:00
Vlad Zahorodnii
c61085dc2e Remove Toplevel::compositing() and Workspace::compositing()
It is error-prone to have multiple sources for the same data. If the
base implementation (Compositor::compositing()) changes, other helpers
can get out of sync.
2021-06-22 08:32:35 +00:00
Vlad Zahorodnii
ae70b17c79 Set compositor On status before setupCompositing()
This is needed to ensure that Compositor::compositing() returns true
when Toplevel::setupCompositing() is called.
2021-06-22 08:32:35 +00:00
Vlad Zahorodnii
d74e81bdd0 x11: Properly detect compositing status
When finishing compositing, Workspace::compositing() will return true,
but it will be preferred if it returns false instead so kwin can properly
update x11 window visibility status, etc.

Instead of checking whether the compositor has a scene, check the status
of the compositor. It will not be "On" during teardown.
2021-06-22 08:32:35 +00:00
Vlad Zahorodnii
10769548db kwineffects: Allow creating GLTexture without allocated storage
This allows creating a GLTexture object and attaching a dmabuf to it.
Currently, we can do that by using the foreign GLTexture constructor,
but it makes the deletion of the texture handle more error prone.

In the future, we can add a method that allocates the texture storage,
but there's no need for that yet.
2021-06-22 08:25:50 +00:00
Vlad Zahorodnii
2b8453abb8 platforms/x11: Port away from GLTexture::discard()
Currently, if discard() is called, kwin will crash because
EglPixmapTexture does not override the discard method.

In principle, neither GlxPixmapTexture nor EglPixmapTexture should mess
around with internals of the GLTexture class. It is better to have a
wrapper texture with a bind method, which will re-bind the pixmap to the
opengl texture if necessary.
2021-06-22 08:25:50 +00:00
Vlad Zahorodnii
3b8b87a663 scenes/opengl: Update unstyled EffectFrame texture only when rendering
When the EffectFrame is created, there may not be any opengl context
current.
2021-06-22 09:58:31 +03:00
Vlad Zahorodnii
19699e9a26 scene: Store cached quads using std::optional
This way, the code is slightly more readable.
2021-06-21 16:32:55 +00:00
Xaver Hugl
9194c0c974 platforms/drm: some improvements for logging 2021-06-21 17:57:36 +02:00
Xaver Hugl
7552b53066 partially revert 2742e5b422
It seems like without a surface creation of the scene fails somehow. At
least until the exact problem is solved, update outputs for EglStream
gpus before creating the EglStreamBackend.

BUG: 438363
2021-06-21 14:49:44 +02:00
Xaver Hugl
0f6495f4b2 XdgSurfaceClient: set to current activity and desktop in constructors
BUG: 435745
FIXED-IN: 5.22.2
2021-06-20 20:37:29 +02:00
Xaver Hugl
0223136712 platforms/drm: fix mistake in DrmGbmBuffer
When gbm_bo_get_handle_for_plane isn't supported or doesn't work we'd be
passing the buffer format as its handle to drmModeAddFB(2).
2021-06-20 18:47:10 +02:00
Alexander Lohnau
e170c3be7d
Use K_PLUGIN_CLASS_WITH_JSON instead of K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON
Task: https://phabricator.kde.org/T14542
2021-06-19 07:12:52 +02:00
Xaver Hugl
b33fef02f5 platforms/drm: show cursor when exiting dpms
BUG: 438824
2021-06-18 14:10:22 +00:00
Nate Graham
c9a719e109 [effects] Use standard arrow cursor in Present Windows & Desktop Grid
The pointing finger cursor is used to show that a piece of text is a
clickable link, and it is inappropriate to use it in other contexts.
Regular UI elements that do something when single-clicked continue to
use the standard arrow cursor in other contexts, so let's follow that
convention in the Present Windows and Desktop Grid effects too.

BUG: 421928
FIXED-IN: 5.23
2021-06-18 12:58:40 +00:00
Felipe Kinoshita
ca3609eb4d [kcmkwin/kwincompositiong] Remove not so useful separators lines
This commit removes the separators lines below "scale method" and
"rendering backend", options here shouldn't be separated since they
are all related to eachother.
2021-06-18 10:40:23 +00:00
Nate Graham
bbf9c54dd8 [kcmkwin/kwineffects] Collapse list item when clicking on it again
Currently, each effect's list items expands when you click on any
non-interactive part of it, but it does not collapse when you click on
it again.

With this commit, now it does.

BUG: 421883
FIXED-IN: 5.23
2021-06-18 10:17:47 +00:00
Aleix Pol
56915dc113 xdgactivation: do not tell effects about unknown applications
Makes for an odd decoration.
We generally will not have an app_id in the cases where we are creating
a token just in case it's necessary down the line.
2021-06-18 00:11:56 +00:00
Aleix Pol
81f7436fda xdgactivation: Let activation requests through when they come from a window manager
If a client already has powers to move clients around, let them also
activate using the right protocols as well.

This is useful to be able to implement SNI or Notifications where the
shell doesn't get full surface activation when interacting with it.
2021-06-18 00:11:56 +00:00
l10n daemon script
2f3a425c5e 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-06-16 01:24:38 +00:00
Nate Graham
77affd3259 [kcmkwin/kwindesktop] Drop local back for Formlayout label width
This hack was added in the past to prevent the combobox from being
pushed out of view when the label next to it was very long, as it can be
in certain languages. However it had the effect of making the label get
elided in *all* languages, and also the issue it was working around is
no longer present; even with very long text, the combobox no longer gets
pushed out of view, and instead the formlayout first switches to mobile
view and then elides the Label, exactly as intended. So we can safely
remove the hack.

BUG: 438504
FIXED-IN: 5.22.2
2021-06-15 17:27:14 -06:00
Xaver Hugl
250169ff84 platforms/drm: make context current without outputs in eglstream 2021-06-15 23:21:08 +02:00
Vlad Zahorodnii
61159d943c effects: Fix interpolated values for redirected animations
If a redirected animation reaches the end, the timeline value will be 0,
i.e. the interpolated() function has to return the from value, not `to`.

BUG: 438368
2021-06-15 08:46:58 +03:00
Vlad Zahorodnii
2ab70d0674 scenes/opengl: Clean up includes 2021-06-14 16:19:48 +03:00
Vlad Zahorodnii
1c94e1bfc4 scenes/opengl: Move out X11 explicit sync
This moves X11 specific code to a better place, which allows us make
item rendering code less platform specific and easier to change.
2021-06-14 13:14:54 +00:00
Vlad Zahorodnii
047c1a91f2 Properly destroy Compositor during teardown
When the aboutToDestroy signal is emitted, the compositor object is
already partially destroyed. This contradicts to the name of the signal.

In addition to that, it will be better to call the stop method in the
destructors of X11Compositor and WaylandClient as it allows them to add
custom cleanup code when compositing is turned off.
2021-06-14 13:14:54 +00:00
Vlad Zahorodnii
38f6494b2c scene/opengl: Remove unused includes 2021-06-14 12:20:37 +03:00
Vlad Zahorodnii
f9cf0baead kwineffects: Allocate hidpi textures in DeformEffect
If a window is animated using DeformEffect, allocate an offscreen
texture with the scale factor of the screen where the window is
considered to be on.

Also, resize the offscreen texture on demand in order to make resource
handling more efficient.
2021-06-14 09:02:44 +00:00
Vlad Zahorodnii
4af9d6c234 kwineffects: Remove unused WindowVertex and WindowQuad props
Since window quads are no longer passed in prePaintWindow(), we don't
need to track original vertex coords. This results in smaller memory
footprint.
2021-06-14 07:56:02 +00:00
Vlad Zahorodnii
5339b1a9d7 scene: Move item preprocessing to scene
We no longer use window pixmaps to get the shape and the opaque regions,
so preprocess() can be called now only if we are about to paint the item.
2021-06-14 07:56:02 +00:00
Vlad Zahorodnii
49744cfc53 scene: Improve window quad management
At the moment, we handle window quads inefficiently. Window quads from
all items are merged into a single list just to be broken up again.

This change removes window quads from libkwineffects. This allows us to
handle window quads efficiently. Furthermore, we could optimize methods
such as WindowVertex::left() and so on. KWin spends reasonable amount
of time in those methods when many windows have to be composited.

It's a necessary prerequisite for making wl_surface painting code role
agnostic.
2021-06-14 07:56:02 +00:00
Vlad Zahorodnii
a6268595fb scene: Generate quads in item local coordinate space
Window quads need to be in some coordinate space. Since we want items to
be used not only for rendering windows, window-local coordinates do not
suffice.

This change makes scene items generate quads in the item-local coordinate
space.

The model matrix is used to map the quads to the global screen coordinate
system from the item coordinate space.

Since the quads are in the item local coordinate space, the mvp matrix
needs to be updated on every draw call. Given the render data, tracking
the last mvp matrix won't result in less glUniform calls. If this indeed
becomes a serious performance bottleneck, we can explore the possibility
of dumping mvp matrices in a UBO, which have been introduced in OpenGL
3.1.
2021-06-14 07:56:02 +00:00
Vlad Zahorodnii
29cc319455 kwineffects: Remove WindowQuadType
The window quad type has become irrelevant.
2021-06-14 07:56:02 +00:00
l10n daemon script
3ed363c498 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-06-14 01:16:13 +00:00
l10n daemon script
943bdc0e64 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-06-13 01:21:07 +00:00
Vlad Zahorodnii
86bb4e68ef Refactor window quad handling
The scene items depend on the scene windows for caching window quads.
The goal of this change is to move window quads management to item.

Merging window quads in one list and then splitting them is inefficient,
it will be highly desirable if window quads are removed from the public
api so we can optimize window quad management.

With this change, the window quad type becomes irrelevant to render
backends for the most part. Note that the Xrender backend is a bit
nitpicky about window quads, so the shadow item doesn't create generic
"WindowQuadShadow" quads anymore.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
d109e7d69b Introduce Item visible property
This property can be used to control the visibility of an item and its
child subtree.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
a106a5aab8 Move AbstractClient::isShade() to Toplevel
This simplifies rendering code and allows to cache properly the shaded
state for Deleted windows.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
de122825fd scenes/qpainter: Remove support for drop-shadows
Drop-shadows with the software render backend impact performance quite
significantly. It also makes it easier to prepare render backends for the
item based design.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
30d0dbbaf0 Remove EffectsHandler::buildQuads()
It's currently unused and it doesn't fit the item based scene design.
2021-06-11 06:03:08 +00:00
Vlad Zahorodnii
a9e4d6d1f7 x11: Initialize m_target of EGL platform surface texture
We need to initialize m_target; otherwise the surface texture won't be
bound to GL_TARGET_2D.
2021-06-11 06:01:00 +00:00
Ismael Asensio
40d708f9c5 kcm/kwinrules: Adapt spinbox width to actual text
Use FontMetrics to calculate the expected max text width so it
doesn't overflow with wider fonts, specially in some languages
like pt_BR

BUG: 438193
FIXED-IN: 5.22.1
2021-06-10 23:16:31 +02:00
Ömer Fadıl Usta
dc73d622c0 Guard gbm and eglstreams parts for non-gbm or non-eglstreams systems 2021-06-10 20:10:14 +00:00
David Edmundson
bc6eba6114 [xwl] Create a new datasource on offer changes
Offers shoul be set on a source before data_device.set_selection. Doing
so afterwards appears to be against the spec and as such we may not pass
the update to wayland clients / klipper.
2021-06-10 17:18:50 +00:00
Vlad Zahorodnii
f280423b92 kwineffects: Remove PaintClipper
PaintClipper worked only with the XRender backend, which is gone now.
2021-06-10 15:58:33 +00:00
Vlad Zahorodnii
3ae400772b kwineffects: Remove dead code
AnimationEffect sets the clip region to clip windows, so this code can
be safely removed.
2021-06-10 15:58:05 +00:00
Xaver Hugl
40c485f2a6 platforms/drm: fix EglStreamBackend init
BUG: 438363
2021-06-10 13:06:43 +00:00
Xaver Hugl
3d6659b0d7 platforms/drm: on NVidia do pageflips with QPainter
Otherwise it's just gonna display a static black screen

CCBUG: 438363
2021-06-10 11:19:07 +00:00
Aleix Pol
a24e92d0b7 blur: Use a custom projection matrix when passing to copy sample
The screen projection matrix doesn't necessarily apply to that
framebuffer, so we can't use it.
2021-06-10 10:06:35 +02:00
Aleix Pol
fffd41b32e Only create the viewport as needed
So far, we were creating a model view with the complete scene rendered
(even if we didn't render the windows themselves). This required us to
have a big glPerspective spanning the entire scene and we were just
cropping it as we rendered it into a smaller texture.

This changes our scenes so we have the correct matrix set up at all
times.

Specifically in the case of the Pinephone, this solves the following
issue where we were unable to connect external displays because it
exceeded GL_MAX_VIEWPORT_DIMS:
https://invent.kde.org/teams/plasma-mobile/issues/-/issues/11
2021-06-10 10:06:35 +02:00
Aleix Pol
bec50eaec0 deform effect: Use the provided matrix instead of creating a new one 2021-06-10 10:06:35 +02:00
Aleix Pol
059b78337f Add Q_ENUM to enum classes 2021-06-10 10:06:35 +02:00
Aleix Pol
09f99df1a3 inputmethod: Be more assertive towards the input panel visibility
If a new input client has taken over, don't override the trackedClient's
geometry.
Only consider the input geometry of a visible keyboard.
2021-06-10 03:33:36 +00:00
Aleix Pol
6fa96852dc inputmethod: Reconsider what a hidden input method is
When the panel disappears, just reconsider the panel's state but don't
just stop sending updates to the input method.
Some input methods are just helpers that show and hide as necessary.
2021-06-10 03:33:36 +00:00
Nate Graham
66661a9ddc [kcmkwin/kwindecoration] Re-phrase awkward message
BUG: 438189
FIXED-IN: 5.23
2021-06-09 14:22:09 -06:00
Vlad Zahorodnii
a06690021d Remove OpenGL2Compositing enum
OpenGLCompositing and OpenGL2Compositing enums mean de-facto the same
thing, it's confusing to have them both.
2021-06-09 15:24:22 +00:00
Nicolas Fella
1e36e79fa3 Remove unused KIO dependency 2021-06-09 16:18:41 +02:00
Marco Martin
ada29cfc9a don't place windows with invalid geometry
if a window has a size of 0x0, doesn't have its final place yet, so it can't be reliably
placed centered yet
2021-06-09 12:42:12 +00:00
Vlad Zahorodnii
811beb94e0 Remove Xrender backend
The Xrender backend was added at the time when OpenGL drivers were not
particularly stable. Nowadays though, it's a totally different situation.

The OpenGL render backend has been the default one for many years. It's
quite stable, and it allows implementing many advanced features that
other render backends don't.

Many features are not tested with it during the development cycle; the
only time when it is noticed is when changes in other parts of kwin break
the build in the xrender backend. Effectively, the xrender backend is
unmaintained nowadays.

Given that the xrender backend is effectively unmaintained and our focus
being shifted towards wayland, this change drops the xrender backend in
favor of the opengl backend.

Besides being de-facto unmaintained, another issue is that QtQuick does
not support and most likely will never support the Xrender API. This
poses a problem as we want thumbnail items to be natively integrated in
the qtquick scene graph.
2021-06-09 11:21:57 +03:00
Vlad Zahorodnii
3c2ca184e3 effects: Remove Desktop Cube Animation effect
With the ongoing scene redesign, it needs to be rewritten. However,
given that it is not used widely based on support information from
various bug reports and our available man power is sparse, the most
reasonable thing is to drop the effect, unfortunately.
2021-06-09 08:21:27 +00:00
Vlad Zahorodnii
47ef0b5a3c effects: Remove Desktop Cube effect
With the ongoing scene redesign, it needs to be rewritten. However,
given that it is not used widely based on support information from
various bug reports and our available man power is sparse, the most
reasonable thing is to drop the effect, unfortunately.
2021-06-09 08:21:27 +00:00
Vlad Zahorodnii
3722c21660 effects: Remove Cover Switch effect
With the ongoing scene redesign, it needs to be rewritten. However,
given that it is not used widely based on support information from
various bug reports and our available man power is sparse, the most
reasonable thing is to drop the effect, unfortunately.
2021-06-09 08:21:27 +00:00
Vlad Zahorodnii
bcff948e39 effects: Remove Flip Switch effect
With the ongoing scene redesign, it needs to be rewritten. However,
given that it is not used widely based on support information from
various bug reports and our available man power is sparse, the most
reasonable thing is to drop the effect, unfortunately.
2021-06-09 08:21:27 +00:00
Xaver Hugl
4ee3f69dd5 platforms/drm: only allocate two dumb buffers for the swapchain 2021-06-08 21:11:39 +02:00
Vlad Zahorodnii
35e37f7347 Fix loading of window rules
We need to call KCoreConfigSkeleton::load() otherwise window rule
objects will not be created.
2021-06-08 15:58:48 +00:00
Vlad Zahorodnii
5929147ee1 Remove unused include 2021-06-08 15:58:21 +00:00
Xaver Hugl
19f92d731a platforms/drm: fix modifiers detection
CCBUG: 437893
2021-06-08 16:38:52 +02:00
Andrey Butirsky
471d635f0c [tabbox] fix non-working global shortcuts overrides
static cuts[] array was initialized only once with copies of non-const
objects, so when new shortcuts are configured, the old objects were still
referenced.
Fixed by having non-static array instead, so actual objects are copied
on the init every time.

BUG: 359141
2021-06-08 11:50:02 +00:00
Vlad Zahorodnii
52eabd064d Remove unused define preprocessor directive
IN_KWIN is unused.
2021-06-08 11:43:46 +00:00
Vlad Zahorodnii
9d1db97f05 Make kwin friendlier for static code analysis tools
Some static code analysis tools break when analysing kwinbindings.cpp.

This change moves the contents of kwinbindings.cpp file in useractions.cpp
to make those tools happier. It also makes code more readable.
2021-06-08 11:43:46 +00:00
Vlad Zahorodnii
1b2c7b248b Run clazy with qt-keywords fixit
In C++20, there will be emit() class member, which can conflict with the
emit keyword. Given that, there are plans to enable QT_NO_KEYWORDS by
default in the future.

See also
https://lists.qt-project.org/pipermail/development/2020-February/038812.html
2021-06-08 10:49:42 +03:00
Ismael Asensio
b5a58f83ee kcm/kwinrules: Manage RuleSettings instead of Rules objects
The KCM now manages the RuleSettings config objects directly,
instead of using a list of `Rules` objects as an intermediary.

This highly reduces the overhead, improving loading and saving
times, and also enables a better use of KConfig capabilites.

The config state is now automatically tracked by KConfigXT
objects. Whenever the user edits either the rule list, or any
specific property within a rule, the `needsSave` state is
updated accordingly.

BUG: 421564
FIXED-IN: 5.23
2021-06-07 21:03:29 +02:00
Ismael Asensio
61c2055da7 rulebooksettings: Add accesors to the rules settings list
Previously, the only way to access the rules list was via
the `rules()` and `setRules()` methods, so the actual
settings objects were not accesible.

This commit adds methods to retrieve, insert, remove or reorder
the rules within the list.

Since every individual rule is stored as a KConfig group, and
they are not designed to be dynamically renamed, using consecutive
numbered groups and store only the total count is problematic.

So we also add a new stringlist setting to store the rules group
names and their order.

Now any group name is valid. To avoid collisions use random QUuids
as group names for newly created rules.
2021-06-07 21:03:29 +02:00
Vlad Zahorodnii
d4f75f3e64 scripting: Add clientArea() overload that takes mutable client
Even though there is a clientArea() overload that takes const abstract
clients, QJSEngine seems to be unable to find the right clientArea()
overload if a mutable abstract client has been passed.

BUG: 437507
2021-06-07 18:08:30 +00:00
Alexander Lohnau
9c689d7ddb plugins: Port away from deprecated version checks
Task: https://phabricator.kde.org/T14302
2021-06-07 15:01:19 +00:00
Xaver Hugl
3c10398104 screencast: only use glGetTextureImage where supported 2021-06-07 14:11:07 +02:00
Xaver Hugl
0208f78336 platforms/drm: make context current for direct scanout 2021-06-07 13:45:50 +02:00
Xaver Hugl
cfd7af0179 platforms/drm: support NVidia as secondary GPU with CPU copy
BUG: 431062
2021-06-07 09:23:06 +02:00
Vlad Zahorodnii
605f00d03a effects/backgroundcontrast: Properly handle empty regions set by internal windows 2021-06-07 06:03:19 +00:00
Vlad Zahorodnii
cade5064c3 effects/blur: Properly handle empty blur regions set by internal windows
The task switcher has a valid empty blur region and the blur effect
misdetects that, which results in no blurred background.

BUG: 433131
2021-06-07 06:03:19 +00:00
Aleix Pol
34bfc25759 inputmethod: Don't move the clients around when the input panel is an overlay
It's meant to be floating around the cursor, if we do this we just get a
weird tiny screen.
2021-06-05 23:33:32 +00:00
Ömer Fadıl Usta
8fc3b024be Update dumb_swapchain.cpp 2021-06-05 04:59:02 +00:00
Vlad Zahorodnii
8c8098a61c Move X11Client::wantsShadowToBeRendered to AbstractClient
Otherwise only X11 windows will lose server-side drop-shadows when the
maximized mode changes.

BUG: 434213
2021-06-04 17:57:21 +03:00
Vlad Zahorodnii
5498b37938 scenes/opengl: Delegate viewport setup to backend
Only the backend knows what the right viewport rect is. Furthermore,
setting up the viewport before rendering is less error-prone.
2021-06-04 16:18:34 +03:00
Vlad Zahorodnii
d3f4da370b Prevent emitting Scene::frameRendered more than once per frame
Currently, the frameRendered() signal is emitted every time an effect
calls paintScreen(). This means that the frameRendered() signal can be
emitted more than once when effects such as slide are active. However,
we'd like if it's emitted only once before buffers are swapped.
2021-06-04 07:49:32 +00:00
Vlad Zahorodnii
8b3e999fbf scenes/opengl: Properly destroy backend if initialization fails
SceneOpenGL takes the ownership of the backend. So, if the scene fails
to initialize, the backend will be deleted twice.
2021-06-04 07:39:51 +00:00
Bhushan Shah
2b1d709b04 inputmethod: hook the key and modifiers functions 2021-06-04 00:14:34 +02:00
Aleix Pol
454425b43f inputmethod: Allow input methods to grab the keyboard
This allows different input methods to get information about what's
beign typed from the actual hardware. This is especially useful for
non-latin script languages.
2021-06-03 19:13:21 +02:00