Move implementation of iconGeometry from ShellClient to AbstractClient
Summary: This allows Client to use the Wayland-specific implementation if there is no icon geometry set through the X11 way. That way Xwayland windows have an icon geometry even if Plasma is using Wayland and setting the icon geometry in the Wayland way. Which is expected as Plasma is ignorant about the windowing system a PlasmaWindow uses. In order to move the code from ShellClient to AbstractClient WaylandServer gained a new findAbstractClient(Surface*) method which is just like findClient(Surface*) with the difference that it returns an AbstractClient instead of a ShellClient*. Test Plan: minimized/unminimized an X client on Wayland, verified animation is correct (though broken in general for minimize) Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2530
This commit is contained in:
parent
af80a546bf
commit
455c5c07a0
7 changed files with 37 additions and 32 deletions
|
@ -1598,4 +1598,33 @@ void AbstractClient::leaveEvent()
|
|||
// TODO: handle Options::FocusStrictlyUnderMouse
|
||||
}
|
||||
|
||||
QRect AbstractClient::iconGeometry() const
|
||||
{
|
||||
if (!windowManagementInterface() || !waylandServer()) {
|
||||
// window management interface is only available if the surface is mapped
|
||||
return QRect();
|
||||
}
|
||||
|
||||
int minDistance = INT_MAX;
|
||||
AbstractClient *candidatePanel = nullptr;
|
||||
QRect candidateGeom;
|
||||
|
||||
for (auto i = windowManagementInterface()->minimizedGeometries().constBegin(), end = windowManagementInterface()->minimizedGeometries().constEnd(); i != end; ++i) {
|
||||
AbstractClient *client = waylandServer()->findAbstractClient(i.key());
|
||||
if (!client) {
|
||||
continue;
|
||||
}
|
||||
const int distance = QPoint(client->pos() - pos()).manhattanLength();
|
||||
if (distance < minDistance) {
|
||||
minDistance = distance;
|
||||
candidatePanel = client;
|
||||
candidateGeom = i.value();
|
||||
}
|
||||
}
|
||||
if (!candidatePanel) {
|
||||
return QRect();
|
||||
}
|
||||
return candidateGeom.translated(candidatePanel->pos());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ public:
|
|||
virtual bool isShadeable() const;
|
||||
virtual bool isMaximizable() const = 0;
|
||||
virtual bool isMinimizable() const = 0;
|
||||
virtual QRect iconGeometry() const = 0;
|
||||
virtual QRect iconGeometry() const;
|
||||
virtual bool userCanSetFullScreen() const = 0;
|
||||
virtual bool userCanSetNoBorder() const = 0;
|
||||
virtual void setOnAllActivities(bool set) = 0;
|
||||
|
|
|
@ -737,7 +737,7 @@ QRect Client::iconGeometry() const
|
|||
return geom;
|
||||
}
|
||||
// No mainwindow (or their parents) with icon geometry was found
|
||||
return QRect();
|
||||
return AbstractClient::iconGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -581,35 +581,6 @@ bool ShellClient::isMinimizable() const
|
|||
return (!m_plasmaShellSurface || m_plasmaShellSurface->role() == PlasmaShellSurfaceInterface::Role::Normal);
|
||||
}
|
||||
|
||||
QRect ShellClient::iconGeometry() const
|
||||
{
|
||||
if (!windowManagementInterface()) {
|
||||
// window management interface is only available if the surface is mapped
|
||||
return QRect();
|
||||
}
|
||||
|
||||
int minDistance = INT_MAX;
|
||||
ShellClient *candidatePanel = nullptr;
|
||||
QRect candidateGeom;
|
||||
|
||||
for (auto i = windowManagementInterface()->minimizedGeometries().constBegin(), end = windowManagementInterface()->minimizedGeometries().constEnd(); i != end; ++i) {
|
||||
ShellClient *client = waylandServer()->findClient(i.key());
|
||||
if (!client) {
|
||||
continue;
|
||||
}
|
||||
const int distance = QPoint(client->pos() - pos()).manhattanLength();
|
||||
if (distance < minDistance) {
|
||||
minDistance = distance;
|
||||
candidatePanel = client;
|
||||
candidateGeom = i.value();
|
||||
}
|
||||
}
|
||||
if (!candidatePanel) {
|
||||
return QRect();
|
||||
}
|
||||
return candidateGeom.translated(candidatePanel->pos());
|
||||
}
|
||||
|
||||
bool ShellClient::isMovable() const
|
||||
{
|
||||
if (m_plasmaShellSurface) {
|
||||
|
|
|
@ -69,7 +69,6 @@ public:
|
|||
bool isFullScreen() const override;
|
||||
bool isMaximizable() const override;
|
||||
bool isMinimizable() const override;
|
||||
QRect iconGeometry() const override;
|
||||
bool isMovable() const override;
|
||||
bool isMovableAcrossScreens() const override;
|
||||
bool isResizable() const override;
|
||||
|
|
|
@ -561,6 +561,11 @@ ShellClient *WaylandServer::findClient(SurfaceInterface *surface) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
AbstractClient *WaylandServer::findAbstractClient(SurfaceInterface *surface) const
|
||||
{
|
||||
return findClient(surface);
|
||||
}
|
||||
|
||||
ShellClient *WaylandServer::findClient(QWindow *w) const
|
||||
{
|
||||
if (!w) {
|
||||
|
|
|
@ -108,6 +108,7 @@ public:
|
|||
void removeClient(ShellClient *c);
|
||||
ShellClient *findClient(quint32 id) const;
|
||||
ShellClient *findClient(KWayland::Server::SurfaceInterface *surface) const;
|
||||
AbstractClient *findAbstractClient(KWayland::Server::SurfaceInterface *surface) const;
|
||||
ShellClient *findClient(QWindow *w) const;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue