wayland: Close layer-shell clients when associated output is disabled
When an output is disabled, it's not necessarily destroyed.
This commit is contained in:
parent
de9af6edce
commit
887a859621
6 changed files with 28 additions and 1 deletions
|
@ -67,6 +67,11 @@ QByteArray AbstractOutput::uuid() const
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AbstractOutput::isEnabled() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractOutput::setEnabled(bool enable)
|
void AbstractOutput::setEnabled(bool enable)
|
||||||
{
|
{
|
||||||
Q_UNUSED(enable)
|
Q_UNUSED(enable)
|
||||||
|
|
|
@ -103,6 +103,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual QByteArray uuid() const;
|
virtual QByteArray uuid() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns @c true if the output is enabled; otherwise returns @c false.
|
||||||
|
*/
|
||||||
|
virtual bool isEnabled() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable the output.
|
* Enable or disable the output.
|
||||||
*
|
*
|
||||||
|
@ -190,6 +195,10 @@ Q_SIGNALS:
|
||||||
* This signal is emitted when the geometry of this output has changed.
|
* This signal is emitted when the geometry of this output has changed.
|
||||||
*/
|
*/
|
||||||
void geometryChanged();
|
void geometryChanged();
|
||||||
|
/**
|
||||||
|
* This signal is emitted when the output has been enabled or disabled.
|
||||||
|
*/
|
||||||
|
void enabledChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(AbstractOutput)
|
Q_DISABLE_COPY(AbstractOutput)
|
||||||
|
|
|
@ -240,6 +240,8 @@ void AbstractWaylandOutput::setEnabled(bool enable)
|
||||||
// xdg-output is destroyed in KWayland on wl_output going away.
|
// xdg-output is destroyed in KWayland on wl_output going away.
|
||||||
updateEnablement(false);
|
updateEnablement(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit enabledChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AbstractWaylandOutput::description() const
|
QString AbstractWaylandOutput::description() const
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
return m_waylandOutput;
|
return m_waylandOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEnabled() const;
|
bool isEnabled() const override;
|
||||||
/**
|
/**
|
||||||
* Enable or disable the output.
|
* Enable or disable the output.
|
||||||
*
|
*
|
||||||
|
|
|
@ -58,6 +58,8 @@ LayerShellV1Client::LayerShellV1Client(LayerSurfaceV1Interface *shellSurface,
|
||||||
|
|
||||||
connect(output, &AbstractOutput::geometryChanged,
|
connect(output, &AbstractOutput::geometryChanged,
|
||||||
this, &LayerShellV1Client::scheduleRearrange);
|
this, &LayerShellV1Client::scheduleRearrange);
|
||||||
|
connect(output, &AbstractOutput::enabledChanged,
|
||||||
|
this, &LayerShellV1Client::handleOutputEnabledChanged);
|
||||||
connect(output, &AbstractOutput::destroyed,
|
connect(output, &AbstractOutput::destroyed,
|
||||||
this, &LayerShellV1Client::handleOutputDestroyed);
|
this, &LayerShellV1Client::handleOutputDestroyed);
|
||||||
|
|
||||||
|
@ -256,6 +258,14 @@ void LayerShellV1Client::handleAcceptsFocusChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayerShellV1Client::handleOutputEnabledChanged()
|
||||||
|
{
|
||||||
|
if (!m_output->isEnabled()) {
|
||||||
|
closeWindow();
|
||||||
|
destroyClient();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LayerShellV1Client::handleOutputDestroyed()
|
void LayerShellV1Client::handleOutputDestroyed()
|
||||||
{
|
{
|
||||||
closeWindow();
|
closeWindow();
|
||||||
|
|
|
@ -54,6 +54,7 @@ private:
|
||||||
void handleUnmapped();
|
void handleUnmapped();
|
||||||
void handleCommitted();
|
void handleCommitted();
|
||||||
void handleAcceptsFocusChanged();
|
void handleAcceptsFocusChanged();
|
||||||
|
void handleOutputEnabledChanged();
|
||||||
void handleOutputDestroyed();
|
void handleOutputDestroyed();
|
||||||
void scheduleRearrange();
|
void scheduleRearrange();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue