wayland: Implement xdg-shell v6

This change adds support for xdg_wm_base v6, which introduces
xdg_toplevel suspended state.

The suspended state is tied to the visibility of the window item so the
effects could possibily "resume" window content updates.
master
Vlad Zahorodnii 1 year ago
parent 05527271f5
commit c2dfb55c59

@ -168,7 +168,12 @@ bool WindowItem::computeVisibility() const
void WindowItem::updateVisibility()
{
setVisible(computeVisibility());
const bool visible = computeVisibility();
setVisible(visible);
if (m_window->readyForPainting()) {
m_window->setSuspended(!visible);
}
}
void WindowItem::updatePosition()

@ -16,7 +16,7 @@
namespace KWaylandServer
{
static const int s_version = 5;
static const int s_version = 6;
XdgShellInterfacePrivate::XdgShellInterfacePrivate(XdgShellInterface *shell)
: q(shell)
@ -540,7 +540,7 @@ quint32 XdgToplevelInterface::sendConfigure(const QSize &size, const States &sta
{
// Note that the states listed in the configure event must be an array of uint32_t.
uint32_t statesData[8] = {0};
uint32_t statesData[9] = {0};
int i = 0;
if (states & State::MaximizedHorizontal && states & State::MaximizedVertical) {
@ -571,6 +571,12 @@ quint32 XdgToplevelInterface::sendConfigure(const QSize &size, const States &sta
}
}
if (d->resource()->version() >= XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION) {
if (states & State::Suspended) {
statesData[i++] = QtWaylandServer::xdg_toplevel::state_suspended;
}
}
const QByteArray xdgStates = QByteArray::fromRawData(reinterpret_cast<char *>(statesData), sizeof(uint32_t) * i);
const quint32 serial = xdgSurface()->shell()->display()->nextSerial();

@ -207,6 +207,7 @@ public:
TiledTop = 0x40,
TiledRight = 0x80,
TiledBottom = 0x100,
Suspended = 0x200,
Maximized = MaximizedHorizontal | MaximizedVertical,
};
Q_DECLARE_FLAGS(States, State)

@ -4256,6 +4256,26 @@ void Window::setHiddenByShowDesktop(bool hidden)
}
}
bool Window::isSuspended() const
{
return m_suspended;
}
void Window::setSuspended(bool suspended)
{
if (isDeleted()) {
return;
}
if (m_suspended != suspended) {
m_suspended = suspended;
doSetSuspended();
}
}
void Window::doSetSuspended()
{
}
} // namespace KWin
#include "moc_window.cpp"

@ -988,6 +988,9 @@ public:
}
virtual bool isMinimizable() const;
bool isSuspended() const;
void setSuspended(bool suspended);
QRectF fullscreenGeometryRestore() const;
virtual bool isFullScreenable() const;
virtual bool isFullScreen() const;
@ -1502,6 +1505,7 @@ protected:
virtual void doSetQuickTileMode();
virtual void doSetHidden();
virtual void doSetHiddenByShowDesktop();
virtual void doSetSuspended();
void setupWindowManagementInterface();
void destroyWindowManagementInterface();
@ -1753,6 +1757,7 @@ protected:
bool m_keepBelow = false;
bool m_demandsAttention = false;
bool m_minimized = false;
bool m_suspended = false;
QTimer *m_autoRaiseTimer = nullptr;
QTimer *m_shadeHoverTimer = nullptr;
ShadeMode m_shadeMode = ShadeNone;

@ -836,6 +836,17 @@ void XdgToplevelWindow::doFinishInteractiveMoveResize()
}
}
void XdgToplevelWindow::doSetSuspended()
{
if (isSuspended()) {
m_nextStates |= XdgToplevelInterface::State::Suspended;
} else {
m_nextStates &= ~XdgToplevelInterface::State::Suspended;
}
scheduleConfigure();
}
bool XdgToplevelWindow::takeFocus()
{
if (wantsInput()) {

@ -178,6 +178,7 @@ protected:
bool acceptsFocus() const override;
Layer layerForDock() const override;
void doSetQuickTileMode() override;
void doSetSuspended() override;
private:
void handleWindowTitleChanged();

Loading…
Cancel
Save