wayland: Simplify XdgSurfaceConfigure

Rather than have an error prone way to detect whether a configure event
has good position information, handle the case where the plasma shell
surface has a position hint explicitly.
This commit is contained in:
Vlad Zahorodnii 2021-05-12 17:43:26 +03:00
parent 0e63b4e8cc
commit 110182b213
2 changed files with 4 additions and 24 deletions

View file

@ -148,16 +148,7 @@ void XdgSurfaceClient::scheduleConfigure(ConfigureFlags flags)
void XdgSurfaceClient::sendConfigure()
{
XdgSurfaceConfigure *configureEvent = sendRoleConfigure();
if (configureEvent->position != pos()) {
configureEvent->presentFields |= XdgSurfaceConfigure::PositionField;
}
if (configureEvent->size != size()) {
configureEvent->presentFields |= XdgSurfaceConfigure::SizeField;
}
m_configureEvents.append(configureEvent);
m_configureEvents.append(sendRoleConfigure());
m_configureFlags = ConfigureFlags();
}
@ -226,9 +217,10 @@ void XdgSurfaceClient::handleNextWindowGeometry()
frameGeometry = adjustMoveResizeGeometry(frameGeometry);
} else if (lastAcknowledgedConfigure()) {
XdgSurfaceConfigure *configureEvent = lastAcknowledgedConfigure();
if (configureEvent->presentFields & XdgSurfaceConfigure::PositionField) {
if (!m_plasmaShellSurface || !m_plasmaShellSurface->isPositionSet()) {
frameGeometry.moveTopLeft(configureEvent->position);
} else {
frameGeometry.moveTopLeft(m_plasmaShellSurface->position());
}
}
@ -742,7 +734,6 @@ XdgSurfaceConfigure *XdgToplevelClient::sendRoleConfigure() const
XdgToplevelConfigure *configureEvent = new XdgToplevelConfigure();
configureEvent->position = requestedPos();
configureEvent->size = requestedSize();
configureEvent->states = m_requestedStates;
configureEvent->serial = serial;
@ -2032,7 +2023,6 @@ XdgSurfaceConfigure *XdgPopupClient::sendRoleConfigure() const
XdgSurfaceConfigure *configureEvent = new XdgSurfaceConfigure();
configureEvent->position = requestedPos();
configureEvent->size = requestedSize();
configureEvent->serial = serial;
return configureEvent;

View file

@ -36,15 +36,7 @@ class XdgSurfaceConfigure
public:
virtual ~XdgSurfaceConfigure() {}
enum ConfigureField {
PositionField = 0x1,
SizeField = 0x2,
};
Q_DECLARE_FLAGS(ConfigureFields, ConfigureField)
ConfigureFields presentFields;
QPoint position;
QSize size;
qreal serial;
};
@ -265,5 +257,3 @@ private:
};
} // namespace KWin
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::XdgSurfaceConfigure::ConfigureFields)