Commit graph

6013 commits

Author SHA1 Message Date
Aleix Pol
4540925f3f Remove unnecessary variable 2023-11-21 18:52:40 +00:00
Aleix Pol
97e75c858a nv12: Remove unnecessary debug
Forgot to remove it before merging the patch
2023-11-21 18:52:40 +00:00
Xaver Hugl
008e5e5a10 workspace: reduce placeholder output size
Maximized windows get resized to this when the last output gets removed, which
can increase VRAM load unnecessarily. As the placement tracker resizes windows
back to their original size, we can reduce the size of the placeholder output
without causing additional issues
2023-11-21 18:36:29 +00:00
Vlad Zahorodnii
2ff0fc26a4 Merge EffectWindow::{windowMinimized,windowUnminimized}
The main motivation is to match the Window API.
2023-11-21 18:20:02 +00:00
Xaver Hugl
017b4019b6 outputconfigurationstore: don't generate configs that disable all outputs 2023-11-21 18:38:05 +01:00
Xaver Hugl
3c25474b41 outputconfigurationstore: ensure that the config doesn't turn off all outputs 2023-11-21 18:08:01 +01:00
Kai Uwe Broulik
75935c126c layershellv1window: Check isDeleted before activating it
Opening the user actions menu causes auto-hiding layer-shell windows
(such as Kickoff, KRunner) to hide, closing the menu and having KWin
transfer focus back to the window which is now half-destroyed.

XdgToplevelWindow::acceptsFocus() also checks for isDeleted().
2023-11-21 16:13:06 +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
Aleix Pol
118bc93144 config.h: Use constexpr QLatin1String instead of char*
char* are the past, constexpr lets us calculate certain things at
build time.
2023-11-21 08:09:38 +00:00
Aleix Pol Gonzalez
597b041666 Fix build without HAVE_ACCESSIBILITY 2023-11-20 23:38:05 +01:00
Vlad Zahorodnii
4faad8bd49 effects.h -> effecthandler.h 2023-11-20 15:47:36 +00:00
Vlad Zahorodnii
25ab2b53dd Extract EffectWindow into its own header 2023-11-20 15:47:36 +00:00
Alessandro Astone
f555c3301e screencast: Make nvidia use the GLES path
glGetTexImage returns a black image

https://forums.developer.nvidia.com/t/glgetteximage-returns-a-black-image-when-using-a-gbm-backed-egldisplay/273253

Fixes: BUG:476602
2023-11-20 15:26:51 +00:00
Alessandro Astone
491a5b386b screencast: Fix GLES path
glReadPixels reads from the bound framebuffer, so create an offscreen
framebuffer and attach the texture to it

Co-authored-by: Jan Grulich <jgrulich@redhat.com>
2023-11-20 15:26:51 +00:00
David Redondo
4cdf27e74c Expose a method to allow closing windows on shutdown.
This allows Plasma to gracefully close windows on shutdown by sending
xdg_toplevel.close. If after 10 seconds windows are still open because
they prompt for unsaved changes or similar cases, a notification is
shown to either prompt or logout regardless.
CCBUG: 461176
2023-11-20 14:56:17 +00:00
Kai Uwe Broulik
40aa5aceb8 workspace: Add "xdg activation"-only mode
Never auto-activate Wayland windows when "Extreme" focus stealing
prevention is configured. This allows to more easily find places
where window activation isn't properly implemented, such as on
application startup.
2023-11-20 14:36:05 +00:00
Vlad Zahorodnii
433b753360 Drop EffectWindowList
Use `QList<EffectWindow *>` instead.
2023-11-20 13:45:36 +00:00
Xaver Hugl
b28d2c2d80 backends/drm: use closefb instead of removefb when available
The closefb ioctl removes the userspace reference from the framebuffer but does
not try to disable planes and outputs if the buffer is still used. This allows
for example for smoother transitions between SDDM and the Plasma session
2023-11-20 14:36:08 +01:00
Andreas Gattringer
5651bae432 backends/drm: Don't add GPU if we are already using it
BUG: 477242
2023-11-20 13:08:12 +00:00
Vlad Zahorodnii
96af98609e Don't pass ownership of InputEventFilter and InputEventSpy to InputRedirection
This is not compatible with plugins that install their own filters. The
approach in this patch is not elegant, but it should work. Another option
would be to convert these filters and spies to QObjects and use QObject
ownership model, but this would be also too excessive just to save a few
lines of code.
2023-11-20 14:45:29 +02:00
Vlad Zahorodnii
961bd00919 Move WindowVertex,WindowQuad,RenderGeometry out of effects.h
These are core scene abstractions and don't belong in effects.h.
2023-11-20 14:05:52 +02:00
Vlad Zahorodnii
86084d118c libkwineffects/ -> effect/ 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
75f9fda962 Clean up workspacescene.h includes 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
618dee19cf Move GLVertex2D to glvertexbuffer.h 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
9aef54b701 Remove effects.h include in effectframe.h 2023-11-20 11:32:43 +00:00
Vlad Zahorodnii
0a2ed7d1c8 Move scaledRect,roundVector,flooredPoint to globals.h 2023-11-20 11:32:43 +00:00
Xaver Hugl
bec9ffeacd outputconfigurationstore: match KScreen's max scale of 300% 2023-11-20 09:11:09 +00:00
Nicolas Fella
6a1b1d01b8 Fix and simplify UI creation in various effect KCMs
We don't need an intermediate widget class here, we can set up the UI directly, like it's done in several effect KCMs already

Not only does this simplify the code, it also fixes crashes due to broken ownership

BUG: 477020
2023-11-20 07:41:49 +00:00
Huang-Huang Bao
3d4036210d
scene: use fractionalGeometry() as input of RenderViewport renderRect
Fixes mismatches between renderTarget.size() and deivce geometry calculated using viewport.renderRect() * viewport.scale() .

BUG: 475325
2023-11-20 06:14:55 +08:00
Natalie Clarius
8e6b1a363f plugins/nightcolor: osd: show day icon if appropriate 2023-11-16 19:48:06 +00:00
Vlad Zahorodnii
96e979c736 Move window motion manager to the slideback effect
Slide back is the only remaining its user.
2023-11-16 17:06:38 +02:00
Vlad Zahorodnii
b0292fc0de Move Effect::animationTime() implementation to effect.h
Amends d13b53c366.

It was overlooked.
2023-11-16 16:15:32 +02:00
Vlad Zahorodnii
fe9821722e Drop Effect::initConfig()
Effect::initConfig() definition can't be moved to effect.h because
it's going to create a cyclic dependency. On the other hand, the real
benefit of initConfig() is doubtful. It's a shortcut for calling
Config::instance(effects->config()), which is small amount of code.
2023-11-16 16:14:09 +02:00
Vlad Zahorodnii
8566cb3735 Move effectloader.h to libkwineffects/ 2023-11-16 15:51:39 +02:00
Vlad Zahorodnii
36021b12a7 Drop redundant "kwin" prefix in some filenames 2023-11-16 13:37:50 +00:00
Xaver Hugl
e17af124d4 backends/drm: correct color management check for the CTM 2023-11-16 13:15:36 +00:00
Devin Lin
12d04f9d86 libkwineffects: Export EffectTogglableState 2023-11-15 21:41:40 -08:00
l10n daemon script
56c732829f 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-11-16 02:15:19 +00:00
Aleix Pol Gonzalez
b860439be5 Allow support dmabuf formats that we have conversions for.
If there's a supported mechanism to handle the format, announce them as
supported.
If there are modifiers supported by the graphics card (even though as
external only), offer them as well.
2023-11-15 21:42:05 +01:00
Aleix Pol Gonzalez
3568829216 opengl: Add support for NV12 on Wayland dmabufs
Offers wayland clients the possibility to send us their contents using
an NV12 texture.
It implements it by rendering into scene using a shader.
2023-11-15 21:32:25 +01:00
Niccolò Venerandi
9e81d2f65c plugins/overview: Bind values to 1:1 animation while gesture is ongoing
Otherwise the animation feels wrong while activating with a gesture.
Now when a 1:1 gesture is ongoing, then the Overview effect will stop
animating the overviewVal/gridVal values. I implemented this by porting
to states, giving 1:1 gestures their own states, and only animating the
change between states.

BUG: 476536
2023-11-15 17:41:02 +00:00
Vlad Zahorodnii
15b47ce7fc Merge EffectsHandlerImpl and EffectsHandler 2023-11-15 15:21:50 +02:00
Vlad Zahorodnii
d0158ec588 Drop X11 connection getters in Effect
They are redundant, EffectsHandler already provides same things.
2023-11-15 14:41:43 +02:00
Vlad Zahorodnii
a5546f1450 Drop some unused kwineffects.h includes 2023-11-15 14:41:42 +02:00
Vlad Zahorodnii
d13b53c366 Extract Effect into its own header
After merging libkwineffects and libkwin, EffectsHandler and EffectWindow
have effectively become redundant. On the other hand, Effect and the
associated factory code is still relevant. In order to split relevant and
"legacy" code, this change extracts the Effect class in its own header.
It's also a good idea to split kwineffects.h header because it's quite
huge...
2023-11-15 14:41:42 +02:00
Vlad Zahorodnii
56e384e527 Extract TimeLine into its own header 2023-11-15 12:02:50 +00:00
Vlad Zahorodnii
889180b685 Remove code to unset QT_DEVICE_PIXEL_RATIO envvar
QT_DEVICE_PIXEL_RATIO has been dropped in Qt 6.
2023-11-15 12:27:32 +02:00
David Redondo
6befc5d11b Do not set QSG_RENDER_LOOP Variable
This leaks to other processes that are started by KWin.
The QPA sets ThreadedOpenGL capability to false which suffices
to use the basic render loop with OpenGL.
2023-11-15 09:58:54 +00:00
Xaver Hugl
ee146d33b9 libkwineffects: move files out to more fitting places 2023-11-14 17:03:40 +01:00
Vlad Zahorodnii
51cb2b00b3 Extract EffectFrame helper in its own header 2023-11-14 15:11:29 +00: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
Weng Xuetian
9e047059c1
Add isInputMethod in EffectWindow and do not dim input method window 2023-11-14 06:29:51 -08:00
Vlad Zahorodnii
aabc162632 x11: Unload effects before destroying Workspace and Compositor
Effects can hold references to closed windows, which can cause problems
after the workspace is destroyed.

This change makes ApplicationX11 unload effects before destroying the
Workspace and the Compositor similar to how it's done in main_wayland.

BUG: 475511
2023-11-14 15:51:03 +02:00
Xaver Hugl
75304afe0f backends/drm: only disallow direct scanout with mismatching color descriptions
Generically disabling it with color management is a bit overkill
2023-11-14 14:17:37 +01:00
Xaver Hugl
38575ac33d backends/drm: re-allow the hardware cursor with color management
It doesn't look wrong anymore, presumably what caused it to look wrong before
was just a bug. Blending in sRGB or PQ is still technically wrong, but it
looks okay, and that's an acceptable tradeoff to make in order to get the
responsiveness and power usage improvements the hardware cursor offers
2023-11-13 20:49:22 +01:00
Natalie Clarius
5ee2d53561 rename user facing name 'Night Color' -> 'Night Light'
This 1. is more familiar terminology as on other platforms (Gnome, Android); 2. avoids confusion with a planned future day/night light/dark color scheme switcher.
2023-11-13 15:53:29 +00:00
Xaver Hugl
869e86ff00 backends/drm: disable buffer readability checks on Intel
They cause stutters and reduced frame rates on some Intel laptops because the
buffers don't become readable in time, so disable the checks until that's fixed
on the driver side. For debugging purposes, the environment variable
KWIN_DRM_DISABLE_BUFFER_READABILITY_CHECKS can be used to override the default
behavior.

BUG: 476860
2023-11-13 14:33:44 +00:00
Xaver Hugl
93443a8228 backends/drm: set the correct content transform for shadow buffer
BUG: 476931
2023-11-13 13:44:54 +00:00
Xaver Hugl
7bf38e54bf wayland: implement presentation time 2023-11-13 14:25:26 +01:00
Xaver Hugl
46f8bfcf7b dpmsinputeventfilter: don't filter out key release events
If the release event is filtered out, the rest of the system thinks the
button is still pressed, even though it isn't
2023-11-13 13:05:12 +00:00
Xaver Hugl
2a3068b14e workspace: ignore placeholder output for dpms
This doesn't fix any issues, but it's not necessary to destroy and then
re-create the dpms filter just because of the placeholder output
2023-11-13 13:05:12 +00:00
Nathan Garside
3662c75a53 tiling: update ui on shift press/release 2023-11-13 12:31:17 +00:00
Harald Sitter
b8fb43db95 pointer_input: position cursor on the primary output after a placeholder
this improves the out of the box behavior which has regressed a bit over
time. since we default to kcfg_ActiveMouseScreen=true the active screen
by default follows the pointer. during early startup we position the
pointer on a Placeholder output, this output does eventually get
replaced by the real output(s). because of the update logic we'd
re-position the pointer on the closest real output, but that isn't
necessarily the intended primary output.

e.g. consider an eDP + HDMI setup depending on the geometries involved
the cursor may end up on the HDMI screen by default rather than the eDP
resulting in plasma-welcome opening on the HDMI output.

to mitigate this problem we now track whether the last output was a
placeholder and if so we instead try to position the pointer on the
current primary output
2023-11-13 11:34:09 +00:00
Vlad Zahorodnii
0b8b9b70bb Merge EffectWindowImpl with EffectWindow
The indirection no longer required because libkwineffects has been
merged with libkwin. EffectWindow will be eventually dropped in favor
of apis provided by Window and WindowItem.
2023-11-13 11:24:04 +00:00
David Edmundson
4016406e1e wayland: Drop isTrustedOrigin check
The rationale behind the check was sandboxed apps could have a different
mount namespace to kwin, therefore lying about the executable path was
doable.

Moving forward anything sandboxed will have a security context app Id.
Anything not sandboxed can circumvent these checks anyway.

This significantly improves application launch time.
2023-11-13 10:41:35 +00:00
David Edmundson
aec896acc0 wayland: Prefer security context appId for permission lookup where available
The security context appId is set by the launching container (i.e
flatpak) and is therefore more trustworthy than any other source of
application ID.

Use this when looking up allowed wayland extensions.
2023-11-13 10:41:35 +00: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
l10n daemon script
e772428180 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-11-13 02:07:54 +00:00
Fushan Wen
b7e30f2804
main_x11: use QBAV more
to reduce allocations.
2023-11-12 11:25:39 +08:00
l10n daemon script
ba55a6cb55 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-11-12 02:07:55 +00:00
l10n daemon script
472956b4fa 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-11-11 02:13:54 +00:00
Natalie Clarius
a5d1646590 plugins/nightcolor: expose daylight property in DBus interface
So that the applet can provide more detail about the current status, now that there is a configurable day time temperature.
2023-11-10 16:38:05 +00:00
Xaver Hugl
04766c384a outputconfigurationstore: handle missing EDID identifiers correctly 2023-11-10 16:50:31 +01:00
Xaver Hugl
fde1393076 outputconfigurationstore: invalidate duplicate output entries
The configuration file may contain entries that have the same output identifiers if
there's a bug in the implementation. To repair the config, this commit checks for
duplicate entries in the output list and removes them when loading the config file.
2023-11-10 16:50:31 +01:00
Xaver Hugl
0a844c2bde outputconfigurationstore: fix repairing the output list 2023-11-10 16:50:31 +01:00
Xaver Hugl
bd6b946a7e utils/edid: log a warning when parsing fails 2023-11-10 16:50:31 +01:00
Vlad Zahorodnii
7b5ac472c9 libkwineffects: Make OffscreenQuickView opaque
OffscreenQuickView replaces the contents of the default scene. Nothing
will be repainted beneath it.

On the other hand, if the OffscreenQuickView contains translucent region,
there might be visual glitches. To prevent that, this change makes
scene effect views opaque.
2023-11-10 09:07:04 +00:00
Vlad Zahorodnii
7478c81a48 libkwineffects: Add alpha channel option in OffscreenQuickView
We want some quick views to be opaque, for example SceneEffect views.
This changes adds an api allowing to specify whether the given
OffscreenQuickView must be opaque or translucent.
2023-11-10 09:07:04 +00:00
Alexander Lohnau
22dfc8978e Adjust to removed QueryMatch::Type enum in KRunner 2023-11-10 07:11:44 +01:00
Xaver Hugl
acba91672b backends/drm: fix typo 2023-11-09 15:53:08 +01:00
Xaver Hugl
d24edc7890 backends/drm: ensure correct colors with direct scanout of NV12 buffers
If another compositor changes the color encoding and color range properties, the
resulting colors will be wrong. This commit ensures they're always set to BT.709
limited range to prevent that
2023-11-09 12:16:17 +00:00
Xaver Hugl
c1312a5551 backends/drm: fix pageflip events getting lost when outputs get turned off
When a display gets turned off while a pageflip event was still pending, the pending
state gets changed immediately, without waiting for the pageflip event to arrive first.
When this happens, activePending() returns false, and so the pageflip event gets discarded.
This commit changes the logic to only check for activePending() when the pageflip is for a
modeset, avoiding that issue.

BUG: 476340
BUG: 476341
BUG: 476342
BUG: 437520
BUG: 475146
2023-11-09 11:35:19 +00:00
l10n daemon script
e2d072afec 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-11-09 02:08:31 +00:00
Xaver Hugl
bdc62b3516 backends/drm: ensure icc profiles aren't applied with HDR
ICC profiles don't support HDR yet, and they don't make a lot of sense with
how unpredictable displays behave with BT2020 and/or PQ inputs
2023-11-09 01:42:10 +00:00
Nate Graham
cdadf7cf7f Access ShadowedLabel from PlasmaExtras
That's where it's been moved to; see
https://invent.kde.org/plasma/plasma-framework/-/merge_requests/951.
2023-11-08 13:26:22 -07:00
Aleix Pol Gonzalez
6cac17aac0 GLShader: Use floating point values to interact with vectors
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2023-11-08 17:07:37 +01:00
Aleix Pol Gonzalez
7b64433830 GLShader: Fix sdrBrightness into float
It's used as a float and otherwise it makes (some?) drivers very
confused as they're required to cast at runtime.
The original value is double so it makes sense to keep the same type.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2023-11-08 16:46:45 +01:00
Xaver Hugl
15080192f7 Remove latency policy and render time estimator settings
As KWin measures render times properly now, these settings and estimations
should no longer be necessary, so this commit replaces them with one hardcoded
algorithm that should prevent most dropped frames and reduce latency
2023-11-08 13:29:29 +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
Vlad Zahorodnii
16389f0298 Remove NAMELINK_SKIP for libkwin
libkwin headers are installed now, so it should be removed.
2023-11-08 09:06:54 +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
Christophe Marin
b40e960ad7 Bump kwin soversion to 6 2023-11-07 12:56:29 +01:00
Nate Graham
c5a3749a40 XWayland: allow snooping non-character keys with elevated snooping modes
These keys do not represent a security risk to allow apps to snoop since
they can't be used to type passwords etc.

BUG: 474705
FIXED-IN: 6.0
2023-11-06 15:19:19 +00:00
Xaver Hugl
28c27609a4 xdgshellwindow: enforce a minimum size for clients
It doesn't make sense for a window to become 1x1 pixels small. When we have
server side decorations we also know that the decoration takes a lot of
space, so this commit enforces a bigger minimum size for decorated windows

BUG: 469237
2023-11-06 14:55:57 +00:00
Xaver Hugl
d0a9e90716 platformsupport/scenes/opengl: fix format filtering
We support formats that are neither 10 nor 8 bits per color, so the filtering needs
to reflect that
2023-11-06 12:42:00 +01:00
Noah Davis
ea75c094a9 plugins/fallapart: Blacklist spectacle
Spectacle needs to be blacklisted in order to stay out of its own
screenshots.

BUG: 473565
2023-11-06 10:01:03 +00:00
David Edmundson
a8466c3604 layershell: Implement dockWantsInput
Kwin logic has a separate method for if a dock wants input, given layer
shells are always docks it is important to implement this.
2023-11-06 09:37:13 +00:00
Vlad Zahorodnii
0f5e719b61 wayland: Fix none keyboard interactivity in LayerShellV1Window
Window::acceptsFocus() is not taken into account when a window is
activated using Workspace::activateWindow(). The main reason is because
of different input models on X11.

Instead, Window::takeFocus() should check itself if the window accepts
focus.
2023-11-06 08:07:32 +00:00