there is no practical reason I can see for why this should be limited to
stderr only. we are not reading or otherwise consuming stdout, we should
just pass it on.
Context: If a display is removed, the corresponding TileManager is removed with it. This in turn removes every one of its Tiles with it, and when a Tile's destructor is called, it attempts to find a new replacement tile for any windows it was previously managing.
However, if the Tile is removed because its corresponding TileManager has been removed, this has the potential to cause a segfault in KWin, causing it to crash (I suspect a possible race condition? but not sure).
This MR correctly evacuates custom tiled windows & migrates quick tiled windows upon output removal.
BUG: 465522
dmabuf buffers have the origin in the top left corner, so a texture with
attached dmabuf must have y inverted.
By correctly specifying the y inverted flag, we could leverage existing
infrastructure in kwin to handle vertically mirrored textures and make
simpler some projection matrix code in screencasting.
Even though the names seem to match, QtWayland maps button values
to enum values in ascendung order (as it does on X11). The wrong
mapping is usually not a problem because we send the native button
events to clients. However when the Qt names or values are used
for communication between KWin and a client this leads to
misunderstandings.
BUG:465463
FIXED-IN:5.27.1
This isn't necessary with atomic modesetting, as moving and setting are
the same thing. With legacy though, if the cursor was hidden, moving it
with the layer visible does not automatically show it again, so that needs
to be done explicitly
BUG: 461181
This has the benefit of providing a saner default for the values
of `opacityActive` and `opacityInactive` rule properties, both
in the UI and when reading the config.
The side effect is the same we have when changing default values:
if someone would have set a rule with some opacity to 0%, it will
be read as 100% next time kwin starts.
In this case it is a small price, as it is always easier to change
it back when the windows are visible that restoring it when they're
not, specially if it wasn't voluntary.
Once upon a time, in a moment of acute stupidity, I accidentally created a window rule making all windows completely transparent. I meant to go for 0% transparency when really the slider said 0% opacity. And once you've made the very window to change this setting invisible, the only way to fix that mistake is to log into a TTY or different DE and find the config file to edit manually. Since I've since seen several KRedditors fall into the same trap:
Show a warning when active or inactive opacity is set to ~~<= 15%~~ < 25%.
![warning](/uploads/0b1178bf5782bff3b4293a0031bb4fca/warning.png)
PointerInterface is a "Server-managed multicasting resource". As in we
have one QObject, managed by the server, but internally it represents
multiple resources from various clients.
We cannot control the lifespan of those resources, they may persist long
after we stop having these capabilities on the seat.
If we delete our pointer object when we stop advertising a pointer
capability we have race conditions with clients calling release, or
potentially even having a seat_get_pointer in flight.
It's easier and safer just to have PointerInterface last as long as the
Seat. If we don't have a mouse no-one should try to bind, and even if
they did or remained bound long after we stop having a mouse it won't do
any harm as there are no mouse events to broadcast.
QAbstractEventDispatcher blocks and waits constantly on every external event
processed; every timer or update from an X or wayland client, mouse
move or DRM event.
Right now every time this happens we go and check Xwayland for new
events, this is a system call (poll) that based on strace will
unsurprisingly immediately return with EAGAIN as there's nothing to read
from X. If there is something to read our socket notifier will fire. On block we do still need to read any events read in the meantime that weren't dispatched.
This cuts down our system calls significantly, which hopefully should have a
noticeable impact on performance especially when the kernel is under
load.
---
Found whilst analysing strace (by accident whilst looking for something else!)
In a simple case of xwayland nested running glxgears we go from 28 calls per frame to 21. With many many clients and more input events it'll be an even higher percentage.
The current state is inconsistent. Some window-specific signals are
exposed in the workspace, some not.
This change drops those signals. One should monitor the signals it's
interested in instead.
The blur effect is used to improve the contrast. The option was added
thinking "why not? it might be useful." This was perhaps a mistake and
it should have been added with a clear valid usecase in mind.
CCBUG: 457495
Leverage the standardized ShortcutSettings config object to handle
the shortcuts config for the tabox (setting default values, reading
and saving to KGlobalAccel, etc).
This way, we can remove the extra methods in TabBoxConfigForm and
improve separation between UI and logic.
It also fixes the actions getting stored untranslated when saving
from the KCM (until next restart of KWin)
Provide a new KConfigSkeleton (ShortcutSettings) so that the
KCModuleData knows if any of the shortcuts is non-default.
This improves the UX by showing an "orange dot" in system
settings when just a shorcut has been changed.
We also need to implement a new specific KConfigSkeletonItem
(`ShortcutItem`) that uses KGlobalAccel to retrieve and store
the shortcuts, instead of storing them in a config file.
This installs a socket notifier onto our xwayland socket, when a user
connects we launch xwayland. The client then connections once kwin has
established itself as the compositor.
For a full desktop plasma session this patch effectively does nothing
too useful as we still start kcminit and make xrdb calls on startup
which in turn will launch X, but for the same reason this patch should
be harmless now as we're still processing the xrdb calls before any
clients will connect.
By passing the config object to the TabBoxConfigurationForm, we
can handle it directly instead of bouncing information from and
back between the forms and the KCM main class.
Now the user changes in the UI translate to the config objects,
which can directly provide `isSaveNeeded()` and `isDefaults()` info.
This allows to simplify the logic on both classes, reducing the
coupling between them and minimizing the number of exposed public
methods and some boilerplate.
If the window has been originally on another output, make sure that the
window will be properly put back on it.
This logic seem to originate from 7d67380205,
but it's not necessary anymore because geometry restore will be updated
if the window is moved to another output by the user.
BUG: 465358
- Add the switchers to the model directly, instead of using
temporal lists and a second loop over them
- Use the same model for main and alternative forms
This makes this code a little more clear and efficient
When a window goes away it was stoppping translucencyWindowTypeAnimation
and translucencyInactiveAnimation but any translucencyMoveResizeAnimations
was hanging there forever, causing ghost windows
BUG:439332
If a window is made ready for painting with some delay, the item won't
schedule an update. To fix that, sync the item visibility state with
Window::readyForPainting(). When the item visibility changes, a repaint
will be scheduled.
BUG: 464955
Window::maximize() used to be split in two halves:
- generic Window::setMaximized() and Window::maximize()
- protocol-specific Window::changeMaximize()
Window::changeMaximize() used to block all geometry updates and
Window::maximize() emit "maximize mode changed" signals. With that,
frameGeometryChanged came always before clientMaximizedStateChanged.
After merging Window::changeMaximize() and Window::maximize(), the order
of the signals has been reversed because of RAII. Unblock geometry
updates explicitly to preserve the old behavior.
BUG: 465157
Imports come at a big cost when they're unused.
Also we shouldn't be importing WindowView from a different plugin. If
that effect is disabled it meant tileseditor would fail to load.
BUG: 464970
This affects direct scanout and when the window isn't triggering desktop
repaints otherwise, like being minimized or on a different virtual desktop
or activity
KDecoration.Decoration eats all the events for the sake of keeping
an illusion of buttons being like the real ones. I didn't find any sane
way to completely turn off event filtering on that level, so instead
let's fix this MouseArea, which is a workaround, but a decent one.
AFAIK this is the last KCM in Plasma to properly support "double-click
to save" behavior. There might be others though: watch out for event
filters inside thumbnail.
If the root tile node contains only one child node, but the child node
has its own children, kwin will fail to show an outline when the user
interactively tiles the window.
On the other hand, there is no reason to have this child count check.
For what it's worth, it also prevents tiling the window if the output
only has one tile, which is odd, but a valid usecase.
BUG: 464379
Normal event flow is from a client view is
-> wlr_data_control_device.set_selection
wlr_data_control_device.selection
or
wlr_data_control_source.cancelled
wlr_data_control_device.selection
However when the race mentioned in the comment happens the client
sees
-> wlr_data_control_device.set_selection
wlr_data_control_device.selection
wlr_data_control_source_cancelled
Which can confuse client state thinking the clipboard didn't change
as it associates the selection event with its own request. Resend
the selection event in this case to tell the client the correct
selection.
BUG:464509
FIXED-IN:5.27
While there's specific hardware where the IM could benefit from requesting to
be shown on a specific output, it effectively never has enough information to
choose a useful output - and the protocol doesn't allow setting a null output
to indicate that the compositor should do the choice.
To avoid showing the OSK on the wrong output, always put it on the active
output and ignore what the IM client requests.
QuickTile::setRelativeGeometry() and QuickRootTile::setVerticalSplit() or
QuickRootTile::setHorizontalSplit() can hit recursion when size
constraints start taking effect.
This change reworks how other quick tiles are resized. With the proposed
design, when relative geometry changes, QuickRootTile will notice that
and start resizing other tiles.
When QuickRootTile resizes horizontal or vertical split, it is going to
ignore QuickRootTile::relativeGeometryChanged() signals (m_resizedTile).
It prevents hitting the recursion and makes moving h/v splits more
predictable.
I do think that in order to make the tile design more robust to this
kind of bugs, it's worth splitting geometry in two kinds though - the
one that indicates the preferred geometry (implicitWidth/implicitHeight
in qtquick lingua) and the current geometry, the parent node then
monitors the preferred geometries and updates the current geometries.
BUG: 464621
Move some generic properties to the OutputLayer class and add a cursor
layer getter in the RenderBackend class. That allows us to get rid of
some code duplication. And we could use this work to move more cursor layer
code from backends to Compositor.
Sending an axis event for every high-res scroll wheel movement was
causing excessive scrolling on clients that expect low-res (discrete)
scroll events.
Signed-off-by: John Brooks <john@fastquake.com>
At quick glance, it doesn't seem like there's any benefit from storing
the shadow elements as pixmaps. It saves us some QImage <-> QPixmap
conversions too.
Creating views is the main thing blocking quick effect activation.
Rather than blocking until everything is created, we can use
QQmlIncubator so we create views asynchronously. This allows KWin to do
other things while views are being created. This is mostly relevant for
multiscreen setups where we create a view per screen.
If there's windows and we're not searching, we don't need the
PlaceholderMessage. So only create it when we actually need it to reduce
the time needed to activate the effect.
We don't need the features of Repeater here and can instead just use an
Instantiator, which allows us to use asynchronous creation for the
window delegates, reducing the time needed to activate the effect.
There are some performance differences between X11 and Wayland. Desktop
systems are mostly unaffected by them, but laptops suffer a bit.
On Wayland, kwin always does double buffering. This is great for
reducing latency and avoiding tearing, but if the gpu can't keep up with
the work, you're going to see stuttering.
Another issue is that in order to reduce latency, we need to have very
good frame stats. At the moment, kwin records only cpu render time, but
we also need to record the gpu time. We've already done some work in
this area, but it's most likely Plasma 6 material. (plasma/kwin!1163)
In the meantime, let's change the default latency policy to "Force
smoother animations." It's going to improve frame rate. If people care
about latency, they can change latency policy in system settings; the
option is still there.
CCBUG: 452119
Main reason to support this old interface is because this is the only
protocol chromium (and effectively all electron app) that supports.
The protocol itself very similar to text-input-v2 with some minor difference.
So not hard to support by just duplicate some existing code. There might be
some unclear protocol design issue if kwin need to support multiple SeatInterface,
but for now it should be ok to assume there is only one seat.
Tested using fcitx5 against weston-editor and chromium with flag
--enable-features=UseOzonePlatform --ozone-platform=wayland
--enable-wayland-ime
The window rules kcm uses lower-case window class and role, but kwin can
use window class and role with other casing, which will break the ExactMatch
match rule.
BUG: 464190
It is being phased out. Instead, read the pixels from the
cursor's framebuffer using `glReadPixels`.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
There's a visual glitch that looks like a random rectangle in the top
left corner of morphing popup. It appears like it's caused by the blur
effect, it produces wrong results when the window is captured in
CrossFadeEffect::redirect().
Make CrossFadeEffect::redirect() unset blur and contrast force roles, so
the backdrop effects are not included in the captured frame.
Backdrop effects such as blur and background contrast have to be in the
front of the effect chain because they need to work with background
before the window is painted on top.
Hopefully it's going to fix panel popup blinking visual artifacts.
The subdivided grid used by these effects doesn't account for pixel
alignment. If we force the generated WindowQuads to be rounded, the
quad's sizes no longer match the texture sizes, which results in blurry
rendering.
BUG: 461283
eeffects
Currently, only two modes are provided, rounding or not rounding, which
allows explicitly disabling snapping. However, should we have a reason
to add more modes it is now fairly simple to change.
The value is a representation of the discrete steps a mouse wheel can take.
Multiplying that with a scroll speed destroys the whole purpose of the value.
Some global themes, e.g. Breeze Dark, don't ship a switcher and instead point to the one from the Beeze global theme
They do show up in the selection though, which is confusing and doesn't actually work
This sets the property on the shortcut widgets when they
should get highlighted: the option is selected in System
Settings and the shortcut is not the default.
It requires a change in `KXMLGui/KKeyShortcutWidget` to
actually paint the highlihgt ring.
(commit 47572c26, KF103)
CCBUG: 459318
Currently, tabbox shortcuts are directly saved to KGlobalAccel
when they change, which is inconsistent with the rest of the
KCM and leads to confusion regarding Defaults and isSaveNeeded
status.
Let's instead manage the changes internally and just save them
to KGlobalAccel on Apply/Save.
m_actionsCollection is only used as a helpful way to store this
internal configuration, and doesn't really needs saving to
or restoring from config.
BUG: 459325
FIXED-IN: 5.27
We need to monitor whether the inhibitorActive signal gets emitted. It
reduces the test's execution time from about 5 seconds to a couple
milliseconds.
There are cases where GLVertexBuffer::map will return null (as seen in
kwinglutils.cpp:1816) which does happen (as seen in the backtrace of bug
462017)
Make sure we don't call the null map in that case.
BUG: 372305
In this branch a new animation is being started, so a ref-guard needs
to be the same as in the similar branch for starting minimize animation
in the slot above.
The prototype of OutputLayer::endFrame() looks as follows
virtual bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) = 0;
On the other hand, qpainter output layers use a different order in the
header file and the cpp file.
Virtual backend is used primarily by tests, there are plans to use it
for virtual outputs too. But in either case we don't need screenshots.
I also can't imagine how it can be useful as a debugging tool. It's more
convenient to spin a windowed kwin instance.
The main motivation behind this change is to get rid of custom code in
virtual output layers and simplify it a bit more.
All the other backends present their surface regardless.
If the surface isn't presented, the scheduled frame is never
finished, and rendering gets stuck indefinitely.
This is also consistent with x11 standalone backend
which forgoes this check.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
WindowPaintData contains two projection matrices -
screenProjectionMatrix and projectionMatrix. I'm not sure why we have
two.
screenProjectionMatrix is initialized by the scene. While
projectionMatrix is usually updated by the effects. The two are not in
sync.
On the other hand, OffscreenEffect takes into account only
screenProjectionMatrix. It means that if a window is transformed by two
offscreen effects, the final result is going to be broken because
an OffscreenEffect must use the projection matrix specified by another
OffscreenEffect, which it doesn't.
This change cleans up projection matrix properties in WindowPaintData,
so there's only one projection matrix property. With that, offscreen
effects can be properly nested.
BUG: 462876
The window rules KCM calls this "No titlebar and frame", but different
less user-friendly terminology is used for the context menu action and
the global action. Let's unify them using the more user-friendly name.
BUG: 464007
FIXED-IN: 5.27
The focus outline that highlights the active virtual desktop in the Overview effect, as
well as the half-transparent outlines that are around the other virtual desktops, cover
2 pixels on every side of every virtual desktop thumbnail.
This is because an invisible rectangle is used that has the same size as the thumbnail
and has a colored border, but borders are always drawn on the inside of QML rectangles,
so content in the thumbnail is covered up. Therefore, the width of the rectangle has to
be slightly adjusted to account for the thickness of the border.
BUG: 450963
FIXED-IN: 5.27
Since kwin play with CAP_SYS_NICE, secure_getenv will fail for xkbcommon
to load user level xkbmap. This allows kwin to load config under
~/.config/xkb
BUG: 447206
There are effects that are mutually exclusive, e.g. magnifier and zoom.
They both use the same global shortcuts.
When switching from zoom to magnifier, the zoom effect must be unloaded
first, then the magnifier effect can be loaded. Doing so in the opposite
order will break global shortcuts in the magnifier effect because
zooming shortcuts are still bound by the zoom effect.
BUG: 457800
Right now this is marked as critical, but it's not a critical error.
Make it a debug to avoid spamming logs with not-very-actionable
information.
BUG: 463259
FIXED-IN: 5.27
A touch device could have no output object assigned due to the screen
being disabled, queued events or malconfiguration.
Using output would crash. Touch up is guarded so that we have matching
pairs.
BUG: 463385
By default translations are loaded from /usr/share/locale. This works fine for builtin effects
since we install our translations there.
However, it doesn't work for third-party scripted effects. They only provide a kpackage and can't
install anything to /usr/share/.
This patch allows them to ship translations in contents/locale/$language/LC_MESSAGES/$domain.mo,
where $domain is the X-KWin-Config-TranslationDomain metadata value
This matches what Plasma does for applets since https://phabricator.kde.org/D5209
CCBUG: 317338
Startup notifications optionally contain the target desktop the app should be launched to.
If present the window is sent to that desktop, if not it is sent to the current desktop.
Later in Workspace::activateWindow we check if the window is on the current desktop, and if not
we either move it to the current desktop or switch to the window's desktop depending on user preference.
However, this is broken because the window was already moved to the current desktop. To avoid this
only move the window if specifically requested by the startup id.
BUG: 462996
SurfaceInterface::scaleOverride() doesn't scale the bufferScale, so if the
scale override is 2, but the buffer scale specified by the client is 1,
bufferScale() will return 1.
Xwayland cursor surface implicitly relied on this behavior.
Porting cursor to SurfaceItem changed that. Now cursor surfaces honor
the scale override, which makes Xwayland cursors too small.
In order to properly fix, plasma has to scale Xcursor.size in xrdb. The
problem is that plasma also sets XCURSOR_THEME and XCURSOR_SIZE envvars
that take precedence. Plasma must stop setting those envvars, but it's
doable only with Qt 6.5, which got MouseCursorTheme and MouseCursorSize
hints in QPlatformTheme.
RootTile is a CustomTile and it has no parent because it's the root.
Therefore the sender object in connect() will be null and it's going to
produce a warning.
While not technically fitting for the name of the option, the behavior is what a user
would expect and it also matches with X11 (where the cursor goes to the touch position).
Prior to beb6cca65d, the drm backend used
to specify QRect(0, 0, modeSize.width(), modeSize.height()) CRTC rect,
so we didn't have to care about buffer transforms, but now that we
compute the CRTC rect from the buffer size, we have to take the buffer
transform into account.
It fixes squashed output contents when the output is rotated 90 or 270
degrees and it uses hardware transforms.
Scene::Window::discardPixmap() used not to add damage. No idea how it
got in SurfaceItem::discardPixmap(). Perhaps a mishap when introducing
window items.
From logical point of view, adding damage when discard a pixmap is not
necessary too because a new pixmap is going to be created.
The cursor scene contains the contents of the cursor. It contains a
CursorItem. The CursorItem either creates a SurfaceItem or an ImageItem
based on the currently attached CursorSource.
The cursor item is rendered by the cursor scene. For now, wherever the
cursor must be rendered, a dummy scene delegate is constructed. It's not
nice but it's a pretty cheap operation. There's a lot of potential for
clean up by moving cursor layer handling from output backends to
compositor. The main reason why there are no persistent scene views is
that it's just easier than tracking when they are actually used, e.g.
after switching between hw and sw cursor.
The software cursor fallback is a bit tricky case. It made to work by
constructing a scratch fbo. The cursor scene is rendered in the scratch
fbo, which is then rendered on the screen. Similar to the case above,
there's space for improvements, but I don't think it has to block the
effort for reusing Items to render the cursor.
This makes the OSD message for Night Colour inhibition use the same icon as the tray applet.
I'm not sure where the original icon `preferences-desktop-display-nightcolor-off` is, but it would seem a good idea to remove it?
While direct scanout happens, the damage of the SurfaceItem is reset, which
can cause the OpenGL texture to not be updated once direct scanout ends,
and leave the texture outdated until the surface is damaged again.
In order to fix that, make sure the texture is always fully updated after
the SurfaceItem has been used in direct scanout.
If `callDBus` hits a problem, KWin will log a debug message saying that an error occurred, but it does not log the actual error message. This makes troubleshooting KWin scripts more difficult.
Since the call failed, log the message at warning level to make it more visible.
TabBox::hide() used to contain the following code
QApplication::syncX();
XEvent otherEvent;
while (XCheckTypedEvent(display(), EnterNotify, &otherEvent))
;
The purpose of XSync() is to flush any pending requests and wait until
the X server processes them. After that, we can go through event queue
to find relevant events.
Why did tabbox go through the event queue to find the EnterNotify
events? It's unclear. So it was removed in
b4c957b617. However, the XSync() call was
left out. It doesn't make sense on its own. So remove it too.
In the Overview effect, pressing the space bar doesn't always insert a
space character into the search field as one would expect; when the text
in the search field matches any windows, it instead activates the
highlighted window. At other times, it does insert a space as expected.
This behavior is unpredictable and unintuitive, so this commit fixes the
issue by intercepting the key input event and inserting a space when the
search field has focus. In this state, the highlighted window can be
activated using the enter/return key. When the search field doesn't have
focus, a press of the space bar will continue to activate the selected
window.
While tilt is sent on X11, we're currently only sending pressure events and not tilt/rotation events on Wayland. Since Krita is still running in X11, and it's running through XWayland - it's technically a Wayland client and gets no tilt/rotation. This fixes that issue :-)
I saw !3231 which was working on complete Wayland tablet support, but it's been stagnating. I just wanted tilt & rotation support now, so I added a way to query capabilities from the `m_capabilities` variable on the private interface we already fetched.
Tested on Krita using the Tablet Debug Log.
The size is used in NETRootInfo::setDesktopGeometry, which seems to cause
some applications to misbehave or even crash because they attempt to create
a texture larger than what the GPU supports
CCBUG: 461848