Commit 110182b2 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

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.
parent 0e63b4e8
......@@ -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;
......
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment