When we destroy all internal clients and override-redirect windows, we
assume that corresponding lists will be implicitly detached.
However, in some cases, that might be not the case. For example, if the
list is not shared, neither begin() nor end() will detach. Therefore, it
is possible to hit invalidated iterators if the list is modified inside
the loop.
This change prevents hitting invalidated iterators by making explicit
list copies.
CCBUG: 427373
(cherry picked from commit 08263b534d)
Prepend m_ to unmanaged so no one has to come up with original names if
they want to iterate over a shadow copy of it.
(cherry picked from commit a5b811dadb)
Commit e459c8bf54 added a sanity check to
prevent recomputing the texture matrix if the y-inverted hint hasn't been
changed, which is totally reasonable!
However, code that initializes dmabuf textures implicitly assumes that
calling setYInverted() always results in updating the matrix. But it may
be not the case if the passed value matches current isYInverted().
This change adds missing calls to force updating the texture matrix.
Note that we don't need to check the buffer size every time the dmabuf
image has been modified externally because the window pixmap is going to
be re-created if the dimensions of the attached buffer have changed.
I've seen some reports on the internet about Firefox displaying garbage
instead of videos. 99% that bug is caused by this issue. But it seems
like Firefox no longer displays corrupted videos on my machine, so it's
hard to tell.
(cherry picked from commit f247e35c6d)
Workspace::clientList() only returns X11 clients, while allClientList()
returns all managed clients (both X11 and Wayland).
(cherry picked from commit 1e9bd43368)
In some cases, a ClientLevel model may not contain all Wayland windows
because of missing if (waylandServer()) {} code path in init() method.
(cherry picked from commit faf6b8e049)
It's the same top mapToGlobal()+operator& than the other way around and
we get to skip 1 call.
This path is the most common so we better save it.
(cherry picked from commit f558115def)
Currently, internal on screen display windows have the bypass window
manager hint set. If that hint is set, the osds must place themselves,
but they don't do it.
As far as I know, there is no any reason why internal OSDs have that
flag set.
By removing the Qt::BypassWindowManagerHint flag, we let kwin core
know that it's okay to place internal OSD windows.
BUG: 400675
(cherry picked from commit 4559d30399)
Qt::Popup is a mask, so we cannot use the `&` operator to test the window
type. We need to use QFlags::testFlag() for that purpose instead.
(cherry picked from commit 70700b868a)
Currently, we do some sort of window placement only for decorated
internal windows, which feels hacky.
With this change, all internal clients will go through the window
placement code, unless it's a popup or the BypassWindowManagerHint
flag is set.
If the BypassWindowManagerHint flag is set, the window must have
valid position.
CCBUG: 400675
(cherry picked from commit bc34736534)
Currently, if some script attempts to resize a window while it's being
interactively resized, the corresponding change won't be propagated to
the X server.
The main reason for that is that we don't want to configure the frame
window, the wrapper window, and the client window twice. However, since
Xcb::Window keeps track of the last configured geometry, we can adjust
X11Client::updateServerGeometry() so it only configures windows that
have mismatching geometry.
By doing so, the setFrameGeometry() function can be called by scripts
even when the associated X11 window is being interactively resized.
Note that this bug doesn't affect Wayland windows.
BUG: 426988
(cherry picked from commit 6f153552da)
If the shadow is destroyed immediately before the window is destroyed,
we need to schedule a workspace repaint in order to prevent showing a
"ghost" shadow.
BUG: 425294
(cherry picked from commit ddb24eaf0a)
We need to schedule a workspace repaint in case no effect is going to
animate the window.
The workspace repaint is issued before creating a Deleted because the
latter takes the owner of the effect window, which means that after an
instance of Deleted has been created, visibleRect() returns the frame
geometry.
CCBUG: 425294
(cherry picked from commit 12e59f9af8)
If an X11 event filter has been activated and it unregisters another X11
event filter, then the window manager may crash because the foreach macro
in Workspace::workspaceEvent() makes a copy of m_genericEventFilters or
m_eventFilters and we can call the event() method for an already defunct
filter.
With this change, X11 event filters can be safely removed and installed
at any particular moment.
BUG: 423319
(cherry picked from commit a433fb08a3)
The main motivation for this change is to enable support for our
proprietary shadow protocol in LayerShellV1Client.
Previously we couldn't move code that handles shadows in WaylandClient
because WaylandClient::bufferGeometry() was a pure virtual method.
(cherry picked from commit f24f2bd509)
This reverts commit 9d4c8fda09.
Unlike other effects this wasn't using hide/show as a hack for not
having a created/destroyed signal but because the window is internally
hidden when it's in auto-hide mode despite being still mapped.
BUG: 426686
(cherry picked from commit 095cdcd374)
Currently, if kwin/wayland runs without xwayland, the order in which
windows are painted doesn't actually reflect the true stacking order.
If the stacking order has been changed, we need to invalidate the
cached x stacking order. But it's done only when RootInfo is present.
If Xwayland doesn't run, RootInfo is not available and thus window
raising is completely broken.
With this change, the x stacking order will be invalidated every time
some window has been raised, no matter what mode kwin operates in.
(cherry picked from commit 75cad57cd9)
If showOnScreenEdge is called, immediately followed by the client's destruction, it's possible that the next event queue process will call raiseClient with a destroyed client.
We avoid this by using singleShot that is lifetime-aware.
(cherry picked from commit 1dbe3708f5)
Edge::handle calls showOnScreenEdge, which (on wayland) eventually calls internalShow, which eventually calls ScreenEdges::reserve, which destroys the same edge.
When showScreenOnEdge returns, 'this' has been freed.
Using a singleshot timer allows Edge::handle to return before the Edge is destroyed.
(cherry picked from commit 71dfd60284)
The API version must be bumped because a new virtual method in the
EffectWindow class had been introduced that breaks BC.
(cherry picked from commit 79c667ea67)