2009-01-29 15:11:17 +00:00
|
|
|
#include <kcmdlineargs.h>
|
|
|
|
#include <kapplication.h>
|
|
|
|
#include <kdebug.h>
|
|
|
|
#include <kaboutdata.h>
|
|
|
|
#include <kwindowsystem.h>
|
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qgridlayout.h>
|
|
|
|
#include <netwm.h>
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
KAboutData about("a", "b", ki18n("c"), "d");
|
|
|
|
KCmdLineArgs::init(argc, argv, &about);
|
2009-01-29 15:11:17 +00:00
|
|
|
KCmdLineOptions args;
|
2011-01-30 14:34:42 +00:00
|
|
|
args.add("window <n>", ki18n("Window to show icons for"));
|
|
|
|
KCmdLineArgs::addCmdLineOptions(args);
|
2009-01-29 15:11:17 +00:00
|
|
|
KApplication app;
|
|
|
|
QWidget w;
|
2011-01-30 14:34:42 +00:00
|
|
|
QGridLayout l(&w);
|
|
|
|
l.setSpacing(5);
|
|
|
|
WId window = KCmdLineArgs::parsedArgs()->getOption("window").toLong();
|
|
|
|
NETWinInfo info(QX11Info::display(), window, QX11Info::appRootWindow(), NET::WMIcon);
|
2009-01-29 15:11:17 +00:00
|
|
|
const int* sizes = info.iconSizes();
|
|
|
|
int i = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
for (;
|
|
|
|
sizes[ i * 2 ] != 0;
|
|
|
|
++i) {
|
2009-01-29 15:11:17 +00:00
|
|
|
int width = sizes[ i * 2 ];
|
|
|
|
int height = sizes[ i * 2 + 1 ];
|
2011-01-30 14:34:42 +00:00
|
|
|
l.addWidget(new QLabel(QString("EWMH: %1x%2").arg(width).arg(height), &w), 0, i);
|
|
|
|
QLabel* ll = new QLabel(&w);
|
|
|
|
ll->setPixmap(KWindowSystem::icon(window, width, height, KWindowSystem::NETWM));
|
|
|
|
l.addWidget(ll, 1, i, Qt::AlignCenter);
|
|
|
|
}
|
2009-01-29 15:11:17 +00:00
|
|
|
QLabel* ll;
|
2011-01-30 14:34:42 +00:00
|
|
|
l.addWidget(new QLabel("ICCCM", &w), 0, i);
|
|
|
|
ll = new QLabel(&w);
|
|
|
|
ll->setPixmap(KWindowSystem::icon(window, -1, -1, KWindowSystem::WMHints));
|
|
|
|
l.addWidget(ll, 1, i, Qt::AlignCenter);
|
2009-01-29 15:11:17 +00:00
|
|
|
++i;
|
2011-01-30 14:34:42 +00:00
|
|
|
l.addWidget(new QLabel("CLASS", &w), 0, i);
|
|
|
|
ll = new QLabel(&w);
|
|
|
|
ll->setPixmap(KWindowSystem::icon(window, -1, -1, KWindowSystem::WMHints));
|
|
|
|
l.addWidget(ll, 1, i, Qt::AlignCenter);
|
2009-01-29 15:11:17 +00:00
|
|
|
w.show();
|
|
|
|
return app.exec();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|