Commit graph

22468 commits

Author SHA1 Message Date
Méven Car
1dd12a064a Fix a couple unused warnings
GIT_SILENT
NO_CHANGELOG
2022-05-10 07:33:30 +02:00
l10n daemon script
e1cec89ddb 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"
2022-05-10 01:45:54 +00:00
Kai Uwe Broulik
9cb5b38970 effects: Port EffectFrame to OffscreenQuickView
This allows to toss a large amount of custom rendering code.

Furthermore, it removes the build-time dependency on Plasma Framework
for FrameSvg and Theme from KWin core as it's pulled in through QML
imports now.

It also cleans up the API and removes functions that are effectively
unused or no-op after this change.

For instance, effects often destroy their effect frames
in pre/postPaintScreen, which would now destroy an `OffscreenQuickView`,
which changes GL context. This is alleviated by delaying detruction
of the internal view.

Support for the features of text cross-fade and selection frame,
which are not used by any of the built-in effects, is dropped.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-05-09 17:53:58 +00:00
David Redondo
f6bb95f18e Bump plasmashell version to 7 2022-05-09 15:59:19 +00:00
Xaver Hugl
e4695325a6 backends/drm: store gbm buffer for screen recording 2022-05-09 14:06:55 +00:00
Nicolas Fella
774dbf8d2f Use ECMFindQmlModule instead of ECMQmlModules 2022-05-09 15:22:49 +02:00
Vlad Zahorodnii
1d699a703d autotests: presentwindows -> windowview 2022-05-09 10:56:35 +00:00
Vlad Zahorodnii
0860efecc3 Move SceneWindow::decorationShape() to DecorationItem 2022-05-09 09:41:39 +00:00
Vlad Zahorodnii
bc1f808f0f Move paint method from SceneWindow to Scene
That's the next step in allowing to reuse surface painting code between
the workspace and the cursor layer.
2022-05-09 08:31:13 +00:00
Vlad Zahorodnii
683a222233 Drop lanczos filter
The lanczos filter depends on the effect system. It makes very difficult
changing painting code from SceneWindow to Item.

Given that the last big users of the laczos filter - present windows and
desktop grid effects were re-written in QML. The only remaining user of
the lanczos filter is the thumbnail aside effect. Given that it's a
really obscure usecase, switching to the linear filter won't be very
noticeable.

As a backup plan, one can reimplement the thumbnailaside effect using
QML. The lanczos filter is already implemented in plasma-framework.
2022-05-09 08:31:13 +00:00
Xaver Hugl
a110aabbcc backends/drm: consider escaped separators KWIN_DRM_DEVICES
':' conflicts with the file names in /dev/dri/by-path, so allow it to be
escaped with '\'

CCBUG: 453386
2022-05-09 08:16:47 +00:00
l10n daemon script
5ddcd0827b 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"
2022-05-09 01:43:54 +00:00
Aleix Pol
f3ec05c85a wayland: Fix activation when activating surfaces disappear
We track when the user last interacted with a window so that we can
decide on the relevance of newly activated windows.

Fixes network/neochat#524
2022-05-09 00:59:27 +02:00
Erik Kurzinger
e6d2bc153f platforms/drm: set read buffer in GbmSurface::makeContextCurrent
The first time the GBM backend's EGL context is made current after
creation, both the read and draw surfaces are set to EGL_NO_SURFACE.
This will set the GL read and draw buffers to GL_NONE in accordance with
the EGL spec.

When a real surface is later made current, however, the spec is arguably
unclear on whether the read and draw buffers should remain set to
GL_NONE or whether they should be restored to the default GL_BACK.  The
Mesa driver does the latter, the NVIDIA driver does the former.

To work around this difference, Kwin has an explicit call to
glDrawBuffer in GbmSurface::makeContextCurrent. It does not have a
corresponding call to glReadBuffer, though, which can cause some desktop
effects such as background contrast to render incorrectly with the
NVIDIA driver. This change adds that missing call.
2022-05-08 12:58:10 -07:00
Alex Richardson
35c36be140 Fix incorrect usage of __has_include
I introduced this typo in 0a0a1fd330
2022-05-08 12:11:02 +00:00
Alexander Lohnau
61eba32cdd Rename kcm metadata json files to metadata.json 2022-05-08 09:03:03 +00:00
Alexander Lohnau
c1d0aa18cf Port KCMs to new install location
Task: https://phabricator.kde.org/T14517
2022-05-08 09:03:03 +00:00
Vlad Zahorodnii
51e9340abb Remove a Workspace::findAbstractClient() overload
Workspace::findAbstractClient(QUuid) overload is used only by the
windows krunner plugin.

This change fixes a potential null dereferencing and removes the
findAbstractClient() overload in favor of a more generic findToplevel()
overload.
2022-05-07 18:51:05 +00:00
Xaver Hugl
9ef882f3fb backends/drm: use addfb2modifier again when supported
Otherwise the kernel might fail our request because the modifier doesn't
match the buffer
2022-05-07 13:28:47 +00:00
Xaver Hugl
788ae5891a backends/drm: zero metadata for unused planes
The kernel may fail requests if data for unused planes is non-zero.
2022-05-07 10:09:30 +00:00
l10n daemon script
14cf7524b6 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"
2022-05-07 01:44:29 +00:00
Volker Krause
f32df68f3d Use the properly named screencast Wayland protocol file
This is needed to build with Qt6.
2022-05-06 19:12:06 +00:00
Volker Krause
6eb8d1bbf7 Fix Qt6 build of the xdgactivationtest 2022-05-06 18:45:17 +00:00
Xaver Hugl
04509aaeb7 backends/drm: when creating a fd fails, reset all fds to -1 2022-05-06 18:31:03 +00:00
Vlad Zahorodnii
bc57e89b75 backends/drm: Fix file descriptor check 2022-05-06 17:24:47 +00:00
Vlad Zahorodnii
ad45deaf80 backends/drm: Add missing file descriptor initializer
We need to initialize file descriptors to -1 explicitly.

BUG: 453470
2022-05-06 17:24:47 +00:00
Marco Martin
9a5d34cf6c default value as false
this should also fix compilation on Qt6
2022-05-06 16:52:01 +00:00
Marco Martin
eca9b5047a effects/windowview+overview: get back option to hide minimized windows
Option to hide minimized windows as old present windows effect had.

BUG: 441627
BUG: 453426
FIXED-IN: 5.25
2022-05-06 15:48:41 +00:00
Xaver Hugl
d5dad1b471 backends/drm: properly release all buffers on render backend destruction
Releasing the buffers is necessary for example in the case of a GPU reset,
to make sure that the gbm surface is still properly destroyed and all buffers
with invalid content freed.
2022-05-06 12:39:15 +00:00
Xaver Hugl
c65c822392 backends/drm: refactor buffer management
Instead of buffers being both drm framebuffers and gbm / dumb buffers, these
responsibilities are now split, which makes it possible to do zero copy
screen casting in the future.

Both framebuffers and gbm / dumb buffers also now always hold a valid underlying
resource, which simplifies code a bit.
2022-05-06 12:39:15 +00:00
David Edmundson
ab06dd2e31 Add destructor for primary output global 2022-05-06 11:37:54 +00:00
Marco Martin
ae1937badc Remove completely present windows
since it has been replaced by windowview, and Desktop Grid
is ported as well, remove present windows which is effectively dead code
now

BUG:447001
BUG:362844
BUG:450487
BUG:453426
BUG:374481
BUG:185381
BUG:413342
BUG:451150
BUG:283333
BUG:315314
BUG:397500
BUG:321236
BUG:436572
BUG:335782
2022-05-06 11:37:17 +00:00
Marco Martin
7a4cabf328 QML version of the Desktop Grid effect
Replace completely the old desktop grid effect with a QML version.
Aims to feature parity and be a change as transparent as possible for the user.

BUG: 433071
BUG: 452625
BUG: 443971
BUG: 437121
BUG: 452925
BUG: 437928
BUG: 452439
BUG: 288530
BUG: 450254
BUG: 450106
BUG: 447832
BUG: 449960
BUG: 416576
BUG: 441862
BUG: 444859
BUG: 445999
BUG: 422117
BUG: 404627
BUG: 435483
BUG: 420744
BUG: 435482
BUG: 427055
BUG: 333445
BUG: 429120
BUG: 427391
BUG: 409295
BUG: 294322
BUG: 356955
FIXED-IN: 5.25
2022-05-06 10:44:38 +00:00
David Redondo
d548f4bce4 Implement plasma-surface open-under-cursor
The surface is positioned at the current cursor location but kept in
bounds to keep it fully visible when the cursor is near the screen border.
2022-05-06 07:19:25 +00:00
l10n daemon script
0130b53126 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"
2022-05-06 01:45:37 +00:00
Marco Martin
376ee357db Make windowview replace present windows
* give windowview the ability to show windows from current desktop, all
desktops or current class
* invokable from shortcuts screen edges or gestures
* add a search field to quickly filter
* current present windows effect still present but only internal as is used by desktop grid, which should eventually be ported as well

This can be done either from windowview or overview, tough note that some of the duplication from overview added in windowview is necessary regardless, as WindowHeap, the shared qml part needs some properties exposed from the c++ part.
Implementation wise I'm ok for it being in either place, but i think the functionality of present windows needs to be preserved, otherwise would be a completely unacceptable regression, namely:

* Behavior of what now are the ctrl+f7,f10 and f11 global shortcuts, showing windows of current app (invokable by shoortcut instead of having to use the pointer), windows of current desktop (the only thing overview does atm) or all desktops
* filter on typing, as opposed to invoking krunner. main use case of present windows is quickly switching, and filtering is the most helpful feature, some people do like krunner instead, but is completely out of place for my use case, and i suspect for many other users as well
* also clicking on a taskbar group should be possible to filter
* the view that opens by clicking on a taskbar group should follow the same layout strategy used elsewhere and currently being an effect used only there and not accessible form the list can't even be configured
2022-05-05 14:37:52 +00:00
Vlad Zahorodnii
2c514ac593 Drop ScreenLockerFilter
Since WindowItem::visible is kept in sync with the effective visible
status of the window, window items that are not lockscreen greeter or
input methods can be hidden when the lock state changes.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
def99b1a7c Update WindowItem's visibility
With this, the WindowItem will know whether it's actually visible. As
the result, if a native wayland window has been minimized, kwin won't
try to schedule a new frame if just a frame callback has been committed.

EffectWindow::enablePainting() and EffectWindow::disablePainting() act
as a stone in the shoe. They have the final say whether the given window
is visible and they are invoked too late in the rendering process.
WindowItem needs to know whether the window is visible in advance,
before compositing starts.

This change replaces EffectWindow::enablePainting() and
EffectWindow::disablePainting() with EffectWindow::refVisible() and
EffectWindow::unrefVisible(). If an effect calls the refVisible()
function, the window will be kept visible regardless of its state. It
should be called when a window is minimized or closed, etc. If an effect
doesn't want to paint a window, it should not call effects->paintWindow().

EffectWindow::refVisible() doesn't replace EffectWindow::refWindow() but
supplements it. refVisible() only ensures that a window will be kept
visible while refWindow() ensures that the window won't be destroyed
until the effect is done with it.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
ea0061cd03 Use explicit item visibility when rendering
Item::isVisible() is true if either the item has been marked hidden or
one of its ancestors.

In some cases, kwin may render invisible windows, for example for window
thumbnails.

This change makes rendering code use explicit visibility status when
rendering to ensure that it's still possible to render invisible windows.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
54bbfde2f3 Make SurfaceItemX11 schedule a repaint if the shape changes 2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
94d30c2268 Fix repaint scheduling in Item::setVisible()
If an item disappears, we need a workspace repaint.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
30076f297c effects: Introduce a helper for referencing deleted windows
If an effect is reloaded while it holds deleted references, it's
possible that the closed windows will get stuck in the "zombie" state.

This change introduces EffectWindowDeletedRef helper that can be
used to keep the closed window alive as long as the reference is valid.
2022-05-05 12:21:26 +00:00
Vlad Zahorodnii
00ae7d3893 effects/slide: Use mass-spring-damper model for animation
If you lift fingers but not swipe them enough to switch to another
virtual desktop, the slide effect will play an animation to move from
the current position in the virtual desktop grid to the current desktop.

However, that animation doesn't feel right, there's something missing.
The slide effect uses a TimeLine to animate switching between virtual
desktops, it's great if the amount of sliding is constant.

This change makes the slide effect use the mass-spring-damper model to
simulate the motion of a spring in order to animate switching between
virtual desktops.

The mass-spring-damper equation is integrated using RK4. If the delta
interval is not multiple of the integration step precisely, the
SpringMotion will perform integration as many times as the integration
step fits into the delta. The leftover will be used for LERP between the
previous and the next integration results.

With the spring animation, the slide animation feels more natural when
you lift fingers. If you switch between virtual desktops without using a
gesture, the slide animation should look almost the same as if it were
implemented with the TimeLine.
2022-05-05 11:30:51 +00:00
Aleix Pol
d1522eb47f Move allowWindowActivation into X11Window
It helps to contextualise the method as it's using several x11-isms,
some of them possible ot abstract.
In any case, the method is only called with X11Window and it's the only
case where it makes sense doing so.
2022-05-05 10:40:27 +00:00
l10n daemon script
fa36628a8b 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"
2022-05-05 01:46:17 +00:00
Martin Flöser
7bececfa2f [scripting] Support shaders in scripted effects
The scripting API is extended to support custom fragment shaders. To
support this a new method addFragmentShader is added taking ShaderTraits
and fragment shader. The GLShader is not exposed, instead a uint id is
provided which maps to the GLShader.

This shader id can be used in the animate and set calls to specify the
shader. The animation object is extended by the "fragmentShader" property.

The shader sources are located in the "shaders" directory of the package
contents.

E.g. the scale effect extended by the shader of the invert effect will
have the following layout:

   package/contents/
   -> code/
     -> main.js
   -> shaders/
     -> invert_core.frag
     -> invert.frag

The adjustment in code are:
 * in constructor to load the shader
    this.shader = effect.addFragmentShader(Effect.MapTexture, "invert.frag");
 * in animations objects of the slots the additions
   fragmentShader: this.shader
 * using the type Effect.Shader

or in full:

        window.scaleInAnimation = animate({
            window: window,
            curve: QEasingCurve.OutCubic,
            duration: this.duration,
            animations: [
                {
                    type: Effect.Scale,
                    from: this.inScale
                },
                {
                    type: Effect.Opacity,
                    from: 0
                },
                {
                    type: Effect.Shader,
                    fragmentShader: this.shader
                }
            ]
        });

The animation settings object supports a "uniform" value which takes the
string name of the uniform. For this uniform the location is resolved
and stored in the meta data of the AnimationEffect. This requires the
type Effect.ShaderUniform.

An example animation:

        window.scaleInAnimation = animate({
            window: window,
            curve: QEasingCurve.Linear,
            duration: this.duration,
            animations: [
                {
                    type: Effect.ShaderUniform,
                    fragmentShader: this.shader,
                    uniform: "uForOpening",
                    from: 1.0,
                    to: 1.0
                }
            ]
        });

Furthermore a new setUniform scriptable method is added to the
ScriptedEffect. This allows to update uniforms when the configuration
changes.

The call takes a generic QJSValue which supports:
 * float
 * array of 2, 3 or 4 components
 * string as color
 * variant as color

An example usage to read a color from the configuration and set it as a
uniform:

    effect.setUniform(this.shaderId,
                      "uEffectColor",
                      effect.readConfig("Color", "white"))
2022-05-04 15:19:47 +00:00
Martin Flöser
47b330ea23 [libkwineffects] Add support for shaders in AnimationEffect
The animate and set calls are extended for an optional GLShader* to
allow specifying a custom shader to use during the animation.

To properly support rendering a complete window in the effect the
AnimationEffect gets based on the DeformEffect. If a shader is used
during the animation the window gets redirected.

For the animation with shaders two new enum values are added to the
AnimationType enum:
 * Shader
 * ShaderUniform

The Shader animation type is for specifying that the animation uses a
shader. During the animation a uniform "animationProgress" is set on the
shader.

The ShaderUniform animation type behaves exactly like the Shader type,
but also animates a user provided uniform. The meta data of the
animation is interpreted as a uniform location for a float uniform and
during the animation this uniform is updated with the interpolated
animation data.
2022-05-04 15:19:47 +00:00
Martin Flöser
7dddf3055b [libkwineffects] Support custom shaders in DeformEffect
For a redirected window a custom shader can be specified to draw the
redirected texture to screen. This is useful for inheriting effects to
customize the rendering.

Two new int uniforms TextureWidth and TextureHeight are added and set
from DeformEffect when rendering the texture.
2022-05-04 15:19:47 +00:00
Vlad Zahorodnii
f1f512791e Fix updating fullscreen geometry restore
Currently, fullscreen geometry restore is computed from maximized
geometry restore. However, the latter is set only when the window is
maximized.

Also, updateGeometryRestoresForFullscreen() can be called when the
window has not been moved. Avoid updating geometry restore if the output
has not been changed.
2022-05-04 12:37:50 +00:00
Vlad Zahorodnii
f51db012f2 effects/desktopgrid: Make sure that the screen is rendered correctly when animation reaches the end
If the animation reaches the end, desktop grid may render the screen
incorrectly. Make sure that PAINT_SCREEN_BACKGROUND_FIRST and flags as
such are set even if animation has reached the end.

Also, while on this, simplify the paintWindow() method by removing
redundant effect status checks.
2022-05-04 08:45:15 +00:00