Commit graph

24584 commits

Author SHA1 Message Date
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
l10n daemon script
d91426c170 GIT_SILENT Sync po/docbooks with svn 2023-03-28 03:16:32 +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
l10n daemon script
a2ef5cb1a7 GIT_SILENT Sync po/docbooks with svn 2023-03-27 03:59:44 +00:00
l10n daemon script
26c9a5534e GIT_SILENT Sync po/docbooks with svn 2023-03-26 02:32:43 +00: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
l10n daemon script
9c22df0769 GIT_SILENT Sync po/docbooks with svn 2023-03-25 02:30:01 +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
l10n daemon script
fd6d94a0be GIT_SILENT Sync po/docbooks with svn 2023-03-24 02:28:04 +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
l10n daemon script
95f050d578 GIT_SILENT Sync po/docbooks with svn 2023-03-23 02:59:23 +00: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