Fix show()/hide() for child windows on xcb

Change e946e6895a implements proper
support for ICCM 4.1.4 window state handling. One issue it addressed
is that a show() after a hide() needs to be delayed until the window
manager/X-server has processed the previous event.

This was handled with a deferred task list to send the map/unmap
events. According to ICCM, we should wait for the _NET_WM_STATE
notification before processing the deferred events.

But this is only true for top level windows, as child windows are
not handled by the window manager and will never receive any
_NET_WM_STATE notifications. For those, we should use the unmap
notify event, which means that the X-server has processed the unmap
and handle deferred events once that notification has been received.

This fixes an issue in Qt Multimedia, where QVideoWidget would not
show the video anymore after a minimize of the player or when making
the QVideoWidget fullscreen. This is because QVideoWidget uses an
embedded QWindow to render video using HW acceleration.

Fixes: QTBUG-97257
Pick-to: 6.2 5.15
Change-Id: I5c47eba3276a1f243bdafd5346f353c7843403bb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Lars Knoll 2021-11-01 13:45:30 +01:00
parent 2962e27441
commit 28138aa80a

View File

@ -1846,7 +1846,7 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event)
if (event->window == m_window) { if (event->window == m_window) {
m_mapped = false; m_mapped = false;
QWindowSystemInterface::handleExposeEvent(window(), QRegion()); QWindowSystemInterface::handleExposeEvent(window(), QRegion());
if (!m_isWmManagedWindow) { if (!m_isWmManagedWindow || parent()) {
m_wmStateValid = true; m_wmStateValid = true;
handleDeferredTasks(); handleDeferredTasks();
} }