Commit graph

68 commits

Author SHA1 Message Date
Vlad Zahorodnii
95611189d5 effect: Refuse starting quick effect if keyboard cannot be grabbed
If effects->grabKeyboard() fails and effects->ungrabKeyboard() is called
later, kwin will crash due to an assert in the ungrabKeyboard() function.

This matters only on X11.
2024-08-22 07:25:21 +00:00
Xaver Hugl
d07ce95617 effect/animationeffect: use a normal d pointer
There's no need for Qt macros to do that
2024-08-19 11:58:22 +00:00
Xaver Hugl
f10a93ce1c effects/animationeffect: clean up the code a bit 2024-08-19 11:58:22 +00:00
Xaver Hugl
e48b7b77ec effect/animationeffect: use ItemEffect to prevent direct scanout where applicable 2024-08-12 12:13:31 +00:00
Xaver Hugl
2a5716e782 effects/animationeffect: port to stl containers
We need to attach non-copyable data to animations, and Qt containers don't work for that
2024-08-12 12:13:31 +00:00
Xaver Hugl
18f1092728 scene/item: add ItemEffect
Right now it's just a helper to mark items as being affected by some effect,
to prevent direct scanout of the relevant item without needing to block direct
scanout for the whole screen
2024-08-12 12:13:31 +00:00
Xaver Hugl
833476a111 core/colorspace: add rendering intents
Rendering intents describe how to handle mapping between different colorspaces,
what to do with out of gamut values and what to do if the whitepoint doesn't match.
This way, clients can choose which behavior their content should get.
2024-08-12 11:46:32 +00:00
Xaver Hugl
8542c20030 effect/effectwindow: remove decorationInnerRect
It's the same as contentsRect
2024-08-06 12:23:55 +00:00
Nicolas Fella
80b5910594 Add visual bell effect
This effect is used to implement the visual bell accessibility feature.

It allows to implement it on Wayland and significantly improve it on X11,
where it's currently rather broken.

It offers two modes:
- Inverting the colors (code is based off the invert effect)
- Flashing a solid color
2024-07-30 15:19:35 +02:00
Xaver Hugl
f1a867ea12 color management: map reference luminance of source and target content to each other
This ensures that different content on the screen matches with the user configured
reference / SDR luminance, and both simplifies SDR<->HDR mapping by removing the need
for special casing that situation and significantly improves the mapping in some cases.
As we don't get any reference luminance values for HDR content (yet), this commit
assumes that HDR content is prepared for the reference luminance of the preferred
color description.
2024-06-28 13:16:02 +00:00
Xaver Hugl
bdc24ff8c7 core/colorspace: add mastering display colorimetry
The mastering display colorimetry describes what part of the colorspace
is actually used, which is important when we're sending desired metadata
about a screen using the rec.2020 container colorspace, or when the client
uses an "infinite" / extended colorspace like scRGB
2024-06-26 15:41:38 +02:00
Xaver Hugl
bffae41983 remove Workspace::sendWindowToOutput
It just calls Window::sendToOutput...

BUG: 329980
2024-06-07 00:44:24 +00:00
David Edmundson
8c149bb6b7 effects: Do not call RHI QQuickRenderControl methods when using software rendering
As per the docs:
Note: This function does not need to be, and must not be, called when
using the software adaptation of Qt Quick.

This sets up RHI on the render control, which in turn sets RHI on the
window, which shouldn't exist when using software rendering.

BUG: 482663
BUG: 486078
2024-06-04 08:33:19 +00:00
David Edmundson
5d90f232bd effects: Disable showing desktop when starting any fullscreen effect
Fullscreen effects typically will show all the windows, when the effect
ends having the windows disappear doesn't really work.
From a user point of view any full screen effect is a new task, we want
to cancel any preivous task.

BUG: 487299
2024-05-30 08:06:56 +00:00
Vlad Zahorodnii
a76ae07ee1 Revert "effects: Use unique device for replaying events to QQuickView"
It broke overview.

This reverts commit 862dae455a.
2024-05-27 17:32:14 +00:00
David Edmundson
862dae455a effects: Use unique device for replaying events to QQuickView
When a new mouse event is made it updates the global position of that
device. This causes issues if a mouse event is forwarded with an
adjusted position then used afterwards.

`QPointingDevice::primaryPointingDevice` creates a new pointer device
internally if the seat name does not exist. It is then shared between
future usages.

BUG: 480864
2024-05-27 08:55:27 +00:00
David Edmundson
84633badc7 effects: Support dynamic delegate changes whilst running
The cube effect has a placeholder which can update the delegate at
runtime. There's an "add desktop" button which then might give us 3
virtual desktops. As a general rule any setter exposed via a declarative
API should always perform the setting.

Reloading has to be delayed because otherwise we unload the caller.

BUG: 486839
2024-05-23 12:00:56 +03:00
Pau López
c41315564c effect: Fix clip region in AnimationEffect 2024-05-07 10:45:00 +00:00
Xaver Hugl
26b15feb61 backends/x11/standalone: remove on-demand mouse polling
Instead, rely on XInput if available, and fall back to polling every 50ms if not
2024-04-29 14:13:32 +00:00
Aleix Pol
1ab5453a90 EffectLoader: Warn about trying to load an invalid effect
If the metadata of the effect is invalid, loadEffect will complain
rather than failing silently, making debugging issues a bit harder and
it's something that we are already checking for and shouldn't
realistically be happening.
2024-04-15 00:47:33 +02:00
ivan tkachenko
344e56dd77
plugins/dialogparent: Disable darkening while picking colors
Integrate with colorpicker effect to disable window darkening while
color picker effect is active. Unfortunately, this solution has couple
of limitations:
- active state of effects is not an observable property, so a new
  property had to be added to the effects singleton;
- consequently, list of active effects is not an observable property, so
  the whole thing could not be implemented in pure QML in the dialog
  parent effects;
- actual isActive() state of the color picker for whatever reason
  required that m_scheduledPosition is not an invalid point,
  effectively making it always inactive except for a brief moment
  between addRepaintFull() call and paintScreen() callback. That check
  had to be removed.
- QColorDialog windows are still modal and darkened by default;
- QColorDialog on X11 does not use portals/KWin, so this trick does not
  apply at all;
- effects->isScreenLocked() which isActive() depends on is not an
  observable property either.

BUG: 172921
2024-04-12 22:39:01 +06:00
Xaver Hugl
d59451adcf effects/quickeffect: render qtquick scenes in the normal render pass
If they're rendered in prePaintScreen, the time needed to render them is not
accounted for in compositing scheduling, which may make KWin miss vblank

CCBUG: 482861
CCBUG: 452119
CCBUG: 482034
2024-03-26 17:06:07 +01:00
David Edmundson
e13a30f00f effects: Do not take ownership of QuickEffect::delegate
QuickEffect::setDelegate is exposed QML API.

The lifespan of assigned objects is therefore managed by the QML engine,
and we should be watching for deletion not actually deleting it.
2024-03-18 12:55:51 +00:00
Xaver Hugl
f98477e05b opengl/glframebuffer: move static variables to OpenGlContext 2024-03-08 17:26:54 +00:00
Aleix Pol
1d57c9a5af effects: Use chrono to specify the animation times
Makes both the API and its uses explicit in terms of what unit the times
are on.
2024-03-06 10:19:55 +00:00
Vlad Zahorodnii
8736e44e1a effect: Fix EffectWindow::contentsRect()
It should specify the client rect inside the frame.

2556378dfa incorrectly assumed that the
buffer geometry includes the decoration.

BUG: 482294
2024-03-05 13:34:35 +00:00
Vlad Zahorodnii
64dc01c640 effect: Drop WindowPaintData::screen
It's unused.
2024-02-29 13:33:52 +00:00
Aleix Pol Gonzalez
bf1ce85474 Make it possible to build KWin without libxcb
Now that we have Wayland around, there's a whole branch of dependencies
that shouldn't be necessary anymore.
This allows to build KWin without all of it, allowing us to have a much
more compact alignment for cases where all the legacy software isn't
necessary anymore.

Bundle KWindowSystem X11-specific headers into it too, since it's part
of the same process.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
2024-02-28 16:03:50 +00:00
Aleix Pol Gonzalez
94121c2a42 Unify the format for #include "config.h" 2024-02-28 16:03:50 +00:00
Vlad Zahorodnii
bc62e7e094 Drop Window::{windowShown,windowHidden}
They serve the same purpose as Window::hiddenChanged, so drop these
signals instead of having multiple signals to indicate the same thing.
2024-02-27 20:58:52 +00:00
Vlad Zahorodnii
a8a53c651b Port away the remaining users of windowShown/windowHidden to hiddenChanged 2024-02-27 20:58:52 +00:00
Vlad Zahorodnii
f6b605daf2 scene: Add support for item transformations 2024-02-27 20:14:05 +00:00
Vlad Zahorodnii
693cd16b12 effect: Drop WindowPaintData::projectionMatrix() 2024-02-27 17:47:39 +00:00
Vlad Zahorodnii
bb8b51a3ab Fix disappearing software cursor in overview and zoom effect
The overview and the zoom effect repaint the whole screen every frame.
But the problem is that there are cases when there's nothing to repaint.
I'm not quite sure why it happens. Maybe overview and other effects
should honor the repaint region, but on the other hand, they don't need
to because of the fullscreen effect api promises.

This change forces overview and zoom effect to use "generic paint" code
path in the workspace scene to force infiniteRegion() repaint regions.

BUG: 481523
2024-02-21 01:01:59 +02:00
Aleix Pol Gonzalez
79dd34b3f9 Do not rely on NETWM for the main Window class
NETWM forces a weird X11 dependency on KWin that doesn't necessarily
match what we want to do. Instead we decouple such a central class in
KWin like it's Window from KWindowSystem X11 support.

Signed-off-by: Falko Becker <falko.becker@mbition.io>
2024-02-20 18:04:06 +00:00
Vlad Zahorodnii
fc92544cb3 plugins/overview: Allow switching between modes using shortcuts while already active
Overview and Grid modes have shortcuts assigned to them. While they
provide a way to toggle the overview effect between on and off state, in
other words overview <-> off or grid <-> off, it's not possible to move
between the modes by pressing those shortcuts, e.g. off -> overview ->
grid -> overview -> grid -> ... -> off.

The culprit seems to be that EffectTogglableState has two "inactive"
states - Inactive and Stopped. It's counter-intuitive and needs a further
cleanup.

To make switching between overview modes work, this change makes
EffectTogglableState::toggle() toggle the state based on the Active state.
There's only one active state.

CCBUG: 481335
2024-02-16 08:59:06 +00:00
David Edmundson
95d4671a10 quickeffect: Avoid double delete of QQuickViews
Views are owned by the C++ backend, but also retrievable by invokables
to get neighbouring screens from JS space. By default Qt then transfers
ownership of the view to the QML collector. This results in double
ownership.

BUG: 480788
2024-02-09 09:12:17 +00:00
Vlad Zahorodnii
2556378dfa Fix X11Window wrapper window geometry
This amends 66a491bda6.

There are a few more cases that had been overlooked in the original patch.
2024-02-06 12:13:54 +00:00
Vlad Zahorodnii
e97b6032c2 effect: Allow ref'ing normal windows
It can be used to simplify state tracking in some effects. The
restriction exists because there used to be separation between normal
and closed windows (Toplevel and Deleted), and one could reference
only Deleted windows. So it was easier just to forbid referencing still
alive windows.
2024-02-05 15:06:13 +00:00
Niccolò Venerandi
79a61deb25 Register touch action to activate Overview instead of toggling it
This is because the Overview will activate itself at the end of a 1:1 gesture,
and a toggle action might actually deactivate it rather than activate it.
2024-02-02 14:42:06 +01:00
Vlad Zahorodnii
93b9fdd391 effect: Fix initialization of QEvent::isAccepted() in cloned events in OffscreenQuickView
QEvent::isAccepted() is initialized to true by default.

BUG: 480538
2024-02-02 02:00:07 +01:00
Marco Martin
19970bd639 plugins/wobblywindows: Use snapping when the window isn't moving
disable pixel snapping when the window is moving with some velocity/acceleration,
reenable it when is (alsmost) stopped
2024-02-01 10:47:45 +02:00
Xaver Hugl
896a57d3be opengl/glshader: make uniform enums type safe 2024-01-31 13:24:48 +01:00
Vlad Zahorodnii
35572904fc effect: Overwrite the output in OffscreenQuickView::setGeometry()
It seems like QWindow::setGeometry() won't update the associated output
if no platform window has been created, which is the case when running
overview or any other qml effect.

It's not clear whether this is a Qt bug or intended behavior.
qwindow.cpp contains comments assuming that the window is on the primary
output if no platform window exists.
2024-01-29 10:51:54 +02:00
Vlad Zahorodnii
601d33f294 effect: Allocate an offscreen fbo with correct scale in OffscreenQuickView
QQuickWindow::effectiveDevicePixelRatio() uses the device pixel ratio
of the attached QQuickRenderTarget. Instead, the scale factor of the
output should be used, which is what QWindow::devicePixelRatio() returns.
2024-01-29 10:51:54 +02:00
Vlad Zahorodnii
da4f4d7e69 Rename UnmanagedLayer to OverlayLayer
The UnmanagedLayer layer is used for placing overlay content so
rename it to match how it's used in practice.
2024-01-18 13:13:55 +00:00
David Redondo
203c4998bc Make sure window thumbnails and Qt Quick resources are destroyed properly
Drops the doneCurrent as it was preventing proper cleanUp
because no context was current when textures were deleted.
Also avoid manipulating the context when Qt has the current
one, as various Qt classes have guards around their cleanup
handlers which rely on a current Qt context.
Despite the comment the order of render control and view destruction
needs to be switched as the QQuickWindow destructor calls into
the render control to notify if of window destruction.
BUG:478770
BUG:479846
FIXED-IN:6.0
2024-01-16 13:45:52 +01:00
Vlad Zahorodnii
72c391ebc8 effect: Remove const refs in EffectFrame
It's a micro optimization.
2024-01-15 14:42:27 +00:00
Vlad Zahorodnii
09f97c8037 plugins/mouseclick: Fix glitches
Effect frame geometry is not properly synchronized with the quick
scene geometry.

BUG: 477892
2024-01-15 14:42:27 +00:00
Alexander Lohnau
7d1db53f6b Remove unneeded includes from headers and cpp files 2024-01-13 11:34:45 +01:00