Commit graph

3297 commits

Author SHA1 Message Date
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
Vlad Zahorodnii
9cca0a6f85 effects/blur: 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
Vlad Zahorodnii
4acae79d54 effects/startupfeedback: Add Qt::Widgets dependency
BUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
2ff9093604 effects/desktopgrid: Port to QStyleHints
Let's us avoid making the desktop grid effect depend on qtwidgets.

CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
d6b3b57ba1 effects/zoom: Remove QApplication include
CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
81d6631733 effects/presentwindows: Remove QApplication include
CCBUG: 450359
2022-02-17 07:22:25 +00:00
Vlad Zahorodnii
7ba68fde8c effects/slidingpopups: Avoid using QApplication
CCBUG: 450359
2022-02-17 07:22:25 +00:00
l10n daemon script
9d33190d0d 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-02-17 01:53:20 +00:00
Kai Uwe Broulik
53473d72e6 kwinglutils: Assert glFenceSync
This really should not fail unless we did something seriously wrong
on our end, such as changing GL context during paintScreen.

If we add an invalid `GLSync` to the queue it can lead to very hard
to debug crashes in seemingly unrelated parts of the rendering
process, when the queue is drained, potentially seconds after the
actual failure that occurred here.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 19:06:15 +00:00
Kai Uwe Broulik
2d56154fe8 kwineffects: Support setting opacity on OffscreenQuickView
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 17:29:06 +00:00
Vlad Zahorodnii
c2e3496888 effects/contrast: Remove paint area tracking
Unlike the blur effect, neighbor pixels don't affect the results of the
contrast effect so it doesn't have to extend the painted area.
2022-02-16 16:22:02 +00:00
Vlad Zahorodnii
d06746fa5c scene: Set render target rect in Scene::paintScreen()
This ensures that the render target rect is set when using qpainter
render backend.
2022-02-16 16:04:29 +00:00
Vlad Zahorodnii
2091cb060f effects/highlightwindow: Fix crash
If a window appears on the screen, the highlight window effect will try
to fast-forward animation to the target state by setting the animation
duration to 0. However, TimeLine doesn't like that because it will
eventually lead to division by zero.

This change makes the highlight window effect fast-forward the
transition to highlight or ghost state by using the complete() function.

BUG: 450323
2022-02-16 15:42:55 +00:00
Vlad Zahorodnii
f59a4d6090 Remove dead code in Platform
Software cursor logic has been moved to Scene.
2022-02-16 13:28:33 +00:00
Kai Uwe Broulik
6ab7119d89 Introduce SharedQmlEngine class
Allows to drop the direct dependency on KDeclarative only used
for `QmlObjectSharedEngine` outside of `KCModuleQML`

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-16 12:05:38 +00:00
Vlad Zahorodnii
0c3a8e6f29 scene: Make paintScreen() clip the damage region
paintScreen() already tries to ensure that the damage region doesn't go
outside the scene geometry. With this change, it will try to clip the
damage region to the render target rect, which saves us an extra region
intersection and simplifies code that calls paintScreen().
2022-02-16 07:49:47 +00:00
l10n daemon script
648b2a5bf3 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-02-16 01:49:32 +00:00
Vlad Zahorodnii
a3b5266175 Drop Platform::renderLoop()
Having a render loop in the Platform has always been awkward. Another
way to interpret the platform not supporting per screen rendering would
be that all outputs share the same render loop.

On X11, Scene::painted_screen is going to correspond to the primary
screen, we should not rely on this assumption though!
2022-02-15 18:23:52 +02:00
Vlad Zahorodnii
ba000d5a4e scene: Compute projection matrix based on the render target rect
Neither SceneQPainter nor SceneOpenGL have to compute the projection
matrix by themselves. It can be done by the Scene when setting the
projection matrix. The main benefit behind this change is that it
reduces the amount of custom setup code around paintScreen(), which
makes us one step closer to getting rid of graphics-specific paint()
function and just calling paintScreen().
2022-02-15 14:31:28 +00:00
David Redondo
5caa28c1a3 xwayland: Guard against offers arriving after leaving surface
If the XdndEnter message is handled after leaving the current
wayland surface m_visit will be null.
BUG:449644
2022-02-15 12:28:17 +00:00
Vlad Zahorodnii
7a06ae733c kwinglutils: Drop GLRenderTarget::isRenderTargetBound()
Check whether GLRenderTarget::currentRenderTarget() returns non-null
value instead.
2022-02-15 13:31:10 +02:00
Vlad Zahorodnii
f4f83848b0 kwinglutils: Make GLRenderTarget not store GLTexture reference
This allows us to make the GLRenderTarget a bit nicer when using it to
wrap the default fbo as we don't know what the color attachment texture
is besides its size.

This means that the responsibility of ensuring that the color attachment
outlives the fbo is now up to the caller. However, most of kwin code
has been written that way, so it's not an issue.
2022-02-15 13:30:39 +02:00
Vlad Zahorodnii
dcd1e3b87a kwinglutils: Drop GLRenderTarget::setTextureDirty()
It's effectively unused and removing it allows us to get rid of
GLTexture field, which is very useful for abstracting the concept of a
"render target" across OpenGL and QPainter backends.
2022-02-15 13:02:57 +02:00
Vlad Zahorodnii
436187762e kwinglutils: Deprecate GLTexture dirty state tracking
It's currently being used only by the X11 standalone backend. We should
either port the X11 backend to manual dirty state tracking or waiting
until it gets dropped. The main motivation for getting rid of the dirty
state tracking in the GLTexture is that it keeps kwin open for
alternative opengl wrappers, e.g. QOpenGL, and it simplifies GLTexture
code.
2022-02-15 12:58:43 +02:00
Vlad Zahorodnii
e9af67af3e kwineffects: Add GLTexture::render() overload that takes no scissor region
In many cases, we don't care about the scissor region. This change adds
a relevant overload to make code easier to read.
2022-02-15 12:17:59 +02:00
Vlad Zahorodnii
52beb213e7 kwineffects: Make GLRenderTarget and GLVertexBuffer work without global coords and scale
Because the GLRenderTarget and the GLVertexBuffer use the global
coordinate system, they are not ergonomic in render layers.

Assigning the device pixel ratio to GLRenderTarget and GLVertexBuffer is
an interesting api design choice too. Scaling is a window system
abstraction, which is absent in OpenGL or Vulkan. For example, it's not
possible to create an OpenGL texture with a scale factor of 2. It only
works with device pixels.

This change makes the GLRenderTarget and the GLVertexBuffer more
ergonomic for usages other than rendering the workspace by removing all
the global coordinate system and scaling stuff. That's the
responsibility of the users of those two classes.
2022-02-15 12:17:56 +02:00
Vlad Zahorodnii
d92afc849e kwineffects: Forbid most of operations with invalid render targets
This simplifies a lot of things.
2022-02-15 12:06:50 +02:00
Vlad Zahorodnii
383a5cee0b kwineffects: Remove GLRenderTarget::{attachTexture,detachTexture}
They're unused and immutable render targets are easier to handle.
2022-02-15 12:06:50 +02:00
Vlad Zahorodnii
eea94660dc utils: Extract DamageJournal in its own file 2022-02-15 11:38:51 +02:00
Xaver Hugl
dece547a75 backends/drm: refactor surface handling
In order to support layered rendering and tiled outputs KWin needs to be
able to split rendering of outputs into multiple surfaces. This commit
prepares the drm backend for that, by moving most of the code in EglGbmBackend
out to a EglGbmSurface class, which will later be used for overlay surfaces
and rendering to multiple connectors side by side.

In doing that, this commit also cleans up the code a bit, removes a lot of
now unnecessary multi-gpu stuff and potentially makes modesets a little
bit more efficient by re-using resources more often.
2022-02-15 09:12:23 +00:00
Xaver Hugl
9dc4c7309e backends/drm: move damage tracking into DumbSwapchain 2022-02-15 09:12:23 +00:00
Xaver Hugl
5d317641a4 backends/drm: move damage tracking into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
cfdb303012 backends/drm: inline renderFramebufferToSurface
And also remove an unnecessary makeContextCurrent
2022-02-15 09:12:23 +00:00
Xaver Hugl
c498d31aa7 backends/drm: move makeContextCurrent into GbmSurface 2022-02-15 09:12:23 +00:00
Xaver Hugl
4d0998cfed backends/drm: fix legacy dpms 2022-02-15 08:17:17 +00:00
Vlad Zahorodnii
76dbe9e590 effects/desktopgrid: Remove unused include 2022-02-15 07:21:28 +00:00
Vlad Zahorodnii
e1024d38d1 cmake: Specify link libraries per effect target
This allows to track per effect dependencies more precisely. The main
problem with a library and a comment next to it saying who needs it is
that the comment can get easily outdated.
2022-02-15 07:21:28 +00:00
John Zimmermann
9c65d61b98 utils/serviceutils: compare executablePath against canonical path of exec fields in .desktops
/proc/%/exec always points to the canonical/real path of a binary,
the exec field of a .desktop might contain a symlink and therefore
differ from canonical path.
Explicitely canonicalizing the path in exec prevents this mismatch.
2022-02-14 15:50:24 +01:00
Vlad Zahorodnii
8e05732670 x11: Fix shrinking window size after toggling no border multiple times
The first move() in X11Client::createDecoration() will alter the client
size, which will result in the subsequent resize() incorrectly resizing
to a smaller window size.

In order to fix that issue, this change makes X11Client adjust the
frame geometry atomically after creating or destroying window decoration.

BUG: 449988
2022-02-14 14:00:14 +00:00
Vlad Zahorodnii
c76855520c wayland: Fix maximize mode propagation to decoration
If the window is initially maximized, there won't be any current
decoration when XdgToplevelClient changes the maximize mode, we need to
use m_nextDecoration.

BUG: 450053
2022-02-14 13:41:39 +00:00
Albert Astals Cid
5ddd43958d HighlightWindowEffect: Use the duration parameter 2022-02-14 13:51:02 +01:00
Kai Uwe Broulik
4c0c2cebe6 effects/overview: Add translation domain 2022-02-14 11:36:51 +00:00
Kai Uwe Broulik
2fbc821899 effects: Extract messages from QML files 2022-02-14 11:36:51 +00:00
Vlad Zahorodnii
6182744a2b Add support for xdg_toplevel.configure_bounds()
With the xdg_toplevel.configure_bounds event, the compositor will be
able to indicate the client the maximum desired surface size.

It can be used to prevent mapping too big application windows, etc.
2022-02-14 10:42:32 +00:00
Kai Uwe Broulik
88e36d0b04 Fix build without Qt session manager
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-14 07:58:47 +00:00
Kai Uwe Broulik
7beb3f6ec6 Fix build without tabbox
Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-14 07:58:47 +00:00
Vlad Zahorodnii
3da9e017a0 cmake: Use target-based ecm_qt_declare_logging_category()
This makes CMakeLists.txt code depend less on variables.
2022-02-14 07:29:15 +00:00
l10n daemon script
ead073b0cc 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-02-14 01:42:49 +00:00
Aleix Pol
ad0a35882e inputmethod: Also open the inputm method panel with a pen
BUG: 449888
2022-02-14 00:24:30 +00:00
Nicolas Fella
a2ebad760f Implement services in our QPA
This is required for QDesktopServices to work.

Use QGenericUnixServices like the xcb and wayland QPA

BUG: 446144
2022-02-13 00:41:10 +01:00
Nicolas Fella
77ec43d5e1 Don't force QT_QPA_PLATFORM=wayland
We're setting this env variable because earlier we used it to force kwin to use its special QPA so we need to change that back to something sensible.

However setting it to Wayland breaks apps that ship their own Qt with missing or broken Wayland support.

Set it to be empty instead. Well-behaved Qt apps will use Wayland regardless because of XDG_SESSION_TYPE.

BUG: 450000
2022-02-12 13:57:19 +00:00
Vlad Zahorodnii
9e25fd0468 Add support for xdg_toplevel.configure_bounds()
xdg_toplevel.configure_bounds() allows to indicate the client the
maximum surface size bounds.

wayland-protocols: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/41
2022-02-12 14:14:24 +02:00
Vlad Zahorodnii
a4bb3896bf Schedule workspace repaint when window leaves current desktop
When a window leaves the current virtual desktop, we need to schedule a
workspace repaint so the compositor repaints the old region of the
window on the current desktop.

In hindsight, the scene graph must schedule a repaint, but it's not
doable with the current effects api, it will be changed with future
refactoring changes.

BUG: 444172
2022-02-12 12:06:00 +00:00
l10n daemon script
d7ee3f1221 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-02-12 01:43:02 +00:00
Aleix Pol
c9715a828d Initialize the KSldApp after we connect
In some cases, initialize() will emit an aboutToLock() signal that we
need to catch. Otherwise LockOnStart finds its m_waylandFd=-1
2022-02-11 16:35:17 +00:00
Alexander Lohnau
e70ec569e3 Fix loading of effect if plugin defined X-KDE-Library
Otherwise we get the filename to the library and not the KPackage.

The plugin having this set is most likely a leftover, because KPackage plugins
to not need to define a library.

BUG: 449881
2022-02-11 15:40:42 +00:00
Vlad Zahorodnii
712dbc4122 wayland: Fix mispositioned decoration tooltips
QPlatformScreen::virtualSiblings() must return a list of screens on the
virtual desktop, otherwise QToolTip will use
QGuiApplication::primaryScreen() instead of looking up the screen where
the decoration tooltip must be shown using QDesktopWidget::screenNumber().

BUG: 432860
2022-02-11 10:08:19 +00:00
David Edmundson
12427932de Make openGL context current when recording frame triggered by cursor move
recordFrame requires an openGL context. This is typically done after a
frame is rendered, but when we send a frame after a cursor move this is
not guaranteed.

BUG: 448162
2022-02-11 09:24:12 +00:00
Jan Blackquill
c0cb349cb8 effects/DesktopGrid: use delta, not absolute time for MotionManager
Despite the argument naming, the input for WindowMotionManager::calculate is supposed to be a
delta, not an absolute time. Giving it a delta fixes the PresentWindows in the DesktopGrid.

BUG: 443971
2022-02-11 09:04:30 +00:00
Julius Zint
43bcd57853 Fix window decoration quads in OpenGL scene
The quads for the left and right window decorations were broken in
3b4d55837. The problem is only visible for window decorations with more
than one color.
2022-02-11 08:15:37 +00:00
l10n daemon script
97dde989c3 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-02-11 01:45:31 +00:00
Aleix Pol
725d61877c screencast: have our streams provide SPA_META_Header
It can be useful for clients to know what's going on in a specific
stream.
2022-02-10 23:57:09 +00:00
Vlad Zahorodnii
0574a7534a wayland: Make the launcher not restart kwin_wayland if it crashes at shutdown
Currently, if kwin_wayland crashes at shutdown, the launcher can
potentially spawn it again. This change addresses that issue by making
the wrapper ignore the QProcess::finished() signal.
2022-02-10 12:29:54 +00:00
Tobias C. Berner
feffa184fb Add missing errno.h include 2022-02-10 10:14:02 +01:00
Vlad Zahorodnii
c54937b2ad Avoid mixing current and next state
Mixing of current and next state can create all sorts of undefined
behavior, e.g. windows not moving to the desired location or
experiencing issues when tiling a maximized window.

BUG: 449541
2022-02-10 08:43:17 +00:00
Vlad Zahorodnii
3fb6901646 effects/overview: Hide selection rect during dnd
BUG: 448573
2022-02-10 08:15:00 +00:00
Tobias C. Berner
17fc13f100 Add missing errno.h include 2022-02-10 09:11:31 +01:00
Vlad Zahorodnii
ed670377c8 effects/overview: Don't show minimized windows in desktop thumbnails
BUG: 448850
2022-02-10 07:23:30 +00:00
Vlad Zahorodnii
0ad239a92d Fix mouse pointer disappearing after using zoom effect on X11
Currently, the Cursors::currentCursorChanged signal is wired to the
updateCursor() function which calls xcb_xfixes_hide_cursor() or
xcb_xfixes_show_cursor() depending if the cursor is hidden. However, the
currentCursorChanged signal can be emitted if the cursor changed, e.g. a
new pixmap attached, or its visibility status changes.

The zoom effect hides the pointer, but when user hovers ui elements, it
will most likely change and result in more than one xcb_xfixes_hide_cursor()
calls.

It appears like xcb_xfixes_hide_cursor() is implemented as a reference
counter, i.e. if xcb_xfixes_hide_cursor() is called two times, then you
must call xcb_xfixes_show_cursor() two times as well.

This change adds a dedicated signal to indicate whether the cursor is
hidden to avoid calling xcb_xfixes_hide_cursor() multiple times while
the screen is scaled.

BUG: 448537
2022-02-10 07:07:03 +00:00
Michail Vourlakos
bc145b614c support kdecoration2 blurregion
--use kdecoration2 blurred regions to adjust blur effect appropriately when
needed

CCBUG:395725

Requires: https://invent.kde.org/plasma/kdecoration/-/merge_requests/17
2022-02-09 21:00:07 +00:00
Vlad Zahorodnii
c0d0fab049 x11: Prefer kwinApp()->x11RootWindow() over rootWindow() 2022-02-09 19:10:58 +00:00
Vlad Zahorodnii
ec7198ee33 x11: Prefer kwinApp()->x11Connection() over connection()
With connection(), we will look up the x11 connection property on
kwinApp() object, which is less efficient than just calling a method on
the app object.
2022-02-09 19:10:58 +00:00
Vlad Zahorodnii
b62630c8ac Allow applying output changes to disabled outputs in base Platform::applyOutputChanges()
Since the base Platform::applyOutputChanges() implementation only
applies changes to enabled outputs, it's not possible to re-enable a
previously disabled output.
2022-02-09 15:47:35 +00:00
Vlad Zahorodnii
e419faee39 effects/fallapart: Avoid animating windows while there's a fullscreen effect
While there's a fullscreen effect, the fall apart effect should avoid
animating windows as it can corrupt or interfere with the active full
screen effect. This matches behavior of many other animation effects in
kwin.

BUG: 449844
2022-02-09 15:09:58 +02:00
Vlad Zahorodnii
20399e0c42 effects/scale: Make it not grab open and close roles
Otherwise the fall apart effect will refuse to work; the fade effect
already works like that.

BUG: 449832
2022-02-09 11:49:00 +02:00
Xaver Hugl
d0c12ac54d backends/drm: ignore modifier env var if modifiers are not supported
Otherwise we might crash
2022-02-08 20:09:08 +01:00
Vlad Zahorodnii
11175cb05e kcm/screenedge: Fix default value for TabBox.BorderActivate option
The TabBox does not reserve the left screen edge by default.

BUG: 449720
2022-02-08 08:09:25 +00:00
l10n daemon script
1386c4325c 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-02-08 01:45:25 +00:00
Vlad Zahorodnii
bb935aa5de Fix decoration rendering with scale factor < 1
QPainter won't let paint with a device pixel ratio less than 1. There
are used to be workarounds to force a device pixel ratio of 1, but they
were removed with fractional scaling corner fix.

This change makes sure that the decoration renderer forces a device
pixel ratio of 1 if the output's scale factor is less than 1 so
calculated texture coordinates match where window borders are rendered
in the texture atlas.

BUG: 449681
2022-02-07 11:45:31 +00:00
Ben Cooksley
a428630ea4 Purge all references to download.kde.org, replacing them with the correct endpoint of autoconfig.kde.org.
CCMAIL: plasma-devel@kde.org
CCMAIL: distributions@kde.org
2022-02-07 06:12:40 +13:00
Xaver Hugl
569a994644 backends/drm: don't log addFB failure for direct scanout
It can spam the log and isn't really useful

BUG: 449556
FIXED-IN: 5.24
2022-02-06 00:10:14 +00:00
Vlad Zahorodnii
6a0430eaa0 Fix builtin effects not loading
The api of kcoreaddons_target_static_plugins() has changed so static
plugins must be linked with kwin_x11 and kwin_wayland directly.
2022-02-06 01:29:41 +02:00
Xaver Hugl
e8eb55ad2e backends/drm: port away from mode indices
They're error prone and don't really work for changing modes. Having
a current mode in DrmConnector also doesn't work well together with
the transactional style of how DrmPipeline operates
2022-02-05 14:16:18 +00:00
Vlad Zahorodnii
03efdabf26 Unset electric border after interactive move
AbstractClient::setQuickTileMode() no longer updates electric border
mode, which can leave AbstractClient::electricBorderMode() with an old
value at the next interactive move and potentially result in quick
tiling not work if the user decides to untile and then tile the window
again while still holding left button.
2022-02-03 21:51:01 +02:00
Vlad Zahorodnii
185395caab wayland: Simplify xdg-shell's maximize mode implementation
XdgToplevelClient::changeMaximize() will unset quick tile mode after
maximizing the window.
2022-02-03 18:38:25 +00:00
Vlad Zahorodnii
6e26494b4e Compute tile geometry without relying on electric border mode
Quick tiling allows you tile a window so it covers one half or a quarter
of the screen. Electric border is basically interactive flavor of quick
tiling, i.e. it allows you to drag a window to the top screen edge to
maximize it.

Currently, it's confusing that tile geometry is computed based on the
electric border mode.

This change converts electricBorderMaximizeGeometry() in a helper that's
used to compute the tile geometry given the desired mode and output
containing the specified QPoint. With that, setQuickTileMode() won't
need to set electric border anymore, which makes tiling code more
comprehensible, but by not a lot unfortunately.
2022-02-03 18:58:47 +02:00
Vlad Zahorodnii
5cfa4bae77 wayland: Simplify xdg-shell's fullscreen mode implementation
XdgToplevelClient::setFullScreen() won't change the geometry
immediately, so workspace()->updateFocusMousePosition() can be removed.

Also, input handling code takes care of updating the cached mouse
position in the workspace.
2022-02-03 16:23:34 +00:00
Vlad Zahorodnii
77f712d3a7 Fix tracking of geometry restore with electric maximize
If the user wants to move a tiled window, but changes their mind and
tiles the window back to the previous position, the geometryRestore()
will be corrupted because initialMoveResizeGeometry() is the same as the
geometry of the window in the tiled mode.

This change fixes tracking of the geometry restore by precomputing the
geometry restore when starting interactive move. That way, if the window
is untiled and tiled again without release left pointer button, the
geometry restore will be set to the correct value in setQuickTileMode().

This change also adjusts the test suite so such a subtle case won't be
broken again without noticing it.
2022-02-03 16:01:45 +00:00
David Redondo
b1d0928c8e xwayland: Handle drag being cancelled
There was no handling for the drop being cancelled at all, leading to
leaked WlVisit and XtoWlDrag objects. X clients could also be confused
about the state of the drag and for example not being able to start another
drag.
BUG:449362
2022-02-03 14:01:14 +00:00
Xaver Hugl
843cee3d66 Scene: set painted_screen in paintScreen
If it's not set but used by EffectsScreen that can cause crashes
2022-02-03 05:12:24 +01:00
Ismael Asensio
3f29ad6b22 effects/overview: Prevent undesired dragging of desktops bar
Flickable by default allows swiping via click-and-drag or
scrolling with the mousewheel, which is weird when the content
is smaller than the available space.

Inhibit this behavior unless there's a need for scrolling.
2022-02-02 21:22:16 +01:00
Vlad Zahorodnii
4b97bc481e effects/presentwindows: Fix crash
The present windows effect can crash because a null (0) EffectScreen can
be passed to EffectsHandler::clientArea(), which is a bug.

Use EffectsHandler::virtualScreenGeometry() to get the bounding geometry
of all outputs.

BUG: 449508
2022-02-02 19:00:50 +02:00
Vlad Zahorodnii
749cf798ce wayland: Fix spectacle not covering fullscreen windows
The most recently activated window can be an overlay window that covers
all screens. If its center is not at an output with the fullscreen
window, then the fullscreen window's stack position won't be lowered. In
order to fix that, this change makes isActiveFullscreen() use
Toplevel::isOnOutput(), which uses geometry info, to check if both windows
are on the same output.
2022-02-01 19:18:13 +00:00
Severin von Wnuck
5fe9fd13ad Add timestamp to window decoration mouse events
Since 4881dd63 replaced the double click timer for OffscreenQuickView
with a time check, we need to make sure the timestamp from
XInput/libinput is passed on to the actual QMouseEvent.

BUG: 448477
2022-01-31 17:54:28 +00:00
Xaver Hugl
e6fb6ff5d3 backends/x11/standalone: only use sRGB configurations with depth 24
Credit goes to Mario Kleiner, who bisected this issue.

BUG: 423014
2022-01-31 16:23:16 +00:00
Vlad Zahorodnii
fde0e243d9 wayland: Let user set "no border" property in more cases
It can also be applied to client-side decorations. As long as the
compositor can ask the client to use some specific decoration mode, the
"no border" property can be set.
2022-01-31 15:55:25 +00:00
l10n daemon script
f1974db5c9 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-01-31 01:43:23 +00:00
Vlad Zahorodnii
aebe1ab3a4 backends/drm: Detect more connector types 2022-01-28 14:41:16 +00:00
Xaver Hugl
bbc5952f19 backends/drm: don't assume we shouldn't use modifiers without IN_FORMATS
Instead, use a linear modifier
2022-01-27 20:46:30 +00:00
Xaver Hugl
216d0d6c45 backends/drm: only accept xrgb with legacy
xrgb is effectively universally supported, other formats may not be.
In order to make sure things work everywhere, assume only xrgb is supported.
2022-01-27 20:46:30 +00:00
Xaver Hugl
83275c3f31 backends/drm: add warning if no matching mode can be found 2022-01-27 18:40:00 +00:00
Xaver Hugl
74b1fb0ab5 backends/drm: round refresh rate values from KScreen configs
The implicit cast effectively rounds the value down, which make the
refresh rate be different from what KScreen actually wrote.
A better fix would be to use integers instead of floating point numbers
but that needs to happen in KScreen.

BUG: 448778
2022-01-27 18:40:00 +00:00
Xaver Hugl
b0173c236c backends/drm: don't read configuration of zero outputs
Doesn't make any sense and can cause crashes
2022-01-27 18:40:00 +00:00
Xaver Hugl
d67a0b006a backends/drm: guard against wrong KScreen configs 2022-01-27 18:40:00 +00:00
Aleix Pol
d1698e1270 Fix xrandr primary when the new screen is the connected one
We'd trigger updatePrimary before Xwayland had reacted to the new output
so we wouldn't end up calling xcb_randr_set_output_primary() as
necessary.

BUG: 449099
2022-01-27 11:31:11 +00:00
Arjen Hiemstra
e6c1ccbd3b Fix drag and drop with touch between different windows
When dragging from one window to another, we may end up in a data_device
that didn't get "data_device_start_drag". In that case, the internal
touch point serial will be incorrect and we need to update it to the
serial from the seat. The serial stored in the seat is changed to
std::optional so we can properly check if it is set.
2022-01-27 10:44:58 +00:00
David Edmundson
b3abe7526b Fix OpenGLSafePoint guard
qScopeGuard runs the method when the function goes out of scope. Without
a local variable this is immediately.
2022-01-26 22:19:31 +00:00
Vlad Zahorodnii
09fa095039 Drop unused Screens::intersecting() 2022-01-25 17:56:40 +00:00
Vlad Zahorodnii
7120348932 Make checkWorkspacePosition() work without client geometry
A good portion of geometry handling code was written during the X11
times. The main difference between X11 and Wayland is that kwin doesn't
know where a window will exactly be after resize() or moveResize().

In order to handle Wayland specifics, every window has a bounding
geometry that is being manipulated by move(), resize(), and moveResize().
The frameGeometry(), the clientGeometry(), and the bufferGeometry() are
not manipulated by move(), resize(), and moveResize() directly. Almost
everything that manipulates geometry should use moveResizeGeometry().

This creates a problem though, since the clientGeometry() will be
updated only after the client provides a new buffer, kwin has absolutely
no idea what the client geometry for a given move resize geometry will
be.

Another side of the coin is that decoration updates are performed
asynchronously on wayland, meaning that you cannot use border properties
for anything related to geometry handling and you should avoid using
borderLeft(), borderTop(), borderRight(), and borderBottom() in general.

clientGeometry(), bufferGeometry(), and border*() are good only if you
want to forward an event or render something. They can't be used for
manipulating the geometry.

Unfortunately, AbstractClient::checkWorkspacePosition() needs both,
which is a bit of a problem. To add more oil to the fire, contents
of a decorated window can be snapped to a screen edge. This goes against
the nature of geometry updates on wayland, where we try to indicate
the bounds of the frame geometry and avoid using client and buffer
geometries.

In order to make geometry handling more correct on wayland, this change
removes the ability to snap the contents of a decorated window to a
screen edge. This allows to avoid using the client geometry in
checkWorkspacePosition(), which is a very important function that ensures
the window is inside the workspace.

There is nothing wrong with snapping the frame rather than its contents
and that's what kwin used to do. It was changed with the removal of
"Display borders on maximized windows" option, the relevant commit
didn't provide any reasoning behind the change.
2022-01-25 17:56:40 +00:00
Vlad Zahorodnii
e2a393ce2d Move utils.h file to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
8dd1d86310 Move SubSurfaceMonitor to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
0e1d65d5a2 Move opengl context attribute builders to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
293b2244ac Move xcbutils to utils directory 2022-01-25 16:56:33 +00:00
Vlad Zahorodnii
e1d47b5946 effects/startupfeedback: Use clamp to edge wrap mode
The dpi of bouncing icon may not match the dpi of the screen, which
can make the linear filter sample texels from the opposite edge when
using the default wrap mode.

BUG: 448947
2022-01-25 15:43:08 +00:00
David Redondo
91632639b1 xwayland: Do not remove X11Source while drag is going on
setWlSource will delete the X11Source while XToWlDrag did not
finish leading to potential crashes. Since it's only set when
creating a WlToXDrag, only remove it in this case.
We can also replace the virtual with a type check if we have to do
it anyways which also makes it clearer what is going on.
2022-01-25 12:21:55 +01:00
David Redondo
3f7133a022 Apply timeout to startfeedback for xdg activation
Since xdg activation startups do not time out automatically
run a timer for each start up in the effect.
BUG:438622
FIXED-IN:5.24
2022-01-25 10:15:12 +00:00
David Redondo
6b1ccb8bf8 xwayland: Fix out of bounds write
Detected using ASAN, declaration of the type is:
typedef union xcb_client_message_data_t {
    uint8_t  data8[20];
    uint16_t data16[10];
    uint32_t data32[5];
} xcb_client_message_data_t;
2022-01-25 09:07:26 +00:00
Vlad Zahorodnii
6a0fd1d608 xwayland: Emit AbstractDataSource::aboutToBeDestroyed() signal
The seat needs the AbstractDataSource::aboutToBeDestroyed() signal to
properly clean up its tracked primary selection.

BUG: 449101
2022-01-25 08:32:09 +00:00
Vlad Zahorodnii
c793dd93d2 Make data source objects "parentless"
The SeatInterface cleans up currentSelection and currentPrimarySelection
when the AbstractDataSource::aboutToBeDestroyed() signal is emitted, but
since the data source and primary data source have parent objects, they
can be potentially destroyed without emitting the aboutToBeDestroyed()
signal and thus leaving dangling pointers in SeatInterface.

CCBUG: 449101
2022-01-25 09:59:59 +02:00
Alexander Lohnau
c4bcfd0b8c Utilize KCModuleLoader::loadModule for loading KCMs
This will take care of showing user-visible error messages in case the
plugin does not exist.

While we get a log message from KCoreAddons with the change of 728b449891,
the user does not get prompted. Especially if the kcmshell/systemsettings
was not opened from the command line, spotting those error messages is more difficult.
2022-01-25 05:26:43 +00:00
David Edmundson
fdea6d151e Fix xwayland DND crash
Drag and drop objects slightly outlive wayland's DND concept as we have
to cancel the client and wait for a response.

This normally is fine, except in the case that the drag ended because
the sender quit.

Calling setWlSource on drag ends creates a matching pair with
Dnd::startDrag where we first set the source and has parralels with
clipboard.

Selection::handleSelectionRequest checks for the presence of a source.

I could not reproduce the original bug.

BUG: 448920
2022-01-24 20:43:00 +00:00
Xaver Hugl
db1f7414b7 backends/drm: add additional check for direct scanout buffers
While in principle Mesa should already check if the buffer can be scanned
out, this may not always work. If we can't create a framebuffer object for
the buffer, fall back to compositing.

CCBUG: 448818
2022-01-24 21:23:05 +01:00
Xaver Hugl
c952c3a3ae backends/drm: add environment variable KWIN_DRM_NO_DIRECT_SCANOUT
Can be useful for debugging
2022-01-24 21:23:03 +01:00
Vlad Zahorodnii
52bc46069e plugins/screencast: Always clear bitmap cursor
Otherwise the contents of the bitmap can be undefined if the cursor
image is null.
2022-01-24 19:39:09 +00:00
Vlad Zahorodnii
d2867fc4a0 plugins/screencast: Hard-code the maximum cursor size to (256, 256)
XCURSOR_SIZE * scale factor is not the way to compute the current cursor
size. For example, with breeze cursor theme at an output with a scale of
2 and cursor size 24, cursor images will have the effective size of (64, 64).

Also, the cursor can change when passing over user interface elements.

In order to accommodate for all of that, this change makes kwin reserve
enough of space for a cursor of size 256x256. "256" is a magical number
that comes from DRM. With many drivers, the maximum cursor size is 256.

BUG: 448840
2022-01-24 19:39:09 +00:00
Vlad Zahorodnii
edb1a41148 plugins/screencast: Provide hidpi cursor bitmaps 2022-01-24 19:39:09 +00:00
Vlad Zahorodnii
b9b7357086 wayland: Fix getting the last configure event
If there's only one configure event that changes the position of the
window and it gets acknowledged but no buffer is attached yet, and a new
configure is sent, then the ConfigurePosition flag won't be inherited
by the new configure event and the window will be misplaced.

In order to fix that, this change makes XdgSurfaceClient pop the last
acknowledged configure event from the m_configureEvents list only when
it's about to be applied for sure.

BUG: 448856
2022-01-24 18:55:25 +00:00
Vlad Zahorodnii
8f941e5250 build: Use target based apis to populate kwin target's sources
Almost all kwin target sources are populated using target-based API,
except the dbus stuff. The upstream still requires using variables.
2022-01-24 11:29:36 +00:00
Vlad Zahorodnii
fccbfd8654 wayland: Simplify borderless maximized window handling
setNoBorder() checks window rules and it doesn't have an immediate
effect on the geometry.
2022-01-24 09:50:30 +00:00
Xaver Hugl
b5d2b0fb3b backends/drm: do current crtc check without detachments 2022-01-24 09:13:08 +00:00
Xaver Hugl
ca6fcbb2a1 backends/drm: make finding connector<->crtc combinations more efficient
Encoders are not really relevant for the test result, except that one of
the encoders for the connector must be compatible with the crtc.
The kernel usually exposes only a single encoder per connector for this
reason, but if a driver exposes multiple then that means KWin will do a
lot more tests than is necessary.
In order to prevent that from happening, do fewer syscalls and simplify
code, only check supported encoders once per connector.
2022-01-24 09:13:08 +00:00
l10n daemon script
32bdf28868 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-01-24 01:42:58 +00:00
l10n daemon script
4dc7560c9c 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-01-23 01:47:48 +00:00
Ismael Asensio
58a8358636 kcm/screenedges: Fix default indicator for corner ratio
When setting the default value for `ElectricCornerRatio` in the UI form
we also need to update the default indicator for this field.

*Default value for this setting is 25%*
| BEFORE | AFTER |
|---|---|
|![screenedges_25_before](/uploads/2e9f21627cc05cd12fd45ec1a019b89e/screenedges_25_before.png)|![screenedges_25_after](/uploads/7106341983e4cce0a4fb26000fb8583f/screenedges_25_after.png)|

BUG: 448886
FIXED-IN: 5.24
2022-01-21 20:21:40 +00:00
Vlad Zahorodnii
b572aadfd5 wayland: Allow setting "no border" flag even without xdg decoration
Historically, noBorder() was used for two things:

* as a substitute for AbstractClient::isDecorated()
* to determine whether the AbstractClient should have a decoration

With async decoration updates refactoring, a few things around
noBorder() have changed, which exposed an existing bug in the handling
of borderless maximized windows.

It's possible to have a case where an initially maximized window makes
an xdg_toplevel.set_maximized request before the initial commit, but
creates the decoration object after the initial commit.

Since XdgToplevelClient::userCanSetNoBorder() would return false when
maximize() is called in XdgToplevelClient::initialize(), m_userNoBorder
won't be updated and therefore the window can end up having a server
side decoration.

Previously, it wasn't the case because kwin would do nothing if the
decoration is installed and its preferred mode changes after the initial
commit but before the surface is mapped. With async decoration fixes,
kwin would react as expected, which unfortunately has exposed the bug.

The root cause of the problem is the fact that noBorder() is overloaded,
which makes it error-prone.

This patch changes how the noBorder property is treated. Now, it only
indicates whether the compositor wants the window to have no borders. If
noBorder() is true, it means that the compositor doesn't want the window
to have a server-side decoration; on the other hand, if noBorder() is
false, it doesn't imply that the window should have a decoration.

BUG: 448740
2022-01-21 14:59:42 +00:00
Vlad Zahorodnii
151be4584c Prefer isDecorated() over noBorder() when checking if window is decorated 2022-01-21 14:59:42 +00:00
Vlad Zahorodnii
87f2f9001d x11: Don't create decoration input extent window when running on Wayland
Input redirection takes care of handling resize only borders and
relevant event handling code in X11Client has been disabled for a while.
2022-01-21 14:37:02 +00:00
Vlad Zahorodnii
e10cf2a658 x11: Make X11Client not grab pointer when starting interactive move or resize
X11Client can grab pointer when starting interactive move or resize so
all pointer events go to it and kwin can update the move resize geometry
based on the current interactive move-resize mode.

However, on Wayland, X11Client::motionNotifyEvent() is disabled and
pointer events go through a code path that requires no X11 pointer grab.
2022-01-21 14:03:28 +00:00
David Edmundson
f2d3c5289f Only consider the screen lock shown after the screen window is mapped
This signal is sent back to the ksldapp after the greeter has registered
a window with the compositor. Only once ksldapp gets this signal does it
release the lock delaying suspend.

With xdgshell/layershell we have a roundtrip of configuring before the
window is even exposed, so we move to a different signal. This also
helps encapsulate lockscreen code.

Ideally we want to add code tracking frame rendering per screen tracked
too, but that would be based off this change.

CCBUG: 316734
2022-01-21 13:36:39 +00:00
Alexander Lohnau
32785ec1f3 KWin decorations: Fix KCM not refreshing after clicking "Use"-button in KNS dialog
CCBUG: 448749
2022-01-21 13:06:49 +00:00
Vlad Zahorodnii
59b21a0130 Fix -Wreorder-ctor 2022-01-21 11:33:42 +00:00
Vlad Zahorodnii
45c560ea06 Fix typo 2022-01-21 13:28:19 +02:00
Vlad Zahorodnii
85c07df3b3 Port away from KGlobalAccel::getGlobalShortcutsByKey()
KGlobalAccel::getGlobalShortcutsByKey() has been deprecated in favor of
KGlobalAccel::globalShortcutsByKey().
2022-01-21 12:02:40 +02:00
Vlad Zahorodnii
813d861ea6 Fix -Wunused-variable 2022-01-21 11:57:21 +02:00
Aleix Pol
354857e9f1 mouseclick: Also decorate tablet events
BUG: 426584
2022-01-21 09:33:13 +00:00
Aleix Pol
324b172a26 Also redirect tablet events to the effects infrastructure 2022-01-21 09:33:13 +00:00
Mouse Zhang
184cddda4c effects/eyeonscreen: When there are multiple screens, all desktops will be zoomed. 2022-01-21 10:58:00 +02:00
David Edmundson
67205c9133 [Xwayland] Avoid syncing cursor shape during move resize operations
On wayland cursors are managed by kwin. During a move resize operation
kwin updates its own cursors  in pointer_input. There is no need to sync
any cursor changes back to the X server as we end up setting it twice.
2022-01-21 10:53:33 +02:00
Weng Xuetian
e64f60ce08
Fix force xrgb 8888
19c471405e7eb4b6026db24d776d205125dbc013 introduced a regression if
there are two gbm backend and the backend fail to choose drm format.

This fix does two things:
1. Current buffer format should not be reset after create new buffer,
   otherwise current.format may just be empty after resetOutput.
2. force xrgb 8888 need to be set on the primary backend.

BUG: 448790
2022-01-19 15:46:38 -08:00
Niklas Stephanblome
f81e84412e effects/presentwindows: Do not highlight windows based on mouse if user is currently typing
If the user is currently typing, do not highlight windows based on the mouse position. If the user types a window title before the effect opening animation is finished, he ends up in a situation where only one window is on the screen but it is deselected (because the mouse is not on the window) or another window is selected because of the mouse. With this change, the mouse input does not overwrite the window highlighting based on the search entered **if the user is currently typing.**
2022-01-19 14:45:41 +00:00
Xaver Hugl
5b86afa6f0 effecst: disable launch feedback effect if cursor is hidden
Gets annoying with touch
2022-01-19 12:36:29 +00:00
Xaver Hugl
50c167c94b backends/drm: fix reallocation check
When no modifiers are used at all, we shouldn't check them.

BUG: 448557
2022-01-19 10:31:33 +00:00
Xaver Hugl
e0a8fa778e backends/drm: fix output changes with the placeholder output
As the placeholder output gets added or removed in response to other outputs
getting enabled or disabled, the output list may change while iterating over
them and applying changes.

BUG: 448454
BUG: 448474
CCBUG: 448697
FIXED-IN: 5.24
2022-01-18 21:36:23 +00:00
Vlad Zahorodnii
2cf6fc82c4 Make AbstractOutput::sendToOutput() do nothing if the window is on the given new output
Currently, finishInteractiveMoveResize() relies on a hidden behavior
in the sendToOutput() function that makes it treat fullscreen windows
differently, which is confusing.

With this change, finishInteractiveMoveResize() will use the
checkWorkspacePosition() function to make sure that the geometry of the
fullscreen window is adjusted to the new monitor. It allows to make
sendToOutput() more straightforward.

It also fixes checkWorkspacePosition() using wrong geometry type in the
fullscreen window path.
2022-01-18 10:00:10 +02:00
Vlad Zahorodnii
17445d19d0 wayland: Delete X11 unix socket left after previous compositor
If the previous compositor has crashed, the unix socket will be kept
around and listen_helper() will fail.
2022-01-18 07:26:41 +00:00
Vlad Zahorodnii
fcb4df96e1 Avoid updating geometry restore after finishing move or resize
A while ago, geometryRestore() had to have a sane value even if the
window is not maximized because checkWorkspacePosition() used it.

Since checkWorkspacePosition() doesn't use geometryRestore() anymore, we
can stop updating the geometry restore.
2022-01-17 17:08:34 +02:00
Vlad Zahorodnii
ab824959f6 Fix geometryRestore() handling with maximize quick tile mode
geometryRestore() is no longer updated after mapping the window, so
setQuickTileMode() has to update geometryRestore() explicitly to the
correct value.

With this change, geometryRestore() will be updated as follows:

* if the window is tiled, geometryRestore() is valid, nothing to do
* the window has been dragged to the top edge, set geometryRestore() to
  the geometry that the window had when starting move
* otherwise, use the current move resize geometry
2022-01-17 13:02:48 +00:00
Vlad Zahorodnii
fce4b635fb wayland: Remove StackingUpdatesBlocker in XdgToplevelClient::changeMaximize()
The maximized state doesn't affect the window's stack layer.
2022-01-17 12:40:48 +00:00
Vlad Zahorodnii
df913bdc50 Remove some unintuitive code in AbstractClient::setQuickTileMode()
After calling setMaximize(), the window should cover the maximize area.
The commit message of 516ea86341 doesn't
explain why only the y coordinate is enforced or why the x coordinate is
not enforced.

In order to make some sense of the code, this change removes the semi-
random enforcement of the y coordinate.
2022-01-17 12:22:14 +02:00
Vlad Zahorodnii
3ba316e6bf wayland: Don't raise window when entering fullscreen mode
If the window is inactive and it enters fullscreen mode for some reason,
it can create a situation where keyboard goes to a window occluded by
the fullscreen window.

This change makes XdgToplevelClient::setFullScreen() not raise the
window. It's the responsibility of whoever requested the fullscreen mode
change.

If the configure event is acknowledged, the window's stack layer will be
invalidated and recomputed. If the window is active, it will be promoted
to the ActiveLayer, otherwise its stack position won't change.
2022-01-17 11:45:06 +02:00
Xaver Hugl
85cd40c49a backends/drm: remove unused variable 2022-01-17 08:56:41 +00:00
Xaver Hugl
090b687126 backends/drm: prevent some detachments 2022-01-17 08:56:41 +00:00
Vlad Zahorodnii
0c78da0e3a wayland: Make fullscreen and maximize mode not affect interactive resize
dontInteractiveMoveResize() was added to workaround kwin sending bad
configure events when double clicking mpv to make it fullscreen.

With async geometry updates fixed, dontInteractiveMoveResize() can be
finally removed.

Another reason to remove dontInteractiveMoveResize() is that it can make
kwin crash with a debug build. For example, if you enable resizing
maximized windows in breeze decoration settings and resize a maximized
window, kwin would eventually crash in
the AbstractClient::handleInteractiveMoveResize() function because neither
isInteractiveMove() nor isInteractiveResize() return true.
2022-01-17 08:38:03 +00:00
Xaver Hugl
b2d401cddb backends/drm: re-add KWIN_FORCE_SW_CURSOR
It was accidentally dropped
2022-01-16 18:19:04 +01:00
Weng Xuetian
791b0bb296 Do not remove WAYLAND_DISPLAY environment variable for input method.
Based on the implementation of wl_display_connect, WAYLAND_SOCKET is
always preferred over WAYLAND_DISPLAY, which means it is OK to have both
of them set. This allows subprocess of input method to have the correct
WAYLAND_DISPLAY variable set.
2022-01-15 19:36:40 +00:00
Xaver Hugl
de7b429528 backends/drm: remove the now unnecessary check for supported formats
As formats are per output and also checked on crtc changes, there
is no reason to restrict used formats to those that are supported
by all primary planes anymore.
2022-01-14 20:09:03 +01:00
Xaver Hugl
fe9a3f45c0 backends/drm: ensure correct format+modifiers pairs for surfaces
When the crtcs get switched around between outputs, their primary
planes and thus the supported formats also get switched around. In
order to make sure that doesn't cause any problems, always check
whether or not the format+modifiers used are supported.
2022-01-14 20:06:05 +01:00