Commit graph

25635 commits

Author SHA1 Message Date
Vlad Zahorodnii
15b8fbe604 Preserve relative order of transient siblings
If a constraint indicates that window A must be below window B but it's
not the case at the moment, the workspace will move window A right after
window B.

This can invert the relative order of transient siblings, for example
let's say that there are three constraints

- A <- B (window A must be below window B)
- A <- C
- A <- D

and the unconstrained stacking order looks as follows: [B, C, D, A]. The
final constrained stacking order is expected to look as [A, B, C, D],
but currently it's [A, D, C, B] instead:

- starting stacking order: [B, C, D, A]
- apply A <- B constraint: [C, D, A, B]
- apply A <- C constraint: [D, A, C, B]
- apply A <- D constraint: [A, D, C, B]

In order to fix this issue, this patch makes the workspace traverse the
constraint graph in the reverse order. In addition to that, it ensures
that the relative order of transient siblings in unconstrained stacking
order is preserved in the constrained one.

BUG: 477262
2023-11-21 19:26:05 +00:00
Vlad Zahorodnii
41df430aa8 plugins/screentransform: Properly exclude itself from previous screen capture 2023-11-21 19:11:44 +00:00
Vlad Zahorodnii
57ff600c98 plugins/screentransform: Use Output::pixelSize()
It's more accurate than `size * scale`.
2023-11-21 19:11:44 +00:00
Vlad Zahorodnii
b8f2f87672 plugins/screentransform: Drop m_captured flag
It's redundant now. If there's an entry in m_states dictionary for the
given screen, then there's also a valid captured previous frame.
2023-11-21 19:11:44 +00:00
Vlad Zahorodnii
62f904b698 Drop EffectsHandler::renderScreen()
It's no longer relevant after merging libkwin and libkwineffects. By
dropping EffectsHandler::renderScreen() and making the screen transform
use the Scene API directly, we can clean up some OpenGL context handling
code.
2023-11-21 19:11:44 +00:00
Vlad Zahorodnii
6a997b41ae Fix screen becoming black when its geometry changes while overview is active
Offscreen quick views are repainted in the pre paint step because that
requires a QOpenGLContext and we don't want it to mess with kwin's
opengl context. After a view is updated, its QOpenGLContext is going to
be unbound.

During normal operation mode, it works as expected:

- the view gets updated in the pre paint stage
- kwin opengl context is made current when starting the paint stage
- the offscreen view is painted on the screen

However, effects->renderScreen() has no such separation. The OpenGL
context changes from the pre paint stage will leak to the paint stage.
So we have

- the workspace notifies that the screens have changed
- the screen transform effect sees that, makes opengl context current
  and renders the screen
- the offscreen quick view is updated and after OffscreenQuickView
  is done, it's going to call QOpenGLContext::doneCurrent()
- effects->renderScreen() calls m_scene->paint()
- since there's no current opengl context, vbo allocation in
  GLTexture::render() will fail and nothing will be rendered on the
  screen

As a way around it, this change adds a makeOpenGLContextCurrent() call
before the paint stage. It doesn't quite belong there, the opengl
context has to be made current in the paint stage, e.g. by the
ItemRenderer or something. But atm we have no good place where we
could stick it in.

BUG: 477027
2023-11-21 19:11:44 +00:00
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
l10n daemon script
446f6610b4 GIT_SILENT Sync po/docbooks with svn 2023-11-21 02:11:22 +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
Xaver Hugl
da80ed4318 autotests/drm: handle the DRM_IOCTL_MODE_RMFB ioctl 2023-11-20 13:33:54 +00: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
Vlad Zahorodnii
51bcf3440f Port to the new .gitlab-ci.yml include project syntax
As Ben said on the mailing list.
2023-11-20 09:25:55 +02:00
l10n daemon script
a1857132c9 GIT_SILENT Sync po/docbooks with svn 2023-11-20 02:50:54 +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
l10n daemon script
357fba6a08 GIT_SILENT Sync po/docbooks with svn 2023-11-19 02:28:28 +00:00
Jonathan Esk-Riddell
2302d81d5a Update version number for 5.81.80
GIT_SILENT
2023-11-17 12:28:13 +00:00
l10n daemon script
7471d93a33 GIT_SILENT Sync po/docbooks with svn 2023-11-17 02:13:58 +00: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