This causes a longer compile time, because lots of unneeded files are
included. With https://invent.kde.org/sdk/clazy/-/merge_requests/91/
lots of false positives in the clazy check were resolved, this commit
takes care of the remaining places
Some OutputTransform code assumes that Kind enums have specific values.
In order to ensure that that code doesn't break if the enums are reordered
or something, this change sets output transform enums to those explicit
values.
The naive way to combine output transforms is not great, especially
because of the for loop.
The output transform kind enums have the following bit pattern:
- rotate-0: 000
- rotate-90: 001
- rotate-180: 010
- rotate-270: 011
- flip-0: 100
- flip-90: 101
- flip-180: 110
- flip-270: 111
`(rotate-a + rotate-b) & 0x3` can be used to combine two rotation
transforms. The rotatation is clockwise.
If the first transform is a flip transform, then we should rotate
counter-clockwise, i.e. `(rotate-a - rotate-b) & 0x3`.
When users simultaneously press Shift and Tab, the keys are sometimes
registered as Shift+Tab, and sometimes as Shift+Backtab.
So we need to match received Shift+Tab against shortcuts containing
Shift+Backtab, and vice versa. Previously the code only checks for
the first case. This commit adds checks for the second case.
BUG: 438991
FIXED-IN: 6.0
Our painting code is assumed to work as following: scale the geometry,
snap it to the pixel grid, apply the render transform, e.g. flip the
geometry vertically.
However, with QMatrix4x4 in RenderViewport, we have a slightly different
order: scale the geometry, apply the render transform, snap to the pixel
grid. It results in mapToRenderTarget() not properly mapping logical
geometry to the device geometry, which later manifests as glitches.
BUG: 477455
Automatic backend selection is a very normal by-design activity that warrants informing. Decrease from log level Warning to Info to avoid spoiling the log at too high of a log priority.
If an output is disabled, the Output object will be kept alive. That
means that the aboutToChange connection will be kept.
If the output is enabled again and its transform changes, its contents
will be captured more than once.
In order to fix, the screentransform plugin has to break the
aboutToChange connection.
If the output configuration doesn't touch the output transform,
capturing the previous screen contents is pointless.
I believe the main reason why the screen transform operates this way is
because it couldn't access OutputConfiguration before.
Polling the dmabuf for readability doesn't appear to work on NVidia and
we're no longer using an egl surface where the driver does this for us,
so we need to explicitly wait for rendering to complete or there are glitches
on the output
The OpacityMask is used purely for rounding the corners. We can get rid
of it by using ShadowedTexture which does the same thing while also
drawing the shadow, meaning we can also eliminate the ShadowedRectangle.
If the wl_surface is unmapped, the compositor should unmap the window.
Most clients don't do it, and instead destroy the wl_surface or the
surface role object or both. A very tiny fraction of clients actually
close the window by unmapping the wl_surface. Either way, it's worth
handling that case because xdg-shell protocol says that the clients are
allowed to do it.
BUG: 478297
OverlayWindow had different paths for GLX and EGL when it came to
managing size. On EGL the initial size comes from the overlay resizing
to workspace, but future updates were explicitly handled by the backend.
On GLX the backend tracked changes, but then it was the overlay's job to
resize but using a different method.
This patch also prevents use of workspace after destruction fixing
kwin_x11 --replace.
Milou.ResultsView loads runners regardless whether the query string is
empty. It's not clear what milou should do. There are valid arguments
both in favor and against preloading runners.
This change puts Milou.ResultsView behind a Loader so milou is loaded
when it's actually needed and not when starting overview.
CCBUG: 455780
Captions are set to elide with ElideRight, which does allow for multi-line captions.
However, this means that the height of the captions depends on their width (since a shorter
width results in more lines), and the width of the captions depends on the size of the
window thumbnail, which depends on the height of the caption to be positioned. If the
caption is really long, this can cause visual glitches. Having a maximum line value avoids that.
BUG: 477103
To do this, this commit adds infrastructure to include glsl files,
extracts all the color management functions and uniforms into such a
file, and makes use of it in the invert effect
BUG: 443148
The pageflip event may never arrive, as the GPU to trigger it is gone. It
also doesn't make a difference, as the GPU is unaccessible anyways, so
KWin can't affect the relevant output(s) anymore
If the client sets invalid min or max size, that can cause some code in KWin
to assert. To ensure that doesn't happen, enforce that the minimum size is
always at most as big as the maximum.
CCBUG: 478269
WindowThumbnails are image providers meaning it can provide textures
directly to ShaderEffects
layer.enabled is effectively a ShaderEffectSource meaning we render our
single desktop background item into an offscreen texture to ultimately
contain our desktop background.
We can cut out the middle-man and use the DesktopBackground as a source
directly saving a massive texture being generated.
The compilation step still takes a significant amount of time on the
first launch. On my machine, it's around 1s. Even if it happens just
once, freezing the session for 1 second is not great.
This change makes the overview effect load main.qml asynchronously
when plasma session starts. By the time the session is loaded, it should
be ready.
CCBUG: 455780
Effects like overview can create more than one thumbnail for the same
window. For example, if you have 4 virtual desktops, the overview is
going to create 9 window thumbnails for the desktop background, which in
its turn means that each thumbnail is going to have its own texture.
That's not great.
WindowThumbnailItem.sourceSize has been dropped because it's unused and
will complicate texture caching.
CCBUG: 455780
When the pointer moves, the shake cursor effect will either update the
cursor magnification or reset the magnification.
At the moment magnification is reset immediately, which doesn't look
if the pointer moves before the reset scale animation finishes.
Currently FrameSvgItem is used to highlight selected or hovered windows.
But the problem with it is that it's a bit heavyweight. As a way around
it, we could put it in a Loader, but that's going to be bring a set of
other challenges.
As an alternative solution, this change replaces FrameSvgItem with a
simple outline. It still produces decent visuals and it's simpler.
This tells the kernel when a buffer should be done rendering, which allows
it to for example increase GPU clocks in order to hopefully hit our deadlines.
That in turn should reduce the amount of dropped frames
CCBUG: 452119
Let's port the remaining uses to the upstream simpler alternative
`ItemDelegate`, which provides a consistent styling and fixes some
issues such as the background and highlighting.
This affects the rules, efects and virtual desktops KCMs.
Overview was trying always to animate the opening with 2 animations at the same moment:
* the transition from initial to active in WindowHeapDelegate
* the animation on the partialactivationfactor was always ran, partial or not
this resulted in jankier animations than they could be.
now base only on partialanimationfactor, so we a re sure there is one single way to trigger the effect
Do not reparent the OverlaySheet's parent and let it be the
whole page, so that the shadow darkening also covers the empty
space below the view and the placeholder message
BUG: 477963
FIXED-IN: 5.91.0 (Beta2)
The rest of the project is GPLv2, this one is GPLv3 for no apparent
reason. Even the .cpp file is GPLv2.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
There is a window title beneat the stock WindowHeapDelegate. The label
was bound to the size of the window, but because this animates our label
resizes every frame too.
Given the label is only at full opacity when the window is filling the
ExpoCell, we can set the width of our label to that directly.
This looks less glitchy as we don't change wrapping during animation,
but also should have a noticable performance impact as we avoid
re-laying out multiple times.
Instead of hardcoding only NVidia, try to use CTM and GAMMA_LUT before falling
back to the shader path. This way it also works on other GPUs that lack
color management hardware, and only falls back to the color management path
on older NVidia drivers.
This commit also ensures that the color management hardware is set properly
after toggling color management on and off again, and simplifies ColorDevice
to only deal with rgb factors instead of always calculating luts. This should
improve performance of night color animations on hardware where CTMs are
supported
CCBUG: 453701
ButtonPressEvent::state includes keys and buttons prior to the button
press has been generated.
On the other hand, it appears that QMouseEvent::buttons() should include
currently pressed buttons, i.e. the button that has been just pressed
should be in that bitfield.
This is important for QQuickDeliveryAgent, which checks
QMouseEvent::button() and QMouseEvent::buttons() to decide whether to
send the button event only to tap handlers or both tap handlers and
mouse areas.
BUG: 476653
With kernel 6.6+, HOTSPOT_X and HOTSPOT_Y are exposed on the cursor plane
in virtual machines, so the fallback to the legacy API is no longer needed.
At some point in the future, the list of virtual machine drivers can be
dropped entirely.
The shake detector is mistriggered by sporadic pointer movement when the
cursor is pushed back by a screen edge.
As a way to prevent it, this change adds a bounding rectangle
constraint. The cursor will move chaotically within a small bounding
rectangle if it's pushed back. So it should be enough to just check
the length of the diagonal.
The code for placeSmart uses ints to store coordinates and dimensions,
but the various methods of QRectF return qreal types, which can be
non-integers under fractional scaling, causing multiple issues.
This commit explicitly converts the needed quantities to ints,
avoiding the issues.
Previously, the code relied on the assumption that
y = area.y() + area.height(); implies !(y < area.y() + area.height()).
This doesn't always hold when mixing qreals and ints, causing infinite loops
under fractional scaling when attempting to open large windows, as
reported in BUG 477820.
This commit also extends the fix in 5502ce9 to fractional scaling scenarios.
The ceiling of client widths and height is used, instead of the implicit
floor, which caused BUG 477886.
BUG: 477820
BUG: 477886
The initial value was being initialized to true despite the setting
being off by default, and the default checker was highlighting when it
was false, not when it was true.
BUG: 477329
FIXED-IN: 6.0
Makes it possible to easily target things in a window near your panel edge,
without bringing up your panel.
The `m_client` condition this MR removes appears to have been added solely to make autohiding panels appear instantly. See c4140d6f4e.
BUG: 267277
Indent target_link_libraries of kwin to improve code readability. As is,
PUBLIC and PRIVATE blend with target names and therefore they are harder
to spot.
Backends dependending on the wayland server is not great, it makes them
less reusable and creates a strict instantion order that doesn't fully
make sense.
The shift key doesn't make sense to be one of the keys that will trigger
KWin to allow XWayland apps to process all keys when it's pressed,
because there aren't generally global shortcuts that consist of Shift
plus an alphanumeric character key. That's because this key combination
is used to type capital letters.
So we can safely exclude the shift key to improve security against key logging and not break any global
shortcut-using XWayland apps for people using this feature.
The shift key on it's own is still forwarded as that's a non-character key.
We need to be careful about the target rect when painting a hidpi image
onto a lodpi image.
This is the case when the startup feedback generates bouncing frames.
The icon pixmap may be hidpi, while the result image has device pixel
ratio 1.
Currently hidpi region screencasting is broken because output textures
are inappropriately scaled.
The orthographic projection is set up with logical pixels, but the
remaining rendering code uses "1 / m_scale" scale factor, which is wrong.
In order to fix hidpi and also simplify rendering logic, this change
makes rendering code use logical coordinate system. It's okay to do in
screencasting because we don't need to worry about snapping to the pixel
grid.
BUG: 476858
BUG: 476859
If there were no open windows KWin would wait until the timer ran
out and return false signifying that some windows didnt close.
BUG:477573
FIXED-IN:6.0
This change enables the use of HW cursors on Nvidia GPUs. The problem
with the current approach is that the cursor plane requires a linear
buffer to be attached on the Nvidia hardware. However, Nvidia GPUs
cannot render to a linear texture, this is why DRM_FORMAT_MOD_LINEAR is
marked as "external only" when the supported modifiers are queried by
eglQueryDmaBufModifiersEXT(). Since the EGL render backend in KWin
cannot find a common DRM format modifier between what the cursor plane
needs and what the GPU can render to, it falls back to the SW cursor
implementation.
With this change, when the EGL renderer detects that a plane only
supports linear buffers but rendering directly to a linear buffer is not
possible, it copies the rendered content into a linear dumb buffer, and
attaches that buffer to the plane instead of using the rendered buffer
directly.
This overhauls the kill prompt UI to make it more modern and more
easily to grasp.
* Reduce the amount of text and redundancy.
Give the window a title and drop the "app is not responding" heading.
Try to remove the application name from the displayed window title.
Also use the bold emphasis used in other places like deleting files.
* Use the application icon if available with a warning overlay.
This makes it easier to grasp which application it's talking about.
* Move technical information (like PID and hostname) into an
expandable "Details" section.
KGuiAddons has been implicitly pulled in by KConfigWidgets already.
Instead of killing the window without asking, show the kill prompt
like it's done for X11 windows.
The window in question is exported through XDG foreign so the kill
helper can parent itself to it, and an activation token is also provided.
Also, the more contemporary desktop file name is now used for
identification rather than window class.
A no-display desktop file is installed for the kill helper so that it
can get a proper window icon and suppress startup notification.
Without a client asking for it. This way we can send a surface
to another helper application, such as the window killer.
An ExportedSurface wrapper class is introduced which represents
an exported surface in a windowing-system independent way.
This makes it consistent with the timeout used on X11.
The current ping timeout was also generally quite short, causing apps
to desaturate for brief moments when they were busy e.g. starting up
or loading large files.
Closed windows are present in the stack. If user has selected
"Stacking order" sort order in task switcher KCM, we need to guard
against closed windows in the stack.
Otherwise dangling pointers can end up in TabBox::ClientModel. Tabbox is
written with hard model resets in mind. In order to fix it, the client
model has to be rewritten.
BUG: 477166
Ideally the decoration of a closed window should not change. However,
it seems like it can happen when resuming the session.
When switching to another VT, the touchpad input device is removed, but
the touch input device is still kept on my machine. This results in
the tablet mode changing temporarily and triggering recalculation of new
borders in breeze decoration. It's a no-no thing to do if the window is
closed. We need to guard against this case. But in long term, we need to
reroute all decoration state updates through kwin so it can block state
updates when the window is closed. It's also needed for double buffered
state.
How to improve handling of tablet mode detection when switching between
VTs needs a separate investigation.
CCBUG: 477166
sRGB content is made to be encoded with the sRGB piece-wise transfer function,
and to be decoded by displays with the gamma 2.2 transfer function.
When KWin has a display in sRGB mode, this doesn't make a difference - it
decodes with sRGB and encodes with sRGB, so there's effectively no transformation.
When the display is in PQ mode though, KWin uses the sRGB inverse EOTF for
decoding sRGB content, but not the sRGB EOTF for encoding it again.
To fix this, this commit changes KWin to use the gamma 2.2 EOTF and inverse
EOTF for untagged content. That's not technically correct for sRGB screenshots,
where we'd have to use the piecewise sRGB EOTF, but that's a problem that
can be solved in the future.
Bouce keys suppresses additional key presses during a given interval
This is used by people with motor impairments or bad keyboards
It works by remembering the last input timestamp for a key
If an event's timestamp is too close to the last timestamp for that key the event is rejected
BUG: 474752
Place transients of window being raised in correct order when moving
them within unconstrained_stacking_order list; this way we don't have to
reorder them each time we call constrainedStackingOrder() later on.
Workspace::lowerWindow() already does it correctly.
With LayerShell all docks were in the above layer to match with the
semantics of the specification. Under X11 our main panel was also in the
above layer by setting the keep above flag.
The only thing that ended up in the dock layer were wayland applet
popups, and that was mostly by accident. When they get a transient
parent fixed they'll end up in the AboveLayer anyway so we should drop
it now to reduce complications.
This fixes a bug where applet popups could go under the panel.
BUG: 465354
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
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.
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
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
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().
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.
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>
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
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.
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
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.
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
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.
If there's a supported mechanism to handle the format, announce them as
supported.
If there are modifiers supported by the graphics card (even though as
external only), offer them as well.
Otherwise the animation feels wrong while activating with a gesture.
Now when a 1:1 gesture is ongoing, then the Overview effect will stop
animating the overviewVal/gridVal values. I implemented this by porting
to states, giving 1:1 gestures their own states, and only animating the
change between states.
BUG: 476536
After merging libkwineffects and libkwin, EffectsHandler and EffectWindow
have effectively become redundant. On the other hand, Effect and the
associated factory code is still relevant. In order to split relevant and
"legacy" code, this change extracts the Effect class in its own header.
It's also a good idea to split kwineffects.h header because it's quite
huge...
This leaks to other processes that are started by KWin.
The QPA sets ThreadedOpenGL capability to false which suffices
to use the basic render loop with OpenGL.
Effects can hold references to closed windows, which can cause problems
after the workspace is destroyed.
This change makes ApplicationX11 unload effects before destroying the
Workspace and the Compositor similar to how it's done in main_wayland.
BUG: 475511
It doesn't look wrong anymore, presumably what caused it to look wrong before
was just a bug. Blending in sRGB or PQ is still technically wrong, but it
looks okay, and that's an acceptable tradeoff to make in order to get the
responsiveness and power usage improvements the hardware cursor offers