Fixes desktop window losing the keep-below flag.
BUG: 365014
Fixes desktop window losing the keep-below flag.
BUG: 365014
The real issue is probably some race between KWindowSystem and Qt xcb,
but this fixes the issue and it really seems unnecessary to refresh the window flags
on each focus in event.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Fixes desktop window losing the keep-below flag
Just saying: this doesn't make sense. Keep-below doesn't matter for a desktop window. I just checked KWin's source code and the layer of the desktop window is only determined by the window type. Keep above/below has no influence on desktop windows. (For those interested kwin.git file abstract_client.cpp method belongsToLayer())
Overall the proposed change worries me. I totally believe you that it fixes the problem and also think that the current code is wrong. What worries me is that we don't understand what's going on here in a very central part of our desktop application. We don't know when we set the window type. That's urgh.
I would say the ensurePlatformWindow needs to be called from the QPlatformSurfaceEvent::SurfaceCreated event. But we should test that whole thing.
What's really important to know is that KWin does not support changes of window type once a window is mapped. This makes the existing code pointless - it cannot update. But it also means that somewhere there is a race that the window type is not properly set.
snip from xprop -spy on desktop window when clicking on desktop window and other windows:
_NET_WM_USER_TIME(CARDINAL) = 894873 _NET_WM_USER_TIME(CARDINAL) = 894853 _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DESKTOP _MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x1, 0x0, 0x0, 0x0 WM_HINTS(WM_HINTS): Client accepts input or input focus: True Initial state is Normal State. _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DESKTOP _NET_WM_STATE(ATOM) = _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CHANGE_DESKTOP _NET_WM_USER_TIME(CARDINAL) = 896471 _NET_WM_USER_TIME(CARDINAL) = 896471 _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DESKTOP _MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x1, 0x0, 0x0, 0x0 WM_HINTS(WM_HINTS): Client accepts input or input focus: True Initial state is Normal State. _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DESKTOP _NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE _NET_WM_STATE(ATOM) = _NET_WM_STATE_BELOW _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DESKTOP _MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x1, 0x0, 0x0, 0x0 WM_HINTS(WM_HINTS): Client accepts input or input focus: True Initial state is Normal State. _NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DESKTOP _NET_WM_STATE(ATOM) = _NET_WM_USER_TIME(CARDINAL) = 898190
it's probably due from the xcb platformintegration setting window type only after the window has been shown?
can you try that with starting plasmashell? My gut feeling is that it's first a different type and changed afterwards.
Patch for setting through surface event:
diff --git a/shell/desktopview.cpp b/shell/desktopview.cpp index 14a25af..38c6621 100644 --- a/shell/desktopview.cpp +++ b/shell/desktopview.cpp @@ -226,6 +226,7 @@ bool DesktopView::event(QEvent *e) switch (pe->surfaceEventType()) { case QPlatformSurfaceEvent::SurfaceCreated: setupWaylandIntegration(); + ensureWindowType(); break; case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: delete m_shellSurface;
No, that doesn't help, nor does calling ensureWindowType in QEvent::Expose.
As it is now, calling ensureWindowType in QEvent::FocusIn is pointless (and causes this bug), as proper window type is already set *after* QEvent::Show (ensureWindowType is called in showEvent) - that is after native window was created and exposed.