1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 10:16:34 +01:00

X11: Set correct WM_CLASS property to windows

Closes #968
This commit is contained in:
nowrep 2013-07-07 12:32:55 +02:00
parent 166a7fedd4
commit dccf8d9787
8 changed files with 38 additions and 2 deletions

View File

@ -18,6 +18,7 @@ Version 1.5.0
* GreaseMonkey: fixed userscripts when first loading plugin
* oxygen: set rounded corners for tooltips
* oxygen: workaround for transparent background of tooltips
* X11: Set correct WM_CLASS property to windows
* fixed: size of preferences dialog on low-res screens
* fixed: loading plugins with relative paths in portable build

View File

@ -152,6 +152,10 @@ QupZilla::QupZilla(Qz::BrowserWindow type, QUrl startUrl)
connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(receiveMessage(Qz::AppMessageType,bool)));
QTimer::singleShot(0, this, SLOT(postLaunch()));
#if defined(QZ_WS_X11) && !defined(NO_X11)
QzTools::setWmClass("Browser", this);
#endif
}
void QupZilla::openWithTab(WebTab* tab)

View File

@ -76,6 +76,10 @@ 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()

View File

@ -58,6 +58,11 @@ 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)

View File

@ -480,6 +480,10 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
#if QTWEBKIT_TO_2_2
ui->html5permissions->setDisabled(true);
#endif
#if defined(QZ_WS_X11) && !defined(NO_X11)
QzTools::setWmClass("Preferences", this);
#endif
}
void Preferences::showStackedPage(QListWidgetItem* item)

View File

@ -44,6 +44,8 @@
#include <qpa/qplatformnativeinterface.h>
#elif !defined(NO_X11)
#include <QX11Info>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
#ifdef Q_OS_WIN
@ -645,7 +647,7 @@ QString QzTools::escape(const QString &string)
}
#if defined(QZ_WS_X11) && !defined(NO_X11)
void* QzTools::X11Display(const QWidget* widget)
Display* QzTools::X11Display(const QWidget* widget)
{
Q_UNUSED(widget)
@ -655,6 +657,17 @@ void* QzTools::X11Display(const QWidget* widget)
return QX11Info::display();
#endif
}
void QzTools::setWmClass(const QString &name, const QWidget* widget)
{
char* namestr = (char*) malloc(name.size() + 1);
strncpy(namestr, name.toUtf8().constData(), name.size() + 1);
XClassHint classHint;
classHint.res_name = namestr;
classHint.res_class = const_cast<char*>("QupZilla");
XSetClassHint(X11Display(widget), widget->winId(), &classHint);
}
#endif
QString QzTools::operatingSystem()

View File

@ -74,7 +74,8 @@ bool QT_QUPZILLA_EXPORT isCertificateValid(const QSslCertificate &cert);
QString QT_QUPZILLA_EXPORT escape(const QString &string);
#if defined(QZ_WS_X11) && !defined(NO_X11)
void QT_QUPZILLA_EXPORT* X11Display(const QWidget* widget);
Display* X11Display(const QWidget* widget);
void QT_QUPZILLA_EXPORT setWmClass(const QString &name, const QWidget* widget);
#endif
template <typename T>

View File

@ -176,6 +176,10 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
ui->treeImages->sortByColumn(-1);
ui->treeTags->sortByColumn(-1);
#if defined(QZ_WS_X11) && !defined(NO_X11)
QzTools::setWmClass("Site Info", this);
#endif
}
void SiteInfo::imagesCustomContextMenuRequested(const QPoint &p)