Add a themed icon name to PlasmaWindow interface
Server can set a themed icon name, client gets it directly turned into a QIcon. That only works with QGuiApplications as can be seen in the adjusted paneltest.
This commit is contained in:
parent
2f02ee45cf
commit
42a1e1e99e
3 changed files with 28 additions and 2 deletions
|
@ -65,6 +65,7 @@ public:
|
|||
void createResource(wl_resource *parent);
|
||||
void setTitle(const QString &title);
|
||||
void setAppId(const QString &appId);
|
||||
void setThemedIconName(const QString &iconName);
|
||||
void setVirtualDesktop(quint32 desktop);
|
||||
void unmap();
|
||||
void setState(org_kde_plasma_window_management_state flag, bool set);
|
||||
|
@ -89,6 +90,7 @@ private:
|
|||
PlasmaWindowManagementInterface *wm;
|
||||
QString m_title;
|
||||
QString m_appId;
|
||||
QString m_themedIconName;
|
||||
quint32 m_virtualDesktop = 0;
|
||||
quint32 m_state = 0;
|
||||
wl_listener listener;
|
||||
|
@ -277,6 +279,7 @@ void PlasmaWindowInterface::Private::createResource(wl_resource *parent)
|
|||
org_kde_plasma_window_send_title_changed(resource, m_title.toUtf8().constData());
|
||||
}
|
||||
org_kde_plasma_window_send_state_changed(resource, m_state);
|
||||
org_kde_plasma_window_send_themed_icon_name_changed(resource, m_themedIconName.toUtf8().constData());
|
||||
c->flush();
|
||||
}
|
||||
|
||||
|
@ -292,6 +295,18 @@ void PlasmaWindowInterface::Private::setAppId(const QString &appId)
|
|||
}
|
||||
}
|
||||
|
||||
void PlasmaWindowInterface::Private::setThemedIconName(const QString &iconName)
|
||||
{
|
||||
if (m_themedIconName == iconName) {
|
||||
return;
|
||||
}
|
||||
m_themedIconName = iconName;
|
||||
const QByteArray utf8 = m_themedIconName.toUtf8();
|
||||
for (auto it = resources.constBegin(); it != resources.constEnd(); ++it) {
|
||||
org_kde_plasma_window_send_themed_icon_name_changed((*it).resource, utf8.constData());
|
||||
}
|
||||
}
|
||||
|
||||
void PlasmaWindowInterface::Private::setTitle(const QString &title)
|
||||
{
|
||||
if (m_title == title) {
|
||||
|
@ -481,5 +496,10 @@ void PlasmaWindowInterface::setMinimizeable(bool set)
|
|||
d->setState(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MINIMIZABLE, set);
|
||||
}
|
||||
|
||||
void PlasmaWindowInterface::setThemedIconName(const QString &iconName)
|
||||
{
|
||||
d->setThemedIconName(iconName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
void setMinimizeable(bool set);
|
||||
void setMaximizeable(bool set);
|
||||
void setFullscreenable(bool set);
|
||||
void setThemedIconName(const QString &iconName);
|
||||
|
||||
void unmap();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../src/client/shm_pool.h"
|
||||
#include "../src/client/surface.h"
|
||||
// Qt
|
||||
#include <QCoreApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QImage>
|
||||
|
@ -230,6 +230,11 @@ void PanelTest::setupRegistry(Registry *registry)
|
|||
qDebug() << "Window is fullscreenable changed: " << w->isFullscreenable();
|
||||
}
|
||||
);
|
||||
connect(w, &PlasmaWindow::iconChanged, this,
|
||||
[w] {
|
||||
qDebug() << "Window icon changed: " << w->icon().name();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -275,7 +280,7 @@ void PanelTest::render()
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
QGuiApplication app(argc, argv);
|
||||
PanelTest client;
|
||||
client.init();
|
||||
|
||||
|
|
Loading…
Reference in a new issue