wayland: Fix google chrome fullscreen mode

Conceptually, a configure event inherits its parent's state and adds
some of its own. This allows the compositor to skip intermediate
configure events in ack_configure handler and jump to the last one.

Currently, the only field that XdgSurfaceConfigure objects need to
inherit is flags. The geometry info and window states are filled in by
role commit implementations to their latest values.

XdgSurfaceConfigure::flags indicates if the configure event moves the
window. This flag is important to resolve conflicts between geometry
updates initiated by the user and the ones that are made in response to
acknowledged configure events, e.g. after maximizing the window, etc.
(effectively, if the user moves a window, kwin will cancel scheduled
moves in configure events)

If configure flags are not inherited, we can end up with the following
case:

* configure event A (flags: {position})
* configure event B (flags: {})

If the client acknowledges configure event B, kwin will skip configure
event A, and thus it won't move the window to the right place. This is
the root cause of fullscreen mode misbehaving with apps such as google
chrome.
This commit is contained in:
Vlad Zahorodnii 2021-09-15 14:58:45 +03:00
parent d58246961e
commit f4b504c476

View file

@ -129,9 +129,16 @@ void XdgSurfaceClient::scheduleConfigure()
void XdgSurfaceClient::sendConfigure()
{
XdgSurfaceConfigure *configureEvent = sendRoleConfigure();
configureEvent->flags = m_configureFlags;
// The configure event inherits configure flags from the previous event.
if (!m_configureEvents.isEmpty()) {
const XdgSurfaceConfigure *previousEvent = m_configureEvents.constLast();
configureEvent->flags = previousEvent->flags;
}
configureEvent->flags |= m_configureFlags;
m_configureFlags = {};
m_configureEvents.append(configureEvent);
}