Commit graph

3263 commits

Author SHA1 Message Date
Volker Krause
972534eb3c Adapt to changes in the Qt6 QPA API
As a pleasant surprise this turned out much easier than anticipated,
all the API is still there, just moved to Qt::GuiPrivate.
2022-04-08 14:19:56 +00:00
Marco Martin
170b0e9aa0 effects/overview: Support touchpad realtime activation
Now it follows your fingers when you do a four-finger swipe up to activate it.

CCBUG: 401479
2022-04-08 14:17:21 +00:00
Vlad Zahorodnii
91f883f5ca Simplify code that announces available modes and current mode
If no mode has the current flag set, the first mode object will be
announced twice.

There's also no benefit from sending the current mode as last. If the
current mode changes, the compositor will send the current_mode event,
not the mode event.

BUG: 452318
2022-04-08 15:56:17 +03:00
Vlad Zahorodnii
08d18503e3 Use output property in Workspace::clientArea()
Since the Toplevel.output property is properly synchronized with the
frame geometry, Workspace::clientArea() can use the output property
instead of looking up the screen. It makes code intuitive and removes
unnecessary lookups.
2022-04-08 09:53:13 +00:00
Vlad Zahorodnii
510a41eeb8 Ensure that Toplevel::output() stays always in sync with geometry
Currently, if geometry updates are blocked, the Toplevel.output property
won't be updated. On the other hand, it's reasonable to use the output
property instead of manually looking up the output in window management
code, e.g. Workspace::clientArea().

In other words, using the Toplevel.output property is like walking on a
mine field, things can blow up. You can't use Toplevel.output even if it
makes perfect sense.

This change ensures that Toplevel.output property is always kept in sync
with the frame geometry. Unfortunately, this means that the output
property no longer can be updated when the frameGeometryChanged() signal
is emitted. It has to be done in moveResizeInternal() method.
2022-04-08 09:53:13 +00:00
Vlad Zahorodnii
8f36b431e7 Add Q_ASSERT in OutputDeviceV2Interface::setCurrentMode()
CCBUG: 452318
2022-04-08 11:32:21 +03:00
l10n daemon script
6d56fa9820 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"
2022-04-08 01:46:46 +00:00
Martin Seher
3521631bbb Add activeOutputName to DBus interface
Provide the name of the active output via the DBus interface, so it can
be used by other components, like KRunner (see bug 427069).

CCBUG: 427069
2022-04-07 21:26:47 +00:00
Kai Uwe Broulik
121004ebfd debug_console: Swap KTitleWidget for a bold QLabel
It's the only user of KWidgetsAddons API outside of effects and kcms.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-04-07 15:57:26 +02:00
Xaver Hugl
34616520c2 backends/drm: fetch immutable blobs in DrmProperty
If the blob is fetched while there is no kernel-visible reference to it,
the driver may re-use the blob ID. When DrmProperty is created or updated,
KWin holds a reference on the blob via drmModeObjectProperties, so this
should prevent any possible issues.

CCBUG: 449285
2022-04-07 12:53:34 +00:00
Vlad Zahorodnii
d6af43763c Add convenience AbstractOutput::rect() function
Foobar::rect() is a common Qt API convention which is very handy when
you need a rect that looks like rect(0, 0, w, h).
2022-04-07 09:38:16 +00:00
Vlad Zahorodnii
809f383d44 Take layer-local damage regions
Using the global coordinate system when specifying output layer damage
regions would be very confusing. In order to make the coordinate system
comprehensible, use the layer-local coordinate system.

The infinite region is used to tell the Compositor when it needs to
repaint the entire layer.
2022-04-07 09:38:16 +00:00
l10n daemon script
1cf3804f60 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"
2022-04-07 01:44:22 +00:00
Volker Krause
5eef3cde22 Adapt to QKeySequence changes in Qt6 2022-04-06 15:13:20 +00:00
Aleix Pol
52035f43b9 xdgactivation: Demand attention when a process fails to resolve its token
In xdg_activation_v1, if a process fails to negotiate activation, at
least decorate it as demanding attention.
This will give apps ways to indicate attention is required. It can can also
help detect clients doing weird things.
2022-04-06 13:56:57 +00:00
l10n daemon script
1762a59fb4 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"
2022-04-06 01:45:45 +00:00
David Edmundson
c05e2fea45 Guard subsurface parent access.
Whilst a subsurface must have a parent at the time of creation, the
lifespan is not guaranteed afterwards.

It's a weird thing for a client to do, but we need to not crash
afterwards.

If the parent surface is destroyed we should consider the surface
unmapped.

BUG: 452044
2022-04-05 15:33:52 +00:00
David Edmundson
d73bdf2ee2 Fix layer shell reset
In the current form any client committing multiple times without
attaching a buffer would unset the cached state and trigger an error.

It's legal (though weird) to commit multiple times before attaching a
buffer.

We should only reset the state if we commit an empty buffer after having
committed an existing buffer. This brings us in line with XdgShell.
2022-04-05 13:59:12 +01:00
David Edmundson
abec252042 Rename member variables to convention 2022-04-05 09:37:53 +00:00
David Edmundson
6d33612967 Move session management to SessionManagement class
Right now Workspace and SessionManagement were entangled with
SessionManager being a dumb class that just signalled to Workspace to do
the work.

The code, however, lived in sm.cpp despite being part of workspace.

This commit is an initial cleanup to strip some X11 specific features
from Workspace and move towards having the right code in the right
files. It should hopefully help get us in the right direction we get
some wayland session management.

Behaviour should be unchanged.
2022-04-05 09:37:53 +00:00
l10n daemon script
9de79c62c7 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"
2022-04-05 01:49:22 +00:00
Gustavo Silvera
41526bd8dd effects/showfps: add new options
- added option to remove the frametime graph
- added option to remove the "this is a benchmark" message
- location of the fps counter is now on the "active" monitor by default
- removed the hard-limit of 100 for the FPS counter
- added option to color the text based off the FPS value
2022-04-04 16:05:56 +00:00
David Edmundson
9de9b93325 Add new blend effect
When changing global settings like switching between light and dark
themes the result is currently quite messy. Apps update in a scattered
order and a jarring change.

The solution is heavily inspired from Gnome, we cache the window for X
milliseconds, then perform a crossfade between the cache and current
contents.

It does mean any video is paused for half a second, but pragmatically
it's not really bothersome.

On receipt of an explicit DBus method call we create a cache and start
animating. The explicit method call is needed so that we can guarantee
kwin has a fully copy before a client might change.

Use of an offscreen texture is used so that we include any window
decorations. The DeformEffect effect is repurposed as it has most the
relevnat logic if we remove the live updating.
2022-04-04 13:40:41 +00:00
Xaver Hugl
a23d23593b backends/drm: check egl config before creating gbm surface 2022-04-03 15:25:54 +00:00
l10n daemon script
9d3f77f6f4 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"
2022-04-03 01:56:40 +00:00
Xaver Hugl
a4919786c6 gestures: prevent deciding on a direction too eary
Doing that breaks when the input device has a very high resolution, which
is the case with touchscreens for example. The minimum delta of 5 is an
arbitrarily chosen value that can be changed if needed
2022-04-02 15:59:02 +02:00
l10n daemon script
cba443dbe3 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"
2022-04-01 02:01:13 +00:00
Xaver Hugl
63c7f523b0 overview: register touchscreen gestures
This was meant to be done in 8914a6c50e,
a mistake must've sneaked in while rebasing
2022-03-30 16:31:10 +00:00
Xaver Hugl
c16a8e09d7 waylandserver: only signal lockScreenShown once it has actually been shown
When the system goes to suspend and screen locking for suspend is enabled,
suspend is inhibited until ScreenLocker::KSldApp::self()->lockScreenShown()
gets called, in order to make sure that the lockscreen is shown before the
system goes to standby, and thus also when the system wakes (instead of
potentially sensitive user information).
However, signalling that when the lockscreen gets mapped can't work reliably,
as it's then a matter of timing whether or not KWin actually presents an
image with the lockscreen before suspending. To fix that, this commit replaces
that logic with only calling lockScreenShown once every output actually got a
lockscreen presented.
2022-03-30 15:57:29 +02:00
Marco Martin
8e77cc497c Touch friendly changes for the Overview effect
* Makes the close button on thumbnails always visible: besides making it usable on touch, makes it more usable with mouse as well
* add a drag down gesture to close windows, moving opacity to zero while dragigng down to signal the window will be destroyed
* restore behavior animations: animate changes in thumbnails size or positions when not in drag mode or drag gesture to not make jarring sudden changes after closing a window or at end of drag mode
2022-03-30 08:33:30 +00:00
Vlad Zahorodnii
cc1bd42f16 Drop Screens::number() 2022-03-29 17:34:41 +00:00
Vlad Zahorodnii
66850e62a0 scripting: Provide clientArea() overloads that take VirtualDesktop objects 2022-03-29 17:34:41 +00:00
Vlad Zahorodnii
601ef328df Drop more legacy Workspace.clientArea() overloads
With this change, the Workspace would provide clientArea() overloads
that take only AbstractOutput and VirtualDesktop. integer ids are
obsolete as they are unstable.
2022-03-29 17:34:41 +00:00
Vlad Zahorodnii
3ebe480976 scene: Simplify optimized screen prepare pass 2022-03-29 14:38:18 +00:00
Vlad Zahorodnii
1dd6575d76 Compute valid opaque region at surface commit time
This allows us to simplify rendering code in the compositor.
2022-03-29 16:27:17 +03:00
Xaver Hugl
658457df5f backends/drm: attempt a modeset on output disabling
When modesets are necessary, they are attempted when an output on the given
GPU gets presented. With multi-gpu setups however, the situation can arise
where there is only one disabled output on a GPU; in that case KWin eternally
waits and never properly turns off the display.
In order to work around this, explicitly call DrmGpu::maybeModeset when
an output gets disabled.

BUG: 449878
FIXED-IN: 5.24.4
2022-03-29 09:19:57 +00:00
Fushan Wen
5427b4d4da tabbox: Don't play "Show Desktop Animation" when activating from tabbox
We already show the desktop preview when the "Show Desktop" item is focused,
so the animation should be considered redundant.
2022-03-29 03:46:31 +00:00
Fushan Wen
0ded63c464 effects: Don't emit showingDesktopChanged when animated is false 2022-03-29 03:46:31 +00:00
Fushan Wen
c85bb35c98 workspace: Add animated in setShowingDesktop
When `animated` is false, "Show Desktop Animation" should not be played.
2022-03-29 03:46:31 +00:00
l10n daemon script
1a6ebab865 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"
2022-03-29 02:16:07 +00:00
Volker Krause
95505eb044 Adapt to OpenGL related Qt6 QQuickWindow API changes 2022-03-28 14:57:27 +00:00
Aleix Pol
4009345e10 Remove unnecessary Scene::addRepaint(QRect)
We can implicitly convert QRect into QRegion.
2022-03-28 12:52:09 +00:00
Aleix Pol
fd1dd4f915 --warning: Remove unused local variable 2022-03-28 12:52:09 +00:00
Vlad Zahorodnii
e293972eaa Run clang-tidy with -checks=readability-braces-around-statements fixit
This fixes style issues in old code.
2022-03-28 10:54:11 +00:00
Kai Uwe Broulik
0d223742ab kwineffects: Add OffscreenQuickScene::setSource with initial properties
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-03-28 09:47:48 +00:00
Vlad Zahorodnii
19a18e4b5d Clean up QPalette handling in DecorationPalette
When using a "legacy" colorscheme, the QPalette will be loaded twice.
With this change, the QPalette is going to be created only once. It also
cleans up variable naming.
2022-03-28 09:17:25 +00:00
l10n daemon script
e14d31a11a 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"
2022-03-28 01:44:20 +00:00
Xaver Hugl
8914a6c50e add global touchscreen gestures
Swipe with three fingers
- left to switch to the previous virtual desktop
- right to switch to the next virtual desktop
- up and down to toggle the overview

CCBUG: 439925
2022-03-27 19:09:04 +02:00
l10n daemon script
0aab6e3ee5 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"
2022-03-27 01:50:57 +00:00
Volker Krause
648640f9ad Include KF headers properly
With the recent KWayland changes we can build without 4 era legacy include
paths now, which makes this visible.
2022-03-25 16:15:10 +01:00
Vlad Zahorodnii
7096e3ead8 Run clang-format
The .clang-format file is based on the one in ECM except the following
style options:

 - AlwaysBreakBeforeMultilineStrings
 - BinPackArguments
 - BinPackParameters
 - ColumnLimit
 - BreakBeforeBraces
 - KeepEmptyLinesAtTheStartOfBlocks
2022-03-25 13:25:15 +02:00
Volker Krause
68a8fa6034 Adapt to QQuickWindow graphics backend API changes in Qt6 2022-03-25 08:45:07 +00:00
Volker Krause
2a171e5fa8 Adapt build system to also support building against Qt6 2022-03-25 08:26:49 +00:00
l10n daemon script
fca6ffac7b 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"
2022-03-25 01:47:05 +00:00
Volker Krause
5aae8c768a Port to qmlRegisterAnonymousType()
The anonymous variant of qmlRegisterType() is deprecated in Qt5 and
gone in Qt6.

This however now requires us to specify a module URI and major version
number. I used the names and (lowest) versions used already for other
types nearby where available, and fell back to "org.kde.kwin" and 0
otherwise.
2022-03-24 16:18:19 +00:00
Kai Uwe Broulik
3733abab2c scenes/opengl: Paint background with alpha 0
In conjunction with a buffer format with alpha channel this allows
to have KWin's backdrop transparent to see through to a display
layer below.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-03-24 14:49:40 +00:00
Arjen Hiemstra
cb47df4fc4 Add a way to ignore devices for tablet mode
The tablet mode code checks whether we are currently in tablet mode
based on whether or not we have a touch screen and a pointer. For some
devices, a touch screen or pointer device may be detected but we would
like to ignore it, since it incorrectly influences the tablet mode.

This reads the udev tag "kwin_ignore_tabletmode" from libinput devices
and will skip devices with that tag when trying to determine whether we
are in tablet mode or not.
2022-03-24 14:59:04 +01:00
Kai Uwe Broulik
5f4a71904d Remove unused KColorScheme include
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-03-24 11:14:30 +00:00
David Edmundson
d1493295df Simplify ScreenLockerWatcher
ScreenLockerWatcher was written whislt overthinking DBus.

An interface does not have to have the same lifespan as the service the
other end. DBus connections works in terms of established "match rules",
these can be set up before a service is created the other side and they
remain if a service closes. The only part that needs doing is re-fetch
any cached properties.

There's also need to check the intial service names at startup. We can
just let our call to GetActive fail. It's far faster.

This class was getting convoluted in both ifdefs and Qt6 porting all to
solve something that isn't real.

There should be no behavioural differences.
2022-03-23 22:19:44 +00:00
Volker Krause
8feeda5c86 Adapt touch event code to Qt6 API changes
This is uglier with Qt6, as the setter methods for touch points are only
available as private API now.
2022-03-23 16:15:09 +00:00
Eric Edlund
1f8a65c434 Rename DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer
This constant is now DEFAULT_UNIT_SCALE_DELTA.
This makes more sense now that we're using realtime gestures.
2022-03-23 09:49:35 +00:00
Vlad Zahorodnii
4854296b27 xwayland: Make launcher not force EGL_PLATFORM
It was added to work around Xwayland crashing at startup due to a mesa
issue, see commit 58fa92e40b.

It's been almost 6 years since that change. No other major wayland
compositor forces EGL_PLATFORM, so lets remove the workaround.

The main motivation behind this change is to get rid of code that's not
straightforward and should be unnecessary in general.
2022-03-23 08:41:11 +00:00
l10n daemon script
149f756ce8 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"
2022-03-23 02:09:06 +00:00
David Edmundson
2a6746a921 XWayland:split connection and process spawning
These are two conceptually different tasks that were intertwined.
On it's own it doesn't accomplish anything but is an important refactor
for longer term goals, namely:

- moving xwayland into kwin_wayland_wrapper with our wayland restart
handling support
- having multiple X connections

Behaviour should be the same.
2022-03-22 16:25:12 +00:00
Marco Martin
2b6f8a3141 support realtime activation for screen edges gestures
support realtime activation for screenedges gestures, making it possible
for effects to show half-triggered states while dragging from
the edge with a finger, making them much more usable
2022-03-22 20:28:02 +05:30
Vlad Zahorodnii
f26c6ad5be plugins/screencast: Fix a glitch in cursor bitmap
In 52bc46069e, some code was shuffled
around to improve code readability. However, it was overlooked that
spa_meta_bitmap->offset is initialized too late, after QImage dest is
constructed. That's the reason why the left edge of the cursor is
wrapped around horizontally.

This change fixes the cursor glitch by ensuring that
spa_meta_bitmap->offset is initialized to proper value before getting
pointer to bitmap data. While on this, this change also moves
spa_meta_bitmap initialization code around to make spa_meta_bitmap setup
look less like a bowl of spaghetti, i.e. spa_meta_bitmap is initialized
first, and QImage dest is created with spa_meta_bitmap's values.
2022-03-22 10:36:32 +00:00
l10n daemon script
8e19f3149e 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"
2022-03-22 01:41:07 +00:00
Xaver Hugl
4a7007cd93 backends/drm: fall back to legacy mode in virtual machines
Virtual machines aren't properly supporting atomic mode setting yet, which
causes the cursor to be offset, and will cause more issues with overlay
planes. In order to prevent that from impacting users, fall back to legacy,
unless KWIN_DRM_NO_AMS is set.

BUG: 427060
FIXED-IN: 5.24.4
2022-03-21 21:28:18 +01:00
Alexander Lohnau
504e0e01cc Remove call to KQuickAddons::QtQuickSettings::init
This is now done as part of the plasma integration plugin.

Task: https://phabricator.kde.org/T12135
2022-03-21 16:49:22 +00:00
Xaver Hugl
7384405add backends/drm: set max bpc in DrmPipeline
If it's only set in DrmConnector it may be reverted if a test commit fails

CCBUG: 448220
2022-03-21 13:33:14 +00:00
Vlad Zahorodnii
6ea8463ce6 kwineffects: Rename WindowPrePaintData::clip to opaque
"opaque" is more readable than "clip" and it precisely communicates
what that region actually is.
2022-03-21 09:32:41 +02:00
Vlad Zahorodnii
842e46f86f scene: Work around some effects using optimized render path
Some effects (AnimationEffect) transform windows without setting
PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS flag. Make the scene disable
render optimizations if that's the case.

Whether AnimationEffect does a right thing is up to debate.
2022-03-21 09:32:41 +02:00
Vlad Zahorodnii
c65523382d scene: Simplify the management of opaque regions
Window painting is no longer split in two phases - PAINT_WINDOW_OPAQUE
and PAINT_WINDOW_TRANSLUCENT.

PAINT_WINDOW_TRANSLUCENT is used as a hint to the occlusion culling
logic to ignore the opaque region.

Given that, the handling of the opaque region can be simplified. If no
effect sets the PAINT_WINDOW_TRANSLUCENT flag, then the opaque region
can be used as is.
2022-03-21 09:32:41 +02:00
Vlad Zahorodnii
253b0ed808 scene: Rename Phase2Data::clip to Phase2Data::opaque
It makes code easier to understand.
2022-03-21 09:32:41 +02:00
Vlad Zahorodnii
aac0609bb9 scene: Rework surface damage tracking
It's not possible to get the surface damage before calling
Scene::paint(), which is a big problem because it blocks proper surface
damage and buffer damage calculation when walking render layer tree.

This change reworks the scene compositing stages to allow getting the
next surface damage before calling Scene::paint().

The main challenge is that the effects can expand the surface damage. We
have to call prePaintWindow() and prePaintScreen() before actually
starting painting. However, prePaintWindow() is called after starting
rendering.

This change makes Scene call prePaintWindow() and prePaintScreen() so
it's possible to know the surface damage beforehand. Unfortunately, it's
also a breaking change. Some fullscreen effects will have to adapt to
the new Scene paint order. Paint hooks will be invoked in the following
order:

* prePaintScreen() once per frame
* prePaintWindow() once per frame
* paintScreen() can be called multiple times
* paintWindow() can be called as many times as paintScreen()
* postPaintWindow() once per frame
* postPaintScreen() once per frame

After walking the render layer tree, the Compositor will poke the render
backend for the back buffer repair region and combine it with the
surface damage to get the buffer damage, which can be passed to the
render backend (in order to optimize performance with tiled gpus) and
Scene::paint(), which will determine what parts of the scene have to
repainted based on the buffer damage.
2022-03-21 09:32:41 +02:00
Vlad Zahorodnii
d4c44220b4 effects/desktopgrid: Make the desktop grid not depend on nested prePaintWindow()
This is needed to allow the Compositor get the surface damage before
calling Scene::paint().
2022-03-21 09:32:41 +02:00
Vlad Zahorodnii
0db64527f0 effects/slide: Make the slide effect not depend on nested prePaintWindow()
This is needed to allow the Compositor get the surface damage before
calling Scene::paint().
2022-03-21 09:32:41 +02:00
l10n daemon script
b6ec6f8216 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"
2022-03-21 01:44:58 +00:00
l10n daemon script
cdc85e95dc 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"
2022-03-20 02:11:23 +00:00
Volker Krause
31d9aa6914 Adapt to tablet event pointer type changes in Qt6 2022-03-19 16:42:23 +00:00
Vlad Zahorodnii
3c945358fc Revert "Implement desktopSwitching() interface for realtime animations"
This reverts commit c7c1ac78ea.

This change was merged prematurely.
2022-03-19 18:30:41 +02:00
Vlad Zahorodnii
e48357a130 Revert "rework of slide effect internals"
This reverts commit 3c557be707.

This change was merged prematurely.
2022-03-19 18:30:20 +02:00
Vlad Zahorodnii
d3acbf0127 Revert "make gestured desktop switching use natural directions"
This reverts commit 5d9e0be959.

This change was merged prematurely.
2022-03-19 18:29:48 +02:00
Vlad Zahorodnii
91632bd030 Revert "Refactor DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer"
This reverts commit a508a8c6db.

It didn't go through code review process.
2022-03-19 18:29:39 +02:00
Vlad Zahorodnii
7e14716043 Revert "Make overview and present windows use realtime gestures"
This reverts commit 6729380c54.

It didn't go through code review process.
2022-03-19 18:29:26 +02:00
Eric Edlund
6729380c54 Make overview and present windows use realtime gestures
They still aren't realtime animated, but by making them respond to the
realtimeGesture() call, they can use callbacks to determine if they should be shown
or not. This allows you to swipe up, have it trigger, then swipe down in the same
motion and get it to untrigger without ever having to release.
2022-03-19 10:21:30 -04:00
Eric Edlund
a508a8c6db Refactor DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer
This constant is not DEFAULT_UNIT_SCALE_DELTA.
This makes more sense now that we're using realtime gestures.
2022-03-19 10:06:01 -04:00
Eric Edlund
5d9e0be959 make gestured desktop switching use natural directions
BUG: 185710
2022-03-19 13:19:54 +00:00
Eric Edlund
3c557be707 rework of slide effect internals
Fixed a bunch of bugs and polished the slide effect.
Plugged the slide effect into the new VirtualDesktopManager interface desktopChanging() to allow for mac os style desktop switching.

BUG: 448419 BUG: 401479
2022-03-19 13:19:54 +00:00
Eric Edlund
c7c1ac78ea Implement desktopSwitching() interface for realtime animations
Added this interface to the VirtualDesktopManager. Realtime touchpad gestures update the interface to allow for mac os style desktop switching.
2022-03-19 13:19:54 +00:00
Volker Krause
ddaa2a3784 Make QDBusObjectPath debug output also work with Qt6 2022-03-19 11:24:31 +00:00
Volker Krause
bc7324d258 Remove unused CMake files 2022-03-19 11:24:13 +01:00
Volker Krause
c8b67b9120 Fix Qt6 build regressions introduced by 0cd453690b
Hard to avoid as long as we don't have CI coverage yet, but that will take
a bit more time, we need KWin (and all its dependencies) to fully build
first.
2022-03-19 10:00:12 +00:00
Volker Krause
b99c5f9a63 Adapt to QQuickWindow::createTextureFromNativeObject being gone in Qt6 2022-03-19 09:20:34 +00:00
Xaver Hugl
f31b4b36d7 backends/drm: only allow ARGB8888 as the cursor format
The raspberry pi exposes opaque formats for the cursor plane, and interprets
them as being opaque as well... Considering that we effectively don't support
anything else with the QPainter anyways, just hardcode ARGB8888 until we paint
the cursor with OpenGl.
2022-03-18 21:29:35 +00:00
Nate Graham
ec75943425 Revert "revert desktopgrid realtime gestures port"
This reverts commit ca7fc44814.

Reverting work with no explanation is unacceptable, especially when
you've already been asked to stop multiple times.

CWG has already been contacted regarding this conduct, which is
starting to seem like vandalism of KDE's codebase. I am CCing sysadmins
and officially recommending an emergency recovation of commit access
for uhhadd@gmail.com to prevent further abusive behavior.

CCMAIL: uhhadd@gmail.com
CCMAIL: sysadmin@kde.org
2022-03-18 13:51:15 -06:00
Jan Blackquill
ca7fc44814 revert desktopgrid realtime gestures port 2022-03-18 14:17:52 -04:00
Nate Graham
2de09fa249 Revert "revert desktopgrid realtime gestures port"
This reverts commit 154528cdef.

This commit was reverted with no explanation, context, or discussion. In
the future, please discuss things like this before doing them. KWin is a
community project, not a personal playground.

CCMAIL: uhhadd@gmail.com
2022-03-18 09:40:10 -06:00
Volker Krause
a1d61bb6e8 Link against Qt::CorePrivate as we use internal event loop headers here
Needed to compile against Qt6.
2022-03-18 14:34:41 +00:00
Volker Krause
0952512e0a Move Tranche::operator== before its first use
Qt6 QList::operator!= fails to compile otherwise.
2022-03-18 14:34:41 +00:00
Volker Krause
e5a85f503a QScopedPointer in Qt6 doesn't implicitly cast to bool anymore 2022-03-18 14:34:41 +00:00
Volker Krause
e0c1d2583a Add Wayland includes needed to build against Qt6 2022-03-18 14:34:41 +00:00
Volker Krause
ccad0066e7 Disambiguate KWaylandServer::Display
This unfortunately clashes with a typedef in a Qt6 header.
2022-03-18 14:34:41 +00:00
Volker Krause
6cd0014364 Adapt build system to also support Qt6 2022-03-18 14:34:41 +00:00
Volker Krause
09624c5a9b Make the qtwaylandscanner fork build against Qt6 2022-03-18 14:34:41 +00:00
Nicolas Fella
3876c89cc1 Avoid recreating palette in DecorationPalette::palette
KColorScheme::createApplicationPalette is quite expensive and DecorationPalette::palette is called quite a lot

Cache the result and only update when needed
2022-03-18 08:04:28 +00:00
Vlad Zahorodnii
645f5adfc2 Remove guards around unistd.h
We take unistd.h for granted in many places, so remove guards around the
corresponding includes to make code consistent.
2022-03-18 07:35:59 +00:00
l10n daemon script
af5e8a937d 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"
2022-03-18 01:50:19 +00:00
Mathias Tillman
140c2fb20e effects/blur: Fix window flickering when the clip intersected with the current blur region.
This fixes a bug introduced in https://invent.kde.org/plasma/kwin/-/merge_requests/2045 where it would no longer check if it should redraw the whole region unless the data clip intersected. This would lead to flickering in certain cases

BUG: 421135
2022-03-17 22:19:55 +00:00
Vlad Zahorodnii
927714466c Remove KWIN_XCLIPBOARD_SYNC_BIN symbol in config-kwin.h
xclipboard syncer is long time gone.
2022-03-17 12:05:45 +02:00
Alex Richardson
137fea8aa9 Use #cmakedefine01 for the remaining config macros
Using 0/1 instead of undefined/defined to 1 allows the compiler to flag
a missing include of the config header.
2022-03-17 11:40:01 +02:00
Alex Richardson
0a0a1fd330 Use __has_include() instead of check_include_file()
Allows removing some CMake checks config-kwin.h contents. This is
supported by all compilers and required for C++17. While touching those
lines I also cleaned up an unnecessary HAVE_UNISTD_H check (glibc always
has it and and incorrect use of HAVE_SYS_PROCCTL_H.
2022-03-17 11:39:58 +02:00
Vlad Zahorodnii
994c5c24ae Drop fbdev backend
fbdev has been deprecated and unmaintained for a while. With Linux 5.14
including SimpleDRM driver, we can drop it. (at the time of writing this
commit message, the latest Linux version is 5.16).
2022-03-17 09:13:21 +00:00
Julius Zint
97f49edb1c Add the ability to add InputDevices to InputRedirection
[2/6] Make autotests create fake input devices
2022-03-17 08:35:40 +00:00
Julius Zint
3134198a30 Move VirtualInputDevice to autotests
[1/6] Make autotests create fake input devices

The goal of this patch set is simulating user input in unit tests via
InputDevices and no longer use the Platform to fake input. This matches
more closely with how input is processed when running a full plasma
wayland session, i.e. with the DRM and libinput backends.
2022-03-17 08:35:40 +00:00
Volker Krause
4b810833b5 Use new nativeInterface() API to get EGL/GLX contexts with Qt6 2022-03-17 07:54:26 +00:00
Volker Krause
1679452f41 Adapt to QChar ctors being explicit in Qt6 2022-03-17 07:29:51 +00:00
Nate Graham
840e6d400b src/kcmkwin: fix botched indentation code for final checkbox
This line had several problems:
1. Using un-namespaced `units` properties
2. Using `width` in a Layout
3. Using largeSpacing instead of gridUnit for indentation

All are fixed with ths commit.
2022-03-16 20:30:49 -06:00
l10n daemon script
17d562c825 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"
2022-03-17 01:47:48 +00:00
Volker Krause
15611cacb9 Port from QStringRef to QStringView
The QStringView::to[Number]() methods in Qt5 cause one extra allocation
compared to the QStringRef counter-part. As long as we aren't on a hot
path this is probably not worth the extra #ifdef though.
2022-03-16 23:44:23 +00:00
Michail Vourlakos
ba2496ca12 [aurorae] do not make any blur calculations when blur is not supported
when an aurorae theme does not contain "mask" element we can safely assume that blur is not supported. In such case all blur calculations must not run at all. This will make all solid aurorae themes much lighter by default.
2022-03-16 23:42:46 +00:00
Jan Blackquill
154528cdef revert desktopgrid realtime gestures port 2022-03-16 17:14:59 -04:00
Xaver Hugl
1d1b218d97 screencast: better solution for missing context on cursor move
There's no need to use tryEnqueue if we only update the cursor
2022-03-16 17:41:50 +00:00
Xaver Hugl
989361405e Revert "screencast: make context current in tryEnqueue"
This reverts commit 1fd1c03742,
because it can make KWin freeze
2022-03-16 17:41:50 +00:00
Xaver Hugl
6012e409a6 backends/drm: fix multi-gpu
The import code was added but not actually used
2022-03-16 16:32:08 +00:00
Xaver Hugl
36088cc82c backends/drm: fix crash in aboutToStartPainting
m_gbmSurface may still be nullptr
2022-03-16 16:32:08 +00:00
Xaver Hugl
0cd453690b backends/drm: split out layers for lease outputs and remove DrmDisplayDevice 2022-03-16 16:32:08 +00:00
Xaver Hugl
aac7f50d8b backends/drm: remove some unnecessary redirection 2022-03-16 16:32:08 +00:00
Xaver Hugl
0ba5916fe6 backends/drm: remove retry-logic for atomic commits
While it can make KWin work even when the driver changes properties
behind its back, it can also mask bugs in KWin.
2022-03-16 15:18:47 +00:00
Vlad Zahorodnii
b0982f7bbc wayland: Drop ptrace logic
kwin disables ptrace for a good reason - to prevent other processes from
attaching to kwin and snooping sensitive data or taking control of kwin.
But, that will also make things such as memory statistics unavailable to
read, etc.

On the other hand, the supported platforms where kwin runs all have
security measures in places to forbid shady processes ptrace'ing kwin.
For example, on Linux it's YAMA.

On Linux, by default, a process can ptrace only its descendants. For
example, this can be used by debuggers; otherwise you would need to be
the superuser to attach to any process.

This change drops our ptrace logic in favor of system provided security
measures. It allows the System Monitor to gather kwin's memory usage
statistics and also simplifies code, the current debugger detection
logic is not really robust.

If the system provided security measures are proven to be insufficient,
we can add the ptrace disabling logic back, but it would be great to
avoid that because system monitor won't be able to gather resource usage
statistics, which can be useful for detecting memory leaks in plasma
wayland session, etc.
2022-03-16 14:16:14 +00:00
Kai Uwe Broulik
9f9e32e57d Remove unused Qt QuickWidgets dependency
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-03-16 11:31:09 +00:00
Volker Krause
57e0119d23 Adapt to Qt6's removal of Qt::X11Extras 2022-03-16 06:45:42 +00:00
l10n daemon script
45abf173f9 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"
2022-03-16 01:44:25 +00:00
Aleix Pol
f0ce2a0f53 screencasting: Support regions from the v3 of the protocol 2022-03-15 19:49:54 +00:00
Volker Krause
2139e2abab Port away from deprecated QWheelEvent constructors
The additional arguments are based on what the deprecated ctors did
internally.
2022-03-15 18:46:10 +00:00
Michail Vourlakos
f5c4040ac1 [aurorae] remove deprecated blur metadata
- blur json metadata is not needed any more in favor of KDecoration2 blurRegion
2022-03-15 17:17:50 +00:00
Aleix Pol
124c78cb4b screencast: Support screencast of regions 2022-03-15 16:09:45 +01:00
Eric Edlund
934f50717e Move 4 finger swipe up to overview effect 2022-03-15 13:29:05 +00:00
Eric Edlund
7a6792aa2f Make desktop grid effect check for active effects before responding to gestures 2022-03-15 13:29:05 +00:00
Eric Edlund
5cf8db26ec Changes to GestureRecognizer and gestures 2022-03-15 13:29:05 +00:00
Michail Vourlakos
f8b1b7f47e [aurorae] fix incorrectly disabled blur for maximized windows
when aurorae decorated windows become maximized and back to normal, after a while they all start to disable blur for their decorated maximized windows.

- bug was tracked down to aurorae fault sending empty QRegions for its maximized windows. What probably happens is that because mask FrameSvgItem enabled borders change from AllBorders to NoBorder, mask FrameSvgItem calculations can not catch up
- the new approach is lighter than the previous one and simpler as margins and enabledborders for mask framesvgitem are not changed and in the c++ side no QRegions calculations are needed at all for maximized windows
- in my system with the new code changing from normal window to maximized one feels a bit snapper
2022-03-15 13:21:46 +00:00
Volker Krause
ad09d9cc1e Adapt to various Qt6 container changes
QHash::unite is gone, container sizes are no longer int, comparison
operators are enforced to be const.
2022-03-15 08:52:21 +00:00
Xaver Hugl
945a2059b8 egldmabuf: port modifiers to QVector
With this we don't have to convert back and forth between QVector and QSet
to access the data
2022-03-15 08:18:37 +00:00
Volker Krause
ef1e22f517 Adapt to Qt6 nativeEventFilter changes 2022-03-15 07:34:24 +00:00
Xaver Hugl
215de363e8 linuxdmabuf: port to QVector
QVector is much more suitable for modifiers in KWin than QSet, because you
can access the underlying array
2022-03-15 03:25:50 +01:00
l10n daemon script
c7b2c64967 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"
2022-03-15 01:43:59 +00:00
Volker Krause
5eb4c1722a Port from I18N_NOOP to KLazyLocalizedString 2022-03-14 20:16:35 +00:00
Volker Krause
a6b5eb3ebb Use non-deprecated QButtonGroup signal 2022-03-14 17:39:53 +00:00
Volker Krause
f6f2c28aa6 Add additional includes needed by Qt6 2022-03-14 16:41:10 +00:00
Volker Krause
7455507d07 Don't rely on implicit QWeakPointer casting
Needs to be explicit with Qt6.
2022-03-14 16:02:41 +00:00
Harald Sitter
fad658200f fix dependency lookup
the target is called ConfigCore, the relevant cmake config is not.
notably KF5ConfigConfig.cmake is the present file, so look for the
correct name, otherwise the dependency isn't found
2022-03-14 15:15:23 +00:00
Volker Krause
9d9e89fb84 Don't rely on implicit QScopedPointer to bool conversion
No longer available in Qt6.
2022-03-14 13:58:55 +00:00
Xaver Hugl
1fd1c03742 screencast: make context current in tryEnqueue
The method is used when the cursor position changes. There is no guarantee
that a context would be current at that point in time
2022-03-14 01:58:31 +00:00
l10n daemon script
9eecefd157 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"
2022-03-14 01:44:59 +00:00
Jack Hill
a7fdb9ad16 Add Accessibility keyword
This module has various settings for accessibility so it makes sense to have this as a keyword.
2022-03-13 23:22:55 +00:00
Volker Krause
a34717dc22 Ensure moc sees fully qualified property types
Qt6 insists on that. We can do this either by including the moc files,
or by including the corresponding headers in the header defining the
properties, the former seems cleaner when possible.
2022-03-13 16:56:26 +00:00
Volker Krause
eee16b01a4 Port away from deprecated QWheelEvent position methods
Those are gone in Qt6 (unlike similarly named methods for other
event types).
2022-03-13 12:23:22 +00:00
Volker Krause
51250cfb4a Use | rather than + for combining QFlags
The plus operator is no longer available for flags in Qt6.
2022-03-13 10:00:54 +00:00
l10n daemon script
03c80db56d 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"
2022-03-13 01:57:28 +00:00
Volker Krause
19538a8dcb Fully qualify Qt::endl, needed with Qt6 2022-03-12 17:04:44 +00:00
Volker Krause
7188f8fbd1 Port away from deprecated q[s]rand() methods 2022-03-12 12:58:07 +00:00
Volker Krause
c5a712a77a Don't rely on implicit conversion from int to QUuid
Not available in Qt6 anymore.
2022-03-12 10:48:44 +00:00
Volker Krause
f6d14f0401 Adapt to QQuickItem::geometryChanged() rename in Qt6 2022-03-12 09:57:32 +00:00
Volker Krause
fe56f36dd0 Port to QRecursiveMutex
Recursive and non-recursive mutexes are distinct types in Qt6.
2022-03-11 15:39:09 +00:00
Volker Krause
ce22e95d89 Adapt to QtConcurrent API changes in Qt6 2022-03-11 15:01:26 +00:00
Volker Krause
0143b63527 Use version-less Qt macros, targets and variables
Prepares for building against Qt6.
2022-03-11 14:37:24 +00:00
Michail Vourlakos
a1fec92ef2 [blur] use blurRegion to identify if a decoration supports blur
Having blurRegion to identify if a decoration supports blur or not instead of the metadata-json way has the following benefits:

- decorations can now provide both blur or not based on user preference
- theme engines such as Aurorae do not have to enforce blur or not to their themes and they can support blur enabled and disabled themes at the same time if they want to
- blurRegion is empty by default so the Korners bug will be fixed for all solid aurorae themes. Breeze and Oxygen have set **blur:false** so nothing changes for them.
- all aurorae themes that do not require blur will free up system resources by default
2022-03-11 13:13:38 +00:00
Arjen Hiemstra
bd920fb28c effects: Guard against InputMethod being nullptr or not enabled
Apparently InputMethod can be nullptr, in which case we end up
dereferencing nullptr when we try to get the input panel.
2022-03-11 10:16:30 +01:00
Xaver Hugl
9c5d3c9a70 outputchangeset: set default values for vrr policy and rgb range
If this is not done then KScreen will sometimes unintentionally reset them
to the default.

BUG: 442520
FIXED-IN: 5.24.4
2022-03-11 03:51:18 +01:00
Nate Graham
44184f4700 effects/overview: add subtle outline around non-active desktops
Otherwise they have no border and look kind of cut off.

BUG: 450739
FIXED-IN: 5.25
2022-03-10 15:14:13 -07:00
Volker Krause
cd74345652 Adapt to QQmlListProperty API changes in Qt6 2022-03-10 20:48:26 +00:00
Arjen Hiemstra
9253c06105 Disable animations for Maliit when launching it as input method
Maliit does client side animation by default but can be told to disable
them using an environment variable. Since we now want to do this
animation in KWin, always disable the client side animations in Maliit.

It feels slightly weird to unconditionally add a Maliit-specific
variable, but at the same time all other solutions are more error prone
and would likely need more code.
2022-03-10 18:41:22 +00:00
Arjen Hiemstra
844c451156 slidingpopups: Support animating show/hide of input method panel
This adds support for animating showing/hiding of the input method panel
to the sliding popup effect, if the input panel is of type "Toplevel".

This is mainly intended to animate showing the virtual keyboard and has
been primarily tested with Maliit. It replaces the client-side animation
that Maliit would do, instead doing the animation on the KWin side which
provides a significantly smoother experience.
2022-03-10 18:41:22 +00:00
Volker Krause
13f28d7d6d Port away from QList::toSet
That's gone in Qt6, replaced by range constructors.
2022-03-10 17:13:38 +00:00
Volker Krause
205fd169e5 Port from KNS3::Button to KNSWidgets::Button
The former isn't available in KF6 anymore.
2022-03-09 18:13:27 +01:00
Alex Richardson
1980dd0eb8 Use a python script to strip effect metadata
This makes it easier to cross-compile KWin since it is no longer necessary
to have all the KWin dependencies on the host machine. This could be
partially addressed by moving the strip-effects-metadata.cpp into a
separate folder than can be built as a top-level project, thereby reducing
the dependencies to just QtCore. However, it still means we have to build
a native binary. Since all this script is doing is removing some JSON keys,
we could also use a python script and avoid the need to compile a
build-time helper program.
2022-03-09 13:58:41 +00:00
Aleix Pol
e043f2262f inputmethod: Fix the test
We should account for keyboards that are not full screen (unlike
maliit). It shouldn't make a difference for maliit.
2022-03-09 13:24:26 +00:00
Aleix Pol
badf492941 drm: Properly specify the yInversion of the shadow buffer
Otherwise when we render it, we do so upside down and screen sharing
looks broken.
This only happens when the shadow buffer is in use, so it's not all that
common.
2022-03-09 00:47:04 +01:00
Jan Blackquill
eb933bfe0b effects/desktopgrid: don't forget to schedule repaints when timeline is running
BUG: 444678
FIXED-IN: 5.24.4
2022-03-08 17:21:30 +00:00
Jan Blackquill
5ffc307ca8 effects/desktopgrid: register down gesture
Now you can close the desktop grid with the inverse
of the gesture you used to open it.

BUG: 444694
FIXED-IN: 5.24.4
2022-03-08 14:49:39 +00:00
Aleix Pol
1b7173e927 inputmethod: Do not reset when hiding
This will make maliit think there is an ongoing matters and make it pop
up again.
2022-03-08 11:52:22 +00:00
Aleix Pol
c6737b1ae0 inputmethod: Listen to text-input enablement changes when starting disabled
We will need to know about it eventually if the user enables the input
method.
It's guarded with an if so it's no-op.
2022-03-08 11:52:22 +00:00
Laurent Montel
854aab798d Fix signature method in qt6 2022-03-08 07:26:17 +01:00
Laurent Montel
5bb8be96ee Add missing override keyword 2022-03-08 07:15:28 +01:00
Xaver Hugl
8b3a6c3eb0 backends/drm: don't change the configuration while KWin is terminating 2022-03-07 15:13:04 +00:00
Xaver Hugl
83d797785b backends/drm: wait for pending pageflips before doing a modeset
If we don't, KWin may get a pageflip event for an output that is already
considered as being turned off
2022-03-07 15:13:04 +00:00
Xaver Hugl
1247a7b698 output changes: handle to-be-enabled outputs first
This prevents situations where we have no enabled outputs
2022-03-07 15:13:04 +00:00
Xaver Hugl
2693482d10 platform: check all outputs, not only enabled ones for the enabled flag
Otherwise it will block changes that will disable all currently enabled
outputs but also enable some currently disabled output

CCBUG: 450721
2022-03-07 15:13:04 +00:00
Alexander Lohnau
abcf22b4d6 Clean up defunct version header for kwinscripts kcm 2022-03-06 19:11:01 +01:00
Michail Vourlakos
bcff044c73 [aurorae] - support blurregion from kdecoration2
This is an approach for aurorae engine to publish masks for its decorated windows in order to avoid out of window blurring at the decoration corners. Aurorae themes are now able to specify a **mask** element inside **decoration.svg** file like plasma themes already do. Mask is used afterwards to calculate theme's blur region.


| Before | After |
| ------ | ----- |
|![before](/uploads/26014e79c3d5d45ba12fa5cf62294b1c/before.png)|![after](/uploads/923d7021eaaf322be96b611c73558666/after.png)|

Adjusted Aurorae theme for testing: [ROUNDED-DARK.tar.gz](/uploads/082f60ad4311e3e296b7faeeb7c97dac/ROUNDED-DARK.tar.gz)

BUG:395725
2022-03-06 09:58:11 +00:00
Kai Uwe Broulik
32daab286d Use workspaceLayer as context object
Otherwise the connection isn't severed when the layer is destroyed,
leading to crashes when screen resolution changes.

We don't actually need `this` to access `workspace()`, and we have
a guarded `output` as sender in the other case.
2022-03-04 22:26:38 +01:00
Aleix Pol
b11499d95e Remove AbstractWaylandOutput::isBeingRecorded
It's not being used anywhere
2022-03-04 04:05:24 +01:00
Aleix Pol
4c814590fe Fix textureForOutput for the EglWaylandBackend
Ensure we get our texture from the right output
2022-03-04 02:56:35 +01:00
l10n daemon script
eb760505ac 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"
2022-03-04 01:43:35 +00:00
Kai Uwe Broulik
0793c24249 Add KWIN_BUILD_NOTIFICATIONS option
Notifications are really only useful in a setting with a full
shell environment where there is a notification center to display them.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2022-03-03 15:06:36 +01:00
Vlad Zahorodnii
12ec886ccc Port to SeatInterface::notifyPointer{Enter,Leave} 2022-03-03 13:45:47 +00:00
Vlad Zahorodnii
8e304963ad Make pointer focus handling less error prone
Currently, if the pointer surface has to change between two surfaces,
the compositor must do the following

    seat->setFocusedPointerSurface(nullptr);
    seat->notifyPointerMotion(newPos);
    seat->setFocusedPointerSurface(focus);

The pointer motion is needed so the enter event has correct position,
setFocusedPointerSurface(nullptr) is needed to avoid sending a bad
motion event before the leave event.

This change makes the pointer focus api less error prone by splitting
setFocusedPointerSurface() in two functions - notifyPointerEnter() and
notifyPointerLeave().

notifyPointerEnter() takes new focus surface as well as the position
where the pointer has entered the surface so the focus update can be
atomic and without any corner cases.

notifyPointerLeave() is used to clear pointer focus.
2022-03-03 13:35:04 +00:00
Manuel Stoeckl
a2b7c09a11 Allow direct uploads of 16-bpc QImage formats
This commit expands the QImage-to-GL formatTable to include entries
for RGBX64, RGBA64_Premultiplied, and Grayscale16 image formats.
Uploading 16-bit-per-channel formats is supported by OpenGL and, with
the GL_EXT_texture_norm16 extension, GLES.
2022-03-03 10:23:31 +00:00
Marco Martin
e00d836708 Force cancel of any drag in progress when Escape is pressed
when escape is pressed when dragging between different clients,
cancelling any drag is compositor's responsibility

BUG:405267
2022-03-03 09:54:18 +00:00
Marco Martin
fccbe4e027 Add a methood to fore cancel any drag in progress
This is needed to cancel drags by pressing Escape which is
resposibility of the compositor

CCBUG:405267
2022-03-03 09:09:27 +00:00
Manuel Stoeckl
10b109e31c Add support for [ax]bgr16161616 wl_shm formats
These require Wayland 1.20, for the format definitions.
2022-03-02 09:08:53 +00:00
Alex Richardson
d789ecc6d1 Use #cmakedefine01 for all KWIN_BUILD_* macros
This ensures that we get a warning if the config header is not included
instead of compiling the code as if it was disabled. Interestingly, some
checks already used #if KWIN_BUILD_*, so those were generating -Wundef
warnings when the feature is disabled. Commit 886173cab assumed that all
those features were already 01, so this unbreaks the build if any of the
features is disabled.

Fixes: 886173cab ("Reduce ifdefs in Workspace::supportInformation()")
2022-02-28 18:59:04 +00:00
Xaver Hugl
dea33cb311 backends/drm: consider zero modes as failure
If there's no modes, we can't use the output
2022-02-28 17:26:29 +00:00
Xaver Hugl
6bd6ad9d59 backends/drm: let DrmGpu handle mode changes
Doing a test is not sufficient for mode changes

BUG: 450804
2022-02-28 17:26:29 +00:00
Xaver Hugl
907cf72bb0 backends/drm: only update modes if actually necessary
This prevents some unneeded modesets
2022-02-28 17:26:29 +00:00
Xaver Hugl
72d9711e5d backends/drm: fix recording with direct scanout
BUG: 450943
2022-02-28 17:27:44 +01:00
Kai Uwe Broulik
1256ab4b84 scripting: Build generic scripting KCM only with KWIN_BUILD_KCMS
Without scripting KCM there is no access to script configuration either

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-24 21:29:53 +00:00
Kai Uwe Broulik
4a14ac51ed effects: Build effect config only with KWIN_BUILD_KCMS
Without effects KCM there is no access to effect configuration either

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-24 21:29:53 +00:00
Aleix Pol
4c9c5f9fd5 inputmethod: fix placing the virtual keyboard at the bottom
We should use the output area as the margin size as where to position
rather than the panelSize.

This ensures that the keyboard ends up in the right place right above
the panels.
2022-02-24 18:11:45 +01:00
Laurent Montel
cf6cc51651 Allow to use new kauth includes 2022-02-24 07:14:23 +01:00
Vlad Zahorodnii
aaa07f0605 Revert "Remove mysterious s_cursorUpdateBlocking boolean flag in pointer_input.cpp"
This reverts commit 3d0bdc56a4.

seat->setFocusedPointerSurface() before notifyPointerMotion() is needed
to prevent sending a motion event that's outside the previously focused
surface.

BUG: 449273
2022-02-23 22:03:27 +02:00
Kai Uwe Broulik
d54723cbf2 Add KWIN_BUILD_SCREENLOCKER option
Allows to build KWin without lockscreen support and thus drops the
kscreenlocker dependency.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 14:39:25 +01:00
Kai Uwe Broulik
5db527a053 effects/mousemark: Port away from KPluralHandlingSpinBox
It's the only user of KTextWidgets in the entire repository.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 13:48:43 +01:00
Kai Uwe Broulik
8f21921843 effects: Don't call load() from KCM constructor
It is automatically called (and documented as such) by KCModule
after the constructor is run.

This avoids calling a virtual method from the constructor.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 11:47:32 +00:00
Kai Uwe Broulik
aef8ba8d1a Port KComboBox to QComboBox
None of the features it adds ontop of `QComboBox` are used.

Allows to drop the dependency on KCompletion.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 11:28:47 +00:00
Kai Uwe Broulik
ad4bbba08a kwinrules: Use KWindowSystem::isPlatformX11()
No need to use QX11Info if we already have KWindowSystem

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 11:36:37 +01:00
Heiko Becker
df845939a4 Fix kdebugsettings categories file
By using the same EXPORT for ecm_qt_declare_logging_category and
ecm_qt_install_logging_categories.
2022-02-23 10:14:44 +01:00
Kai Uwe Broulik
7e16130eea effects/overview: Don't link against KF5::Completion
None of its classes are used in this effect.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:27:31 +00:00
Kai Uwe Broulik
3aa23093e2 effects: Explicitly link against CoreAddons
Don't rely on another framework to pull it in.
It's where `KPluginFactory` lives.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:27:31 +00:00
Kai Uwe Broulik
2591afc7e7 effects: Remove unused KAboutData includes
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:27:31 +00:00
Kai Uwe Broulik
6e4acb4303 linuxdmabuf: Add unistd.h include
Don't rely on someone else to pull it in for `close()`

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:31:38 +01:00
Xaver Hugl
b530a5b66d backends/drm: fix layer destruction
Layers need to release their resources whenever the render backend gets
replaced.
2022-02-22 14:52:52 +01:00
Xaver Hugl
a04bdf2355 backends/drm: port DrmPipeline and DrmGpu to use layers
Instead of having the render backends manage layers, have DrmGpu and DrmPipeline
do it. This makes it possible to unify code paths for leased and normal
outputs, remove some redirection and have more freedom with assigning layers
to screens.
2022-02-22 14:52:52 +01:00
Xaver Hugl
cdac2690d1 backends/drm: port layers to DrmDisplayDevice 2022-02-22 14:52:52 +01:00
Xaver Hugl
dd198461ea backends/drm: introduce DrmDisplayDevice
DrmDisplayDevice is a new parent class for both normal and lease outputs,
which makes it possible to simplify a few things
2022-02-22 14:52:52 +01:00
Xaver Hugl
ddb6dadfc2 backends/drm: port qpainter to layers 2022-02-22 14:52:52 +01:00
Vlad Zahorodnii
153d5965f8 wayland: Remove unpolish() calls
It's leftover after the times when widget style was using wayland
connection. Breeze had to destroy all wayland resources before
terminating the internal connection.
2022-02-22 07:36:47 +00:00
Xaver Hugl
b063031313 backends/drm: block input with the placeholder output
This is to prevent the user from accidentally changing application state
while they don't have an output connected
2022-02-21 20:11:38 +00:00
Vlad Zahorodnii
4326d3f029 effects/blur: Avoid shrinking unrelated opaque regions
Currently, the blur effect will shrink an opaque region even if it
doesn't intersect m_currentBlur.

This ensures that the blur effect won't do a stupid thing such as
clipping the opaque region of the desktop window.
2022-02-21 16:02:46 +00:00
Vlad Zahorodnii
e27ecfe88d Remove excessive damage region clipping
We already try to ensure that the surface damage is within render target
bounds. Avoid clipping surface damage in render backend, which is a bit
excessive task and perhaps it should be done an abstraction level above.
2022-02-21 15:30:30 +00:00
Vlad Zahorodnii
05de198c41 scene: Check SurfacePixmap's alpha channel to determine if surface is translucent
If the main surface is translucent (e.g. it contains only the drop
shadow) but its subsurface is opaque, the "window->isOpaque()" check
will produce a false positive.
2022-02-21 14:48:01 +00:00
Vlad Zahorodnii
ae3dc3f3c6 effects/colorpicker: Pick color in paintScreen()
It's not guaranteed that there will be current render target in
postPaintScreen() as all painting have been completed. paintScreen() is
a much safer place to pick color.
2022-02-21 14:34:49 +00:00
Vlad Zahorodnii
6d20b977ab effects/screenshot: Capture screenshot in paintScreen()
It's not guaranteed that there will be current render target in
postPaintScreen() as all painting have been completed. Furthermore,
even the docs of the postPaintScreen() function indicate that no
painting should be done there, you can do only cleanup things, e.g.
schedule a repaint, etc. paintScreen() is a much safer place to
capture screenshot.
2022-02-21 14:34:49 +00:00
Alex Richardson
24eee2df7c Cast via uintptr_t when converting between integers and pointers
When casting from integer to pointer, promoting the integer to (u)intptr_t
will ensure that the resulting type can be converted to a pointer without
problems. These two casts changed in this commit trigger a warning when
building for CHERI-enabled architectures such as Arm Morello. This is not
just limited to CHERI, the cast from xcb_pixmap_t (uint32_t) to void*
should also be flagged by -Wint-to-void-pointer-cast when using Clang,
however, it appears that warning only handles C-style casts, and not
reinterpret_cast (https://github.com/llvm/llvm-project/issues/53964).
2022-02-21 13:27:29 +00:00
Vlad Zahorodnii
dd6d0b22cc Port software cursor to RenderLayer
Software cursor has always been a major source of problems. Hopefully,
porting it to RenderLayer will help us with that.

Note that the cursor layer is currently visible only when using software
cursor, however it will be changed once the Compositor can allocate
a real hardware cursor plane.

Currently, software cursor uses graphics-specific APIs (OpenGL and
QPainter) to paint itself. That will be changed in the future when
rendering parts are extracted from the Scene in a reusable helper.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
8739258f2f Drop Platform::isPerScreenRenderingEnabled()
At this point, it's safe to assume that only X11 has weird rendering
model, which stands in the way of making rendering abstractions nice and
intuitive, so let's check operation mode. If OperationModeX11 is
dropped, this will also simplify finding X11-specific code in kwin.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
5933a21641 Introduce render layers
This is the first tiny step towards the layer-based compositing in kwin.
The RenderLayer represents a layer with some contents. The actual
contents is represented by the RenderLayerDelegate class.

Currently, the RenderLayer is just a simple class responsible for
geometry, and repaints, but it will grow in the future. For example,
render layers need to form a tree.

The next (missing) biggest component in the layer-based compositing are
output layers. When output layers are added, each render layer would
have an output layer assigned to it or have its output layer inherited
from the parent.

The render layer tree wouldn't be affected by changes to the output
layer tree so transition between software and hardware cursors can be
seamless.

The next big milestone will be to try to port some of existing kwin
functionality to the RenderLayer, e.g. software cursor or screen edges.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
65ccfd336f Add dummy OutputLayer type
It's needed to make repaint scheduling in render layers simple.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
203d7b3b8a Move direct scanout management to Compositor
The responsibilities of the Scene must be reduced to painting only so we
can move forward with the layer-based compositing.

This change moves direct scanout logic from the opengl scene to the base
scene class and the compositor. It makes the opengl scene less
overloaded and allows to share direct scanout logic.
2022-02-21 09:33:59 +00:00
Aleix Pol
62637c1a92 seat: Do not assert on corner touch cases
Consider the cases where we get a touch move or touch up but we never
received a touch down before.

In the case of move, we'll simulate a touchDown right there and move on
with reality.
In the case of touch up, we'll just ignore the event as simulating could
just be more confusing.

BUG: 450338
2022-02-21 04:08:43 +01:00
Alex Richardson
886173cabe Reduce ifdefs in Workspace::supportInformation()
All of these preprocessor constants are defined to 0 or 1, so we can use
a ternary expression instead of `#if+#else`.
2022-02-20 21:08:07 +00:00
Aleix Pol
52c9eef122 kwin_wrapper: properly handle SIGTERM signals
QCoreApplication is not signal trap safe, use KSignalHandler to do it
properly.
2022-02-19 02:11:43 +00:00
Xaver Hugl
e9db27d05d backends/drm: ignore enabled state of outputs for the lifetime of layers
A buffer is needed for atomic tests before the output is actually enabled

BUG: 450501
CCBUG: 450358
2022-02-18 18:13:48 +01:00
Kai Uwe Broulik
6c803088da inputmethod: Remove unused references to KStatusNotifierItem
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-18 16:20:50 +01:00
Vlad Zahorodnii
0213661a7c wayland: Rework Xcursor theme loading
Xcursor loading code has hardcoded search paths, in order to take into
account distros installing app data in a different location,
libwayland-cursor sets the ICONDIR to the icon directory computed based
on the install prefix.

However, that won't work with gitlab CI because it relocates binaries. A
more robust way to find cursors would be to use QStandardPaths to find
all the icon directories on the system.

Another advantage of using own cursor loading code is that it allows us
to reuse cursor images that are symlinks. For example, with
breeze_cursors, almost half of the files in the cursors directory are
symlinks.

The main disadvantage of this approach is that we would have to keep the
search paths up to date. However, on the hand, there are not that many
of them, e.g. ~/.icons, ~/.local/share/icons, /usr/share/icons,
/usr/local/share/icons. The last three are implicitly handled by the
QStandardPaths.
2022-02-18 09:59:39 +00:00
Xaver Hugl
7faa2587de backends/drm: fix overscan
Somehow its use got lost in the 5.24 development cycle
2022-02-17 19:41:52 +00:00
Aleix Pol
b1c1603c8c inputmethod: Fix read setting
It's specified as a Path in the kcfg file and the KCM will replace the
/home path into $HOME, and I imagine it may do some others likethat.

BUG: 450430
2022-02-17 15:53:15 +00:00
Arjen Hiemstra
03a3ae666c Use the minimum of workspace area size and panel size for input method placement
Rather than assuming the input panel to always be less than or equal to
the maximized area, ensure it is. This ensures that the input panel gets
placed correctly when there maximized area is smaller, like when there's
a panel on the side.

Additionally, don't skip the entire positioning code when "m_output" is
empty, to avoid the placement not happening when Kickoff is open.
2022-02-17 14:50:24 +00:00
David Edmundson
aab395f07b Check lockscreen status for fullscreen effects
Whilst global shortcuts are blocked by grabbing the keyboard, user set
up manual scripts can still invoke a global action.

Given we already have code to deactivate when locking it makes sense to
also prevent activation.

BUG: 450331
2022-02-17 13:01:57 +00:00
Vlad Zahorodnii
1b4f3960fd effects/contrast: Use QGuiApplication::instance() instead of qApp
qApp is defined differently depending on whether QCoreApplication,
QGuiApplication, or QApplication is included.

Use QGuiApplication::instance() to improve code readability.

CCBUG: 450359
2022-02-17 07:22:25 +00:00