From 7e00f73dafc65499e820e69879738b74c5e3e6d2 Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 8 Jul 2013 00:08:05 +0200 Subject: [PATCH] Define QzTools::setWmClass on all platforms. Get rid of #ifdef's and make it do nothing on non X11. --- src/lib/app/qupzilla.cpp | 2 -- src/lib/cookies/cookiemanager.cpp | 2 -- src/lib/other/browsinglibrary.cpp | 3 --- src/lib/preferences/preferences.cpp | 2 -- src/lib/tools/qztools.cpp | 7 ++++++- src/lib/tools/qztools.h | 3 ++- src/lib/webview/siteinfo.cpp | 2 -- 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 955055284..5b4425cf2 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -153,9 +153,7 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl) QTimer::singleShot(0, this, SLOT(postLaunch())); -#if defined(QZ_WS_X11) && !defined(NO_X11) QzTools::setWmClass("Browser", this); -#endif } void QupZilla::openWithTab(WebTab* tab) diff --git a/src/lib/cookies/cookiemanager.cpp b/src/lib/cookies/cookiemanager.cpp index c3cfd58da..c926c436a 100644 --- a/src/lib/cookies/cookiemanager.cpp +++ b/src/lib/cookies/cookiemanager.cpp @@ -77,9 +77,7 @@ CookieManager::CookieManager(QWidget* parent) QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this); connect(removeShortcut, SIGNAL(activated()), this, SLOT(deletePressed())); -#if defined(QZ_WS_X11) && !defined(NO_X11) QzTools::setWmClass("Cookies", this); -#endif } void CookieManager::removeAll() diff --git a/src/lib/other/browsinglibrary.cpp b/src/lib/other/browsinglibrary.cpp index b6c19c3d5..01987cbdf 100644 --- a/src/lib/other/browsinglibrary.cpp +++ b/src/lib/other/browsinglibrary.cpp @@ -59,10 +59,7 @@ BrowsingLibrary::BrowsingLibrary(QupZilla* mainClass, QWidget* parent) connect(ui->tabs, SIGNAL(CurrentChanged(int)), this, SLOT(currentIndexChanged(int))); connect(ui->searchLine, SIGNAL(textChanged(QString)), this, SLOT(search())); - -#if defined(QZ_WS_X11) && !defined(NO_X11) QzTools::setWmClass("Browsing Library", this); -#endif } void BrowsingLibrary::currentIndexChanged(int index) diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 7fcd2da42..6c768a6c4 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -481,9 +481,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) ui->html5permissions->setDisabled(true); #endif -#if defined(QZ_WS_X11) && !defined(NO_X11) QzTools::setWmClass("Preferences", this); -#endif } void Preferences::showStackedPage(QListWidgetItem* item) diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index 09b29a4be..4fa2477cf 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -657,17 +657,22 @@ Display* QzTools::X11Display(const QWidget* widget) return QX11Info::display(); #endif } +#endif void QzTools::setWmClass(const QString &name, const QWidget* widget) { +#if defined(QZ_WS_X11) && !defined(NO_X11) QByteArray nameData = name.toUtf8(); XClassHint classHint; classHint.res_name = const_cast(nameData.constData()); classHint.res_class = const_cast("QupZilla"); XSetClassHint(X11Display(widget), widget->winId(), &classHint); -} +#else + Q_UNUSED(name) + Q_UNUSED(widget) #endif +} QString QzTools::operatingSystem() { diff --git a/src/lib/tools/qztools.h b/src/lib/tools/qztools.h index 3ad25a05d..4f1b3f790 100644 --- a/src/lib/tools/qztools.h +++ b/src/lib/tools/qztools.h @@ -75,9 +75,10 @@ QString QT_QUPZILLA_EXPORT escape(const QString &string); #if defined(QZ_WS_X11) && !defined(NO_X11) Display* X11Display(const QWidget* widget); -void QT_QUPZILLA_EXPORT setWmClass(const QString &name, const QWidget* widget); #endif +void QT_QUPZILLA_EXPORT setWmClass(const QString &name, const QWidget* widget); + template bool listContainsIndex(const QList &list, int index) { diff --git a/src/lib/webview/siteinfo.cpp b/src/lib/webview/siteinfo.cpp index a86e93502..6881801ab 100644 --- a/src/lib/webview/siteinfo.cpp +++ b/src/lib/webview/siteinfo.cpp @@ -177,9 +177,7 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent) ui->treeTags->sortByColumn(-1); -#if defined(QZ_WS_X11) && !defined(NO_X11) QzTools::setWmClass("Site Info", this); -#endif } void SiteInfo::imagesCustomContextMenuRequested(const QPoint &p)