Commit graph

22396 commits

Author SHA1 Message Date
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
Vlad Zahorodnii
2da599c670 effects/desktopgrid: Make termination code less error prone
The desktop grid effect can be deactivated in postPaintScreen() without
delaying finish().
2022-05-04 08:45:15 +00:00
l10n daemon script
e9d1def1ba 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-04 01:45:48 +00:00
Marco Martin
02171495be dynamically load effects that support edge activation
effects can specify in their json file "X-KWin-Border-Activate":true
and will be listed in the edge menus.

Don't hardcode desktop grid and overview in the kcms
2022-05-03 16:54:36 +00:00
Vlad Zahorodnii
0c69ce50ac effects/slide: Fix panels losing blurred background when gesture is active
At the moment, if user switches between virtual desktops using a
gesture, panels will loose blurred background because WindowForceBlurRole
is not set.

This change refactors setup code so the slide effect always forces blur
and background contrast when sliding between virtual desktops using a
gesture or animation.
2022-05-03 17:04:29 +03:00
Vlad Zahorodnii
4513b4830f effects/slide: Use an enum to describe current state 2022-05-03 17:04:25 +03:00
Marco Martin
4cb3ab09ed Realtime screen edges gestures for scripted effects
Possibility to implement realtime screenedges gestures in scripted effects,
implement it in the windowsaperture show desktop effect.
* Expose registerRealtimeScreenEdge to JavaScript, the callback will be
a JS function.
* Add the concept of freezeInTime() in the animation js bindings,
it will either create an animation frozen at a given time or freeze a running animation
that can be restored and ran to completition at any time
* add an edges property only for showdesktop as it's not directly on the effect configuration
2022-05-03 13:43:38 +00:00
Xaver Hugl
46bbe4ff0c backends/drm: don't rely on test commits producing a buffer
When DrmPipeline::commitPipelines returns false without creating a test
buffer, we'd crash.

CCBUG: 453320
2022-05-03 08:14:53 +00:00
l10n daemon script
be5cd1b38e 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-03 01:49:38 +00:00
Xaver Hugl
8d3de947af backends/drm: re-create gamma ramps if necessary when switching crtcs
The gamma ramp size of different crtcs is not guaranteed to be the same,
so the gamma blob may need to be re-created
2022-05-02 17:40:25 +02:00
Xaver Hugl
b5aebc83ee backends/drm: fix gamma ramps with legacy
With legacy, gamma ramps wouldn't be calculated from the color transformation,
which made them not be applied.

BUG: 453070
2022-05-02 17:39:19 +02:00
l10n daemon script
74aff4b088 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-02 01:40:40 +00:00
l10n daemon script
6d8a303138 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-01 01:53:58 +00:00
Méven Car
e97e6e4068 XWayland::Primary: Fix unused warnings 2022-04-30 19:49:29 +02:00
Vlad Zahorodnii
50b3d1d063 Make EffectsHandler use cached active effects list in blocksDirectScanout()
When the scene checks whether any active effect blocks direct scanout,
m_activeEffects is already populated.
2022-04-30 17:03:27 +03:00
Vlad Zahorodnii
2b9adf279e Cancel interactive desktop switching if desktop has not changed
If desktop wrapping is disabled and user swipes to left but there's no
desktop to left, the slide effect can get stuck active because there's
no desktopChanged() nor desktopChangingCancelled() signal emitted.

This change makes the VirtualDesktopManager explicitly cancel
interactive desktop switching session if the current desktop has not
changed.
2022-04-30 12:41:45 +00:00
Xaver Hugl
3c9d209344 backends/drm: fix mode updates with generated modes
DrmOutput::updateModes was called unnecessarily every time, because the
mode list the driver modes was compared against contained generated modes
2022-04-30 11:10:06 +00:00
Xaver Hugl
d50c9b8cb6 backends/drm: initialize layers earlier
With how layers are initialized before this commit, the atomic commit in
DrmOutput::updateModes can cause segfaults.
2022-04-30 10:46:14 +00:00
Aleix Pol
87e72506b8 Add support for KGlobalAccelInterfaceV2::keyReleased
To be able to implement the XdgDesktopPortal for GlobalShortcuts, we
need to let kglobalaccel know when a shortcut is not deactivated
anymore.
2022-04-30 07:24:50 +00:00
Aleix Pol
9a31b0d727 x11: trigger shortcuts when releasing rather than pressing
This way we can issue a keyboard grab without problems
2022-04-30 07:24:50 +00:00
Aleix Pol
1f443301ed x11: Add debug info when grabs fail 2022-04-30 07:24:50 +00:00
l10n daemon script
90d38017da 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-04-30 01:41:28 +00:00
Vlad Zahorodnii
55f0ccc0fe plugins/screencast: Avoid Window::addRepaintFull()
It will be dropped.
2022-04-29 18:29:16 +00:00