Commit graph

5212 commits

Author SHA1 Message Date
Andreas Cord-Landwehr
230c5cc4f7 Include missing cmath header 2023-04-12 18:44:00 +02:00
Nate Graham
d25b9ebdb1 kcms/rules: improve text for window rules with descriptions
In particular, explain what all of the the focus stealing prevention
and protection settings do.

My understanding of the different modes comes from reading the code
and code comments in activation.cpp.

CCBUG: 458976
2023-04-12 14:03:52 +00:00
Xaver Hugl
b14f7959eb backends/drm: add another multi gpu fallback
With the dmabuf multi-gpu path, a buffer is imported to the secondary GPU
and presented directly, but importing a buffer that's usable for scanout
is not possible that way on most hardware. To prevent CPU copy from being
needed in those cases, this commit introduces a fallback where the buffer
is imported for rendering only, and then copied to a local buffer that's
presented on the screen.

CCBUG: 452219
CCBUG: 465809
2023-04-12 15:28:35 +02:00
Xaver Hugl
7bb56eb363 platformsupport/scenes/opengl: move egl dmabuf format queries to KWinEglDisplay 2023-04-12 15:25:41 +02:00
Xaver Hugl
94ac8d235b platformsupport: remove initBufferConfigs
Instead, rely on EGL_KHR_no_config_context everywhere except the standalone x11 backend
2023-04-12 15:25:21 +02:00
Xaver Hugl
57c7eccb32 libkwineffects: extract most useful kwinglplatform bits to a separate class 2023-04-12 15:16:33 +02:00
Xaver Hugl
ab7286fad1 platformsupport/scenes: move egl context into a separate class 2023-04-12 15:01:51 +02:00
Xaver Hugl
48fb07b367 platformsupport/scenes: move egldisplay code into a helper class 2023-04-12 14:57:49 +02:00
Xaver Hugl
acf38d364b backends/drm: add linear dmabuf multi gpu fallback 2023-04-12 13:41:10 +02:00
Xaver Hugl
3c37717121 backends/drm: add more logging for multi gpu 2023-04-12 13:41:10 +02:00
Vlad Zahorodnii
cae64719ec Install kwin_export.h in kwin directory
It allows to build a third party effect. In addition to that, it makes
sense to keep kwin things in a kwin directory.
2023-04-11 19:23:52 +00:00
Noah Davis
616783d892 Blacklist Spectacle for all window open/close effects
Spectacle needs to be blacklisted in order to stay out of its own
screenshots.

BUG: 467890
BUG: 463105
CCBUG: 465784
2023-04-11 19:11:56 +00:00
Ismael Asensio
d4d5e3b7a8 kcm/rules: Improve "Ignore Geometry" property UI
This property is not used on Wayland because windows are
already not allowed to set their own geometry, so let's
hide it from the UI.

Also update the tooltip to explicitly state which properties
the `Ignore Geometry` property does affect on X11

BUG: 431265
FIXED-IN: 6.0
2023-04-11 20:03:38 +02:00
Nate Graham
afdf3ad106 kcms/rules: show explanatory text with contextual help button, not tooltip
Tooltips don't work when using the system with touch, and these here are
also a bit annoying with a pointing device since they appear instantly on
hover and take up a lot of space, so they unexpectedly pop up and cover
UI elements a lot.

To improve this, use a KCM.ContextualHelpButton inline in the list items
to show the explanation when clicked or hovered, just like we do in most
other places in other KCMs.

To make this work, the internal line breaks in the explanatory text had
to be removed to make the text flow properly with an arbitrarily-sized
tooltip.
2023-04-11 10:39:38 -06:00
Vlad Zahorodnii
e2d690e0aa Remove unused stuff in wayland_server.{h,cpp} 2023-04-11 13:39:23 +03:00
Vlad Zahorodnii
076fdebebd Revert "scene: Avoid creating SurfaceItem for Xwayland's cursor surfaces"
This reverts commit b549776b68.
2023-04-11 10:01:05 +00:00
Vlad Zahorodnii
f286c311d5 Revert "cursorsource: fix scaling with Xwayland"
This reverts commit 81571203f1.
2023-04-11 10:01:05 +00:00
Vlad Zahorodnii
0edf264947 Stop setting XCURSOR_THEME and XCURSOR_SIZE envvars 2023-04-11 10:01:05 +00:00
Vlad Zahorodnii
2d7bd94f16 Remove some unused includes 2023-04-11 12:47:41 +03:00
Vlad Zahorodnii
a08857cfd7 Drop OpenGLBackend::supportsSwapBuffersWithDamage()
It's unused.
2023-04-11 12:45:08 +03:00
Vlad Zahorodnii
17f4cde9af Drop kwineglext.h
EGL_WL_bind_wayland_display definitions are needed only in one cpp file,
so move them there instead.

We need to duplicate EGL_WL_bind_wayland_display definitions because
libepoxy doesn't define them for us.
2023-04-11 12:03:16 +03:00
Vlad Zahorodnii
43b7d2e457 Remove EGL_EXT_image_dma_buf_import and EGL_EXT_image_dma_buf_import_modifiers definitions
libepoxy provides them to us.
2023-04-11 11:59:09 +03:00
Vlad Zahorodnii
466868f5d4 wayland: Refactor linux-dmabuf buffer management
At the moment, the render backend provides its specific implementation
of LinuxDmaBufV1ClientBuffer. This has some of its limitations. For
example, due to the strong coupling, compositing restarts must be
handled carefully. It's hard to have a generic code path to import
dmabufs, which would be nice to have in order to unify graphics buffer
allocation across various backends; currently, it's all scattered.

To make the code simpler, this change drops the commented out YUV import
code path for now. Given that Mesa implicitly handles it, the need for
it is no longer so urgent.
2023-04-11 07:59:28 +00:00
l10n daemon script
2538243765 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"
2023-04-10 02:19:54 +00:00
Xaver Hugl
6f722954a0 backends/drm: set the scaling mode to none
Setting it to "Full Aspect" causes some problems with amdgpu, breaking switching
the refresh rate between modes

BUG: 468235
2023-04-09 10:26:38 +00:00
l10n daemon script
81f62b9d4f 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"
2023-04-09 02:25:33 +00:00
Vlad Zahorodnii
4691086389 wayland: Break xdg-foreign connection when window is closed
When a window is closed, we don't want to listen for the
WaylandServer::foreignTransientChanged signal anymore as it can lead to
a crash.
2023-04-08 07:56:05 +00:00
David Edmundson
023fc220a1 wayland: Update pointer state before ending the drag
ending a drag will update focus. Kwin explicitly resets it to whatever
is now under the mouse now that the implicit grab has ended.

This means no-one sends a pointer up.

Clients (xwayland) don't automatically make leave events count as a
mouse up, because typically you don't get a leave event whilst we have a
grab.

Xwayland also can't track the status of the wl_datasource as it didn't
use it.

This patch shouldn't affect any wayland clients as we don't send a frame event
until the focus changes which is after the dnd_finished events.

BUG: 465444

Testing done:
 - dragged firefox under xwayland tabs out from firefox to the desktop
 - confirmed a new window appeared
2023-04-07 22:14:27 +00:00
Ismael Asensio
78643b958f kcms/rules: Import kcmutils to provide ConfigModule attached property
On KF5 it was provided by the module `kcm`.
2023-04-07 21:01:09 +02:00
Aleix Pol
f35afcd7ae screencast: Still set the size to 0 for cursor-only frames
Otherwise OBS glitches (and so does KPipeWire-based software)
2023-04-07 17:15:28 +02:00
Aleix Pol Gonzalez
ef6612ff77 screencast: Improve how we communicate that a frame has just cursor info
Set the SPA_CHUNK_FLAG_CORRUPTED flag to tell clients to ignore the frame.

See https://github.com/obsproject/obs-studio/issues/8630
2023-04-05 16:36:19 +00:00
David Edmundson
f03af5eff5 libkwineffects: Set format on the main OffscreenQuickView
When showing the window RHI will realise the window has no underlying
platform window and create a temporary offscreen surface, different from
the offscreen surface we'll eventually be rendering into. This will use
the format of the main window.

If this offscreen surface format does not match the format of the
context we can fail in makeCurrent calls.
2023-04-05 14:36:33 +00:00
Jorge Barroso Barea
e68e92bcbd kcms: Move footer actions to headers
This yields a more modern appearance and consistency with other KCMs
that have already adopted this style.
2023-04-05 13:45:28 +00:00
Alexander Lohnau
38758172f3 plugins/kpackage: Refactor CMake code a bit 2023-04-04 18:16:24 +00:00
Alexander Lohnau
d32f9be5af plugins/kpackage: Rename metadata json files
Having them this long and the cpp file very short doesn't really make sense.

Also, we no longer install those files, but embed then in the C++ plugins
2023-04-04 18:16:24 +00:00
Alexander Lohnau
4ed3522e60 Remove author data, name and description from package metadata files
We do not display this data anywhere and do not use it internally either.

Task: https://phabricator.kde.org/T15452
2023-04-04 18:16:24 +00:00
Alexander Lohnau
3c2ac3c901 plugins/kpackage: Simplify CMake code
Just a simple wrapper that creates the plugin and links KPackage
2023-04-04 18:16:24 +00:00
Alexander Lohnau
f88b80e90e plugins/kpackage: Make plugin cpp file only, add missing Q_Object macro
The macro is not strictly needed, but it simplifies debugging due to us having
the classname from the staticMetaObject available
2023-04-04 18:16:24 +00:00
Alexander Lohnau
017da14444 plugins/kpackage: Modernize code using initializer list syntax 2023-04-04 18:16:24 +00:00
Alexander Lohnau
7e76525f6e plugins/kpackage: Call file/dir definitions without translations
Depends on https://invent.kde.org/frameworks/kpackage/-/merge_requests/74
2023-04-04 18:16:24 +00:00
Vlad Zahorodnii
baac61b8e5 Fix calling virtual methods in Window destructor
When a window is removed from the deleted list, some effects can perform
cleanup. In its turn, it means that they can call some Window methods.

If those methods happen to be virtual, kwin can crash because calling
virtual methods in the destructor of a base class has undefined behavior.
2023-04-03 11:12:13 +03:00
Vlad Zahorodnii
8c87cd913e libkwineffects: Add interface include dirs
libkwineffects has been moved in a subdirectory to avoid including the
"toplevel" include dir in interface include dirs.
2023-04-03 07:07:43 +00:00
Xaver Hugl
86a9796a5a kwinglutils: bind texture in GLTexture::render
... instead of doing it everywhere that the method is used
2023-04-02 12:32:10 +02:00
Vlad Zahorodnii
7af928aae4 Drop Window::tabTo() 2023-03-31 21:58:54 +03:00
Vlad Zahorodnii
1041794e41 Adjust some comments in Window
Neither Window::frameMargins() nor Window::wantsShadowToBeRendered() are
virtual methods, so remove "Default implementation ..." comments.
2023-03-31 20:44:19 +03:00
Vlad Zahorodnii
70353d399d Drop Window::inputGeometry
It's been mostly superseded by Window::hitTest().
2023-03-31 20:44:19 +03:00
Vlad Zahorodnii
3763e4f84b wayland: Interpret input panel's input shape as the window geometry
maliit creates a fullscreen overlay window which doesn't go along well
with out geometry abstractions. For example, raw frame geometry can't be
used to displace normal windows otherwise they will be pushed offscreen.

Some of the maliit quirks are leaked in the InputMethod class. After
extending the lifetime of the InputPanelV1Window, they can cause
problems.

In order to make code in InputMethod more intuitive and encapsulate
maliit quirks, this change makes InputPanelV1Window interpret the
bounding rectangle of the input shape as the window geometry. This
lets us get rid of the hack in inputGeometry() too.

The size checks in Mode::VirtualKeyboard case have been removed because
they should be irrelevant. When reposition() is called, the wl_surface
is mapped, so its size cannot be 0x0.
2023-03-31 16:59:13 +00:00
Vlad Zahorodnii
4e8214e69e Drop custom inputGeometry and inputTransformation in x11 and xdg-shell windows
Effectively, X11Window and XdgSurfaceWindow use same stuff. Using the
buffer geometry should be fine in InternalWindow too.
2023-03-31 18:50:01 +03:00
Vlad Zahorodnii
2233190e67 Update pointer and tablet focus when focused window is closed
Prior to dropping Deleted, we implicitly relied on the fact that the
QPointer storing the focused window will be reset to null when the
window is closed so we didn't include any cleanup logic.

After dropping Deleted and extending the lifetime of the original
window, it's no longer the case and we have to explicitly handle closing
the window otherwise kwin can encounter unexpected cases.
2023-03-31 13:41:43 +00:00
Jan Grulich
75c7689f67 Screencast: fix renegotiation when client fails to use DMABuf modifiers
When client fails to import a DMABuf with a certain modifier, it will
remove it from offerings on his side and offer a new set of modifiers
for us to use. In case the list ends up being small enough that even we
won't be able to use any of the modifiers, we would still keep these
modifiers on our list and offering them to the client. With this we
would end up in a loop renegotiating and never actually fallback to use
MemFD buffers instead. We should also offer modifier-less DMABufs as
in the past. Using these we just need to avoid offering them as they
should be used as the last option.

BUG: 448839
2023-03-31 12:31:23 +00:00
Vlad Zahorodnii
4de69f2ef7 wayland: Close internal popups instead of hiding
Hiding the QWindow handle confuses QWidget, which results in user
actions menu not showing up on second launch. Might be a Qt bug.

On the other hand, it makes sense to close dismissed popups, so let's do
it.
2023-03-31 11:32:11 +00:00
Vlad Zahorodnii
4578cf352b Revert "Revert "wayland: Update shadow immediately""
This reverts commit 08e392f368.

It appears like with RHI, user code can't mess with its current opengl
context, so let's update shadows immediately.

Just to be sure, shadow cleanup logic in ShadowItem has been hardened to
avoid disturbing the current opengl context unnecessarily.

BUG: 467926
2023-03-31 10:37:30 +00:00
Vlad Zahorodnii
072d5ff045 scene: Avoid changing current opengl context if the shadow has no texture
If there's nothing to be destroyed, do nothing.
2023-03-31 10:37:30 +00:00
Vlad Zahorodnii
fd5807ecb7 backends/drm: Fix enabled state
"props->enabled" checks whether std::optional has a value, that's not
what we want.
2023-03-31 11:38:45 +03:00
Vlad Zahorodnii
a04609b46f wayland: Fix output order sanitization in kde-output-management-v2
We need to remove disabled outputs.
2023-03-31 10:46:26 +03:00
Xaver Hugl
4f48258269 kscreenintegration: don't access optionals that may be missing a value 2023-03-31 10:34:18 +03:00
Xaver Hugl
f70be829c6 backends/drm: don't access nullptr output configs 2023-03-31 10:34:18 +03:00
Vlad Zahorodnii
050336e421 Minor cosmetic improvements in Window
This change reorders some things in Window header so related things are
kept spatially close to make the code easier to navigate.
2023-03-31 06:56:47 +00:00
Alexander Lohnau
fe935c0dc8 Adjust to new KPackage namespace for structures
See https://invent.kde.org/frameworks/kpackage/-/merge_requests/73
2023-03-31 04:35:11 +00:00
Aleix Pol
7a6c2ce36f screencasting: Support opaque drm video formats
Fixes a warning on the CI
2023-03-31 00:18:53 +02:00
Aleix Pol
aaae80a569 backends/virtual: Fix format
While we are using GL_RGB8, it seems to be using 32bit pixels.
2023-03-31 00:18:53 +02:00
Vlad Zahorodnii
abb9b0d2cd Reshuffle desktop and activity related code in Window
Keep virtual desktop and activity related code spatially close to
improve code readability.
2023-03-30 18:42:28 +00:00
Vlad Zahorodnii
712a23bd59 Move Window::desktop to X11Window
Window::desktop() is obsolete. On the other hand, X11 doesn't support
having a window on several virtual desktops, so we still need it. As a
compromise, this change moves it to X11Window instead.
2023-03-30 18:42:28 +00:00
Vlad Zahorodnii
0d11a09010 tabbox: Port away from Window::desktop 2023-03-30 18:42:28 +00:00
Vlad Zahorodnii
2c12a6a417 wayland: Avoid updating outputs of a closed window
BUG: 467954
2023-03-30 18:29:05 +00:00
Xaver Hugl
66495f9c79 wayland/outputmanagement: don't access nullptr changesets
Since 6b8e08dfa9, changesets can be nullptr
2023-03-30 18:17:16 +00:00
Vlad Zahorodnii
101e38527d kcms: Port away from org.kde.kcm.ConfigModule
org.kde.kcm.ConfigModule doesn't exist anymore. Its replacement lives in
org.kde.kcmutils module now.

Note that the replacement has no "quickHelp" property, so it's been
removed. While on this, also drop "ConfigModule.buttons". It still
exists in the new ConfigModule but the default buttons should be fine.
2023-03-30 17:21:14 +00:00
Vlad Zahorodnii
73c26baab4 scripting: Make WindowModel.desktop property return list of desktops
The X11 desktop id property is obsolete.
2023-03-30 16:55:42 +00:00
Vlad Zahorodnii
aebc361c45 Drop Window::isOnDesktop(int) 2023-03-30 15:42:31 +00:00
Vlad Zahorodnii
e306e1b287 tabbox: Port away from legacy desktop ids 2023-03-30 15:42:31 +00:00
Vlad Zahorodnii
222b23eaa3 Adjust to kdecoration api changes 2023-03-30 15:25:50 +00:00
Vlad Zahorodnii
d76527e7e6 Port window cascading from X11 desktop ids to VirtualDesktop 2023-03-30 12:21:05 +03:00
Vlad Zahorodnii
044e160a50 Cleanup includes in window.cpp 2023-03-30 11:44:30 +03:00
Vlad Zahorodnii
cd36bb82b2 Regroup methods and fields in Window
Group methods and fields together to make Window internals less chaotic.
2023-03-30 11:44:30 +03:00
Vlad Zahorodnii
ec31ab4980 Drop Window::resourceMatch()
Its body is trivial and it's used only once so it can be inlined.
2023-03-30 07:33:20 +00:00
Vlad Zahorodnii
25f284e68c Remove comments reminding to copy properties in copyToDeleted()
Window::copyToDeleted() is gone.
2023-03-30 07:12:10 +00:00
Nate Graham
fec40b7163 Revert "backends/libinput: don't multiply v120 value by scroll speed"
This reverts commit 9cd52b4060.

This commit broke the adjustable scroll speed feature on Wayland. That
feature may not have been implemented in the most technically ideal way,
but simply breaking it and leaving the mouse KCM with UI control that
does nothing isn't great. Besides, there was always a simple way to
avoid any scroll-related regressions caused by this feature: reset the
scroll speed to its default value, which internally is a multiplier of 1
and exercises the same codepath that 9cd52b40 imposes on everyone.

We can come up with a better implementation for Plasma 6.

BUG: 464592
FIXED-IN: 5.27.4
2023-03-29 15:55:07 +00:00
Vlad Zahorodnii
c6035115f9 Drop ReleaseReason enum 2023-03-29 14:03:42 +00:00
Vlad Zahorodnii
3e766e8d5e Move Window::{frameId,window} to X11Window 2023-03-29 13:18:01 +03:00
Vlad Zahorodnii
1334b38ee1 Move X11-specific "skip close animation" handling to X11Window 2023-03-29 12:53:21 +03:00
Vlad Zahorodnii
d35f88adee Move Window::wmClientLeader to X11Window 2023-03-29 12:49:28 +03:00
Vlad Zahorodnii
e403c5bf63 Move Window::info to X11Window 2023-03-29 12:39:10 +03:00
Vlad Zahorodnii
bf19234df3 Move Window::detectShape to X11Window 2023-03-29 11:10:51 +03:00
Vlad Zahorodnii
fa8bd5c0d9 Move Window::{opaqueRegion,shapeRegion} to X11Window 2023-03-29 11:10:51 +03:00
Vlad Zahorodnii
46d0c04f91 Move Window::{depth,hasAlpha,visual} to X11Window 2023-03-29 11:10:51 +03:00
Vlad Zahorodnii
87bfdcf1d6 scene: Port WindowItemX11 to X11Window 2023-03-29 11:10:51 +03:00
Vlad Zahorodnii
551e4a8233 Move Window::propertyNotifyEvent to X11Window 2023-03-29 06:50:53 +00:00
Vlad Zahorodnii
005b098707 Move xwayland surface association logic to X11Window 2023-03-29 06:50:53 +00:00
Vlad Zahorodnii
2d275e16ec Merge XwaylandWindow with X11Window 2023-03-29 06:50:53 +00:00
Friedrich W. H. Kossebau
c395afde9b KIdleTime plugin: adapt to new name KAbstractIdleTimePoller 2023-03-29 02:51:46 +00:00
l10n daemon script
4bf7fdf8e0 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"
2023-03-29 02:28:14 +00:00
Vlad Zahorodnii
dbbcf31d0d x11: Merge Unmanaged into X11Window
Currently, managed and override-redirect windows are split in two types:
X11Window and Unmanaged. While looking at it strictly from type
perspective, this is great. But it creates other problems, e.g. we need
to put shared X11-specific code in the base Window class or mess with
"base" classes.

As an alternative solution, this change merges the Unmanaged class into
the X11Window class and disables some functionality based on the value
of isUnmanaged().

X11Window::manage() is used to create a managed Window. X11Window::track()
is used to create an unmanaged Window.
2023-03-28 18:14:32 +00:00
Xaver Hugl
062f092f38 workspace: prevent dangling pointers in output order list
An output can be still enabled but also scheduled for deletion
2023-03-28 16:22:20 +02:00
Xaver Hugl
c51824b535 Add OutputManager for taking care of output settings in KWin
As a first step to move away from having an external service remember output settings
for KWin, this commit introduces an output manager that can load configuration files
and generate new output configurations.
2023-03-28 16:19:09 +02:00
Xaver Hugl
6b8e08dfa9 core/outputconfig: store output properties with std::optional 2023-03-28 16:19:09 +02:00
Vlad Zahorodnii
08bebd1c4a Drop supported_types parameter in Window::windowType()
It's unused mostly.
2023-03-28 12:08:20 +00:00
Vlad Zahorodnii
902c2feb12 scripting: Drop Window.shaped property
It should be irrelevant to the scripts and there's no matching
abstraction on wayland.

is_shape is made protected, but it will be eventually moved to an X11
specific subclass.
2023-03-28 13:09:52 +03:00
Vlad Zahorodnii
94f0e564be Move internal window fbo and pixmap to InternalWindow 2023-03-28 11:47:22 +03:00
Vlad Zahorodnii
10b5236cfa Unvirtualize some Window properties 2023-03-28 08:31:08 +00:00
Vlad Zahorodnii
e31ec802f4 Drop Deleted
Currently, the normal window lifecycle looks as follows: create Window,
wait until it's shown, add it to Workspace, wait until it's closed,
create a Deleted, copy properties from the original window to the
deleted one, destroy the original window, wait until the last deleted
window reference is dropped.

There are a couple of issues with this design: we can't nicely
encapsulate X11 or Wayland specific implementation details if they need
to be accessed for closed windows; manual copying of properties is
cumbersome and error prone and we've had a dozen of cases where effects
worked incorrectly because some properties had not been copied.

The goal of this patch is to drop Deleted and extend the lifetime of the
original window, but with a special state set: Window::isDeleted().

The main danger is that somebody can try to do something with deleted
windows that they should not do, but on the other hand, such code needs
to be guarded with relevant checks too.
2023-03-28 08:31:08 +00:00
Vlad Zahorodnii
5454cc47c3 Preserve stacking order constraints when closing a window
When closing a window, we may need to change parent-child relationship
between windows, but we need to preserve stacking order constraints so
dialogs are placed above their parents when they're closed.
2023-03-28 08:31:08 +00:00
Vlad Zahorodnii
2510bf0439 wayland: Cache WaylandWindow::isScreenLocker()
This is needed to ensure that Window::isScreenLocker() returns a good
value for closed windows. Also, it's needed to get rid of
ClientConnection::aboutToBeDestroyed() connection, which can cause
problems with window teardown.
2023-03-28 08:31:08 +00:00
Nicolas Fella
008bdd18e4 Remove wrong prefixes from includes 2023-03-28 08:13:01 +00:00
Alexander Lohnau
8fc8bf89b5 Remove unneeded KCMUtils prefix for KCModule include
This was a temporary fix that is no longer needed
2023-03-27 18:50:35 +02:00
Vlad Zahorodnii
70a5052587 Remove commented out code 2023-03-27 15:16:30 +00:00
Vlad Zahorodnii
d45d8b5f98 Simplify X11Window::removeTransient()
If a transient parent is removed, X11Window::removeTransient() will try
to upgrade the transient to a group transient.

On the other hand, that code is broken because Window::removeTransient()
will unset transientFor() so we never hit the code path in the if
statement.

While we could fix it, I think it's not worth it because transient
handling code is already mental and making group transients and normal
transients disjoint will help to keep the things simpler.
2023-03-27 15:16:30 +00:00
Aleix Pol
fb3018b711 dpms: Make sure we are not calling the interface after the output is gone
It seems it's possible at times, as described in the bug.

BUG: 466346
2023-03-27 13:36:36 +00:00
Vlad Zahorodnii
71956e1bb5 effects/mouseclick: Fix warning about unhandled QPointingDevice::PointerType enum
AllPointerTypes is used as a filter in pointing input device handlers in
QML. I don't think we should hit this case in real world.
2023-03-27 15:35:22 +03:00
Vlad Zahorodnii
a1703ab97e Remove kwincompositingdata.moc include 2023-03-27 12:05:18 +00:00
Vlad Zahorodnii
9e4ed75e8e Remove kwinoffscreenquickview.moc include
It's not needed anymore.
2023-03-27 12:05:18 +00:00
Vlad Zahorodnii
f20cf30693 Fix populating CMAKE_AUTOMOC_MACRO_NAMES with kwineffects macros
Apparently CMAKE_AUTOMOC_MACRO_NAMES modifications are not visible in
sibling directories. To work around that, populate
CMAKE_AUTOMOC_MACRO_NAMES with libkwineffects plugin macros in the
top level CMakeLists.txt file.
2023-03-27 12:05:18 +00:00
Vlad Zahorodnii
4b343698c3 scripting: Drop registerWindow() workaround
desktopchangeosd appears to stop updating because kwin fails to deselect
XShape events.
2023-03-27 11:05:34 +00:00
Vlad Zahorodnii
983a0bc599 Prefer QThreadPool over QtConcurrent where we don't care about result
QtConcurrent::run()'s return type is marked with [[nodiscard]], which is
not nice to code that just needs to move some tasks to a worker thread.

On the other hand, QThreadPool satisfies our needs too and Qt doesn't
need to construct futures that we won't use.

One remark about the screenshot plugin: the task lambda is mutable so it
cannot be represented using a std::function.
2023-03-27 10:00:22 +03:00
Vlad Zahorodnii
a9ad59b32a Improve Workspace::outputAt()
Workspace::outputAt() casts vectors to four rectangle corners and uses
the shortest one to decide which output is the closest to the given
point.

This works poorly on dual monitor setups where on the left side you have
a monitor with landscape orientation and one with portrait orientation
on the right hand side. In that case, outputAt() will prefer the left
monitor even though the right monitor is the closest one if you cast a
perpendicular from the given point to the right monitor.

In order to improve the handling of that case, this change makes
Workspace::outputAt() compute the closest point to the output geometry
rectangle and use the squared distance as the score.
2023-03-25 21:24:59 +00:00
Vlad Zahorodnii
cbd50a1e08 libkwineffects: Install headers in libkwineffects/
This improves the scoping of libkwineffects header files and it helps to
make `#include "libkwineffects/foobar.h"` code work in user code.
2023-03-25 21:05:12 +00:00
Vlad Zahorodnii
1211d8e3d6 Prefix more kwineffects includes with libkwineffects/ 2023-03-25 21:05:12 +00:00
Vlad Zahorodnii
c049d5afb1 tabbox: Provide raw window caption
Use "textFormat: Text.PlainText" in window switchers instead.
2023-03-25 22:47:53 +02:00
Vlad Zahorodnii
c5eabfa4d1 tabbox: Drop TabBoxClient
The indirection contributes unnecessary complexity. The usage of
std::weak_ptr and std::shared_ptr complicates the things further, e.g.

![Screenshot_20230325_170226](/uploads/d8b68a9eff47c93c4463bb230b5bbe49/Screenshot_20230325_170226.png)

---

Ideally, same should be done with TabBox and TabBoxHandler, but that can be done in another MR.
2023-03-25 20:46:54 +00:00
Vlad Zahorodnii
fc890340d9 Fix warning about duplicate names in debug_console.ui
"label" is already used.

    Warning: The name 'label' (QLabel) is already in use, defaulting to 'label1'.
    Warning: The name 'label' (QLabel) is already in use, defaulting to 'label2'.
2023-03-25 18:33:24 +00:00
Xaver Hugl
67dc0c5c48 backends/drm: restrict common mode generation to drivers that support scaling
Also set the scaling mode property to "full aspect", which should reduce
the number of cases where the feature can cause issues
2023-03-25 18:52:15 +01:00
Vlad Zahorodnii
cf1d66ef59 tabbox: Drop support for _KDE_FIRST_IN_WINDOWLIST
LXR search shows that _KDE_FIRST_IN_WINDOWLIST is not used anywhere in
KDE codebase besides KWin.
2023-03-25 11:14:09 +00:00
Vlad Zahorodnii
09cc312f31 Drop irrelevant Deleted cleanup in Workspace
Deleted windows are no longer destroyed using deleteLater(). They will
be destroyed immediately as Workspace goes through the window list
because the effects will be unloaded by that time.
2023-03-25 07:53:41 +00:00
Vlad Zahorodnii
1f43605329 Drop Workspace::clientList() 2023-03-24 22:28:46 +00:00
Vlad Zahorodnii
4a1e7df599 tabbox: Drop desktop switching
Tabbox supports two operation modes: switching between windows and
desktops. Switching between windows is more commonly used. Desktop
switching is not exposed in user settings and it requires some advanced
knowledge of kwin's internals to enable it.

On the other hand, over the past years, we've double downed on effects
like desktop grid and overview to provide graphical means to switch
between virtual desktops.

This change drops desktop switching because it's effectively unused to
simplify the tabbox code, which can be very handy for the future
refactorings of window switching.
2023-03-24 22:01:12 +00:00
Ismael Asensio
7b25c8525e kcms/rules: Remove custom executable
The `kwin_rules_dialog` executable was used to launch the rules
KCM on a specific window when called from the window menu
because we couldn't depend on the `kde-cli-tools` repo

Since now `kcmshell6` lives on KCMUtils we can call it directly
2023-03-24 20:40:54 +01:00
Ismael Asensio
6082de1345 kcms/rules: Make Comboboxes bordered again
The property `flat: true`was set since the QML redesign and remained
unnoticed because it didn't actually work.

Now that the qqc2-desktop style has been fixed and correctly draws
flat (non-bordered) comboboxes let's remove it for a nicer look
(just the same as the have had all this time)
2023-03-24 19:20:56 +01:00
Xaver Hugl
ec593a2364 backends/drm: consider color property changes as failed when the output is off
The atomic test it does will succeed even when it shouldn't, which can make
enabling the output again fail
2023-03-24 14:10:36 +00:00
Vlad Zahorodnii
3c96b21b32 effects: Fix dialogparent installation 2023-03-23 16:51:49 +02:00
Vlad Zahorodnii
e88a4e34a3 Remove some include_directories()
It seems we've settled on dir/dir/header.h includes, so let's use them
consistently.
2023-03-23 14:37:48 +02:00
Vlad Zahorodnii
82ef63a3d4 wayland: Use correct signal to get notified when to destroy InputPanelV1Window
The window should be destroyed when the associated surface role is about
to be destroyed. QObject::destroyed is too late.
2023-03-23 11:24:20 +02:00
Vlad Zahorodnii
bffeae89c7 Drop unused X11Window::wasOriginallyGroupTransient() 2023-03-23 09:48:07 +02:00
Vlad Zahorodnii
017906541b Refactor compositing teardown in X11Window and Unmanaged
Currently, X11Window and Unmanaged call finishCompositing(), which tries
to destroy the window item and other associated compositing data.

Usually, it has no any effect on the window item and the effect window
because they are moved to the Deleted. However, it has some effect on
the XDamage handle.

If the X11 window is unmapped, it will destroy the XDamage handle. If
the X11 window is destroyed, it will do nothing. Why does it behave like
that? Because that's how the XDamage spec is written.

This change removes the call to finishCompositing() and refactors how
the XDamage is handled so Window::finishCompositing() is more generic.

If the X11 window is destroyed, SurfaceItemX11::forgetDamage() will be
called and SurfaceItemX11::~SurfaceItemX11() won't attempt to destroy
the damage handle.

If the X11 window is unmapped, SurfaceItemX11::destroyDamage() will be
called and destroyDamage() in SurfaceItemX11::~SurfaceItemX11() will
noop.

If compositing has been restarted, destroyDamage() in
SurfaceItemX11::~SurfaceItemX11() will destroy the damage handle.
2023-03-22 19:15:19 +00:00
Vlad Zahorodnii
48cf6a75cc Allow creating Deleted on shutdown
It helps to reduce the number of cases that have to be taken into
account when closing a window. Deleted is cheap to create too.
2023-03-22 19:15:19 +00:00
Vlad Zahorodnii
ad42cfecc1 wayland: Disable text-input-v3 when it's destroyed
Destroying a zwp_text_input_v3 object should be viewed as disabling it.

isEnabled property is cached because it cannot be computed in
_destroy_resource() handler. By that time, the resource no longer will
be in resourceMap(), so TextInputV3InterfacePrivate::isEnabled() will
erroneously return false even though we expect true.
2023-03-22 17:59:22 +00:00
Xaver Hugl
71ebaebe9b backends/drm: remove unused variable 2023-03-22 17:50:20 +01:00
Xaver Hugl
54e338eaed backends/drm: remove egl config handling
Without gbm_surface, egl configs aren't needed anymore
2023-03-22 17:50:20 +01:00
Xaver Hugl
629fb00341 platformsupport/scenes/opengl: filter out external formats properly
Using a hardcoded list is error prone and doesn't work on NVidia
2023-03-22 17:50:14 +01:00
Vlad Zahorodnii
c5f08d62d1 Use proper signal to get notified when to reset virtual keyboard geometry
Currently, input method relies on the fact that QObject::destroyed and
Window::closed are equivalent. But it's going to change, so make the
input method use a signal that's semantically better.
2023-03-22 15:59:34 +02:00
Vlad Zahorodnii
2dca6cd003 Extend lifetime of decoration to lifetime of Deleted
When a window is closed, a Deleted object will be constructed and the
Window's properties will be copied over to it. The long term plan is to
stop doing that, i.e. keep the Window alive but just flip a few flags to
indicate that it's been closed.

In order to unify decoration management, this change ensures that it's
okay to have decorations live as long as the Deleted.
2023-03-22 11:25:58 +00:00
Vlad Zahorodnii
d563382350 Fix destruction order of alive and deleted windows
It's needed to work around the cleanup logic of decorations.

Currently, decorations have a valid QObject parent and they're managed
using std::shared_ptr. That's not a perfect combination, but changing it
is also going to be an involved task because the QObject parent is used
to look up the Window.

In long term, it won't matter since we want to get rid of Deleted.

For what it's worth, it restores the order in which Deleted and normal
windows used to be destroyed prior to
995d509e45.
2023-03-22 11:25:58 +00:00
Vlad Zahorodnii
16a07d5df2 wayland: Handle xdg_wm_base being destroyed before surface role
If a client owns several windows (for example it can be the case with
plasmashell) and it crashes, it's possible to encounter the following
case:

- xdg_wm_base resources are destroyed
- xdg_toplevel is destroyed
- another xdg_toplevel is destroyed

When kwin processes the destruction of the first xdg_toplevel, it may
ping the second xdg_toplevel. But the xdg_wm_base is already free()d by
that time, so kwin can access already released memory.

In order to prevent that, make the associated XdgSurfaceInterface
objects inert. Since XdgToplevelInterface and XdgPopupInterface will
become useless after destroying XdgSurfaceInterface, make them inert too.

As the spec states, it's illegal to destroy a bound xdg_wm_base object
while there are still alive xdg surfaces created by it so destroying the
surface role objects should be fine.
2023-03-22 10:56:38 +00:00
Vlad Zahorodnii
1f7975e271 effects/screenshot: Provide screenshot scale information 2023-03-22 10:35:55 +00:00
Vlad Zahorodnii
1b1f0c6b32 effects/screenshot: Provide information about captured window or screen
This can be useful for the screenshot capture tool if it needs some
information about the captured window or screen, for example to generate
the file name.
2023-03-22 10:35:55 +00:00
Vlad Zahorodnii
5e63f9afc9 Drop Qt::Network dependency
We used it primarily for QHostInfo, but as QHostInfo::localHostName()
docs indicate, QSysInfo::machineHostName() returns the same info.
2023-03-22 07:23:24 +00:00
Vlad Zahorodnii
07b9588bd6 kcms/scripts: Remove unused stuff 2023-03-21 18:54:13 +00:00
Vlad Zahorodnii
2c0acdca11 Drop unused kitemviews dependency
Seems unused. KWin compiles fine without it.
2023-03-21 20:32:04 +02:00
Vlad Zahorodnii
1b5d2e9998 Drop Workspace::internalWindows() 2023-03-21 17:01:20 +00:00
David Edmundson
6f30a33033 Add a runtime guard that offscreen windows do not generate platform windows
It's come up before, and it's very very difficult to debug without a
backtrace even when you know what's going wrong.
2023-03-21 16:09:56 +00:00
David Edmundson
82b2fa37c2 Avoid accidental creation of backing stores for offscreen surfaces
Aurorae decorations and several effects are powered by QQuickWindows
that render into offscreen surfaces.

Iterating through all windows and then calling winId() will create a
platform window including for our Aurorae decorations.

Not only is this wasteful but it caused an issue with resizing windows.
QWindow code updates the internal state directly if there's no
underlying platform window, if there is it delegates responsiblity to
the backend. Our own QPA didn't update geometry whilst hidden.

The result of that is Aurorae decorations "randomly" stop resizing
correctly as the contentItem stops resizing to the window size.

BUG: 465790
2023-03-21 15:43:35 +00:00
Vlad Zahorodnii
4aec002d13 effects: Make -DTRANSLATION_DOMAIN target specific
This makes effect specific cmake code more encapsulated. It's also more
readable if the translation domain is specified explicitly rather than
having it implicitly set by add_definitions().
2023-03-21 10:12:26 +02:00