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.
Brightness is a loose word for how bright we perceive things to be, but the
values we're using are about objective measurements, about luminance instead.
If a context is forward compatible, that means the deprecated functions are not
available, and if the QSurfaceFormat::DeprecatedFunctions option is set, that means
they are available.
Wrongly setting QSurfaceFormat::DeprecatedFunctions thus causes Qt to use OpenGL in
a way the context doesn't actually support.
CCBUG: 486460
If two mouse areas are stacked on top of each other and a button press
event is sent so one of them accepts it, QMouseEvent::isAccepted() will
still return false. It's a QtQuick bug, see the associated upstream bug
report https://bugreports.qt.io/browse/QTBUG-126733.
On the other hand, given that the MenuButton implements its own input
handling, we can port it away from DecorationButton to mitigate the issue.
BUG: 488993
The preedit struct holds values that need to be effectively double
buffered till the preedit string is set. There is no need to store the
text in this struct as it is reset at the end of setPreeditString
It's usefulness is doubtful, the current visuals poorly map to the
wayland abstractions, and it's partially incomplete because surface
previews are only shown for surfaces that have wl_shm buffers attached.
Tree hierarchy changes are also handled very poorly.
There are a couple of reasons why it's worthwhile doing:
The first is that it makes the logic in the updateServerGeometry()
function reusable for the interactive code path. As of now, when the
window is being interactively resized, doInteractiveResizeSync() will
issue some xcb_configure_window() calls but then it also implicitly
assumes that updateServerGeometry() will call updateShape() and
updateInputWindow() but skip m_frame.setGeometry() later. That is
confusing, and error prone. For example, if somebody drops
m_lastFrameGeometry in favor of m_frame.geometry() (which is an
absolutely reasonable thing to do btw!!), a regression will be
introduced: things would appear to work at first, but then eventually
bug reports about input working weirdly would start piling up.
The second is hidpi scaling of wayland clients. toXNative(a + b + c)
is not the same as toXNative(a) + toXNative(b) + toXNative(c). By
switching to the device geometry, we leave less space for making an
error.
The third is that lets us clean up some geometry manipulation code.
When dealing with window hierarchies, it's more convenient to have
m_window.position() rather than a dedicated property in the X11Window
class such as wrapperPos().
If the logical geometry changes, the X11Window still needs to verify
whether the currently applied native geometry differs from it. In order
to do that, the X11Window needs to map the logical geometry to the device
pixels. Given that X11Window already maps the logical pixels to the
device pixels, the Xcb::Window doesn't need to map the geometry again.
Also, the way different coordinate spaces are handled now is inconsistent.
Some things (Xcb::Window) work only with the logical pixels, while other
(e.g. client messages) require the user manually mapping the geometry
between the different coordinate spaces. With this change, it would be
more consistent.
Regarding the porting process, it was performed in a single step because
all the code that changes or reads Xcb::Window geometry is neatly
encapsulated in the X11Window class in a couple of functions.
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
This is to prevent disconnecting clients that sometimes struggle with
keeping up with the events that the compositor sends. 1 MiB was eyeballed.
Wayland's wire protocol consists of a stream of messages. Every message
consists of a header (2 words: 1 word for object id, the other word
specifies the message size + event/request opcode) and the arguments.
Considering the compositor sending motion events generated by a mouse
with 1000Hz polling rate, we have
- wl_pointer.motion event size: (4 bytes for serial + 4 bytes for x +
4 bytes for y + 8 bytes for header) = 20 bytes
- wl_pointer.frame event size: 8 bytes for header
So in total, if the client freezes for a second, the client buffer size
should be at least (20 + 8) * 1000 / 1024 = 27 KiB. 1 MiB corresponds to
the client not processing the motion events for approximately 30 seconds.
Some old hardware is very limited in the amount of instructions it can support.
In order to not have KWin fail to composite, reject using hardware acceleration
in this case and fall back to llvmpipe or QPainter
BUG: 482868
This helps avoid some frame drops after the GPU may have went into a lower power
state. While this isn't generally noticeable, avoiding this makes noticing and
debugging actually relevant frame drops easier
CCBUG: 488843
Makes it so the GlobalShortucts object gets built and its KGlobalAccelD
parts get disabled.
Addresses the TODO in GestureHandler.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
If a SwipeGesture or a PinchGesture is cancelled, the associated QAction
is going to be triggered. It is against the expectations of the gesture
handlers.
In order to address that, this ports the gesture handlers to the native
gesture apis, which expose whether the gesture has been started or cancelled
better.
After !5532 a new code path was triggered during Workspace::rearrange call.
When first Polonium window opens on any screen, there is no active tile yet.
This forces geometry calculation in Window::checkWorkspacePosition -> Window::ensureSpecialStateGeometry
To return empty QRect, which depending on the screen arrangement will move window to the other screen.
This confuses Polonium plugin, as it receives wrong outputChanged signal in scripting API.
BUG: 488898
Signed-off-by: Alik Aslanyan <inline0@pm.me>
The currently used cursor theme can be different from the configured one.
For example, if the configured theme cannot be used.
In order to ensure that that case is handled well, this change makes the
shake cursor plugin uses the same cursor theme as PointerInputRedirection.
At the moment, the shake cursor respects the current cursor shape. But
there are couple of drawbacks behind doing it: the first is that it's
very likely that the cursor pixmap has low resolution, the second is
the cursor can be hidden client-side.
This change makes the shake cursor plugin load the Xcursor theme with
a high enough size and display the default cursor shape regardless of
what the client has set in order to address the two aforementioned issues.
At the moment, the FocusChain has Q_ASSERT()s to prevent inserting closed
windows back into the focus chain. It makes sense on paper. But, there
are code paths that could still hypothetically call FocusChain::update(),
they are harmless except the logic in the FocusChain.
So instead this change makes the FocusChain ignore closed windows, i.e.
take a more defensive approach. There are a few reasons why it's
worthwhile doing: the first is that it would prevent inserting closed
windows back into the focus chain in release builds and potentially even
back into the stack, debugging such crashes is absolutely no fun; the
second is that it would be preferred to avoid sprinkling random
isDeleted() checks in the Window code here and there and thus making
the code harder to follow.
Otherwise we might miss some changes that come without a hotplug event,
like adaptive sync becoming available after the output has been initialized
BUG: 486149
It's printed whenever any opengl context is created, which can flood the
logs. On the other hand, this information is also included in the support
information, which we often ask in the bug reports.
BUG: 489000
Data like target vs. actual pageflip time, and render times is often needed for
debugging or optimizing render time predictions, so this commit makes KWin print
that information to a file in the home directory whenever KWIN_LOG_PERFORMANCE_DATA
is set.
CCBUG: 488843
Now that they will be shown and hidden in the proper state, we can set
up the input panel slide as the window gets added and ignore the
geometry changes that it will have in its lifetime.
Do not markAsMapped an unpositioned panel, it would confuse the sliding
popups effect and force it to figure out its state in creative ways.
Mark the panel window as hidden as it gets destroyed.
These flags affect kwin in general so WaylandServer is not the best place
for them to live in. For such things, we typically add properties in the
Application object, which is what this change does.
The way the glide effect works is that it takes 2D geometry and applies
the perspective projection to it on the CPU side. The reason we do it is
that the scene is 2D.
However, this leaves us with the well known problem where a texture
that's mapped to a trapezoid won't be correctly interpolated along the
diagonal.
It can addressed by performing a perspective division in the fragment
shader, but given the way the effect is structured, it's off the table. So
instead subdivide the window grid.
BUG: 488840
We are doing half a job of resetting spa_meta_cursor, the actual cursor
content is still left as is. On the other hand, it should plenty enough
to simply reset the cursor id. The clients are expected to call
spa_meta_cursor_is_valid().
currentTemperature, targetTemperature, and mode properties have "u" type.
But there is a mismatch between the property types declared in the
Q_PROPERTY macro and the org.freedesktop.DBus.Properties.PropertiesChanged
signal.
This change makes the property types consistent and match the types
declared in the xml file.
Amends a136a159f9 which changed the value in the kcfg file that the kcm reads, KWin uses options.kcfg
4f322e24d3 changed the in code default but this will be later overriden when loading the options.
Adds support for BGR888 and RGB888.
Some clients use it and we just fail to render them, making devs
thinking that kwin is broken.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
KWin already supports following org.freedesktop.locale1 for the
keyboard keymap, but only by passing a command-line option. This is
typically used in SDDM when running the greeter in kwin_wayland.
We want to use locale1 mode in livesys environments too, so that
environment-agnostic installers can configure the keyboard and also
immediatly apply the same configuration to the running desktop.
When KWin is started through `startplasma` we cannot easily supply
an extra command-line option, so we need to make this configurable
from the external environment, in the form of a KConfig.
The command-line option will keep precedence over the KConfig.
In case the current state and the pending state have the same buffer for
a particular side or a corner, that buffer can be prematurely released
because the buffer in the current state is unreferenced first.
The ref/unref order should be vice versa to ensure that the GraphicsBuffer
is not released prematurely.
This effects is off by default, which means to instruct someone how to
use it for debugging purposes, you need to both tell them to enable it,
and then also teach them how to assign a shortcut for it.
Since it's off by default, there's no harm in setting a shortcut, which
simplifies the enablement instructions. I've chosen Meta+Ctrl+Alt+P,
which uses so many modifiers that it won't conflict with anything.
This allows us to make the code that computes transition timings more
cleaner, and other time constants are in milliseconds, so it makes sense
to make m_transitionDuration store milliseconds too.
The current code is unreadable:
- it creates a lambda that captures two local variables for latitude and longitude
- then it copies values from the config to those local variables
- calls the lambda
- and finally copies the data from the local variables to the NightLightManager fields
That code can be simplified by simply calling checkLocation() directly
and using an if statement.
Morning and evening timings should be ordered correctly. When computing
the daylight duration, that ternary operator should not be needed and it
hides other bugs.
There are a couple of reasons why it's worth removing it:
- it's error prone. If one forgets to pass correct "force" flag, night
light will break
- it contributes some complexity
- updateTransitionTimings() is not called in any hot path and the code
that calculates the position of the Sun is not resource intensive
Currently, resetSlowUpdateTimers() will start a timer that will pass
m_next.first as the current time to resetSlowUpdateTimers(). This kind
of works, but there are more code paths where updateTransitionTimings()
can be called.
This change hardens updateTransitionTimings() against the current time
being very close to the start of the next transition by introducing a
time fudge factor.
If we are currently 1 second away from the start of the next transition,
then it is assumed that that transition has been reached, and we need
to calculate the timings of a transition after that.
This change simplifies the color temperature interpolation code by doing
the following:
- compute a progress value so 0 corresponds to target1, i.e. the beginning
of the transition, and 1 corresponds to target2, the end of the
transition, instead of vice versa
- and use std::lerp() function
Rounding to a multiple of ten is not needed, it is for nicer digits in
the applet, but if the applet really cares about it, it could perform
such rounding on its own. In the night light manager, it's better to avoid
rounding the interpolated values because that can result in the final
temperature getting outside of the [target1, target2] interval.
The interpolated temperature can get out of the bounds of [target1, target2]
if the current time is slightly earlier than m_prev.first, which can be
unexpected. This change addresses that by adding a relevant guard.
There are two mechanisms to throttle ConfigureNotify events during
interactive resize:
- either using XSync
- or by a dummy QTimer
The QTimer approach is pretty straightforward: the wm configures the
window, blocks the interactive resize operation and arms a timer to
unblock it some time later in the future.
With the xsync approach, the wm sends an xsync request, makes a
call to XConfigureWindow(), and blocks interactive resize until
the xsync request is acked by the client. When the client sees the
ConfigureNotify event, it is going to repaint and ack the xsync request.
When the xsync request is acked, the wm will apply new geometry and
unblock interactive resize.
After the scaling changes, the logical geometry can have some fractional
part, which gets rounded when configuring the X windows. Due to that,
it's possible to encounter the case where the logical geometry changes,
but the native/device geometry does not due to std::round(). In that
case, the wm should not send an xsync request because the client won't
ack it because the device geometry has not changed.
BUG: 488223
In order to match dnd actions, we need both a data source and a data
offer. If the preferred actions of either change, then a new dnd
must be chosen.
The code that sets up the monitoring of the preferred actions of the
data offer sets the correct receiver context object (data source).
But the code that sets up the monitoring of the preferred actions of
the data source uses the data source as the receiver context object,
however we would like to break the matchOffers connection when either
the data source or the data offer is destroyed.
After the screen edge is reserved, the touch screen gestures will be
registered or unregistered when the Edge::activatesForTouchGesture()
signal is emitted.
On the other hand, Edge::reserveTouch() lacks code to emit that signal,
which results in touch screen gesture not working if the same screen
edge is reserved both for pointer and touch input.
BUG: 451349
While the scaling mode has caused some issues with external displays, we've had several
reports that using "unify outputs" has caused the internal display to no longer show
anything, as it changes to an unsupported mode. This sets the scaling mode so that the
driver handles the scaling internally, instead of leaving it up to the panel, and it only
does so on internal displays with generated modes, to minimize the risk of further breakage.
BUG: 488111
The effect does not work very well for two main reasons:
Some clients will make a new popup rather than move an existing one, so
whether it does anything is highly unpredictable as a user.
Popups can be of massively different sizes with different amounts of
text. This means the text in the smaller popup gets resized which
doesn't look like a natural in-between state of the two popups. This
defeats the objective of looking smoother.
On top of that, it's rather glitchy.
This effect was purely visual, no functionality changes.
BUG: 473411
BUG: 466638
BUG: 416048
BUG: 461501
BUG: 466637
The SPA_FORMAT_VIDEO_modifier property has the following format:
preferred_value,alternative1,alternative2,...
The preferred value is usually the same as the first alternative value.
It can also happen that the modifier list the compositor has supplied is
not good either and it contains duplicate entries, specifically
`DRM_FORMAT_MOD_INVALID` to indicate that modifier-less buffers are
supported.
In order to deal with that, the screencast plugin removes the
duplicates by sorting the modifier list and then using std::unique().
That is not good, there is no written rule that the order of the
modifiers passed to the graphics buffer allocator matters but it
typically does, some drivers in mesa assume that the modifiers are
sorted in the preference order. The graphics buffer allocator might be
also very lazy and just look at the first supplied modifier instead of
wisely choosing the best modifier.
This change makes the ScreenCastStream remove the duplicate modifiers
in a more conservative fashion preserving the relative order of the
modifiers. It also removes an extra `{DRM_FORMAT_MOD_INVALID}` because
this kind of thing should be dictated by the render backend.
showfps is a handy plugin when deploying to a new platform because it
will render something that says "I am here".
Since both kirigami and quickcharts are quite high level, we add a
variant that just depends on QtQuick and shows the fps which is what we
promise anyway.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
It's fine to be conservative about what kind of buffers we support, but
failing silently only makes it hard on such cases.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
The alternative is silent failures and KWin rendering nothing. The
kernel will only be telling us that something went wrong which makes it
hard to debug.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
QSize::isEmpty() will return true if either dimension is 0. On the other
hand, given the current language in the spec, it seems like the client
is allowed to set size constraints per dimension.
BUG: 488260
Output frames can outlive the output they were created for, so the render loop
might also be deleted by the time the output frame is destroyed or presented
BUG: 487701
It caused bugs and doesn't seem to work anymore, with no complaints about it
not working or an obvious reason for it to exist, so it almost certainly
isn't needed at all.
When the slow update timer fires, it's going to pass m_next.first as the
current time in order to calculate the next transition timings. After
the timings have been calculated, the slow update timer will be started
with an interval of "todayNow.msecsTo(m_next.first)". Since todayNow
is a reference to m_next.first, the time diff will be 0, which will
throw off the night light manager. To fix that, make a copy of m_next.first
and then pass the copy as the current date time to resetSlowUpdateTimers().
BUG: 487901
Instead, move the outline below the window, so that the visual order of things stays the
same. This also fixes a visual glitch, where the outline is visible for a moment after
maximization, and is above the no-longer-elevated window
BUG: 436466
BUG: 354741
While in theory it could be useful with both, I'm not sure that it makes sense
in practice, and the current triple buffering logic doesn't support it.
BUG: 487605
My recent testing has shown that screen freezes when moving the cursor
cannot be observed anymore. Maybe the issue has been fixed upstream by
some unrelated change. Either way, let's re-enable the hardware cursor
to gather some feedback.
Otherwise, the pipeline state from an earlier hotplug scenario can leave
the pipeline disabled and without a CRTC, which means leasing the output
will fail
BUG: 487938
FIXED-IN: 6.1.0
If the mode the user has previously set through KScreen isn't available, this falls
back to a different mode without overwriting the user preference. If on the next
hotplug, the desired mode is available again, it then gets chosen instead of the
fallback
BUG: 484037
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
A layer shell window can request a screen edge without having a chance
to map the surface. In that case, no Workspace::windowRemoved() signal
is not going to be emitted because no surface has been mapped. Perhaps
it needs some re-wiring, but on the other hand, it is also more reasonable
to monitor Window::closed() signal.
With this change, the ScreenEdges manager will reject any request to
reserve a screen edge for a closed window. And in addition to that,
the ScreenEdges will unreserve screen edges when the window is closed
rather than when the window is unmapped.
CCBUG: 485318
Whilst the XWayland input filter only runs whilst XWayland is running
there is hypothetical window between the wayland connection to xwayland
being disconnected and handleXwaylandFinished, the process exiting. This
should be guarded correctly.
BUG: 480925
If a new drag and drop session is started while there is already one
existing, it's possible to end up in a situation where the
SeatInterface::dragEnded signal is emitted the second time when one of
the data sources is destroyed.
CCBUG: 460374
HiddenPreviews was a hack to not inform X11 that windows were minimised,
so that their previews kept working.
On wayland the user facing setting is not visible but the value is
loaded which is a bad combination.
CCBUG: 415286
Write something into the logs when a call goes awry, it can save some
time to the next person porting kwin to a dysfunctional driver.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
05a3e2bad9 added `geteuid` use but didn't
add the needed headers. This works by chance on libstdc++ systems via
transitive includes, but it doesn't work on libc++ systems, as reported
downstream in Gentoo at https://bugs.gentoo.org/933120.
The Qt pipeline cache causes a disk sync on every load and save of a
QQuickWindow. This causes a stutter under high disk usage.
The gains from this cache are minimal on our simple scenes on PC
hardware. Especially given mesa has it's own cache, profiling on my
personal laptop showed the pipeline as being 0ms.
There is an upstream patch at
https://codereview.qt-project.org/c/qt/qtdeclarative/+/564411 .
QSaveFile still has a sync, but that should only be hit for the first
non-cached run. I'm also adding a flag to QSaveFile to fix the QML cache
and first run case.
Tested via running kwin with `strace -e
inject=fdatasync:delay_enter=10000000` to simulate a slow flush.
BUG: 487043
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
Until effects are converted to schedule repaints on the item they're modifying,
we need to allow repaint scheduling from nullptr items, and handle repaints on
the (cursor) render layers to still be filtered out
BUG: 487480
This will also look at the "product serial string" in addition
to the actual serial number. The former is what we use elsewhere
in Plasma like the kscreen kcm.
BUG:485015
FIXED-IN:6.1
QOpenGLContextPrivate::setCurrentContext() was dropped because the
platform opengl context no longer uses QOpenGLFramebufferObject, which
needed QOpenGLContext::currentContext().
When the render time estimation is much higher than the real render time, and triple buffering is
enabled, the previous logic would schedule frames multiple vblanks in advance, which could drop the
effective refresh rate by more than is necessary. This commit limits it to the second vblank after
the current time, which ensures that we hit the full refresh rate even when render time prediction
is wrong
Otherwise, if render time prediction and actual render time are very different,
a lot of frames get dropped and in some cases more frames than is useful are
rendered, creating stutter instead of only unnecessary latency
BUG: 487605
A bad rebase in commit 43e5f17547 inadvertedly
reverted half of the fix from 1f1c54ca6c. As a
result, custom tiling would appear broken again for keyboard layouts where caps
lock is achieved by pressing both shift keys at the same time. Reapply the half
of the fix that went missing.
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
This improves the integration of the XcursorTheme class with the rest of
the Qt ecosystem, for example it should be possible to load cursor themes
from Qt resources.
When rendering a frame takes longer than a refresh period, allow rendering to
happen before the previous frame is presented. This way the effective refresh
rate is increased, without increasing latency or impacting frame pacing more
than necessary
Plasma::Dialog contains logic that we don't want for a kwin window and
is considered deprecated. Dialog uses the width of the main item which
results in an unavoidable binding loop.
PlasmaWindow allows us to propagate implicit sizes upwards correctly.
BUG: 420757
kglobalacceld needs to process all key events to detect whether
a modifier only shortcut has been triggered.
On the other hand, when using Meta+Space keyboard layout switching
shortcut, we will get the following key syms (not native scan codes)
- press meta: Meta_L
- press spacebar: Super_L
- release meta: Meta_L
- release spacebar: Space
The fact that xkb reports Super_L when the spacebar is pressed trips
modifier only shortcut detection in kglobalacceld, and it's likely
that kickoff will open after pressing Meta+Space to switch the keyboard
layout.
In order to prevent that, kglobalacceld needs to see all key events
even with invalid key codes. As an alternative, we could explore the
possibility of using native scan codes instead of mapping keysyms to
key codes, but that needs thorough analysis, which we have no time
for.
The check was introduced in 4403e86acc.
After that check is removed, the test still passes.
This is the backend that will be used by the portal to enable
the functionality of the input capture portal.
When the cursor tries to move out of the workarea across a barrier
that the portal registered all input events are filtered out
and forwarded via eis.
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
With this change the preferred buffer scale, transform and color
description properties will be latched to xdg shell configure events.
This should ensure that the clients are told the preferred buffer
scale before the first configure events.
This makes it a bit more conservative for reducing latency, which decreases the
amount of dropped frames in desktop usage a lot (by 13x on my desktop, 2x on my laptop)
pointerEvents contain all motion events, the xwayland filter is only
concerned with forwarding clicks. Right now we would update an invalid
button state constantly. It did nothing harmful but was still a bit
silly.
An EDID can contain zero or more detailed timing definitions, which can contain
more precise physical dimensions of the screen (in millimeters, as opposed to
centimeters).
The Xorg server has similar logic for determining the physical screen size from
the EDID: pick the first sane size from the detailed timing definitions, and
fall back to the screen size given in the "Basic Display Parameters & Features"
section.
BUG: 486585
Apparently people have differing ideas of what "vertically" and
"horizontally" mean, and some feel that this wording contradicts the
icon.
That's not accurate, but the wording is admittedly a little a bit
ambiguous. We can clarify this by using super duper explicit
terminology that always matches the icon.
BUG: 475103
FIXED-IN: 6.1
If the slow transition is scheduled slightly earlier before m_next.first,
don't skip the "m_prev.first <= todayNow && todayNow <= m_prev.second" branch.
Also explicitly handle the case when resetSlowUpdateTimers() gets called
after m_prev.second, i.e. the previous transition has finished running.
Due to QTimer sometimes firing a tad bit early, transitions get skipped, or we
end up in the "Error in time calculation" branch. This commit improves timer
handling to avoid this.
We do not snap to docks (i.e. panels) since the ones we
actually want to snap to (i.e. always visible ones) will
restrict the workspace area, and the window will snap to
that, effectively snapping to the panel too. Explicitedly
avoiding panel snapping solves any possible issue of
floating panels, since they change their size when a window
gets near them.
The communication between the compositor and plasmashell is asynchronous.
It's possible that plasma can call get_window_by_uuid before it is notified
that the window has been closed. There's no any way around with the
current design of the protocol. So printing a warning message is
unjustified. This fixes kwin's logs being full of "could not find window"
warning messages.
After receiving a drop a client should call data_offer.finish
to tell the source it's done using the drop.
A client could delete an offer after drop before calling finish.
This can happen with misbehaving/buggy or malicious Wayland clients.
A real case was found in the wild with Chromium, as described in the
linked bug.
In this situation we should let the source know the dnd is finished
as there are no other transfers than can take place.
We don't want to universally send this in all data offer destructors
only, offers that are deleted post drop so the flag on the source is
exposed.
BUG: 482142
Currently, the dmabuf format is hardcoded to DRM_FORMAT_ARGB8888, but
testCreateDmabuf() uses m_drmFormat.
Furthermore, if the shm buffers are used, it's preferred to use a buffer
format that's friendly to QImage and OpenGL, which is DRM_FORMAT_ARGB8888.
It appears like pipewire can ask kwin to allocate a drm buffer even
though m_dmabufParams has been reset. It's underspecified when pipewire
will start requesting new buffers after changing the stream params. So
use the last reported video info to allocate buffers. If even it is wrong,
then it's an issue somewhere in pipewire.
Right now the opening duration is 150ms, and the closing duration is
250ms. Neither are standard durations we use elsewhere, and it's also a
bit odd to be slower to close than to open--at least from a visual
perspective.
The average of these value happens to be 200ms, which happily is the
exact value of Kirigami.Units.longDuration.
As such, use that value instead, in the interests of visual consistency.
Enabling this feature makes Xwayland send xtest events via
the remote desktop portal and libei.
XWayland will create a new session for each X client (it keeps
contexts around and reuses them if the cmdline matches, so not
every xdotool invocation produces a new portal prompt).
n_datas must match the plane count in the graphics buffer. But apparently
pw buffers with wrong n_datas can still slip through somehow. It makes
the screen cast stream crash when filling in buffer data.
The crash is hard to reproduce, but on the other hand, according to
sentry, a substantial number of users is affected by this issue.
Taking the defensive approach is not great, there will likely be other
issues with screencasting, but it seems like the only feasible option
so far. Broken streams is better than kwin crashing. It also wouldn't
hurt to add some warning messages, that will be done in a follow up MR.
Otherwise the effect of night color is much bigger in larger colorspaces.
This is mostly a workaround, but the better solution (adapting the color
temperature of the colorspace instead) will have to wait for 6.1
BUG: 483801
FIXED-IN: 6.0.5
With multiple OpenGL render time queries, you can't just add the render
times together, because the GPUs execute commands asynchronously and you
may get a far too big result this way. Instead, this converts all timestamps
to steady_clock and correctly calculates the actual total time spent rendering
with the first and last timestamp.
The GL renderer currently doesn't apply any transformations except clipping,
so allowing direct scanout is okay as long as colorimetry and transfer
function match.
After porting to KConfigXT settings some time ago, there was still an
inefficient and error-prone codepath between the `RuleBook` (which keeps
the runtime list of `Rules`) and the `RuleBookSettings` (responsible for
config reads and saves), in the form of the `setRules()` method.
We can eliminate the `setRules()` codepath, reducing unnecessary
runtime process and file access operations, and instead:
- Keep track of the config `id` in the `Rules` objects
- Keep a single `RuleBookSettings` object as a member
- Modify or delete the discarded rules settings directly
- Save when necessary
This also fixes two bugs/pitfalls of the previous solution:
- the config group id for each rule is now preserved instead of creating
new ones
- no leftovers on the config file for the discarded groups and entries
Setting custom configs for the integration tests still works unchanged.
BUG: 446381
FIXED-IN: 6.1
Damage reported from the output is output-local and therefore doesn't
need to be translated.
I tested this with Chromium, where the damage region on my 3-monitor
setup was always -4k something on the right screen, -2k on the middle
one and correct on the left screen. With this change I can confirm that
the position is now correctly reported for the right screen.
Our connection to pipewire can go down if the pipewire service restarts, it's on us to tear down and reconnect.
To ensure Streams can tear down on their own properly, this patch leaves existing streams with a defunct connection
and creates a new connection for new streams, sharing the connection between them.
This also implicitly fixes the case for distributions without working socket activation.
BUG: 483137
Unless there is no focus window. Matches X11 behavior.
Otherwise (re)starting plasmashell would pull focus away from
whatever window is currently focussed.
To clarify that the toggle action merely temporarily disables the blue light filter, rather than turning the schedule off permanently like the "Disbaled" setting in the KCM does, use "suspend/resume" terminology instead of "off/on" in the keyboard shortcut and OSD.
Follow-up on plasma-workspace!4262
CCBUG: 486647
Include a warning if we are ever setting an invalid value, this can save
some of us quite some time in the future, since failing to fall in the
range makes the whole pipeline become rejected.
This is in part a workaround for an issue in Qualcomm drivers where the
range for alpha is 0-UINT8_MAX (255). We were setting a value too big
and this would make the whole pipeline fail.
Instead set the top of the property range which is what we were doing
after all, resulting in more explicit code to what we were trying to
achieve.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
Deleted windows have frameId zero, which makes Xorg stack other windows
below the bottom-most window instead of the correct one. To avoid that,
filter out deleted windows in Workspace::propagateWindows.
BUG: 478556
There were two problems preventing it from working:
1. The placement tracker didn't handle them correctly; now it sets the custom tile mode
after moving the window to its location
2. The window code used `output()` instead of `moveResizeOutput()`, which means when KWin
just moved the window to a different screen and immediately changes the tile mode
afterwards, it would tile the window on the wrong output
There were two problems:
1. Workspace interacted with the tile mode of windows before inhibiting
the placement tracker, so the wrong window state was stored in the placement
tracker
2. Window::setQuickTileMode is unintuitive and has some undesired side effects,
meant to handle quick tiling with keyboard shortcuts and by dragging the
window with a mouse specifically. This commit just works around that by
un-setting the tile mode first
BUG: 461886
If the X11 socket directory has wrong permissions, XwaylandSocket will
refuse to create sockets. Crashing in that case is undesired, just continue
executing without X.
It seems that, on some systems (such as on mine), 1s is not long enough
for a spurious disconnect and reconnect to happen. 2s seems enough,
however, while still likely not being long enough to cause user
confusion.
BUG: 480026
Process the geometry update as usual but just avoid confuguring the x
windows. It simplifies the implementation of the move resize function
and makes it more refactorable.
GeometryUpdatesBlocker is unnecessary. One could just compute the
final geometry on a side and then issue one moveResize() rather than
call move(); resize(); moveResize() and so on in a sequence. The
advantage of the former approach over the latter is that the code
can be a bit more straightforward.
When a window is closed, its geometry should not change, so the geometry
updates blockers are not needed. There's also no code that could potentially
change the geometry in destroyWindow() or releaseWindow().
Drm planes aren't specialized enough to need completely separate code paths to
handle them, and having one class for all layers makes it easier to add support
for overlay planes
We have a bunch of logic in there that is effectively no-op if the
values don't change. We might as well skip it altogether and save some
code from being run to do nothing.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
While these geometry updates blockers are used in functions that can
call moveResize() several times in a row, it's not critical.
On the other hand, by removing these blockers, no other core code is
going to rely on GeometryUpdatesBlocker, which opens us the future
opportunitinies to drop it and make geometry manipulation code simpler.
Instead of the active screen being purely defined by the mouse position,
or purely defined by the active window and keyboard shortcuts, this changes
it to make the active screen all about the last user interaction. This should
work for most workflows without needing a setting to choose between two flawed
approaches.
BUG: 482865
BUG: 484902
BUG: 484902
There's a bunch of differences between them, like direct scanout, adaptive sync, content type
and the actually painted output in the Wayland session but not on Xorg, so keeping them in one
method doesn't really make sense
This simplifies how the stream resolution is updated and removes a couple
more of failure points. This also appears to fix window screencasts freezing
in obs when those windows are resized.
The existing check incorrectly compares the directory path only. This
allows unintended GPUs to be added when events occur for them, such
as with "udevadm trigger".
Update the check to use the full path.
This moves some of the responsbilities up in the stack, which simplifies
the backends and opens up some future possibilities like making direct scanout
work for non-surface items
ScreenCastStream::onStreamAddBuffer() can be called before the stream
params are updated. This is problematic because that function expects a
valid m_dmabufParams.
The reason why m_dmabufParams is reset is to force the onStreamParamChanged()
function to check whether dmabufs can be still allocated with the new size.
Also pull "Rows" out of the SpinBox into a dedicated label.
Both to address concerns "Add" about being misinterpreted as
"Add Row", given that the button to add a new virtual desktop
now sits right next to the row count spinner.
The steady clock is more preferred for generating timestamps because it
ensures that timestamps increase monotonically.
This fixes screencasts freezing in obs after changing the system time.
If the max framerate is 60Hz, currently, the frameInterval is going to
be 16.6ms. On the other hand, lastSentAgo is likely to be just 16ms. So
the frame throttling timer will be started just to wait less than a
millisecond.
Hidden moveResize() calls stand in the way of making geometry code
reusable or more refactorable. They also usually require one using
geometry update blockers, which are just a horrible concept because
they make geometry code unnecessarily more complex and add more failure
points.
The existing code overwrites all per-output data with the config from KScreen
every time an output config is found that isn't in the KWin data base yet.
That causes problems like the scale being reset to 1.0 if the user logged
into Xorg before, or resetting it to whatever scale KScreen had saved on
Wayland, which isn't much better.
Instead of doing that, use the KScreen config as inspiration for some specific
output settings, instead of copying it outright. It's not ideal, but it's
better than overwriting settings the user has explicitly set up
BUG: 485353
We don't need a pixmap for direct scanout, and the drm backend destroys the pixmap
when direct scanout is successful... so this check created a loop of direct scanout
working and not working, and worse, the client reallocating its buffers each time.
BUG: 485639
BUG: 485730
BUG: 485712
CCBUG: 477016
SyncTimeline::moveInto imports the provided fence to the syncobj by
calling drmSyncobjImportSyncFile. However, that function assumes the
syncobj a binary syncobj, meaning the fence will be imported at timeline
point 0, not at the intended timeline point.
Since there is no timeline equivalent of drmSyncobjImportSyncFile, to
achieve the correct behavior we create a temporary binary syncobj,
import the fence into that, and then use drmSyncobjTransfer to transfer
the fence to the desired timeline point on the destination syncobj.
Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Try harder to get some cursor theme loaded, otherwise the cursor is
invisible, which also makes it hard to fix the configuration.
Also add some warnings instead of failing silently.
Workspace already makes sure to only dynamically delete the
dpmsinputeventfilter if all screens are currently on. This line to wake
all screens is therefore redundant.
It's problematic as it can cause a crash on final teardown when
workspace is destroyed.
BUG: 484861
This adds a libeis backend via plugin which supports clients sending
emulated input events. No public listening socket is exposed,
clients are expected to go through the RemoteDesktop portal.
In order to restrict the device types available to clients
according to what was approved via the portal a separate eis
context per portal request is created. The communication with
the portal happens through a simple dbus interface where cookies
are handed out for each eis context so the portal can inform KWin
when the portal session is closed/should end.
The quicktileMode member now is just for the requested tile mode, base the "real" mode only on m_tile.
The requested tile mode is used for double buffering, to look and behave just like requestedMAximizeMode() which is updated immediately, but needs to acknowledge the configure request and render for quickTileMode() (and the right tile() instanced to be associated) to be updated accordingly
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.
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
This is a hidden destructive action[1] in a context where users are not
primed to expect it. It's also largely unnecessary since the delegates
already show a delete button on hover, and deleting virtual desktops
isn't such a common task that it benefits from an accelerator. Let's
remove it for safety.
[1] It's destructive because user-created state on the deleted virtual
desktop is lost--with no confirmation or undo, to boot.
BUG: 484999
FIXED-IN: 6.1
When filtering windows by screen, match the screen closest to the window
center, instead of testing whether the window is visible on the current
screen. The new method guarantees that when filtering by screen, the
window appears for exactly one screen. Previously windows spanning
multiple screens appear on all of them, and off-screen windows are not
shown in any screen.
BUG: 480028
BUG: 485337
FIXED-IN: 6.0.4
It makes sense only with dnd and sending the source_actions events for
selections and primary selections tricks gtk into thinking that there
are drag motion events.
BUG: 464196
Currently the edge erroneously triggers when the pointer repeatedly
enters and leaves the edge in short durations. Send all events to edges,
and reset the timer when pointer leaves edge. Add corresponding test.
BUG: 441892
FIXED-IN: 6.0.4
linux-drm-syncobj-v1 allows drivers and apps to synchronize KWin's buffer access
to their rendering, and synchronize their rendering to KWin's buffer release. This
fixes severe glitches with the proprietary NVidia driver and allows for some
performance improvements with Mesa too.
Accidental changes in zoom can become very time consuming to undo otherwise.
With a value of 100, you can still zoom in far enough to only see a few pixels
on the screen, so it shouldn't break any actual use cases
BUG: 485192
testCreateDmaBuf() is going to use the GbmGraphicsBufferAllocator under
the hood.
The GbmGraphicsBufferAllocator works as follows: if you pass it the
DRM_FORMAT_MOD_INVALID modifier, the resulting GraphicsBuffer is going
to have the invalid modifier as well. So the receivedModifiers check
is unnecessary.
Every caller of sendCursorData() is required to retrieve the
spa_meta_cursor object. But there's no good reason to do it, this can
be done by the sendCursorData() function.
Also, sendCursorData() is not a good name, it doesn't send anything.
Instead, it adds cursor metadata to the buffer.
The hardware cursor on vmware virtual machines is missing. This is
likely related to issues with importing DRM dumb buffers through
prime on vmwgfx.
Force software cursor on vmwgfx to make sure cursor is visible and
working properly until the hardware cursor is fixed.
Disable the readability checks when running on vmwgfx. The DMABuf syncs
seem broken on vmwgfx and until they're fixed disable the readablity
checks to actually let KDE propertly redraw when running on vmwgfx.
The DRM_IOCTL_MODE_CLOSEFB ioctl takes a struct drm_mode_closefb as
argument and not the framebuffer id as integer.
That distinction is important because the kernel side explicitly
checks whether the padding in drm_mode_closefb has been correctly
initialized to zero:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_framebuffer.c#n494
Use drm_mode_closefb and thus make sure the kernel side is not reading
garbage when testing the padding.
Now that we have Kirigami.Units.cornerRadius, there's a central source
of truth for corner radius so don't have to use random numbers for
these anymore.
Part of https://invent.kde.org/teams/vdg/issues/-/issues/45.
I swapped the order of "Add" and row count because (in LTR layouts)
row captions are on the left and an "Add" button on the right sits
right on top of the "Remove" buttons in the list view.
Right now both source and target color descriptions have SDR brightness values,
and the target one gets used; in this case however the source brightness needs
to be used instead.
BUG: 484497
Because of a shortcoming in upstream qtwaylandscanner and the cmake
macro we defered to the ecm macro which renames the output files
acoording to what qtwaylandscanner expects. However since this
was corrected in newer Qt this doesn't build anymore since
the tool now expects correctly named files.
The workaround prevents cropping with direct scanout, and it's no longer necessary
because we force a software cursor with adaptive sync on AMD to work around a related
problem
There's not much point checking that we can convert an executable into a
file if we are not going to use that file.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
plasma-desktop/keyboard/keyboardmiscsettings.kcfg has the default value
600. When default value (600) is set from kcm, kwin will wrongly use its
own default value in the code (660, which is most likely due to a typo when the
code is initially written).
If two items display image data, the item renderer needs to special case
each item. It's not an extensible design, and my long term goal is to
introduce a separate tree specifically to solve this problem and also
help with computing the repaint damage automatically, instead of issuing
scheduleRepaint()s manually.
The first step is to refactor the item renderer so it merely takes the
input data and renders it. At the moment, it's not exactly the case
because surface textures are updated while painting the items, which
inherently requires special casing. This change moves surface texture
update code to the surface item so it's easier to refactor rendering code
in the item renderer.
Previously when drawing has length 1, it is not cleared. So the
remaining point in drawing can connect with the new point when the user
represses the modifiers, leading to a unexpected mark.
This ammends commit 46807b1a72.
BUG: 482297
If I'm not mistaken, the renegotiate event is leaked. Also, its handler
function can be hypothetically called after thhe ScreenCastStream object
is destroyed.
SPA_META_HEADER_FLAG_CORRUPTED indicates that the buffer contains
absolutely no any data.
SPA_CHUNK_FLAG_CORRUPTED indicates that the buffer has no frame contents
but it can contain other data, for example cursor metadata.
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
Streams are deleted with QObject::deleteLater(), it's still possible to
process some events before the stream is actually destroyed, which can
cause problems.
I guess sys/types.h is implicitely included on glibc but that's definitely
not the case on Musl libc. The include is however necessary to define
dev_t introduced in 3c82d5a919
There are behavior differences between QFutureInterface and QPromise.
The QFutureWatcher::finished() signal will be emitted in both cases
when the promise reports results or it is canceled.
Both frameSize and clientSize are rounded to integral XNative units.
So their difference must also be rounded to integral XNative units.
Otherwise we get cycles of rounding that can cause growing window sizes.
BUG: 481460
Otherwise it's theoretically possible to create a new ClientConnection
object for the zombie wl_client when its resources are being destroyed.
For example
- process early wl_client destroy notification
- the ClientConnection objects gets removed from the client list in Display
- process wl_resource objects getting destroyed
- if some code calls display->getConnection(zombie_client), it's going to
reintroduce the client in the client list
- process late wl_client destroy notification, it's going to destroy the
original and the clone ClientConnection object
This change prevents reintoducing a clone client object, by keeping the
original for a bit longer until it's actually destroyed. In the future though,
it would be great to kill the client lists in Display and ClientConnection,
and just use `static_cast<ClientConnection *>(wl_client_get_user_data())`.
If the pointer is constrained, the screen edge may push the cursor back,
which will work not as expected. It's also undesired to trigger the screen
edge while the pointer is constrained by some surface, in general.
As Wayland doesn't have a warp event yet, before this commit, warps were
dealt with like normal absolute motion events. This trips up games though,
which don't deal with actual absolute motion events well. As a solution
to that, until an actual warp event is a thing, we send a motion event with
a position + a relative motion event with no motion
BUG: 458233
CCBUG: 482476
Consider a window with the size of 50x100 and the titlebar height of 36px.
The maximum number of visible titlebar pixels is 1800, but the
titleBarRect() function reports 3600 instead, which is completely wrong.
Since the reported number of required visible pixels is wrong, the window
geometry constraining logic is mistriggered and it's possible to move the
window only by 1px.
The pointer should cross a corner as soon as the movement in the barrier
zone exceeds barrierWidth. Previously horizontal and vertical movements
were separately considered, which made corners harder to cross compared
to edges even when the separate corner barrier was disabled.
CCBUG: 483651
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.
X11 did not have a requirement that apps needed keyboard focus to update
a clipboard. Apps could copy things on click. With context menus and
grabs there can be no active window at this point.
Kwin tried to retrofit a requirement, which doesn't work in all cases.
Whilst there are security implications of reading a clipboard there are
no security issues about pushing a new clipboard. Gnome also allows X11
apps to push to the clipboard at any point.
Make a roundtrip to the x server to ensure that WM_STATE changes have
been propagated. xcb_flush() is not good enough, there's still a race
condition between the wm flushing its connection and the client reading
window properties.
While KWin may not have information about the formats, that doesn't mean KWin
should filter them out - EGL can still import them, so allow clients to use them
*Second in series after https://invent.kde.org/plasma/plasma-workspace-wallpapers/-/merge_requests/17*
Another patch will follow from the translations SVN, after I figure out how to work with it.
In kwin repo alone, there's another 4MB in savings with funny files like those:
```
kwin/po/ru/docs/kcontrol/windowspecific/tbird-reminder-info.png
[oxipng] Reduced by 768.94 KB (-96.42%) from 797.52 KB
```
The main benefit from doing this is that kwin is going to handle
maximizing the window by dragging it on touchscreen correctly if the
pointer focus point and touch focus point are on different screens.
The "!isMovable()" code path is needed to handle moving fullscreen windows.
Maximized windows are movable and their geometry is computed in
Window::nextInteractiveMoveGeometry().
our plasmoid only listens to signals when the interface was found.
also when switching from 2 to 1 layout we'd emit a signal that the
layouts changed but then we'd throw away our interface leaving
the client wondering what happened to us (and consequently
printing warnings because our service wasn't found)
this specifically resulted in the plasmoid not getting layout event
changes when switching from 1 to >1
BUG: 449531
The main motivation behind this change is to make the code in
Window::handleInteractiveMoveResize() more reasonable. Almost all of the
code in it will be called after startInteractiveMoveResize(), except
when one drags the decoration to initiate an interactive move operation.
This change moves that code to the places where it makes more sense to
ensure that handleInteractiveMoveResize() has no any hidden pitfalls.
Unlike X11, on Wayland, the window won't change its maximize mode until
it renders a new buffer. This creates a problem for interactive move
because if it's not careful and moves the window while it's still effectively
maximized, it will look as if the window has leaked to other screens.
This change fixes the problem by making Window::handleInteractiveMoveResize()
avoid move() if the window needs to be unmaximized.
As a bonus, it also allows to unmaximize the windows that are maximized
along only one dimension by dragging them.
Unfortunately, tiling stuff still suffers from the same issue. In order
to fix it, Window::tile() has to be part of double buffered state, like
Window::maximizeMode().
BUG: 449105
BUG: 459218
CCBUG: 482085
This provides the grab point that controls the interactive move resize
operation. It can be used outside Window::handleInteractiveMoveResize()
to position XdgToplevelWindow when a configure event is acked.
Window::interactiveMoveOffset() stores the move offset in pixels, but it
is somewhat annoying to deal with when the window size changes, for example
when the window is unmaximized.
This change makes Window::interactiveMoveOffset() store a ratio where
the move offset can be found. This simplifies the code a bit and fixes
the cursor jumping to the topleft window corner. Although there are other
glitches.
CCBUG: 449105
Instead of not-delaying cursor updates with adaptive sync, this forces a
software cursor instead. That way, the functionality works the same on all
the vendors.
For testing potential driver fixes, the environment variable
KWIN_DRM_DONT_FORCE_AMD_SW_CURSOR=1 can be used to disable this workaround
Previously m_keysym was only updated on key press. This caused issues
when multiple keys are pressed at the same time. E.g., if the user
presses A, presses B, releases A, releases B, the actual events sent by
kwin was A pressed; B pressed; B released; B released.
Also call xkb_state_update_key after xkb_state_key_get_one_sym, as
recommended by the libxkbcommon documentation
XKB_KEY_KP_9 is 0xffb9 while XKB_KEY_KP_Equal is 0xffbd and XKB_KEY_F1
is 0xffbe. So XKB_KEY_KP_Equal, instead of XKB_KEY_KP_9, has the maximum
keysym for keypad keys.
Seat has to handle two types of drags; ones where clients are updated
through data device, and xwayland version where the drag target has
mouse events sents as pointer events. A mechanism to treat them
differently was introduced, but this former xwayland hack was not
included. We also don't need to send frame events when in datadevice
mode.
This reset of pointer state breaks electron.
The compositor doesn't need to synchronize with the client when moving
windows, except cases like unmaximizing the window. It's needed only
when resizing to avoid overwhelming the client with configure notify events.
The accessibility kcm can be used to enable/disable the shake cursor
plugin and change its other parameters, so hide it in the desktop
effects kcm by default.
Adds whitespace between documented members of the header file.
Currently the members are all bunched together, making it difficult to
read as one flows directly into the next. This change adds a newline
between each member, making it easier to read.
Allow the creation of screen edges bordering two screens. This allows
panels in auto-hide/dodge-windows mode to work when the panel is
positioned between two edges.
Don't change the X11 behavior since edge barrier is not supported on
X11, without which it is virtually impossible to exactly position the
cursor on the pixel to activate the edge.
BUG: 351175
Allow users to configure a virtual edge barrier between screens.
The pointer will only cross over to the other screen after the distance
travelled surpasses edgeBarrier.
Reduce the speed during interactive moveresize, at edges that trigger,
and at the corner.
Only supports wayland. Doesn't have X11 support since it is far too
complicated there.
BUG: 416570
BUG: 451744
A target mobile DPI of 135 is rather low and results in excessively
large scale factors, so everything is too big.. Let's raise it a
little bit to improve the default level of information density on
these devices that are designed to be held close to the face.
This has the effect of changing the calculated default scale factor for
the following devices:
| Device | Device DPI | Old scale factor | New scale factor |
| ---------- | ---------- | ---------------- | ---------------- |
| Steam Deck | 204 | 1.5 | 1.25 |
| PinePhone | 268 | 2.0 | 1.75 |
| OnePlus | 388 | 3.0 | 2.5 |
Devices are taken from the autotest data found at
https://invent.kde.org/plasma/kscreen/-/blob/master/tests/kded/configs/AutogeneratedMobileScreenScales.json
The autohidden panels "blink" because this effect animates their opacity.
The dock windows are animated because, as the comment says, the old effect
animated almost every window.
Conceptually, animating docks doesn't align with the purpose of this effect.
Wayland has a design philosophy of prohibiting keyloggers, which is
sane. However X11 did not, and a lot of X11 apps were developed with the
expectation of being able to sniff keyboard events to handle global
shortcuts. When such apps are run in a Wayland session under XWayland,
these features break.
Historically we have prohibited this in the name of security. In Plasma
5.27, we gave users a KCM they can use to choose their preferred balance
of security and unbreaking XWayland apps with global shortcuts. But we
still defaulted to total 100% security, at the expense of breaking these
apps by default.
However today we have a compromise that unbreaks them 99% of the time
while not meaningfully reducing security: we can have KWin only prohibit
XWayland apps from reading alphanumeric key events that don't have a
modifier key pressed at the same time. This still prevents those apps
from acting as keyloggers and reading your password or all the text you
type, but does allow those apps that have a legitimate need to read key
events for global shortcuts do so, because global shortcuts will involve
modifier keys being held down.
Due to the way the security modes work, making this change will also
allow XWayland apps to read non-alphanumeric keystrokes without any
modifiers being held down, but that's also fine for security since you
can't use any of those keys to type text or passwords.
NET::OnAllDesktops is a special desktop number (-1), desktopForX11Id will not return a desktop for it
When all desktops are requested pass an empty desktop list, the following code will handle it appropriately
BUG: 482670
We need to re-arrange layer shell surfaces, compute new struts and adjust
the windows in a single step.
Workspace::updateClientArea() is the best candidate for that, so this change
repurposes that function from computing work areas to a generic relayouting
function.
CCBUG: 482361
When the output layout changes, the Workspace is going to update the
struts and then go through every window and see whether it should be
moved or resized.
On the other hand, the layer shell windows react to output changes on
a timer. Furthermore, it's not synchronized with the workspace rearranging
the managed windows. It means that when Workspace::desktopResized() runs,
the panel struts can be slightly outdated, i.e.
- An output layout change occurs
- Workspace::desktopResized() is called but the struts can be wrong
- some time later, LayerShellV1Integration::rearrange is called, it
fixes layer shell window geometries and struts
- after the layer shell integration has finished rearranging the
layer shell windows, it calls Workspace::desktopResized(), but the
damage had already been caused
With the proposed change, the Workspace and the LayerShellV1Integration
will rearrange the windows in sync.
CCBUG: 482361
The behavior between direct scanout and normal presentation being different is an
implementation detail of DrmPipeline, the output layers shouldn't need to care
Multi monitor setups with 4K screens are not uncommon and one of the
annoyances associated with such setups is that you lose the track
of the cursor sometimes. It's natural to shake the cursor in such
occasions.
This change enables the shake cursor effect to improve the desktop
experience. One potential risk associated with doing so is that the cursor
can be magnified in some undesired situations. It is true. But we took a
great precaution of that and added some heuristics to avoid triggering the
effect in such cases given all the data we have available.
Only store one history item for movement in the same direction.
With this optimization I measure m_history.size() <= 15 for all kinds of
movements, including back and forth, and circular.
The current behavior is that the cursor size follows how hard or fast
the cursor is shaken. While this looks fancy, given the purpose of this
plugin, it should be possible to magnify the cursor as easy as possible
without interfering or false triggering.
This change implements a sort of a compromise. When the cursor is shaken
for the first time, the cursor is magnified by some certain scale factor.
Then every next shake magnifies the cursor further by a smaller amount.
When using fractional scaling, an xwayland window's client geometry can
have some fractional part. When that's the case, .toRect() can shrink the
client geometry or extruding the decoration borders inside the surface.
On the other hand, the pointer is going to be confined as long as the
wl_surface is focused. If the focus jumps to the decoration, the pointer
constraint is going to be broken. Unfortunately, the focus can shift to
the decoration even though the wl_surface is still focused because of the
pesky .toRect().
BUG: 482448
CCBUG: 477124
When GPUs are barely loaded, render times can spike randomly, likely because it goes
to a lower power state and has to ramp up again when KWin renders. To ensure this
doesn't make KWin drop frames, assume rendering always takes at least 2 milliseconds
Due to some misinterpretation of mode timings, the old method calculated vsync, not vblank,
so the resulting duration was much shorter, which caused frame drops on some systems.
BUG: 482064
When a key is pressed the string that should be used in the key event
changes depending on the xkb updated state for composed keys.
The key itself should be not be affected.
In the codepath to keep xwayland notified of key presses we have to
check the focussed window is not already an xwayland client. To avoid a
null dereference a guard is added that the focussed window is not null,
however the current code incorrectly returns early intead of skipping
just the relevant check.
BUG: 478705
```
/var/tmp/portage/kde-plasma/kwin-6.0.49.9999/work/kwin-6.0.49.9999/src/input_event.h:21:7: error: type ‘struct MouseEvent’ violates the C++ One Definition Rule [-Werror=odr]
21 | class MouseEvent : public QMouseEvent
| ^
/var/tmp/portage/kde-plasma/kwin-6.0.49.9999/work/kwin-6.0.49.9999/src/plugins/mouseclick/mouseclick.h:27:7: note: a type with different bases is defined in another translation unit
27 | class MouseEvent
| ^
lto1: some warnings being treated as errors
```
Bug: https://bugs.gentoo.org/921558
Signed-off-by: Sam James <sam@gentoo.org>
This is to help to fix maximized xwayland windows not covering the whole
work area. Size hints are obeyed only when restoring the window.
According to the net wm spec, the window manager should not obey size
hints when maximizing a window and some other window managers already ignore
them when maximizing windows.
CCBUG: 459373
Currently desktop grid view is missing the selection rectangle when hovered over a desktop.
This adds the selection rectangle on hover, since it used to be there before three-state design.
Currently selected desktop has thinner and different colored border.



BUG:481812
The end render timestamp can be slightly in the past before the start
render timestamp. This results in negative render times, which can make
kwin wait way more than just one vblank interval before starting the
next frame.
It appears that there is no way to detect if the gpu has performed a
disjoint operation in OpenGL. It's available only in GLES. As a way
around, this change makes the GLRenderTimeQuery insert two probes: one
queries gl timestamps when starting rendering and ending rendering;
another one just queries std::steady_clock before and after painting.
This hardens the GLRenderTimeQuery against OpenGL providing nonsensical
results sometimes.
BUG: 481721
We know that org.kde.breeze.desktop is invalid as LayoutName for the
tabbox, it will break the default button in the tabbox kcm.
Also the DesktopListLayout and DesktopLayout aren't valid anymore
BUG:481640
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>
It reduces the amount of manual OpenGL code, and it's better to use
ImageItem because that way the ItemRenderer will take care of snapping
to the pixel grid or colorspaces.
It reduces the amount of manual OpenGL code, and it's better to use
ImageItem because that way the ItemRenderer will take care of snapping
to the pixel grid or colorspaces.
It's needed to properly render transformed overlay items. Ideally, the
ItemRenderer would split items that can be rendered with and without the
scissor test on its own. But we are not there yet, so pass the
PAINT_SCREEN_TRANSFORMED flag to force the ItemRendererOpenGL to use
hardware clipping.
The environment variable is primarily meant as a workaround for displays
and drivers that misbehave when more than 8 bits per color is used. To simplify
the code, this commit makes the environment variable only control the bpc
used for displays, instead of also controlling which buffer formats get
used.
The InputPanelV1Window doesn't actually need popupOffset(). Its popup
positioning is not data driven like xdg-positioner. It will be simpler
and more readable to compute the desired popup geometry explicitly.
The main motivation behind this change is to make the glide effect stop
setting a custom projection matrix in order to assist with making the scene
2d only.
The brightness of the screen is read from the luminance tag, and through
the color management protocol(s) passed to apps, so that they can adjust
their content accordingly
If the client is slow, kwin can receive _NET_WM_MOVERESIZE requests
after user has released mouse buttons. Ideally, the window manager
should refuse starting an interactive move/resize operation in such a
case so it's still possible to finish moving or resizing the window
by releasing mouse buttons.
If somebody else claims the selection, it's unclear what we should do.
kwin can't give up its selection as it's the one who is responsible for
window management and compositing. If anything, Xwayland should ensure
that no client can claim WM_S0.
Apparently, libepoxy requires a current EGL display in order to resolve
EGL functions. This is unexpected as most of the EGL functions require no
current opengl context.
This change makes kwin bypass libepoxy for problematic cases.
BUG: 470980
Quick tile mode reset should be done in the interactive move handler,
where the new move offset is set. Only reset it on resize to unsnap
the window from the tile.
BUG: 472366
This addresses an issue where mpv window with keep aspect ratio enabled
cannot be fullscreened due to constrainClientSize() returning size that
doesn't fit full screen area.
NOTE: This has been tested with 3440x1440 display and 1920x1080 video in
mpv.
Strict geometry disables certain user activites; full screen requests
and only sending configure events at sizes the client claims to support.
This was added as a workaround for xterm in 19 years ago. It's a client
side bug as applications can still choose to ignore the configure event,
so kwin shouldn't have to sanitise them in advance. xterm seems to have
fixed it's bug, and pragmatically we know not all window managers
perform these checks so most clients should not be relying on it.
On Wayland this additional check is proving problematic, the handling of
scaling especially fractional scaling is hitting cases where it's better
to always ask the client to do what kwin wants.
Tests that refer to sizeIncrements are dropped as they are only used in
the strict geometry passes which is being obsoleted. Resizing in general
is still tested.
BUG: 481456
Previously a tile could intersect with the tile next to it when resizing tiles in tiles-editor.
This checks that the tile next to the resized one is not at minimum size already, and stops
resizing if it is.
Do note that any current setups that may get broken if there is tiles that intersect each other,
so they may have to remake the tile setup.
BUG: 465721
FIXED-IN: 6.0.1
The perspective projection matrix has its y axis flipped vertically. It
should be undone when applying the render target transformation, otherwise
the rotation order will be wrong.
BUG: 481664
Try to send the tablet input to the configured screen for the tablet if any,
otherwise always send it to the active screen, not the screen of the active window
which is very confusing
BUG:479713
Allows to notify systemd whether kwin is still running and possibly
restart the service if it stops responding.
Use Type=notify-reload to watch the kwin service. This will make it so
we receive SIGHUP rather than SIGTERM on the wrapper which we can handle
gracefully and stop the kwin process and restart as expected.
https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
The config may have HDR or WCG enabled, and the driver or display settings changed
since then to make it impossible to actually enable either.
The config values stay unchanged when this happens, so reconnecting the display with
HDR support will automatically turn it on again.
BUG: 481518
the behavior of converting negative floating-point numbers to unsigned
integers is undefined. It is necessary to keep the conversion behavior
consistent between ARM and x86 platforms.
through the above conversions, all become the two's complement of
negative numbers.
Signed-off-by: zorowk <near.kingzero@gmail.com>
wl_surface size is not used when re-arranging surfaces. It also results in
excessive configure events.
Note that it can be useful for updating strut rects, but we could use the
next geometry, which is even preferrable over the frame geometry as the
Workspace would use proper struts earlier.
Otherwise, Qt thinks the old context is still current and will do things like
destroying VAOs with KWin's context, which ends up destroying the VAO of the
context and breaks rendering.
BUG: 479094
While the primary plane delivers a high enough refresh rate for the cursor to be
at least usable, delay cursor updates to be in sync with the primary plane. This
avoids stutter of the content being shown on the primary plane.
Because amdgpu doesn't handle this correctly at the moment, this feature is guarded
behind the KWIN_DRM_DELAY_VRR_CURSOR_UPDATES environment variable.
See https://gitlab.freedesktop.org/drm/amd/-/issues/2186 for more details on that.
In almost all cases it's duplicated in the name, and if the user manually
changes the name, the custom name should be shown without additional numbers
CCBUG: 481576
The user may have no usecase for the grid view mode, i.e. they may want
to activate overview, do their thing, and then return back to normal
desktop. However, with the current behavior, there's one extra step
(switch to grid mode) in order to go back to desktop.
In hindsight, we should have added different screen edge actions for
overview and grid modes. This can be done in 6.1.
BUG: 481335
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
Zoom push tracking now considers the layout of the user's monitors, accounting for situations where the monitor layout doesn't form a perfect rectangle. These changes help prevent the zoom area from being unable to reach certain areas of the workspace depending on which edge of which screen the user pushes against.
One known issue is that, if the mouse moves too quickly, the zoom area can sometimes imperfectly track the movement. It will look the same as the original bug (areas of the screen will appear to be cut off/unreachable), but moving the mouse in the opposite direction a tiny bit snaps the zoom area back to where it should be.
BUG: 467182
@teams/qa Heads-up that I'm very blind, and this is the first time I've ever contributed to a KDE project. I've tested the changes on my system and they fix the bug, but I want to make sure I didn't break anything in the process.
DrmOutput::setDrmDpmsMode() already takes care of reverting any
pending output pipeline changes, but the aboutToTurnOff signal from
setDpmsMode() needs an explicit wakeUp signal to cancel it out.
BUG: 477916
CCBUG: 481520
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>
Geometry restores were only saved when maximize or fullscreen changed, which is
not the only time the geometry restores change. This adds a signal to Window for
that, which fixes a few bugs with windows being moved between screens while
maximized or fullscreened
kwin does not support true multiscreen drag and drops. Events are sent
to an offscreen location of the screen initiating the drag. Therefore it
is important that off-screen items do not process drop events
BUG: 481331
This check is old and I'm not sure why it even exists. It should not be
needed in general.
The problem with this check is that when interactive move/resize
operation finishes, the seat input transformation is not synchronized.
Replace old "closest" and "natural" layout algorithms with new layout
algorithm. The new layout algorithm tries to
- use screen space efficiently, given diverse geometries of windows
- be aesthetically pleasing
- and minimize movement of windows from initial positions.
More concretely, find a layered layout, where each layer, or strip, is a
row or column. Ensure that different strips have similar widths, and use
binary search to find a packing with similar aspect ratio to the layout
area. Within each strip, minimize horizontal movement (for rows) or
vertical movement (for columns) of windows.
Run time is O(n) (up to log factors), where n is the number of windows.
CCBUG: 453749
BUG: 450263
BUG: 477833
BUG: 478097
BUG: 477830
i915 doesn't implement the Colorspace property correctly, so exposing this
feature makes it look like our HDR implementation is broken. This hides the
HDR checkbox in system settings until Intel fixes their driver
For testing purposes, users can still opt into this with the environment
variable KWIN_DRM_ALLOW_INTEL_COLORSPACE.
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
The section header being now a QQC2.ItemDelegate needs to explicitly
set the width to be visible.
The ContextualHelpButton size was getting constrained by the parent
layout's being adjusted to just the label height.
OutputTransform::Normal is handled by doGrabTexture().
If the texture transform is neither normal nor flip-y, the GPU is going
to be used to transform the texture, however since it doesn't flip the y
axis, doGrabTexture() will flip the y axis on the cpu side. To fix that,
make the contents of backingTexture mirrored vertically.
Opaque is a QRegion in logical pixels, using .toRect will round to the
nearest integer in either direction. This can mean an area is considered
opaque outside the rendered area, leading to glitchy contents on
shadows.
This is most noticable on on X11 windows when fractional scaling is
used.
Long term I hope to move Item::opaque to QList<QRectF> and
WindowPrePaintData::opaque to device pixels.
QWindowSystemInterface goes via QGuiApplication which updates some
internal properties. Most notably QGuiApplication::lastCursorPosition
which is used by advanced menu closing behaviour.
BUG: 478061
otherScreenThumbnail is used to fake a window thumbnail being dragged
half in the old screen, half in the "new" one (or even more than two)
right now the condition to use it is purely the "real" thumbnail x
or y change, but sometimes especially when the item has just been created
and is being laid out it might trigger an itemDraggedOutOfScreen
when no-one was dragging.
We should never make otherScreenThumbnail visible when we aren't dragging
a thumbnail, so check for Drag being active in the source item.
the item will be kept visible even if drag becomes inactive as before,
as it still needs to be visible for the reset animation
BUG:480564
By default the translation domain of KQuickManagedConfigModule is the
unique identifier within the namespace of the plugin, but those i18n
strings belong to kwin.po.
Though there are 3 common CVD types, each individual can have different
color perception level, and the default intensity might not be suitable
for everyone, so add an intensity slider to select how much the filter
affects the display.
Modifiers for global shortcuts are handled differently from normal shortcuts,
because they need to consider modifiers that are consumed by xkb for keyboard
layout transitions and similar. This restriction is not relevant for custom
tiling.
BUG: 465858
SeatInterface currently has a separation of kwin's focus scope to
pointer input with early return guards in notifyPointerEnter and
notifyPointerLeave where clients don't get pointer events.
However we don't update the initial state when a drag is started, this
patch notifies sends a pointer leave to the new drag target before the
data_device enter so things are consistent.
This also brings it in line with Weston and Mutter.
notifyPointerLeave has it's early return removed as for wayland windows
as we know nothing will have pointer focus.
Instantiators create objects when they're added to a model, and
deference when when they're removed from the model.
When we explicitly set a parent in onObjectAdded we're creating a second
reference. This does get cleaned up later, but not in the same frame.
This brings us in line to what QQmlRepeater (which works with items)
does internally for items being added and removed.
BUG: 478777
Reducing approachGeometry is not needed.
During edge creation, createHorizontalEdge and createVerticalEdge
already substract the needed cornerOffset, and edges reserved by client
windows shouldn't be reduced in geometry.
In addition, during display, ScreenEdgeEffect confines the painted area
to approachGeometry. So approachGeometry shouldn't be reduced in
advance.
BUG: 481282
The original assumption was that once PointerInputRedirection starts
pushing cursor sources to cursors, they cannot be null. In many cases,
it is true, but the tests are a bit special as many of them lack
wl_pointer.set_cursor requests, so it's possible to set a null source.
As an example, when the pointer moves from the decoration to the
surface. On the other hand, it also does make sense to allow having
no source connected.
While tabbox switching is usually a keyboard operation, we offer also
a mouse-friendly way to launch it via screen edges, and should allow
to switch directly on mouse click.
BUG: 481267
FIXED-IN: 6.0
The blur geometry is scaled in the global coordinate space, while it
works fine with integer scale factors, it's not okay with fractional
scale factors as it doesn't match how the ItemRenderer snaps quads to
the pixel grid.
Note that blur behind apps can be still off by one pixel, but it
should be harder to notice it. In order to fix it, it would be great
to apply effects behind Items, which is on my todo list.
Window::layoutDecorationRects() uses KDecoration2::Decoration::rect() to
get the bounding decoration rect.
While Decoration::rect() should normally match Window::rect(), they can
diverge for a brief moment during async geometry updates. The worst
possible case is that the cached item quads may not be invalidated when
the geometry updates saddle.
To fix that, make DecorationItem monitor decorated client size changes
instead of window frame geometry changes. The reason for that is that
Decoration::size() is effectively decorated client size with added border
margins.
Wine/Wayland hides the cursor as follows:
[ 853107.473] -> wl_pointer@15.set_cursor(172832, wl_surface@38, 0, 0)
...
[ 858989.757] -> wl_surface@38.destroy()
[ 858989.759] -> wl_pointer@15.set_cursor(172832, nil, 0, 0)
i.e. it destroys the cursor surface, then calls wl_pointer.set_cursor().
SurfaceCursorSource stores the wl_surface in a QPointer, furthermore it
is going to emit the changed signal, which is needed to force the
CursorItem to update its content, only if either a new hotspot or a
surface has been passed to SurfaceCursorSource::update(). So what happens
is the following:
- The SurfaceInterface object is destroyed and the QPointer resets its
value to nullptr
- SurfaceCursorSource::update(nullptr, QPointF(0, 0)) gets called in
response to wl_pointer@15.set_cursor(nil, 0, 0)
- but since m_surface has been implicitly reset to nullptr, no changed
signal is going to be emitted
This change addresses the issue by making the SurfaceCursorSource track
the SurfaceInterface's destroyed signal.
BUG: 480582
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
Window::checkWorkspacePosition() before the window is mapped is still
problematic and should be avoided as it can produce undesired constrained
client size (1x1).
Given that XdgToplevelWindow tries to maintain the same frame geometry
size, it should be enough to schedule another configure event instead.
It is going to be in line with the other decoration logic in the
XdgToplevelWindow and it's a better way to handle async geometry updates.
BUG: 480910
These shortcuts make more sense to be used with Meta+Tab and Meta+Shift+Tab.
Let's keep them reserved for the task switcher. Cycling between overview
modes is not something that requires Meta+Tab to be assigned to it by default.
There are a few issues:
- it's incompatible with Version 6 format
- activity shortcuts cannot be changed in kwin
- overview shortcuts don't need to be touched
BUG: 480758
glGetQuery can fail (for example because of a context loss) in this
case the buffer stays unmodified. In this case this is zero resulting
in GLRenderTimeQuery::result() returning a negative value. Down the
line this leads to a negative duration in the RenderJournal and
RenderLoopPrivate::scheduleRepaint starting a timer with an amount
of milliseconds bigger than what an int can hold. This will not
actually start a timer but QTimer::isActive returns true resulting
in no futher repaints being scheduled.
BUG: 475605
FIXED-IN: 6.0
when in overview mode, don't scale down WindowHeap, as this
will cause ugly glitches, but resize it down instead.
Still use transforms when it goes in desktop grid mode, at least for now
probably future further refactor can still help things
Before:

After:

CCBUG:475682
The y axis should be mirrored as the last step, otherwise it's going to
change the winding order in rotation transforms in the render target
transform.
BUG: 479934
There is a mix of cursor shape names from the CSS W3C specification and
non-spec ones, which is confusing when deciding what cursor shapes need
aliases in Cursor::cursorAlternativeNames().
m_dmabufParams is initialised after a format with modifiers is
suggested. Should the negotiation process fallback to SHM buffers, we
should reset it, so it can be used to determine if the negotiated format
is of type DmaBuf or not.
This reverts commit b31baaf0cd.
It's still a good idea to show the task switcher even if there's only
one window in order to provide the user feedback about their action.
Since the task switcher is not shown when there's only one window, it
can be confusing and lead to thinking that the task switcher is broken.
It also fixes a regression which prevents alt-tabbing to the only
remaining minimized window.
BUG: 480940
CCBUG: 419408
While this should really never happen in the first place, if the kernel still accepts
atomic commits, this is better than the screen(s) freezing and never recovering.
BUG: 480895
Instead of calling glFinish, which blocks until it's done and has high CPU
usage on NVidia, use EGL_ANDROID_native_fence_fd to get an explicit sync
fd, which the commit thread automatically waits on before committing the
buffer to KMS.
CCBUG: 452219
In the late Plasma 5 times we agreed that it would be better to drop
"active mouse screen" option and stick with last interacted screen
approach instead. However, it was forgotten and nobody has pursued this
goal, so let's hide the option in the system settings ui at least.
The option is not completely removed because some parts of kwin would
need adjustments.
The new scale value is written but it's not flushed to the disk so
when kcm_fonts_init and kcm_style_init run, they use the old scale
value.
CCBUG: 480792
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.
Imagine the following case:
- the window is hidden, slideOut() is called but no deleted reference is
created because the window is not deleted
- the window is closed, slideOut() won't be called because the window is
hidden and SlidingPopupsEffect::slotWindowClosed() ignores closed windows
that are already hidden
- the window is deleted in meanwhile
- the sliding popups effects attempt to delete m_animations[w] entry,
but since "w" is a dangling pointer at this point, visibleRef is going
to access released memory
To fix that, make slideOut() always ref the window.
When a QPromise reports results, it's not necessary that the
QFutureWatcher is going to report it immediately. That can happen at
some point in the future, which is okay according to the QFuture api
contract.
Due to that, we cannot assume that the stored Output and EffectWindow
objects pointers are valid when the QFutureWatcher::finished is emitted.
kwin_wayland has become unstable. Sometimes it works fine, sometimes it
is randomly killed. Things are quite bad after kwin_wayland --replace.
This reverts commit 71ade59f4b.
It makes code more intuitive, updating X11 specific stuff should not be
needed to update the grid layout. Another advantage that this change
brings is that it should be possible to decouple X11 bits from the
virtual desktop manager completely, might be useful for running multiple
xwayland instances.
The documentation of NETRootInfo::activate() says that it should be
called after creating the NETRootInfo object to read properties.
However, it's called in two places: VirtualDesktopManager::setRows()
and Workspace::initializeX11(). At quick glance, there's no justifying
reason to call activate() in setRows(), it doesn't fit the purpose
of setRows().
This change re-arranges NETRootInfo initialization code so it makes
more sense.
Allows to notify systemd whether kwin is still running and possibly
restart the service if it stops responding.
Use Type=notify-reload to watch the kwin service. This will make it so
we receive SIGHUP rather than SIGTERM on the wrapper which we can handle
gracefully and stop the kwin process and restart as expected.
https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
The current implementation of the `<N>` suffix is still buggy and its
benefits are doubtful. One could argue that visual aids such as window
thumbnails or highlighting the windows are better. On its own, these
numbers don't have strong connections to the windows and can change on
a whim.
This way no extra buffer space is going to be wasted for a decoration
that isn't there, and it might be nicer for fractional scaling as kwin
won't need to deal with border size voodoo cases.
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.
With how Xwayland scaling works, KWin assumes the window already uses the
new coordinate system - but that doesn't happen until Xwayland and the client
know about the new size as well.
BUG: 480642
The failure might be from the commit reordering going wrong in some way.
The total accumulated state might still work even if an individual commit
does not though, so before considering the whole frame lost, merge all the
commits and try again
This was just done because of the wrong assumption that displays needed that
to show the full native gamut. That turned out to be an amdgpu bug though; with
that fixed, most of the 0-100% range is wildly oversaturated.
To make the slider more intuitive, this changes the sdr gamut wideness to instead
interpolate to the native display primaries as indicated by the EDID.
The screencast plugin doesn't take into account the hidden status of
the cursor, which results in the cursor being visible when screencasting
even though it's hidden.
At the moment, the desktop layout in _NET_DESKTOP_LAYOUT overwrites new
desktop layout with outdated information. This happens because kwin tries
to honor the desktop layout set by the pager. However, kwin itself
already acts as the pager. The pager applet in plasma doesn't attempt to
maintain _NET_DESKTOP_LAYOUT with proper values.
On the other hand, kwin trying to both update and also sync its state to
_NET_DESKTOP_LAYOUT and _NET_DESKTOP_NAMES has created a series of
issues, like lockups or rendering glitches.
Given that the window manager can ignore these properties, and the fact
that kwin already does act like a pager, this patch makes kwin ignore
external updates to _NET_DESKTOP_LAYOUT and _NET_DESKTOP_NAMES.
In order to modify the desktop layout on X11, use the dbus api. On
Wayland, either the dbus api or the virtual desktop wayland protocol.
BUG: 422319
BUG: 480371
Support is hidden by an environment variable to prevent accidental standardization
on this experimental version. It allows app devs to already implement and
test it though, and easily switch to the proper protocol later
A window is added to the workspace when it's mapped. It's assumed that
the first Window::windowShown signal indicates that. But it's not
entirely true. For example, if setHidden(false); setHidden(true); are
called in succession, the window will be marked as ready for painting
even though it isn't.
The Window::readyForPaintingChanged() signal fixes that. It's emitted
when the window is actually mapped.
At the moment, if the workspace extends or shrinks by an output, the
hidden panel will be shown. It doesn't make sense in all cases.
Furthermore, no screen edge will be reserved if the layer surface has
some margins.
To address that, allow "floating" panels reserve screen edges and also
make kwin try harder to preserve window edges if the output layout
changes.
CCBUG: 448420
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.
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.
By default the focus item in a tabbox is always the main item, so if the
main item is not a focus scope, the inner item will not get focused.
BUG: 477286
FIXED-IN: 6.0
This can be used to disambiguate the exclusive edge when the anchors are
on a corner (so there would be 2 candidates)
it's quite quick and dirty mostly to understand if we do want to push for
something along the lines (it should at least do a protocol error when
the requested edge is not within the anchors)
If the active window is on a different output than the one the renderloop is for,
the scheduling logic would otherwise never schedule a repaint while adaptive sync
is active.
BUG: 480252
It's universally supported, and our format negotiation code needs improvements to
properly handle the receiving application not suporting the actual output format
`QRegion::operator|=` has some optimizations but it basically boils
down to
QRegion result(*this);
result.detach(); // it will make a copy because this is shared
result.d->append(rect);
return result;
On the other hand, `QRegion::operator+=` tries to add the new rect
in-place.
Currently, if only blur behind decoration is enabled, no m_windows entry
is going to be created and so the blur effect won't blur the background.
BUG: 479893
Currently the window rule is not 100% effective because the "take focus"
message is not guarded. So depending on the input model of the X11
window, kwin can still activate a window even if it has a window rule
to force no focus.
workspace()->setShouldGetFocus() should be guarded too to help the focus
stealing prevention logic.
Technically though, forcing XSetInputFocus() or WM_TAKE_FOCUS if the
client doesn't advertise supporting them is finiky. But on the other
hand, the window rules are an advanced feature, so its assumed that the
user knows what they do.
The output goes through the following stages when it changes its dpms
mode:
- Output::aboutToTurnOff()]
- some time later, Output::dpmsModeChanged() to indicate that it's off
- Output::dpmsModeChanged() to indicate that it's back on
- Output::wakeUp()
The Output::dpmsModeChanged() signals in the middle are optional. They
may not be emitted after Output::aboutToTurnOff() if the user quickly
cancels the dpms mode transition.
The Workspace should monitor the Output::wakeUp() signal instead.
Alternatively, create the dpms input event filter only after the dpms
mode has changed. While the screen won't be turned back on immediately,
it's still going to produce acceptable visuals. Either solution is fine.
This patch makes the Workspace monitor the wakeUp signal because it
takes fewer lines of code.
BUG: 479659
The compiler prints the following warning at the moment:
wl-socket.c:143:9: note: ‘snprintf’ output between 10 and 20 bytes into a destination of size 16
When edid parsing fails, KWin will base output settings on the connector, which
isn't great on its own, but at least works in many cases. When the edid can be
parsed later though, the display settings will reset because now the edid identifier
is used to exclude the old config (in which the latter is missing).
To work around that, this commit adds output identification based on the edid hash,
which is also not ideal, but can be safely matched with in case no output config
with a matching edid identifier exists.
This optimizes out an unnecessary atomic test - instead of testing the new state and
then attempting to present with that new state, this just directly tries to present the
full state. If that commit fails, the backend just tries again with the safer presentation
mode.
Replace the hardcoded thumbnails which have a low resolution for
current screen standards (~300x200), with higher resolution ones
(~1200x800).
Also set the new 6.0 wallpaper as the fallback desktop thumbnail
BUG: 446765
FIXED-IN: 5.93.0
Allow rebinding buttons to send modifier keys (Control, Alt, Meta,
Shift) without any other key.
This is part of restoring the functionality kcm-wacomtablet had under
X11 for wayland.
CCBUG: 461259
Instead of giving the rolling average for render times a special case for
when render time suddenly increases, detect how stable render times are.
If they're volatile and increase a lot, increase the predicated render time
beyond the spike, as more render time spikes are likely to follow.
CCBUG: 477959
vec3() will complain if the vector is not fully initialized. Also if the
type of these variables is changed to vec4 and some miss alpha values,
the glsl compiler will complain again.
This functionally fixes
* duplication of output configuration in ~/.config/kwinoutputconfig.json
* _wrong_ ouput configuration - in particular the scale - being restored (i.e. scale would never be restored)
The textureToTransformMatrix should be applied first, otherwise the scale
transform is going to change the winding order of rotations.
In practice though, it shouldn't matter because these matrices are used
to downscale or upscale uv coordinates.
The redshift table is in gamma 2.2 encoding and not linear, which means
that it only yields correct results with 1.0 pixel values. It also means
that when it's being applied in linear space in the color management shaders,
the result is quite wrong.
To fix that, this commit makes the channel factors linear and the backend
calculates the nonlinear factors where needed.
If the cursor is magnificated and it's slightly moved so the shake
detector returns std::nullopt, the cursor scale will be set back to 1.0
as soon as possible. This is not ideal. Immediately resetting doesn't
help with locating the cursor.
Also the cursor scale reset delay has been increased to two seconds to
provide more time to see the cursor.
First, the texture-to-buffer transform has to be applied, then the y
axis should be flipped. Doing it vice versa changes the winding order
of rotation transforms.
Also the screenshot plugin uses incorrect render transform. Since
convertFromGLImage() undoes the render target's transform, the color
space transformation pass should use the same transform, not the
inverted one.
BUG: 479934
The protocol doesn't have a definition of what it means, but damage is a
flawed interpretation. Color management changes are arguably content updates,
so are viewporter changes, so are blur changes and so on.
Also see https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/36
for an upstream discussion of this
Practically all code assumes that the window type is static and fixing
it would bring extra complexity, which may not be worth given that there
are window rules to control position, focus, layer, etc.
BUG: 466016
The new window rule allows to overwrite the stack layer. It can be
useful on wayland to force picture-in-picture surfaces (which are
xdg-toplevels at the moment) to be placed above fullscreen windows.
Keep above flag is unsuitable because fullscreen windows are placed
higher "above" windows.
CCBUG: 466016
With fractional geometries, we can only guarantee that
nextMoveResizeGeom eventually is within one unit of
currentMoveResizeGeom.
BUG: 479786
FIXED-IN: 6.0
Currently there is a 150ms delay before screen edge actions and
hotcorners are triggered; the cursor has to spend that much time there
before they'll activate. This is good for preventing accidental
activations, but also prevents and delays deliberate activations, which
are likely to be more annoying for the user.
To alleviate this, the delay is reduced to 75ms, which still prevents
most of the accidental activations in my testing, while making
deliberate activations faster and easier.
If a commit is applied during vblank, the kernel delays it to the next vblank,
for X11 reasons. To ensure that doesn't happen with KWin, read how long
vblank is for the current mode and adjust the safety margin accordingly.
CCBUG: 477959
Loading pipewire is noticably slow with libpipewire loading a bunch of
internals.
Change from a singleton pattern to being managed by the
ScreencastManager
This is still unloaded if the plugin is explicitly stopped.
It can be handy if kwin runs on a setup not capable of HDR or without an
ICC profile. The output management protocol has not been touched because
the long term goal is to have color management enabled by default. This
is rather for testing purposes.
If the user wants to move a tiled window but changes their mind and tiles the window back to the previous
position, quickTileGeometryRestore() will return an error value beacause m_electricMaximizing is true and
the m_electricGeometryRestore is the same as the geometry of the window in the last tiled mode.
Now the geometry restore of the tiled window is true when starting interactive move, so we no longer need
to precompute it.
Changes for testQuickTilingPointerMove:
We need to attach a new image after the tiling window, so that updateElectricGeometryRestore can obtain
the same framegeometry as the framegeometry obtained during actual runtime.
Now testQuickTilingPointerMove can detect the error:If the user wants to move a tiled window but changes
their mind and tiles the window back to the previous position, quickTileGeometryRestore() will return an
error value beacause m_electricMaximizing is true and the m_electricGeometryRestore is the same as the
geometry of the window in the last tiled mode.
Signed-off-by: Jie Liu <liujie01@kylinos.cn>
As a side effect, this ensures that when alpha is zero, rgb is zero as well.
This is needed because the ICC profile may contain transformations where zero
brightness gets mapped to a non-zero value.
BUG: 479380
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
This is required by the KWin target, but was missing a find_dependency
call. If any downstream project tried to link to the KWin::kwin target,
it would fail because epoxy couldn't be found.
When we start renegotiation the stream is pasused. This is not restarted
when the format has been renegotiated.
This occurred when a streaming window was resized
Outputs present frames at different pace, some can present new content
later, some sooner. If the scene gets a slightly older presentation
timestamp, it's okay.
XdgToplevelWindow doesn't call finishWindowRules(). It creates a problem
for Workspace::removeWindow() because it calls setShortcut() to release
the window shortcut.
While one way to fix the bug would be to add a finishWindowRules() call
in XdgToplevelWindow, it would perhaps be not the best one because it
would change the appearance of decoration when the window is closed.
Instead, this change makes the workspace release the shortcut when the
window is closed. It has a couple of advantages: the appearance of the
decoration won't change, shortcut cleanup is better encapsulated.
BUG: 478647
It reduces the chances of false triggering the plugin, for example if
the user presses a mouse button and chaotically moves the pointer
because they navigate in 3D space and what not.
Flip y axis before and after applying renderTarget.transform to undo
ortho() flipping the y axis. Otherwise the cursor is invisible on
rotated screen.
BUG: 479764
FIXED-IN: 6.0
Currently when input panel is using overlay mode and the cursor rectangle
is below or above the screen area, the input panel may be placed off the
screen. The change ensure it is always placed within the screen area
using similar math like xdg_popup's slide_y constrain.
Remove code that duplicates functionality of KCModule.
Previously the various config items were not fully ported to using
KCModule methods, and kept custom versions of isSaveNeeded and
isDefault. When called from KWinOptions::updateUnmanagedState, these
methods incorrectly reports that there are still changes to be saved.
This patch set ports all configs in window behavior to methods provided
by KCModule, solving the problem.
BUG: 477940
The window switcher previews don't use the actual quick components
the KWin plugin provides, but mock-up objects of those.
Add a mock-up component for `KWin.DesktopBackground`, which is just
a thumbnail of the desktop default image but stretched to cover the
whole parent size.
This fixes the previews for flip&cover window switchers.
BUG: 479552
FIXED-IN: 5.93.0
The sRGB global colordescription uses gamma 2.2, so this function also has to do
it, or the shader will end up doing a colorspace conversion where there shouldn't
be one.
This also meams that HDR content will be wrongly encoded, but fixing that while
also dealing with sRGB content correctly requires a lot more invasive changes, in
KWin and in the screenshot and screencast APIs.
BUG: 478967
On X11 we would dismiss the tabbox preview when clicking outside
of the switcher. This doesn't work on Wayland because the popup
cannot globally grab the mouse and doesn't get notified.
Use `QEvent::FocusOut` instead which works on both platforms.
We also get rid of a warning message.
BUG: 374971
FIXED-IN: 5.93.0
When the software cursor leaves an output, its RenderLayer is marked
as invisible and the area corresponding to the layer is scheduled to
be repainted in the output layer. However, the composite function only
checks whether the root RenderLayer needs a repaint, not the output
layer too.
BUG: 479668
Accidentally pressing any shortcut shouldn't take down the whole session.
If KWin isn't reponsive but can still process shortcuts for some reason,
you can still switch to a different virtual terminal to explicitly kill
it from there
As we translate DRM_FORMAT_MOD_LINEAR to implicit modifiers + linear flag, the
egl import path should still work without implicit modifiers too.
BUG: 478921
gedit changes its caption from "Untitled document - gedit" to "gedit"
when it closes. This schedules Window::evaluateWindowRules() to be
called when the window is already marked as deleted. kwin then crashes.
In order to prevent that, a direct connection can be used instead. But
then the caption must be initialized extra carefully because if the
window rule changes the window type, "<N>" can be lost.
Its main purpose is to reroute surface size updates through SurfaceItem
so it can invalidate quads cache. Not all SurfaceItems currently discard
them when needed. When proper item transform support lands,
setDestinationSize() could also change the surface scale instead.
The wayland spec is not quite clear about the transforms, but the buffer
transform indicates a transform from wl_surface to wl_buffer or compositor
global coordinate space to composited buffer.
On the other hand, SurfaceItem assumes that the order is vice versa.
The render transform is applied first, after that, the texture is
flipped implicitly by opengl.
So in order to undo these transforms, we need to flip the image
vertically first, then undo the render target transform.
`flip-y | rotate-N` transforms are equivalent to `flip-x | rotate-N`.
However, it is not intuitive to express transforms that flip the y axis
via flip-x transforms. This change adds convenience aliases to improve
code readability and keep code intuitive, which is going to be needed in
order to drop TextureTransforms flags.
Return the resulting value immediately than use moveLeft(),moveRight().
It makes no difference for QRectF, but it might be nicer for QRect which
would need to recompute the right and bottom coordinates twice.
I wanted to do this refactoring for a while but didn't do it due to the
lack of test coverage.
These can be useful in case a QRect needs to be mapped. One could
convert the QRect into a QRectF and then back to QRect, but given that
these conversion helpers are present in rendering hot paths, it would
be great to be more efficient and also potentially loosing precision
because of floating point arithmetic.
Instead of checking for fullscreen windows and deciding whether or not to schedule repaints
based on that, check if the active window is refreshing fast enough to be reasonable for vrr.
For automatic mode, vrr is also enabled with the active window instead of the direct scanout
candidate.
BUG: 478680
BUG: 477199
When returning back from direct scanout to compositing, the whole frame
has to be repainted because the most recent buffer in the EGL swapchain
contains outdated contents now.
This change works around it by purging the DamageJournal when scanning
out a buffer. However, a nicer solution would be to assign a unique
sequence number to every frame and use that to index the entries in the
DamageJournal. It's a nicer design. With such absolute frame numbers,
the DamageJournal could properly detect discontinueties.
Given the final release is in close proximity, this change doesn't go
after such a refactoring.
Most actions do not handle drag and drop properly yet (e.g. entering
the overview during drag and drop is just very broken), at least
allow "show desktop" and "application launcher".
This allows to easily drag a file onto the desktop by starting a drag,
nudging the "show desktop" screen edge and dropping it on the desktop.
Until night color is dealt with properly by adjusting the output whitepoint,
the channel factors have to be multiplied in with the color transformation
matrix manually
BUG: 413134
Most importantly, fall back to an assumption of 1000 nits peak brightness when the
max brightness is missing, instead of the sdr brightness, which causes more immediately
visible issues.
Ideally the user should configure this value in the display settings, but it's too
late to still do that for Plasma 6.0.
BUG: 478860
Ideally they should match. If kwin uses software renderer, qtquick should
too. If kwin uses OpenGL, then qtquick should a hardware accelerated
graphics api too.
Some components are incompatible between plasma5 and 6, and they need to
search in different categories in the store
Fixes Aurorae Decorations, Effects, Scripts, tabboxes
Item type is incredibly fragile as a way to determine what was dropped,
as proven by recent breakage. Instead, we can use `Drag.keys` to provide
metadata about what is being dragged/dropped.
The overview effect uses the type of the dragged object to determine
if a single window is dragged or the entires desktop.
Commit 0ff4f84a changed the type of mainBackground, but did not
update the code for matching the type.
BUG: 478746
FIXED-IN: 6.0
In default shortcuts, change +Shift+Backtab to +Shift+Tab.
Functionally the behavior doesn't change.
But Shift+Tab is better since it is
- easier to understand (not everyone knows what Backtab is)
- more consistent with other shortcuts containing Shift:
we use Alt+Shift+1, instead of Alt+Shift+!
- more consistent with how user defined shortcuts with Shift and Tab are
displayed and stored
BUG: 422713
FIXED-IN: 6.0
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
This 1. is more familiar terminology as on other platforms (Gnome, Android); 2. avoids confusion with a planned future day/night light/dark color scheme switcher.
They cause stutters and reduced frame rates on some Intel laptops because the
buffers don't become readable in time, so disable the checks until that's fixed
on the driver side. For debugging purposes, the environment variable
KWIN_DRM_DISABLE_BUFFER_READABILITY_CHECKS can be used to override the default
behavior.
BUG: 476860
this improves the out of the box behavior which has regressed a bit over
time. since we default to kcfg_ActiveMouseScreen=true the active screen
by default follows the pointer. during early startup we position the
pointer on a Placeholder output, this output does eventually get
replaced by the real output(s). because of the update logic we'd
re-position the pointer on the closest real output, but that isn't
necessarily the intended primary output.
e.g. consider an eDP + HDMI setup depending on the geometries involved
the cursor may end up on the HDMI screen by default rather than the eDP
resulting in plasma-welcome opening on the HDMI output.
to mitigate this problem we now track whether the last output was a
placeholder and if so we instead try to position the pointer on the
current primary output
The indirection no longer required because libkwineffects has been
merged with libkwin. EffectWindow will be eventually dropped in favor
of apis provided by Window and WindowItem.
The rationale behind the check was sandboxed apps could have a different
mount namespace to kwin, therefore lying about the executable path was
doable.
Moving forward anything sandboxed will have a security context app Id.
Anything not sandboxed can circumvent these checks anyway.
This significantly improves application launch time.
The security context appId is set by the launching container (i.e
flatpak) and is therefore more trustworthy than any other source of
application ID.
Use this when looking up allowed wayland extensions.
This allows KWin to securely identify the client for a given connection,
without relying on the process name.
This patch does not do anything meaningful with the application ID other
than store it.
This first version does not support kwin restarts, it can come
afterwards.
Testing done:
With latest flatpak, running `WAYLAND_DEBUG=1 flatpak run org.telegram.desktop |& grep security`
shows that flatpak itself bound the security context, and the client did not see it advertised.
The configuration file may contain entries that have the same output identifiers if
there's a bug in the implementation. To repair the config, this commit checks for
duplicate entries in the output list and removes them when loading the config file.
OffscreenQuickView replaces the contents of the default scene. Nothing
will be repainted beneath it.
On the other hand, if the OffscreenQuickView contains translucent region,
there might be visual glitches. To prevent that, this change makes
scene effect views opaque.
We want some quick views to be opaque, for example SceneEffect views.
This changes adds an api allowing to specify whether the given
OffscreenQuickView must be opaque or translucent.
If another compositor changes the color encoding and color range properties, the
resulting colors will be wrong. This commit ensures they're always set to BT.709
limited range to prevent that
When a display gets turned off while a pageflip event was still pending, the pending
state gets changed immediately, without waiting for the pageflip event to arrive first.
When this happens, activePending() returns false, and so the pageflip event gets discarded.
This commit changes the logic to only check for activePending() when the pageflip is for a
modeset, avoiding that issue.
BUG: 476340
BUG: 476341
BUG: 476342
BUG: 437520
BUG: 475146
It's used as a float and otherwise it makes (some?) drivers very
confused as they're required to cast at runtime.
The original value is double so it makes sense to keep the same type.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
As KWin measures render times properly now, these settings and estimations
should no longer be necessary, so this commit replaces them with one hardcoded
algorithm that should prevent most dropped frames and reduce latency
2023-11-08 13:29:29 +00:00
2131 changed files with 147770 additions and 120957 deletions
@ -27,9 +27,9 @@ The Breeze decorations theme is not located in the KWin repository, and is in fa
### Tab Switcher
The default visual appearance of the tab switcher is not located in the KWin repository, and is in fact part of [Plasma Workspace](https://invent.kde.org/plasma/plasma-workspace), located at `lookandfeel/contents/windowswitcher`.
The default visual appearance of the tab switcher is located in `src/tabbox/switchers`.
Other window switchers usually shipped by default are located in [Plasma Addons](https://invent.kde.org/plasma/kdeplasma-addons), located in the `windowswitchers` directory.
Other window switchers usually shipped by default are located in [Plasma Addons](https://invent.kde.org/plasma/kdeplasma-addons), located in the `kwin/windowswitchers` directory.
### Window Management
@ -53,7 +53,7 @@ Other scripting stuff is located in `src/scripting`.
KWin's coding conventions are located [here](doc/coding-conventions.md).
QTest::newRow("single modifier plus key")<<QKeySequence(Qt::ControlModifier|Qt::Key_N)<<QList<quint32>{KEY_LEFTCTRL,KEY_N};
QTest::newRow("multiple modifiers plus key")<<QKeySequence(Qt::ControlModifier|Qt::MetaModifier|Qt::Key_Y)<<QList<quint32>{KEY_LEFTCTRL,KEY_LEFTMETA,KEY_Y};
QTest::addRow("left + left exclusive edge")<<int(Test::LayerSurfaceV1::anchor_left)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_left)<<QRectF(300,0,980,1024);
QTest::addRow("top + top exclusive edge")<<int(Test::LayerSurfaceV1::anchor_top)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_top)<<QRectF(0,300,1280,724);
QTest::addRow("right + right exclusive edge")<<int(Test::LayerSurfaceV1::anchor_right)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_right)<<QRectF(0,0,980,1024);
QTest::addRow("top | left + top exclusive edge")<<int(Test::LayerSurfaceV1::anchor_top|Test::LayerSurfaceV1::anchor_left)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_top)<<QRectF(0,300,1280,724);
QTest::addRow("top | left + left exclusive edge")<<int(Test::LayerSurfaceV1::anchor_top|Test::LayerSurfaceV1::anchor_left)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_left)<<QRectF(300,0,980,1024);
QTest::addRow("top | right + top exclusive edge")<<int(Test::LayerSurfaceV1::anchor_top|Test::LayerSurfaceV1::anchor_right)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_top)<<QRectF(0,300,1280,724);
QTest::addRow("top | right + right exclusive edge")<<int(Test::LayerSurfaceV1::anchor_top|Test::LayerSurfaceV1::anchor_right)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_right)<<QRectF(0,0,980,1024);
QTest::addRow("bottom | left + bottom exclusive edge")<<int(Test::LayerSurfaceV1::anchor_bottom|Test::LayerSurfaceV1::anchor_left)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_bottom)<<QRectF(0,0,1280,724);
QTest::addRow("bottom | left + left exclusive edge")<<int(Test::LayerSurfaceV1::anchor_bottom|Test::LayerSurfaceV1::anchor_left)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_left)<<QRectF(300,0,980,1024);
QTest::addRow("bottom | right + bottom exclusive edge")<<int(Test::LayerSurfaceV1::anchor_bottom|Test::LayerSurfaceV1::anchor_right)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_bottom)<<QRectF(0,0,1280,724);
QTest::addRow("bottom | right + right exclusive edge")<<int(Test::LayerSurfaceV1::anchor_bottom|Test::LayerSurfaceV1::anchor_right)<<QMargins(0,0,0,0)<<300<<int(Test::LayerSurfaceV1::anchor_right)<<QRectF(0,0,980,1024);