wayland: Provide a way to force xdg surface configure events
XdgSurfaceClient tries to avoid sending unnecessary configure events, but in some cases, the compositor has to send one even if the surface state hasn't changed, for example in response to a set_maximized() request, etc. This change introduces a special flag to indicate that the scheduled event has to be sent no matter what.
This commit is contained in:
parent
4a0128cac1
commit
0ad4901687
2 changed files with 18 additions and 9 deletions
|
@ -128,13 +128,15 @@ bool XdgSurfaceClient::stateCompare() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void XdgSurfaceClient::scheduleConfigure()
|
||||
void XdgSurfaceClient::scheduleConfigure(ConfigureFlags flags)
|
||||
{
|
||||
if (isZombie()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stateCompare()) {
|
||||
m_configureFlags |= flags;
|
||||
|
||||
if ((m_configureFlags & ConfigureRequired) || stateCompare()) {
|
||||
m_configureTimer->start();
|
||||
} else {
|
||||
m_configureTimer->stop();
|
||||
|
@ -153,6 +155,7 @@ void XdgSurfaceClient::sendConfigure()
|
|||
}
|
||||
|
||||
m_configureEvents.append(configureEvent);
|
||||
m_configureFlags = ConfigureFlags();
|
||||
}
|
||||
|
||||
void XdgSurfaceClient::handleConfigureAcknowledged(quint32 serial)
|
||||
|
@ -1039,7 +1042,7 @@ void XdgToplevelClient::handleMaximizeRequested()
|
|||
{
|
||||
if (m_isInitialized) {
|
||||
maximize(MaximizeFull);
|
||||
scheduleConfigure();
|
||||
scheduleConfigure(ConfigureRequired);
|
||||
} else {
|
||||
m_initialStates |= XdgToplevelInterface::State::Maximized;
|
||||
}
|
||||
|
@ -1049,7 +1052,7 @@ void XdgToplevelClient::handleUnmaximizeRequested()
|
|||
{
|
||||
if (m_isInitialized) {
|
||||
maximize(MaximizeRestore);
|
||||
scheduleConfigure();
|
||||
scheduleConfigure(ConfigureRequired);
|
||||
} else {
|
||||
m_initialStates &= ~XdgToplevelInterface::State::Maximized;
|
||||
}
|
||||
|
@ -1060,7 +1063,7 @@ void XdgToplevelClient::handleFullscreenRequested(OutputInterface *output)
|
|||
Q_UNUSED(output)
|
||||
if (m_isInitialized) {
|
||||
setFullScreen(/* set */ true, /* user */ false);
|
||||
scheduleConfigure();
|
||||
scheduleConfigure(ConfigureRequired);
|
||||
} else {
|
||||
m_initialStates |= XdgToplevelInterface::State::FullScreen;
|
||||
}
|
||||
|
@ -1070,7 +1073,7 @@ void XdgToplevelClient::handleUnfullscreenRequested()
|
|||
{
|
||||
if (m_isInitialized) {
|
||||
setFullScreen(/* set */ false, /* user */ false);
|
||||
scheduleConfigure();
|
||||
scheduleConfigure(ConfigureRequired);
|
||||
} else {
|
||||
m_initialStates &= ~XdgToplevelInterface::State::FullScreen;
|
||||
}
|
||||
|
@ -1226,7 +1229,7 @@ void XdgToplevelClient::initialize()
|
|||
}
|
||||
|
||||
blockGeometryUpdates(false);
|
||||
scheduleConfigure();
|
||||
scheduleConfigure(ConfigureRequired);
|
||||
updateColorScheme();
|
||||
m_isInitialized = true;
|
||||
}
|
||||
|
@ -1983,7 +1986,7 @@ void XdgPopupClient::initialize()
|
|||
placeIn(area);
|
||||
blockGeometryUpdates(false);
|
||||
|
||||
scheduleConfigure();
|
||||
scheduleConfigure(ConfigureRequired);
|
||||
}
|
||||
void XdgPopupClient::installPlasmaShellSurface(PlasmaShellSurfaceInterface *shellSurface)
|
||||
{
|
||||
|
|
|
@ -70,8 +70,13 @@ protected:
|
|||
virtual void handleRoleCommit();
|
||||
virtual bool stateCompare() const;
|
||||
|
||||
enum ConfigureFlag {
|
||||
ConfigureRequired = 0x1,
|
||||
};
|
||||
Q_DECLARE_FLAGS(ConfigureFlags, ConfigureFlag)
|
||||
|
||||
XdgSurfaceConfigure *lastAcknowledgedConfigure() const;
|
||||
void scheduleConfigure();
|
||||
void scheduleConfigure(ConfigureFlags flags = ConfigureFlags());
|
||||
void sendConfigure();
|
||||
|
||||
QPointer<KWaylandServer::PlasmaShellSurfaceInterface> m_plasmaShellSurface;
|
||||
|
@ -91,6 +96,7 @@ private:
|
|||
QQueue<XdgSurfaceConfigure *> m_configureEvents;
|
||||
QScopedPointer<XdgSurfaceConfigure> m_lastAcknowledgedConfigure;
|
||||
QRect m_windowGeometry;
|
||||
ConfigureFlags m_configureFlags;
|
||||
bool m_haveNextWindowGeometry = false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue