Commit graph

69 commits

Author SHA1 Message Date
Vlad Zahorodnii
2ac1f9b7d3 kwineffects: Expose internalId 2022-04-13 19:06:11 +00:00
Vlad Zahorodnii
bfb60e3610 Add RenderTarget type
The main motivation behind this change is to unify render target
representation across opengl and software renderers and avoid accessing
the render backend directory in order to get the render target.
2022-04-13 10:16:16 +00:00
Gustavo Silvera
41526bd8dd effects/showfps: add new options
- added option to remove the frametime graph
- added option to remove the "this is a benchmark" message
- location of the fps counter is now on the "active" monitor by default
- removed the hard-limit of 100 for the FPS counter
- added option to color the text based off the FPS value
2022-04-04 16:05:56 +00:00
Vlad Zahorodnii
601ef328df Drop more legacy Workspace.clientArea() overloads
With this change, the Workspace would provide clientArea() overloads
that take only AbstractOutput and VirtualDesktop. integer ids are
obsolete as they are unstable.
2022-03-29 17:34:41 +00:00
Fushan Wen
0ded63c464 effects: Don't emit showingDesktopChanged when animated is false 2022-03-29 03:46:31 +00:00
Vlad Zahorodnii
e293972eaa Run clang-tidy with -checks=readability-braces-around-statements fixit
This fixes style issues in old code.
2022-03-28 10:54:11 +00:00
Xaver Hugl
8914a6c50e add global touchscreen gestures
Swipe with three fingers
- left to switch to the previous virtual desktop
- right to switch to the next virtual desktop
- up and down to toggle the overview

CCBUG: 439925
2022-03-27 19:09:04 +02:00
Vlad Zahorodnii
7096e3ead8 Run clang-format
The .clang-format file is based on the one in ECM except the following
style options:

 - AlwaysBreakBeforeMultilineStrings
 - BinPackArguments
 - BinPackParameters
 - ColumnLimit
 - BreakBeforeBraces
 - KeepEmptyLinesAtTheStartOfBlocks
2022-03-25 13:25:15 +02:00
Marco Martin
2b6f8a3141 support realtime activation for screen edges gestures
support realtime activation for screenedges gestures, making it possible
for effects to show half-triggered states while dragging from
the edge with a finger, making them much more usable
2022-03-22 20:28:02 +05:30
Vlad Zahorodnii
aac0609bb9 scene: Rework surface damage tracking
It's not possible to get the surface damage before calling
Scene::paint(), which is a big problem because it blocks proper surface
damage and buffer damage calculation when walking render layer tree.

This change reworks the scene compositing stages to allow getting the
next surface damage before calling Scene::paint().

The main challenge is that the effects can expand the surface damage. We
have to call prePaintWindow() and prePaintScreen() before actually
starting painting. However, prePaintWindow() is called after starting
rendering.

This change makes Scene call prePaintWindow() and prePaintScreen() so
it's possible to know the surface damage beforehand. Unfortunately, it's
also a breaking change. Some fullscreen effects will have to adapt to
the new Scene paint order. Paint hooks will be invoked in the following
order:

* prePaintScreen() once per frame
* prePaintWindow() once per frame
* paintScreen() can be called multiple times
* paintWindow() can be called as many times as paintScreen()
* postPaintWindow() once per frame
* postPaintScreen() once per frame

After walking the render layer tree, the Compositor will poke the render
backend for the back buffer repair region and combine it with the
surface damage to get the buffer damage, which can be passed to the
render backend (in order to optimize performance with tiled gpus) and
Scene::paint(), which will determine what parts of the scene have to
repainted based on the buffer damage.
2022-03-21 09:32:41 +02:00
Vlad Zahorodnii
3c945358fc Revert "Implement desktopSwitching() interface for realtime animations"
This reverts commit c7c1ac78ea.

This change was merged prematurely.
2022-03-19 18:30:41 +02:00
Eric Edlund
c7c1ac78ea Implement desktopSwitching() interface for realtime animations
Added this interface to the VirtualDesktopManager. Realtime touchpad gestures update the interface to allow for mac os style desktop switching.
2022-03-19 13:19:54 +00:00
Eric Edlund
5cf8db26ec Changes to GestureRecognizer and gestures 2022-03-15 13:29:05 +00:00
Michail Vourlakos
a1fec92ef2 [blur] use blurRegion to identify if a decoration supports blur
Having blurRegion to identify if a decoration supports blur or not instead of the metadata-json way has the following benefits:

- decorations can now provide both blur or not based on user preference
- theme engines such as Aurorae do not have to enforce blur or not to their themes and they can support blur enabled and disabled themes at the same time if they want to
- blurRegion is empty by default so the Korners bug will be fixed for all solid aurorae themes. Breeze and Oxygen have set **blur:false** so nothing changes for them.
- all aurorae themes that do not require blur will free up system resources by default
2022-03-11 13:13:38 +00:00
Arjen Hiemstra
bd920fb28c effects: Guard against InputMethod being nullptr or not enabled
Apparently InputMethod can be nullptr, in which case we end up
dereferencing nullptr when we try to get the input panel.
2022-03-11 10:16:30 +01:00
Arjen Hiemstra
844c451156 slidingpopups: Support animating show/hide of input method panel
This adds support for animating showing/hiding of the input method panel
to the sliding popup effect, if the input panel is of type "Toplevel".

This is mainly intended to animate showing the virtual keyboard and has
been primarily tested with Maliit. It replaces the client-side animation
that Maliit would do, instead doing the animation on the KWin side which
provides a significantly smoother experience.
2022-03-10 18:41:22 +00:00
Alex Richardson
d789ecc6d1 Use #cmakedefine01 for all KWIN_BUILD_* macros
This ensures that we get a warning if the config header is not included
instead of compiling the code as if it was disabled. Interestingly, some
checks already used #if KWIN_BUILD_*, so those were generating -Wundef
warnings when the feature is disabled. Commit 886173cab assumed that all
those features were already 01, so this unbreaks the build if any of the
features is disabled.

Fixes: 886173cab ("Reduce ifdefs in Workspace::supportInformation()")
2022-02-28 18:59:04 +00:00
Kai Uwe Broulik
d54723cbf2 Add KWIN_BUILD_SCREENLOCKER option
Allows to build KWin without lockscreen support and thus drops the
kscreenlocker dependency.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-23 14:39:25 +01:00
Vlad Zahorodnii
5933a21641 Introduce render layers
This is the first tiny step towards the layer-based compositing in kwin.
The RenderLayer represents a layer with some contents. The actual
contents is represented by the RenderLayerDelegate class.

Currently, the RenderLayer is just a simple class responsible for
geometry, and repaints, but it will grow in the future. For example,
render layers need to form a tree.

The next (missing) biggest component in the layer-based compositing are
output layers. When output layers are added, each render layer would
have an output layer assigned to it or have its output layer inherited
from the parent.

The render layer tree wouldn't be affected by changes to the output
layer tree so transition between software and hardware cursors can be
seamless.

The next big milestone will be to try to port some of existing kwin
functionality to the RenderLayer, e.g. software cursor or screen edges.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
203d7b3b8a Move direct scanout management to Compositor
The responsibilities of the Scene must be reduced to painting only so we
can move forward with the layer-based compositing.

This change moves direct scanout logic from the opengl scene to the base
scene class and the compositor. It makes the opengl scene less
overloaded and allows to share direct scanout logic.
2022-02-21 09:33:59 +00:00
Vlad Zahorodnii
52beb213e7 kwineffects: Make GLRenderTarget and GLVertexBuffer work without global coords and scale
Because the GLRenderTarget and the GLVertexBuffer use the global
coordinate system, they are not ergonomic in render layers.

Assigning the device pixel ratio to GLRenderTarget and GLVertexBuffer is
an interesting api design choice too. Scaling is a window system
abstraction, which is absent in OpenGL or Vulkan. For example, it's not
possible to create an OpenGL texture with a scale factor of 2. It only
works with device pixels.

This change makes the GLRenderTarget and the GLVertexBuffer more
ergonomic for usages other than rendering the workspace by removing all
the global coordinate system and scaling stuff. That's the
responsibility of the users of those two classes.
2022-02-15 12:17:56 +02:00
Michail Vourlakos
bc145b614c support kdecoration2 blurregion
--use kdecoration2 blurred regions to adjust blur effect appropriately when
needed

CCBUG:395725

Requires: https://invent.kde.org/plasma/kdecoration/-/merge_requests/17
2022-02-09 21:00:07 +00:00
Vlad Zahorodnii
293b2244ac Move xcbutils to utils directory 2022-01-25 16:56:33 +00:00
Aleix Pol
324b172a26 Also redirect tablet events to the effects infrastructure 2022-01-21 09:33:13 +00:00
Xaver Hugl
5b86afa6f0 effecst: disable launch feedback effect if cursor is hidden
Gets annoying with touch
2022-01-19 12:36:29 +00:00
Vlad Zahorodnii
5f83f2a781 Replace abort() with Q_ASSERT and Q_UNREACHABLE
This change replaces abort() with Q_ASSERT and Q_UNREACHABLE() macros to
make kwin code base consistent. Besides that, Q_UNREACHABLE may
potentially provide the compiler more info that can be used to generate
more efficient machine code.
2022-01-04 10:28:42 +02:00
Xaver Hugl
6a99bfd2f4 make software cursors work per output 2021-12-28 18:42:29 +00:00
Vlad Zahorodnii
ec5950aedb Rename EffectQuickScene to OffscreenQuickScene
EffectQuickScene is not used strictly by effects, aurorae decorations
use it too to render window decorations.

This change renames the EffectQuickView/Scene to
OffscreenQuickView/Scene to clear up the naming scheme.
2021-11-23 09:53:18 +00:00
Vlad Zahorodnii
6d0cca5c7f Move all dirty region scene repaint scheduling to Scene
The Compositor contains nothing that can potentially get dirty and need
repainting.

As is, the advantages of this move aren't really noticeable, but it
makes sense with multiple scenes.

Backend parts are far from ideal, they can be improved later on as we
progress with the scene redesign.
2021-11-11 11:33:04 +02:00
Vlad Zahorodnii
48f943bd75 Introduce explicit base render backend type
The main idea behind the render backend is to decouple low level bits
from scenes. The end goal is to make the render backend provide render
targets where the scene can render.

Design-wise, such a split is more flexible than the current state, for
example we could start experimenting with using qtquick (assuming that
the legacy scene is properly encapsulated) or creating multiple scenes,
for example for each output layer, etc.

So far, the RenderBackend class only contains one getter, more stuff will
be moved from the Scene as it makes sense.
2021-11-11 08:55:29 +00:00
Vlad Zahorodnii
2e8f811d3f Remove bogus full repaint in EffectsHandlerImpl::isEffectSupported()
It makes no sense to schedule a full repaint when somebody checks if the
specified effect is supported.
2021-11-09 15:34:08 +02:00
Xaver Hugl
6ff4de2e05 port everything away from Q_FOREACH 2021-11-08 14:19:05 +00:00
Vlad Zahorodnii
15520888d9 kwineffects: Drop numScreens property
The screen count can be retrieved by checking the number of items in the
EffectHandler.screens property.

The replacement for the numberScreensChanged signal are the screenAdded
and the screenRemoved signals.

The main motivation behind this change is to clean up the screens api
and reduce the number of usages of the Screens class.
2021-10-22 09:14:52 +00:00
Vlad Zahorodnii
701902fbec effects: Port effects from int screens ids to EffectScreen
EffectScreen objects are better as they are more stable and we avoid int
screen ids in kwin core.
2021-10-20 12:09:09 +00:00
Aleix Pol
ff618e9f41 Do not ask for decoration settings without guarding
Otherwise we crash when no decoration is set (e.g. Plasma Mobile)
2021-10-17 14:41:34 +00:00
Janet Blackquill
6231699ac1 Lay some groundwork for realtime gestures in Wayland
This lays down some groundwork for realtime gestures in Wayland,
so that gestures that are 1:1 with user motion on a touchpad are
now possible to implement.

Due to earlier commits, this is mostly just glue code to make a
convenient API.

Gestures implemented with this API are four-finger gestures, to
avoid conflicting with apps that may use two or three-finger
gestures.
2021-09-01 19:48:41 -04:00
Vlad Zahorodnii
7016da39c8 Move active output tracking to workspace
Active output is a window management concept. It indicates what output
new windows have to be placed on if they have no output hint. So
Workspace seems to be a better place for it than the Screens class, which
is obsolete.
2021-08-30 13:28:23 +00:00
Vlad Zahorodnii
6ca411a84a Port AbstractClient::sendToScreen() to AbstractOutput 2021-08-29 21:55:07 +00:00
Vlad Zahorodnii
5a1b98d148 Allow passing Toplevel to Workspace::clientArea()
This allows us to re-use the same code path for alive and deleted
windows.
2021-08-27 19:33:47 +00:00
Vlad Zahorodnii
fff32f64e6 effects: Drop EffectsHandler::screenGeometryChanged()
It's confusing to have two signals (virtualScreenGeometryChanged() and
screenGeometryChanged()) that indicate the same thing.
2021-08-27 09:23:33 +00:00
Vlad Zahorodnii
894ed68ff4 effects: Wire EffectsHandler::screenGeometryChanged() to Screens::geometryChanged()
Currently, the EffectsHandler has two signals that are emitted when the
combined geometry of all outputs change - virtualScreenGeometryChanged()
and screenGeometryChanged(). Having two signals is most likely a
historical artifact.

This change untangles the screenGeometryChanged() signal from the
Workspace and makes it the same as the virtualScreenGeometryChanged()
signal.
2021-08-27 09:23:33 +00:00
Vlad Zahorodnii
78b5330824 Drop VirtualDesktopManager::name()
It's confusing to have two ways to query the same information.
2021-08-25 20:12:07 +03:00
Aleix Pol
9a4bbdf226 Make it possible for an effect to render a screen
Useful in case it needs the contents of the screen but they can't be
blitted, as the state of the framebuffer is unknown.
2021-08-25 14:44:03 +00:00
Aleix Pol
24cc93ec5b effects: Allow exposing an EffectScreen::transform
This way an effect can know the transformation that is applied on a
display.
2021-08-25 14:44:03 +00:00
Aleix Pol
34cfc6680b effects: Include signals notifying about outputs changing 2021-08-25 14:44:03 +00:00
Vlad Zahorodnii
c66f38ba7d kwineffects: Add properties to EffectScreen
This allows exposing EffectScreen to effects that use js or qml.
2021-08-19 06:30:55 +00:00
Vlad Zahorodnii
0197d770ab Drop Toplevel::transparentRect()
It can be computed via other means (Toplevel::frameMargins()) and its
name is confusing. It specifies the inner decoration rect.
2021-08-12 17:22:49 +00:00
Vlad Zahorodnii
ad4f183a76 x11: Drop support for _NET_WM_FRAME_OVERLAP
The main idea behind _NET_WM_FRAME_OVERLAP is to extend the borders of
the server-side decoration so the application can draw on top of it. It
was inspired by similar feature in Windows.

However, _NET_WM_FRAME_OVERLAP is basically unused. Neither GTK nor Qt
support it and I have never seen any application that uses it.

At the moment, kwin is the only compositing window manager that supports
_NET_WM_FRAME_OVERLAP. Neither mutter nor compiz nor compton and so on
support it.

Since _NET_WM_FRAME_OVERLAP is practically unused, there's no point for
keeping supporting it.

This change shouldn't affect any existing app as _NET_WM_FRAME_OVERLAP
atom is not listed in _NET_SUPPORTED.
2021-08-12 11:44:40 +00:00
Vlad Zahorodnii
cb219da766 Remove screenGeometryChanged() in OpenGLBackend and QPainterBackend
The screenGeometryChanged() function is very X11-specific. On Wayland,
it's effectively unused.
2021-07-26 14:55:54 +00:00
Aleix Pol
eb62dbb9c5 Allow the KScreenEffect to work on Wayland
Makes it possible for wayland systems to show a dimming effect when a
display dpms is off.
2021-07-09 12:39:42 +02:00