[wayland] Pass appId to PlasmaWindow interface

For the appId we use:
* wl_shell windowClass for Wayland clients
* resourceName from window class for X11 clients

This is implemented by sharing the window class implementation in
Toplevel.

CCMAIL: hein@kde.org
This commit is contained in:
Martin Gräßlin 2015-07-20 09:37:36 +02:00
parent 105cda7769
commit 01d805f193
4 changed files with 21 additions and 2 deletions

View file

@ -546,6 +546,7 @@ void AbstractClient::setupWindowManagementInterface()
w->setMinimizeable(isMinimizable());
w->setFullscreenable(isFullScreenable());
w->setThemedIconName(icon().name().isEmpty() ? QStringLiteral("xorg") : icon().name());
w->setAppId(QString::fromUtf8(resourceName()));
connect(this, &AbstractClient::captionChanged, w, [w, this] { w->setTitle(caption()); });
connect(this, &AbstractClient::desktopChanged, w,
[w, this] {
@ -575,6 +576,11 @@ void AbstractClient::setupWindowManagementInterface()
w->setThemedIconName(i.name().isEmpty() ? QStringLiteral("xorg") : i.name());
}
);
connect(this, &AbstractClient::windowClassChanged, w,
[w, this] {
w->setAppId(QString::fromUtf8(resourceName()));
}
);
connect(w, &PlasmaWindowInterface::closeRequested, this, [this] { closeWindow(); });
connect(w, &PlasmaWindowInterface::virtualDesktopRequested, this,
[this] (quint32 desktop) {

View file

@ -93,6 +93,13 @@ ShellClient::ShellClient(ShellSurfaceInterface *surface)
// setup shadow integration
getShadow();
connect(surface->surface(), &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow);
setResourceClass(surface->windowClass());
connect(surface, &ShellSurfaceInterface::windowClassChanged, this,
[this] {
setResourceClass(m_shellSurface->windowClass());
}
);
}
ShellClient::~ShellClient() = default;

View file

@ -226,8 +226,13 @@ Window Toplevel::wmClientLeader() const
void Toplevel::getResourceClass()
{
resource_name = QByteArray(info->windowClassName()).toLower();
resource_class = QByteArray(info->windowClassClass()).toLower();
setResourceClass(QByteArray(info->windowClassName()).toLower(), QByteArray(info->windowClassClass()).toLower());
}
void Toplevel::setResourceClass(const QByteArray &name, const QByteArray &className)
{
resource_name = name;
resource_class = className;
emit windowClassChanged();
}

View file

@ -457,6 +457,7 @@ protected:
void getWmOpaqueRegion();
void getResourceClass();
void setResourceClass(const QByteArray &name, const QByteArray &className = QByteArray());
Xcb::Property fetchSkipCloseAnimation() const;
void readSkipCloseAnimation(Xcb::Property &prop);
void getSkipCloseAnimation();