Commit graph

24635 commits

Author SHA1 Message Date
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
l10n daemon script
5a024d7e9a GIT_SILENT Sync po/docbooks with svn 2023-03-22 03:09:45 +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
Vlad Zahorodnii
1f24b0f7cb Drop Workspace::unmanagedList()
It reduces the number of window lists to make the api of the workspace
cleaner.
2023-03-21 07:49:38 +00:00
Vlad Zahorodnii
49607b6eab cmake: Tidy scripted effect CMakeLists.txt code 2023-03-21 07:18:27 +00:00
Vlad Zahorodnii
dc2d8c875f cmake: install_scripted_effect -> kwin_add_scripted_effect 2023-03-21 07:18:27 +00:00
Vlad Zahorodnii
d6d3c0114e cmake: kwin4_add_effect_module -> kwin_add_builtin_effect 2023-03-21 07:18:27 +00:00
l10n daemon script
893b4bac4f GIT_SILENT Sync po/docbooks with svn 2023-03-21 02:53:12 +00:00
Aleix Pol
07f6241cd7 inputmethod: Properly report that it's not visible
Window::isShown only checks that it's not hidden, in this case it's not
that it's hidden it's that it's neither shown or hidden. Take the
readyForPainting attribute into account.
2023-03-20 21:24:19 +01:00
Xaver Hugl
a60d8941b6 port more stuff to standard smart pointers 2023-03-20 14:16:37 +01:00
Xaver Hugl
3e94a3945c src/tabbox: port to standard smart pointers 2023-03-20 14:05:29 +01:00
l10n daemon script
ff5165f9dd GIT_SILENT Sync po/docbooks with svn 2023-03-20 02:46:24 +00:00
l10n daemon script
1cb3fa96b3 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-20 02:35:00 +00:00
Vlad Zahorodnii
871a1a460c scripting: Refactor generic scripted config
Currently it makes an assumption that the name of a scripted effect
starts with "kwin4_effect_" prefix, which has its issues. For example,
it will stop working if we choose to use simpler naming scheme.

This change reworks how the generic scripting kcmodule is constructed.
Instead of guessing kpackage type, make relevant kcms pass it explicitly
via the arg list.
2023-03-19 22:36:12 +02:00
Xaver Hugl
e83c593fda adapt to kdecoration changes 2023-03-19 15:26:15 +00:00
l10n daemon script
d4581a6cf3 GIT_SILENT Sync po/docbooks with svn 2023-03-19 02:30:16 +00:00
l10n daemon script
854c19e00a GIT_SILENT Sync po/docbooks with svn 2023-03-18 02:58:27 +00:00
Vlad Zahorodnii
9aebfcb2ff Include src/ directory in the proper place
There's other code that includes headers starting from src/ directory,
so putting the corresponding include_directory() in src/effects/ is
inappropriate.
2023-03-17 21:14:14 +00:00
Vlad Zahorodnii
ed87ac837b Stop including src/effects directory in kcmkwincommon target 2023-03-17 21:14:14 +00:00
Vlad Zahorodnii
f288212869 Stop kcm_kwin4_genericscripted linking with libkwineffects 2023-03-17 21:14:14 +00:00
Vlad Zahorodnii
ffce2a61f1 Drop service type desktop files
They're irrelevant now.
2023-03-17 22:07:51 +02:00
Vlad Zahorodnii
25440385e7 Port to KPluginMetaData::fromJsonFile()
KPluginMetaData::KPluginMetaData(QString) assumes that the file
specified in the string corresponds to a binary plugin now, not a
metadata file.

This fixes scripted effect kcms not working.
2023-03-17 14:54:36 +00:00
David Edmundson
f88ff99d82 wayland: Truncate strings sent via plasmawindowmanager interface
Wayland has a limited size for strings in arguments. We should truncate
any strings that come from user-defined data before sending.

We keep the full title around within kwin as it keeps logic simpler.
Size length logic is lifted from QWaylandWindow's setTitle

BUG: 465775
2023-03-17 12:21:48 +00:00
l10n daemon script
86508b25c0 GIT_SILENT Sync po/docbooks with svn 2023-03-17 03:02:04 +00:00
Alexander Lohnau
1f7ec93954 Adjust to new KCM classes
Depends on https://invent.kde.org/frameworks/kcmutils/-/merge_requests/121
2023-03-16 13:50:16 +00:00
David Redondo
d5679ee82c Port some connections to Qt::SingleShotConnection 2023-03-16 11:03:07 +01:00
Vlad Zahorodnii
3704c0a945 backends/drm: Remove some gbm_surface,gbm_device forward declarations 2023-03-16 09:49:06 +02:00
l10n daemon script
b7834edefe GIT_SILENT Sync po/docbooks with svn 2023-03-16 02:37:01 +00:00
Vlad Zahorodnii
7dbb06d80c Fix picking drag target
The normal stacking order contains managed and unmanaged windows now.
This kind of breaks dragging from X11 to Wayland clients.

When an X11 client is the drag source, it's going to create an override
redirect window for the drag icon, which is beneath the pointer.

findManagedToplevel() will return the drag icon instead of the window
beneath the drag icon.

The root problem is that normal event processing has different needs. It
doesn't care about window type except when the screen is locked, while
dnd does. Perhaps it also makes sense to check whether the window accepts
focus.

This change introduces a specialized helper to pick the drag target.
Unfortunately, it amounts to some code duplication. On the other hand,
not sure that other options (such as adding flags to findToplevel()) are
better.
2023-03-15 15:45:33 +00:00
Vlad Zahorodnii
bcc299c3fe Drop unused Workspace::deletedList()
It's unused, and there should not be any usecases for it outside the
Workspace.
2023-03-15 14:10:44 +02:00
Vlad Zahorodnii
8f21d444c6 Make Workspace::allClientList() return all windows
Currently windows are scattered in a few separate lists. If you need to
go through the windows, you have to do it piece by piece. On the other
hand, with the overhaul of window types, we've started converging
towards one universal type: Window. Keeping windows in the separate
buckets goes against this design.

Workspace::stackingOrder() already contains all windows. This change
repurposes Workspace::allClientList() from a list of "normal" windows to
all windows, i.e. Workspace::windows(), to be consistent.

There's one API change though. Scripting API will expose other window
types too. This is an intentional change so scripted effects could
operate with all windows. It also matches the current behavior observed
in libkwineffects, which exposes all windows as well.
2023-03-15 11:52:01 +00:00
Vlad Zahorodnii
392fb4eb01 Add explicit Window::isClient() checks
This is needed to prepare for introducing Workspace::windows().
2023-03-15 11:52:01 +00:00
Xaver Hugl
f433213bd6 backends/drm: simplify how atomic commits are done
Instead of having every DrmProperty store pending values, store the data
for the next commit in a separate and temporary type. This simplifies the
code and makes it possible to do commits in a separate thread
2023-03-15 12:09:12 +01:00
l10n daemon script
f71e322ead GIT_SILENT Sync po/docbooks with svn 2023-03-15 02:35:20 +00:00
Jan Grulich
3807b41c66 Screencast: avoid using DMABufs exclusively to allow renegotiation
Using DMABufs only will not allow clients to fallback to MemFD buffers
in case they fail to import DMABufs for whatever reason and completely
break screen sharing in such case.
2023-03-14 19:50:07 +00:00
Alexander Lohnau
4e9303a6cc Adapt to KPackage API changes for install/uninstall
This simplifies the code, because we can access the package after installing it.

Depends on https://invent.kde.org/frameworks/kpackage/-/merge_requests/68
2023-03-14 20:18:39 +01:00
Xaver Hugl
d9077e36c5 backends/drm: use a common base class for property blobs
This simplifies the code a bit and makes more generic handling of blobs
possible
2023-03-14 19:23:17 +01:00
Vlad Zahorodnii
f3dc057c71 x11: Disable NETWinInfo in X11Window
This piece of logic belongs in X11Window rather than Deleted as the
latter is merely a representation of a closed window.
2023-03-14 17:52:50 +00:00