Commit graph

1432 commits

Author SHA1 Message Date
Kai Uwe Broulik
9b7718459e xdgforeign: Allow exporting surfaces internally
Without a client asking for it. This way we can send a surface
to another helper application, such as the window killer.

An ExportedSurface wrapper class is introduced which represents
an exported surface in a windowing-system independent way.
2023-11-27 14:10:15 +00:00
Kai Uwe Broulik
2b868edb9e xdgshell: Use killPingTimeout option
This makes it consistent with the timeout used on X11.

The current ping timeout was also generally quite short, causing apps
to desaturate for brief moments when they were busy e.g. starting up
or loading large files.
2023-11-27 14:10:15 +00:00
Xaver Hugl
301e95b07c backends/drm: unset GAMMA_LUT and CTM when enabling color management
BUG: 477430
2023-11-24 20:50:55 +00:00
Xaver Hugl
8408dcfad0 core/colorspace: use gamma22 for sRGB content
sRGB content is made to be encoded with the sRGB piece-wise transfer function,
and to be decoded by displays with the gamma 2.2 transfer function.
When KWin has a display in sRGB mode, this doesn't make a difference - it
decodes with sRGB and encodes with sRGB, so there's effectively no transformation.
When the display is in PQ mode though, KWin uses the sRGB inverse EOTF for
decoding sRGB content, but not the sRGB EOTF for encoding it again.

To fix this, this commit changes KWin to use the gamma 2.2 EOTF and inverse
EOTF for untagged content. That's not technically correct for sRGB screenshots,
where we'd have to use the piecewise sRGB EOTF, but that's a problem that
can be solved in the future.
2023-11-23 13:13:30 +00:00
David Edmundson
e52163d405 Drop DockLayer concept
With LayerShell all docks were in the above layer to match with the
semantics of the specification. Under X11 our main panel was also in the
above layer by setting the keep above flag.

The only thing that ended up in the dock layer were wayland applet
popups, and that was mostly by accident. When they get a transient
parent fixed they'll end up in the AboveLayer anyway so we should drop
it now to reduce complications.

This fixes a bug where applet popups could go under the panel.

BUG: 465354
2023-11-22 16:13:17 +00:00
Vlad Zahorodnii
a01a11fc35 wayland: Reset SurfaceInterface::primaryOutput when the output is removed
CCBUG: 477325
2023-11-22 14:42:59 +00:00
Xaver Hugl
ae884dd19e backends/drm: add brightness metadata overrides and sdr gamut wideness setting
The brightness overrides are for displays with missing or broken brightness
data in their EDID, and allow the user to work around those displays. In
the future we could also offer an HDR calibration process that allows determining
the correct brightness values for the screen.

The gamut wideness setting allows the user to tweak what gamut KWin assumes
sRGB applications to have. This is useful for working around the gamut mapping
displays do, which make sRGB content look washed out, and also to allow
users to make colors of sRGB apps look more saturated if they wish to.
2023-11-21 15:51:53 +01:00
Vlad Zahorodnii
86084d118c libkwineffects/ -> effect/ 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
36021b12a7 Drop redundant "kwin" prefix in some filenames 2023-11-16 13:37:50 +00:00
Xaver Hugl
ee146d33b9 libkwineffects: move files out to more fitting places 2023-11-14 17:03:40 +01:00
Vlad Zahorodnii
9692c65390 Drop "sub-feedback" concept in PresentationFeedback
This gets rid of the container feedback to simplify presentation
feedback organization.
2023-11-14 14:58:40 +00:00
Vlad Zahorodnii
79d5a70c01 wayland: Make SurfaceInterface::{frameRendered,takePresentationFeedback} not touch subsurface tree
This gives us greater flexibility and in general more cleaner code.
2023-11-14 14:58:40 +00:00
Xaver Hugl
7bf38e54bf wayland: implement presentation time 2023-11-13 14:25:26 +01:00
David Edmundson
4f9531ad77 Support SecurityContextManagerV1
This allows KWin to securely identify the client for a given connection,
without relying on the process name.

This patch does not do anything meaningful with the application ID other
than store it.

This first version does not support kwin restarts, it can come
afterwards.

Testing done:
With latest flatpak, running `WAYLAND_DEBUG=1 flatpak run org.telegram.desktop |& grep security`
shows that flatpak itself bound the security context, and the client did not see it advertised.
2023-11-13 09:51:28 +00:00
Vlad Zahorodnii
d52ba8c3fe wayland: Fix transaction cleanup with destroyed surfaces
When sorting surfaces in the ancestor order we need to ignore null
surfaces.

In addition to that, we also need to properly handle the case where
a transaction with dependencies is unlocked and it contains null
surfaces.

For example, if there are three transactions A -> B -> C, and the B
transaction is unlocked, we cannot apply it until transaction A is
applied. The readiness check is based on checking the first pending
transaction of the surface. But if the surface is null, the check
will be skipped, which is not ideal as transaction B can be applied
before transaction A now. To address that, this change makes every
transaction entry remember the previous transaction. With that, the
readiness check can be performed even if the surface has been destroyed.

BUG: 475648
2023-11-08 13:09:51 +00:00
Xaver Hugl
9d4fe3adf1 implement the frog color management protocol 2023-11-07 20:23:06 +01:00
Xaver Hugl
15d6d8c336 wayland/surface: add the output a surface is on the most 2023-11-07 20:23:06 +01:00
Xaver Hugl
09278caf48 add colorspace metadata to surfaces and items, and use it in the OpenGL renderer 2023-10-25 14:19:12 +00:00
Xaver Hugl
872aa55630 allow setting the icc profile through the output management protocol 2023-10-25 16:05:26 +02:00
Vlad Zahorodnii
d7b1661e08 Merge libkwineffects into libkwin
libkwineffects was introduced when kwin used to be an executable. It
provided an api to implement effects and shielded from the technical
quirks in kwin.

Over the time, kwin internals had been split and abstractions were
refactored so they can be consumed in scripts or plugins. Besides that,
new ways to implement extensions have been introduced, which use
kwin's internal abstractions.

On the other hand, effects continue using libkwineffects specific apis.
This has a few issues: qtquick effects use both apis and it bites us,
duplicating same apis.

The best solution so far is to merge libkwineffects with libkwin, and
replace libkwineffects abstractions with libkwin abstractions, e.g.
EffectScreen -> Output, etc. This change takes care of adjusting libs.

Obviously, the main disadvantage of doing so is that binary effects
have to be recompiled every time new libkwin is released. But it's
already the case with libkwineffects too.
2023-10-25 12:46:12 +00:00
Aki Sakurai
115ea7454b Send tablet events to every bound wl_resource
Some apps, notably Tablet KCM, will rebind the tablet interface and consume all events that should be sent to the GUI toolkit.
This commit sends events to every consumer and also stores the latest cursor indexed by wl_client instead of wl_resource.
BUG:473126
2023-10-24 11:22:27 +00:00
Laurent Montel
bc6116c5a7 There's no QVector anymore, QList is the QVector in Qt6 2023-10-19 13:43:53 +00:00
Aleix Pol Gonzalez
c899cd07f8 xwayland: Do not set scale to 0
It would be the case upon lid close which would make KWin crash. Also
adds an assert so in case it happened again we would be able to catch it
easily. It gets applied asynchronously so it needs to be chased down.
2023-10-18 06:11:27 +00:00
Laurent Montel
2a14a4e398 Use std::as_const here 2023-10-18 06:54:47 +02:00
Vlad Zahorodnii
787d3a3ba4 wayland: Fix SurfaceState forward declaration
It's a struct and clang is not happy about using class.
2023-10-09 11:11:23 +03:00
Vlad Zahorodnii
5246d3924f wayland: Destroy ClientConnection immediately
With QObject::deleteLater(), the client object can unexpectedly outlive
the expected lifetime as in 03d0a226fb.
2023-10-09 06:32:14 +00:00
Vlad Zahorodnii
8d3b4a21c8 wayland: Properly update subsurfaces in cached transaction
Cached transaction will be merged with parent transaction when the
parent surface is committed, it's not included in the transaction graph.
2023-10-06 12:47:42 +00:00
Vlad Zahorodnii
7d56aa3687 Merge wayland tests with other tests
This makes wayland tests organization consistent with other kwin tests.
2023-10-06 11:21:00 +00:00
Xaver Hugl
3654b76ec2 split output rotation setting from rotation applied because of auto rotation 2023-10-05 20:29:04 +02:00
Xaver Hugl
ae84480fbf outputconfigurationstore: add new config system
Instead of an external service (like KScreen) storing and restoring output configurations,
with this commit KWin takes over that responsibility. This allows it to, among other things,
generate appropriate configs for new sets of outputs immediately, and take KWin-internal information
about outputs into account when generating them.

CCBUG: 474021
CCBUG: 469653
CCBUG: 466342
CCBUG: 470863
CCBUG: 466556
BUG: 466208
BUG: 455082
BUG: 457430
2023-10-05 20:29:04 +02:00
Vlad Zahorodnii
0b21c53d44 Move resource_cast helper to shared utils/ directory 2023-09-30 08:09:34 +00:00
Vlad Zahorodnii
e0074d6078 Move wayland utils to shared utils directory 2023-09-30 08:09:34 +00:00
David Edmundson
4b1a90b32a Implement axis relative direction
This is useful for the few cases where wheel events are not for
scrolling. For example adjusting the volume in the tray.

In this case having the metadata that the delta is backwards is
important. From a kwin POV it's just proxying the libinput
isNaturalScroll setting to clients.

Tested against "qtbase/examples/widgets/widgets/mousebuttons" with
modified Qt and changing the setting in the UI.

Not mergable until upstream lands.
Relevant link:
https://gitlab.freedesktop.org/whot/wayland/-/merge_requests/1 /
https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/183

CCBUG: 442789
2023-09-29 13:18:30 +03:00
Vlad Zahorodnii
1d6ac05a8c autotests: Make testServerSideDecoration test more robust
The test fails sometimes with "Tried to add event to destroyed queue".
It does so because the event queue is not destroyed last. See also
33827bbdbe for more details.
2023-09-25 10:46:32 +03:00
Vlad Zahorodnii
ff9a6cd3fa Port away from KWayland's server-decoration-palette implementation 2023-09-25 06:42:02 +00:00
Vlad Zahorodnii
dc6dba231d Port away from KWayland's server-decoration implementation 2023-09-25 06:42:02 +00:00
Vlad Zahorodnii
d6e94163f5 backends/fakeinput: Implement fake input protocol in backend
The interface is redundant now since there's an abstract input backend
abstraction.
2023-09-22 11:08:26 +03:00
Vlad Zahorodnii
de36fe82e8 wayland: Integrate KWaylandServer classes into KWin namespace 2023-09-15 16:31:15 +03:00
Vlad Zahorodnii
6ac4012827 wayland: FakeInputDevice -> FakeInputDeviceInterface
This is to avoid conflicting with KWin::FakeInputDevice
2023-09-15 16:31:15 +03:00
Vlad Zahorodnii
43eceba9ce wayland: Rename Cursor to PointerSurfaceCursor 2023-09-15 16:31:15 +03:00
Vlad Zahorodnii
541fd45a25 wayland: Add missing moc include 2023-09-15 13:13:43 +00:00
Vlad Zahorodnii
8bf2318800 wayland: Drop "_interface" from filenames
The cpp files in the wayland directory are named after protocol names.
"_interface" does not contribute anything new.
2023-09-15 13:13:43 +00:00
David Redondo
216a268a43 Use qt prefix variant of toplevel drag protocol
As this is what Qt now implements
2023-09-13 15:30:17 +00:00
David Redondo
b336691b3e Implement xdg-toplevel-drag 2023-09-13 15:30:17 +00:00
David Redondo
01a1aaf99e Also send drop when it was not accepted
This enables applications to distinguish
- successful drop
- drop onto client that didn't accept
- cancelled drag
2023-09-13 15:30:17 +00:00
Vlad Zahorodnii
08836ba471 wayland: Port to OutputTransform::map(QSize) 2023-09-12 14:21:19 +00:00
Vlad Zahorodnii
7887f7c38b wayland: Remove some properties from public XdgPositioner api
Most of these properties have no use after introducing placement().
2023-09-12 16:53:05 +03:00
Vlad Zahorodnii
df8ddb609b wayland: Keep transaction entries for deleted surfaces
If a transaction entry is removed, the graphics buffer reference will
be dropped and it's possible that the TransactionDmaBufLocker is going
to be destroyed as well.

If that happens, the transaction may remain in the locked state.
2023-09-12 13:09:43 +00:00
Vlad Zahorodnii
693fa8a968 wayland: Properly clear transaction list in TransactionDmaBufLocker
Transaction::unlock() can destroy buffer reference and thus also destroy
TransactionDmaBufLocker.
2023-09-12 13:09:43 +00:00
Vlad Zahorodnii
00c12aa766 wayland: Desynchronize transactions of the same client
At the moment transactions from the same client are applied in the
commit order even if the trasactions affect unrelated surfaces.

This patch desynchronizes transactions affecting unrelated surfaces.

With this, if a client updates two surfaces (as an example, Firefox with
two windows) and one of its surfaces takes longer to render, the other
surface is not going to be slowed down.

Another nice thing is that it removes client from Transaction, which
might be potentially useful to the Workspace for coordinated resize or
something.
2023-09-12 13:09:43 +00:00