mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 03:12:56 +00:00
optimize QSystemTrayIconSys::locateSystemTray() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d544f49526
commit
5a51e6ec4f
1 changed files with 8 additions and 6 deletions
|
@ -32,24 +32,27 @@
|
||||||
#include "qtimer.h"
|
#include "qtimer.h"
|
||||||
#include "qsystemtrayicon_p.h"
|
#include "qsystemtrayicon_p.h"
|
||||||
#include "qpaintengine.h"
|
#include "qpaintengine.h"
|
||||||
|
#include "qcorecommon_p.h"
|
||||||
|
|
||||||
#ifndef QT_NO_SYSTEMTRAYICON
|
#ifndef QT_NO_SYSTEMTRAYICON
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
Window QSystemTrayIconSys::sysTrayWindow = XNone;
|
Window QSystemTrayIconSys::sysTrayWindow = XNone;
|
||||||
QList<QSystemTrayIconSys *> QSystemTrayIconSys::trayIcons;
|
QList<QSystemTrayIconSys *> QSystemTrayIconSys::trayIcons;
|
||||||
QCoreApplication::EventFilter QSystemTrayIconSys::oldEventFilter = 0;
|
QCoreApplication::EventFilter QSystemTrayIconSys::oldEventFilter = 0;
|
||||||
Atom QSystemTrayIconSys::sysTraySelection = XNone;
|
Atom QSystemTrayIconSys::sysTraySelection = XNone;
|
||||||
XVisualInfo QSystemTrayIconSys::sysTrayVisual = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
XVisualInfo QSystemTrayIconSys::sysTrayVisual = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
// Locate the system tray
|
// Locate the system tray
|
||||||
Window QSystemTrayIconSys::locateSystemTray()
|
Window QSystemTrayIconSys::locateSystemTray()
|
||||||
{
|
{
|
||||||
Display *display = QX11Info::display();
|
Display *display = QX11Info::display();
|
||||||
if (sysTraySelection == XNone) {
|
if (sysTraySelection == XNone) {
|
||||||
int screen = QX11Info::appScreen();
|
const int screen = QX11Info::appScreen();
|
||||||
QString net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen);
|
QSTACKARRAY(char, snprintfbuf, 32);
|
||||||
sysTraySelection = XInternAtom(display, net_sys_tray.toLatin1(), False);
|
::snprintf(snprintfbuf, sizeof(snprintfbuf), "_NET_SYSTEM_TRAY_S%i", screen);
|
||||||
|
sysTraySelection = XInternAtom(display, snprintfbuf, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
return XGetSelectionOwner(QX11Info::display(), sysTraySelection);
|
return XGetSelectionOwner(QX11Info::display(), sysTraySelection);
|
||||||
|
@ -366,6 +369,5 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &message, const QStri
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif //QT_NO_SYSTEMTRAYICON
|
#endif //QT_NO_SYSTEMTRAYICON
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue