Summary:
Unfortunately Aurorae decoration engine creates several internal clients
per each decoration. One of those clients represents QOffscreenSurface,
which is not a toplevel. Given that no QWindow object will be found for
such clients, m_internalWindowFlags contains undefined value.
Luckily, QOffscreenSurface sets FramelessWindowHint flag, but because
InternalClient is not able to find matching QWindow object, cached
QWindow flags won't have that hint set.
Thus InternalClient will attempt to decorate QOffscreenSurface. A new
Aurorae decoration will be created, which means a new QOffscreenSurface
will be created, which means a new Aurorae decoration will be created,
and so on.
This change restricts subset of internal clients that can be decorated.
Only clients with valid m_internalWindow can be decorated. If m_internalWindow
isn't null, then m_internalWindowFlags is guaranteed to be valid as well.
BUG: 407612
FIXED-IN: 5.16.3
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22136
Summary:
To do so can in some situations lock up as the loop goes through
different positions incrementing by client->width/height.
If this is zero we can get into a stuck state.
This became a more common issue due to my earlier patch that places windows
in ShellClient::finishInit to allow the maximize placement strategy to
set the first configure size.
BUG: 408754
Reviewers: #kwin, broulik
Reviewed By: broulik
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21997
Summary:
On Placement=Maximized it becomes a problem because we end up sending an invalid size and when we try to recover from it, we recover from the wrong size.
This fixes setting the right size to Plasma Mobile applications.
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22054
Summary: readX11ShadowProperty fails without an X connection
Test Plan: Tested by Kai who didn't have xwayland
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21965
Summary:
QtQuick windows created by KWin currently use the default swap interval
of 1, meaning buffer swaps will block until vblank. However, this
results in a problematic interaction on hybrid graphics systems running
the proprietary NVIDIA driver. VSync on such setups relies on a system
called "PRIME synchronization", where the xf86-video-modesetting driver
controlling the display will signal the NVIDIA driver when vblank has
occurred. The issue is that it will only do so if there has been damage
to the screen.
So, when KWin creates a QtQuick window, compositing will stop waiting on
the window to render, therefore no damage to the screen will occur. But
this means that no vblank notifications will be delivered to the NVIDIA
driver, so the glXSwapBuffers call by the QtQuick window will block
perpetually. The end result is a freeze of the desktop.
To get around this, we can simply disable vsync for QtQuick windows by
setting the swap interval for the default QSurfaceFormat to 0. Since
they are redirected, this shouldn't cause any tearing.
BUG: 406180
FIXED-IN: 5.16.2
Test Plan:
Using the proprietary NVIDIA driver on a hybrid graphics system, with
PRIME synchronization enabled (see
https://devtalk.nvidia.com/default/topic/957814/linux/prime-and-prime-synchronization/),
perform any action causing a QtQuick window to be created by KWin, for
example, triggering the application switcher dialogue with alt + tab.
Ensure the desktop does not temporarily freeze.
Note, this required a Qt build that includes commit
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=0c1831178540462da31fd7a4b6d2e446bc84498b
resolving a bug that prevented the changing the swap interval.
Reviewers: #kwin, davidedmundson, zzag
Reviewed By: #kwin, davidedmundson, zzag
Subscribers: zzag, romangg, alexeymin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21808
Summary:
This adds again the workaround from 1fb2eace3f, which got temporarily
removed by 9b922f8833.
BUG: 386304
Test Plan: Manually
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21601
Summary:
xcb_put_image doesn't handle big images well. Contrary to XPutImage, the
caller must manually split the data in such a way that each xcb_put_image
request doesn't exceed the maximum request length. Not doing so will result
in libxcb shutting down the connection.
CCBUG: 338489
CCBUG: 388182
Test Plan: Take a screenshot of an active fullscreen client on a 4K monitor.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21370
Summary:
The Lanczos filter is applied to thumbnails, so we need to specify screen
projection matrix in order to properly project window coordinates into
screen-space.
BUG: 407485
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21224
Summary:
When a client sets a strut, checkWorkspacePosition will be called to
bump clients that touch corresponding screen edge.
In order to do that, checkWorkspacePosition needs to calculate client
boundaries before and after the restricted move area was changed. As it
turns out, if the client reserves space "between" screens, calculated
boundaries can be incorrect, which may lead to some funky results, e.g.
shrunken clients.
For example, let's say that there is a dual-monitor setup. If a client
reserves some amount of space at the right border of the left screen,
then clients on the right monitor will have rightMax which is equal to
the x coordinate of screenArea.
To fix that, this change ensures that only restricted areas belonging
to the same screen as the client are taken into account when computing
the boundaries.
BUG: 404837
BUG: 406573
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20987
Test Plan: Compiles, the number of compiler warnings has been reduced from 990 to 202.
Reviewers: #kwin, apol, davidedmundson
Reviewed By: #kwin, apol, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21217
Summary:
The size passed to an XDG shell configure request should match the
window size of the given window, we don't want to include the size of
any shadows that may be drawn by the client.
Kwin has the same concept of geometry for both window management, input
and rendering.
In order to approach this in a way that does not risk any regressions
with kwin's current structure AbstractClient::geometry remains the
canonical source and we handle the window within that internally within
ShellClient treating the windowGeometry as a set of margins from this.
This is part of a much bigger task (T10867). This patch addresses
windows growing when starting a drag based resize.
BUG: 403376
Test Plan:
Unit test
gtk3-demo
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20937
Summary:
This is used by GTK clients to know whether to draw as though they have
focus or not. Whilst it's most visible for CSDs headers, use of the
active/inactive palette (or backdrop class in GTK terms) applies
everywhere.
Rationale of the flag is to allow the WM to hint visual states without
giving input, i.e so you can hint that the parent of a modal dialog
should be shown as active. Though kwin only sets it on the truly active
window to match the behaviour our other windows follow.
BUG: 398832
I expect this to be potentially controversial as it's new code in X11,
so in advance:
* Unlike GTK_FRAME_EXTENTS, it is part of the specificiation (albeit
1.4) even i3 supports it.
* It does fix a real world issue
* It's only 2 lines (plus trivial boiler plate in kwindowsystem)
* It's in code path that we rely on for our existing code
* If there's a situation where this does break, the worst that will
happen is a client gets a visual hint to have focus incorrectly, which
ultimately is the same as the current state
Test Plan:
Used my CSS for breeze-gtk
moved between windows
Reviewers: #kwin, rooty, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, ognarb, ngraham, rooty, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19613
Summary:
Returning a reference to a value on the stack is broken.
This caused kwin_wayland to crash in openQA with a nullptr deref.
BUG: 407199
Test Plan: Only build tested.
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21085
Summary:
If a virtual desktop is removed, then desktopChanged will be followed by
numberDesktopsChanged signal. In which case, we have to cancel the
active animation because front_desktop might be no longer valid when
it's time to perform compositing.
BUG: 406452
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D21064
Summary:
The compositor tries to switch to the next tabbox client when currently
highlighted client is closed. Though there is a small issue with that.
Because the switch happens too late, a dangling pointer can be inserted
into the unconstrained stacking order, which can lead to a crash later on.
There are two cases:
- compositing is on;
- compositing is off.
Compositing is on: TabBox will try to un-elevate currently highlighted
client, though by that time the client no longer owns EffectWindow, so
this is basically a no-op (that's why we haven't experienced this bug
before).
Compositing is off: TabBox will try to restack currently hightlighted
client under the next tabbox client. Given that the restack method
doesn't do any sanity checks(see Client::manage why), a client that is
about to be destroyed will be re-inserted back into the unconstrained
stacking order.
This change ensures that the switch happens before currently highlighted
client is removed from the stacking order.
BUG: 406784
Test Plan:
- Turn off compositing;
- Follow steps to reproduce in the bug report (see comment 2).
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20916
Summary:
There is no point for keeping them in the Workspace class because they
are used only in sm.cpp.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20783
KWin replaces any non-printable character with a space. This check does not
handle surrogate pairs correctly. Additionally, translators sometimes insert
non-printable soft-hyphens into titles, which also cause KWin to display a
space instead.
This code adds the missing surrogate handling, and (to fix both issues), also
removes non-printable characters instead of replacing them with a space.
Also moved the changed test after these changes, so that changes in non-
printable characters do not cause unneeded redraws.
Unit tests adapted by Vlad Zagorodniy.
Test Plan:
kwrite /tmp/Test😣.txt shows correct title. I also tested actual non-printable
characters, such as 0x1A, and these are correctly omitted.
BUG: 376813
FIXED-IN: 5.15.5
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, grasslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19052
Summary:
The current icon (`window-duplicate`) is semantically incorrect and visually disconnected from what it actually does.
This one is much more appropriate on both counts.
Test Plan: {F6792003, size=full}
Reviewers: #vdg, #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20801
Summary:
checkWorkspacePosition has a guard again desktop clients right at the
top, so the for loop is basically a no-op.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20777
Summary:
kdelibs coding style recommends to avoid abbreviations, i.e. variable
names like compMngr, errStr, and so on are bad. Unfortunately, all
getters in OutputScreens don't follow that recommendation. In general,
we could address this issue by renaming enOuts but there is a bit simpler
approach to implement most of those getters.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: apol, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20588
Summary:
Kwin has a mandatory dependency on kscreenlocker, we can use the
screensaver interface definition installed from there.
Test Plan: Compiles
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20764
Summary:
Every time a display gets connected/disconnected, every output will be
reinitialized. We don't really need to reset the scaling to 1 every time
we don't know, especially since the setting has been set voluntarily.
Test Plan: When I disconnect the external display, my laptop doesn't fallback to scale=1.
Reviewers: #plasma, apol
Reviewed By: apol
Subscribers: davidedmundson, ngraham, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20521
Summary:
initWaylandOutput can be called before or after all properites are set.
If it's called after, we need to still have xdgOuput set correctly.
Test Plan:
Simplified Aleix's patch that avoids a no-op setScale call
Now it works.
Reviewers: #kwin, apol
Reviewed By: apol
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20800
Summary:
KWin is not only an X11 compositing window manager, but also a Wayland
compositor. The Compositor class is used in both cases so in general it
would be nice to keep it as much as possible generic.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19879
Summary:
Depending on how pointer approaches a screen corner, the maximum
distance between two may be smaller than 2 * edgeDistance. This can
happen for example when approaching the corner along of any two adjacent
screen edges.
As a result, the calculated factor can be anywhere between 0 and 0.5
when pointer enters approachGeometry(). This change adjusts calculation
of the factor, so it always ranges from 0 to 1 no matter how the pointer
approaches corners.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20707
Summary: We want to set the right orientation as the system starts.
Reviewers: #plasma, #kwin, zzag, davidedmundson
Reviewed By: #plasma, #kwin, zzag, davidedmundson
Subscribers: zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D20622