1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36: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 * GreaseMonkey: fixed userscripts when first loading plugin
* oxygen: set rounded corners for tooltips * oxygen: set rounded corners for tooltips
* oxygen: workaround for transparent background of 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: size of preferences dialog on low-res screens
* fixed: loading plugins with relative paths in portable build * 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))); connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(receiveMessage(Qz::AppMessageType,bool)));
QTimer::singleShot(0, this, SLOT(postLaunch())); QTimer::singleShot(0, this, SLOT(postLaunch()));
#if defined(QZ_WS_X11) && !defined(NO_X11)
QzTools::setWmClass("Browser", this);
#endif
} }
void QupZilla::openWithTab(WebTab* tab) void QupZilla::openWithTab(WebTab* tab)

View File

@ -76,6 +76,10 @@ CookieManager::CookieManager(QWidget* parent)
QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this); QShortcut* removeShortcut = new QShortcut(QKeySequence("Del"), this);
connect(removeShortcut, SIGNAL(activated()), this, SLOT(deletePressed())); connect(removeShortcut, SIGNAL(activated()), this, SLOT(deletePressed()));
#if defined(QZ_WS_X11) && !defined(NO_X11)
QzTools::setWmClass("Cookies", this);
#endif
} }
void CookieManager::removeAll() 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->tabs, SIGNAL(CurrentChanged(int)), this, SLOT(currentIndexChanged(int)));
connect(ui->searchLine, SIGNAL(textChanged(QString)), this, SLOT(search())); 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) void BrowsingLibrary::currentIndexChanged(int index)

View File

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

View File

@ -44,6 +44,8 @@
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#elif !defined(NO_X11) #elif !defined(NO_X11)
#include <QX11Info> #include <QX11Info>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -645,7 +647,7 @@ QString QzTools::escape(const QString &string)
} }
#if defined(QZ_WS_X11) && !defined(NO_X11) #if defined(QZ_WS_X11) && !defined(NO_X11)
void* QzTools::X11Display(const QWidget* widget) Display* QzTools::X11Display(const QWidget* widget)
{ {
Q_UNUSED(widget) Q_UNUSED(widget)
@ -655,6 +657,17 @@ void* QzTools::X11Display(const QWidget* widget)
return QX11Info::display(); return QX11Info::display();
#endif #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 #endif
QString QzTools::operatingSystem() 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); QString QT_QUPZILLA_EXPORT escape(const QString &string);
#if defined(QZ_WS_X11) && !defined(NO_X11) #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 #endif
template <typename T> template <typename T>

View File

@ -176,6 +176,10 @@ SiteInfo::SiteInfo(WebView* view, QWidget* parent)
ui->treeImages->sortByColumn(-1); ui->treeImages->sortByColumn(-1);
ui->treeTags->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) void SiteInfo::imagesCustomContextMenuRequested(const QPoint &p)