wayland: implement plasmawindowmanagement v18
This commit is contained in:
parent
a6e429f348
commit
ae336e464e
3 changed files with 40 additions and 1 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace KWin
|
||||
{
|
||||
static const quint32 s_version = 17;
|
||||
static const quint32 s_version = 18;
|
||||
static const quint32 s_activationVersion = 1;
|
||||
|
||||
class PlasmaWindowManagementInterfacePrivate : public QtWaylandServer::org_kde_plasma_window_management
|
||||
|
@ -81,6 +81,7 @@ public:
|
|||
void setResourceName(const QString &resourceName);
|
||||
void sendInitialState(Resource *resource);
|
||||
wl_resource *resourceForParent(PlasmaWindowInterface *parent, Resource *child) const;
|
||||
void setClientGeometry(const QRect &geometry);
|
||||
|
||||
quint32 windowId = 0;
|
||||
QHash<SurfaceInterface *, QRect> minimizedGeometries;
|
||||
|
@ -103,6 +104,7 @@ public:
|
|||
quint32 m_state = 0;
|
||||
QString uuid;
|
||||
QString m_resourceName;
|
||||
QRect clientGeometry;
|
||||
|
||||
protected:
|
||||
Resource *org_kde_plasma_window_allocate() override;
|
||||
|
@ -432,6 +434,10 @@ void PlasmaWindowInterfacePrivate::sendInitialState(Resource *resource)
|
|||
send_resource_name_changed(resource->handle, m_resourceName);
|
||||
}
|
||||
}
|
||||
|
||||
if (clientGeometry.isValid() && resource->version() >= ORG_KDE_PLASMA_WINDOW_CLIENT_GEOMETRY_SINCE_VERSION) {
|
||||
send_client_geometry(resource->handle, clientGeometry.x(), clientGeometry.y(), clientGeometry.width(), clientGeometry.height());
|
||||
}
|
||||
}
|
||||
|
||||
void PlasmaWindowInterfacePrivate::setAppId(const QString &appId)
|
||||
|
@ -1139,6 +1145,29 @@ void PlasmaWindowActivationInterface::sendAppId(const QString &appid)
|
|||
}
|
||||
}
|
||||
|
||||
void PlasmaWindowInterface::setClientGeometry(const QRect &geometry)
|
||||
{
|
||||
d->setClientGeometry(geometry);
|
||||
}
|
||||
|
||||
void PlasmaWindowInterfacePrivate::setClientGeometry(const QRect &geometry)
|
||||
{
|
||||
if (clientGeometry == geometry) {
|
||||
return;
|
||||
}
|
||||
clientGeometry = geometry;
|
||||
if (!clientGeometry.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
if (resource->version() < ORG_KDE_PLASMA_WINDOW_CLIENT_GEOMETRY_SINCE_VERSION) {
|
||||
continue;
|
||||
}
|
||||
send_client_geometry(resource->handle, clientGeometry.x(), clientGeometry.y(), clientGeometry.width(), clientGeometry.height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_plasmawindowmanagement.cpp"
|
||||
|
|
|
@ -227,6 +227,11 @@ public:
|
|||
*/
|
||||
QString uuid() const;
|
||||
|
||||
/**
|
||||
* Set the client geometry (i.e. without window border/style)
|
||||
*/
|
||||
void setClientGeometry(const QRect &geometry);
|
||||
|
||||
Q_SIGNALS:
|
||||
void closeRequested();
|
||||
void moveRequested();
|
||||
|
@ -289,6 +294,7 @@ Q_SIGNALS:
|
|||
* Requests sending the window to @p output
|
||||
*/
|
||||
void sendToOutput(KWin::OutputInterface *output);
|
||||
void clientGeometryChanged(const QRect &geometry);
|
||||
|
||||
private:
|
||||
friend class PlasmaWindowManagementInterface;
|
||||
|
|
|
@ -1794,6 +1794,7 @@ void Window::setupWindowManagementInterface()
|
|||
w->setVirtualDesktopChangeable(true); // FIXME Matches X11Window::actionSupported(), but both should be implemented.
|
||||
w->setParentWindow(transientFor() ? transientFor()->windowManagementInterface() : nullptr);
|
||||
w->setGeometry(frameGeometry().toRect());
|
||||
w->setClientGeometry(clientGeometry().toRect());
|
||||
connect(this, &Window::skipTaskbarChanged, w, [w, this]() {
|
||||
w->setSkipTaskbar(skipTaskbar());
|
||||
});
|
||||
|
@ -1835,6 +1836,9 @@ void Window::setupWindowManagementInterface()
|
|||
connect(this, &Window::frameGeometryChanged, w, [w, this]() {
|
||||
w->setGeometry(frameGeometry().toRect());
|
||||
});
|
||||
connect(this, &Window::clientGeometryChanged, w, [w, this]() {
|
||||
w->setClientGeometry(clientGeometry().toRect());
|
||||
});
|
||||
connect(this, &Window::applicationMenuChanged, w, [w, this]() {
|
||||
w->setApplicationMenuPaths(applicationMenuServiceName(), applicationMenuObjectPath());
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue