|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.cpp.systemtrayicon qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.cpp
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.cpp.systemtrayicon 2014-03-30 15:36:45.000000000 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.cpp 2014-03-31 18:16:39.707974934 -0500
|
|
|
462c49 |
@@ -158,15 +158,23 @@ void Window::createIconGroupBox()
|
|
|
462c49 |
iconComboBox->addItem(QIcon(":/images/bad.svg"), tr("Bad"));
|
|
|
462c49 |
iconComboBox->addItem(QIcon(":/images/heart.svg"), tr("Heart"));
|
|
|
462c49 |
iconComboBox->addItem(QIcon(":/images/trash.svg"), tr("Trash"));
|
|
|
462c49 |
+ iconComboBox->addItem(QIcon::fromTheme("system-file-manager"), tr("File Manager"));
|
|
|
462c49 |
|
|
|
462c49 |
showIconCheckBox = new QCheckBox(tr("Show icon"));
|
|
|
462c49 |
showIconCheckBox->setChecked(true);
|
|
|
462c49 |
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+ jitToolTipCheckBox = new QCheckBox(tr("Just In Time Tooltip"));
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
+
|
|
|
462c49 |
QHBoxLayout *iconLayout = new QHBoxLayout;
|
|
|
462c49 |
iconLayout->addWidget(iconLabel);
|
|
|
462c49 |
iconLayout->addWidget(iconComboBox);
|
|
|
462c49 |
iconLayout->addStretch();
|
|
|
462c49 |
iconLayout->addWidget(showIconCheckBox);
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+ iconLayout->addWidget(jitToolTipCheckBox);
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
iconGroupBox->setLayout(iconLayout);
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
@@ -254,5 +262,37 @@ void Window::createTrayIcon()
|
|
|
462c49 |
trayIconMenu->addAction(quitAction);
|
|
|
462c49 |
|
|
|
462c49 |
trayIcon = new QSystemTrayIcon(this);
|
|
|
462c49 |
+ QByteArray category = qgetenv("SNI_CATEGORY");
|
|
|
462c49 |
+ if (!category.isEmpty()) {
|
|
|
462c49 |
+ trayIcon->setProperty("_qt_sni_category", QString::fromLocal8Bit(category));
|
|
|
462c49 |
+ }
|
|
|
462c49 |
trayIcon->setContextMenu(trayIconMenu);
|
|
|
462c49 |
+
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+ trayIcon->installEventFilter(this);
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+bool Window::eventFilter(QObject *, QEvent *event)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ switch(event->type()) {
|
|
|
462c49 |
+ case QEvent::ToolTip:
|
|
|
462c49 |
+ if (jitToolTipCheckBox->isChecked()) {
|
|
|
462c49 |
+ QString timeString = QTime::currentTime().toString();
|
|
|
462c49 |
+ trayIcon->setToolTip(tr("Current Time: %1").arg(timeString));
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ break;
|
|
|
462c49 |
+ case QEvent::Wheel: {
|
|
|
462c49 |
+ QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event);
|
|
|
462c49 |
+ int delta = wheelEvent->delta() > 0 ? 1 : -1;
|
|
|
462c49 |
+ int index = (iconComboBox->currentIndex() + delta) % iconComboBox->count();
|
|
|
462c49 |
+ iconComboBox->setCurrentIndex(index);
|
|
|
462c49 |
+ break;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ default:
|
|
|
462c49 |
+ break;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ return false;
|
|
|
462c49 |
}
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.h.systemtrayicon qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.h
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.h.systemtrayicon 2014-03-30 15:36:45.000000000 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/examples/desktop/systray/window.h 2014-03-31 18:16:39.707974934 -0500
|
|
|
462c49 |
@@ -69,6 +69,9 @@ public:
|
|
|
462c49 |
|
|
|
462c49 |
protected:
|
|
|
462c49 |
void closeEvent(QCloseEvent *event);
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+ bool eventFilter(QObject *object, QEvent *event);
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
|
|
|
462c49 |
private slots:
|
|
|
462c49 |
void setIcon(int index);
|
|
|
462c49 |
@@ -86,6 +89,9 @@ private:
|
|
|
462c49 |
QLabel *iconLabel;
|
|
|
462c49 |
QComboBox *iconComboBox;
|
|
|
462c49 |
QCheckBox *showIconCheckBox;
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+ QCheckBox *jitToolTipCheckBox;
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
|
|
|
462c49 |
QGroupBox *messageGroupBox;
|
|
|
462c49 |
QLabel *typeLabel;
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys.cpp.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys.cpp
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys.cpp.systemtrayicon 2014-03-31 18:16:39.707974934 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys.cpp 2014-03-31 18:16:39.707974934 -0500
|
|
|
462c49 |
@@ -0,0 +1,65 @@
|
|
|
462c49 |
+/****************************************************************************
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
462c49 |
+** All rights reserved.
|
|
|
462c49 |
+** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** This file is part of the QtGui module of the Qt Toolkit.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
462c49 |
+** GNU Lesser General Public License Usage
|
|
|
462c49 |
+** This file may be used under the terms of the GNU Lesser General Public
|
|
|
462c49 |
+** License version 2.1 as published by the Free Software Foundation and
|
|
|
462c49 |
+** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU Lesser
|
|
|
462c49 |
+** General Public License version 2.1 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** In addition, as a special exception, Nokia gives you certain additional
|
|
|
462c49 |
+** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
462c49 |
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** GNU General Public License Usage
|
|
|
462c49 |
+** Alternatively, this file may be used under the terms of the GNU General
|
|
|
462c49 |
+** Public License version 3.0 as published by the Free Software Foundation
|
|
|
462c49 |
+** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU General
|
|
|
462c49 |
+** Public License version 3.0 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/copyleft/gpl.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Other Usage
|
|
|
462c49 |
+** Alternatively, this file may be used in accordance with the terms and
|
|
|
462c49 |
+** conditions contained in a signed written agreement between you and Nokia.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_END_LICENSE$
|
|
|
462c49 |
+**
|
|
|
462c49 |
+****************************************************************************/
|
|
|
462c49 |
+#ifndef QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
+
|
|
|
462c49 |
+#include "qabstractsystemtrayiconsys_p.h"
|
|
|
462c49 |
+
|
|
|
462c49 |
+
|
|
|
462c49 |
+QSystemTrayIconSysFactoryInterface::QSystemTrayIconSysFactoryInterface()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+/////////////////////////////////////////////////
|
|
|
462c49 |
+QAbstractSystemTrayIconSys::QAbstractSystemTrayIconSys(QSystemTrayIcon *icon)
|
|
|
462c49 |
+: trayIcon(icon)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+QAbstractSystemTrayIconSys::~QAbstractSystemTrayIconSys()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QAbstractSystemTrayIconSys::sendActivated(QSystemTrayIcon::ActivationReason reason)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ qtsystray_sendActivated(trayIcon, reason);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys_p.h.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys_p.h
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys_p.h.systemtrayicon 2014-03-31 18:16:39.708974924 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/qabstractsystemtrayiconsys_p.h 2014-03-31 18:16:39.708974924 -0500
|
|
|
462c49 |
@@ -0,0 +1,106 @@
|
|
|
462c49 |
+/****************************************************************************
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
462c49 |
+** All rights reserved.
|
|
|
462c49 |
+** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** This file is part of the QtGui module of the Qt Toolkit.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
462c49 |
+** GNU Lesser General Public License Usage
|
|
|
462c49 |
+** This file may be used under the terms of the GNU Lesser General Public
|
|
|
462c49 |
+** License version 2.1 as published by the Free Software Foundation and
|
|
|
462c49 |
+** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU Lesser
|
|
|
462c49 |
+** General Public License version 2.1 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** In addition, as a special exception, Nokia gives you certain additional
|
|
|
462c49 |
+** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
462c49 |
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** GNU General Public License Usage
|
|
|
462c49 |
+** Alternatively, this file may be used under the terms of the GNU General
|
|
|
462c49 |
+** Public License version 3.0 as published by the Free Software Foundation
|
|
|
462c49 |
+** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU General
|
|
|
462c49 |
+** Public License version 3.0 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/copyleft/gpl.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Other Usage
|
|
|
462c49 |
+** Alternatively, this file may be used in accordance with the terms and
|
|
|
462c49 |
+** conditions contained in a signed written agreement between you and Nokia.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_END_LICENSE$
|
|
|
462c49 |
+**
|
|
|
462c49 |
+****************************************************************************/
|
|
|
462c49 |
+
|
|
|
462c49 |
+#ifndef QABSTRACTSYSTEMTRAYICONSYS_P_H
|
|
|
462c49 |
+#define QABSTRACTSYSTEMTRAYICONSYS_P_H
|
|
|
462c49 |
+
|
|
|
462c49 |
+//
|
|
|
462c49 |
+// W A R N I N G
|
|
|
462c49 |
+// -------------
|
|
|
462c49 |
+//
|
|
|
462c49 |
+// This file is not part of the Qt API. It exists for the convenience
|
|
|
462c49 |
+// of a number of Qt sources files. This header file may change from
|
|
|
462c49 |
+// version to version without notice, or even be removed.
|
|
|
462c49 |
+//
|
|
|
462c49 |
+// We mean it.
|
|
|
462c49 |
+//
|
|
|
462c49 |
+
|
|
|
462c49 |
+#ifndef QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
+
|
|
|
462c49 |
+#include <qfactoryinterface.h>
|
|
|
462c49 |
+#include <qsystemtrayicon.h>
|
|
|
462c49 |
+
|
|
|
462c49 |
+class QAbstractSystemTrayIconSys;
|
|
|
462c49 |
+
|
|
|
462c49 |
+class Q_GUI_EXPORT QSystemTrayIconSysFactoryInterface : public QObject, public QFactoryInterface
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ Q_OBJECT
|
|
|
462c49 |
+public:
|
|
|
462c49 |
+ QSystemTrayIconSysFactoryInterface();
|
|
|
462c49 |
+ virtual QAbstractSystemTrayIconSys * create(QSystemTrayIcon *) = 0;
|
|
|
462c49 |
+ virtual bool isAvailable() const = 0;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ // \reimp
|
|
|
462c49 |
+ virtual QStringList keys() const { return QStringList() << QLatin1String("default"); }
|
|
|
462c49 |
+
|
|
|
462c49 |
+Q_SIGNALS:
|
|
|
462c49 |
+ void availableChanged(bool);
|
|
|
462c49 |
+};
|
|
|
462c49 |
+
|
|
|
462c49 |
+#define QSystemTrayIconSysFactoryInterface_iid "com.nokia.qt.QSystemTrayIconSysFactoryInterface"
|
|
|
462c49 |
+Q_DECLARE_INTERFACE(QSystemTrayIconSysFactoryInterface, QSystemTrayIconSysFactoryInterface_iid)
|
|
|
462c49 |
+
|
|
|
462c49 |
+class QRect;
|
|
|
462c49 |
+
|
|
|
462c49 |
+class Q_GUI_EXPORT QAbstractSystemTrayIconSys
|
|
|
462c49 |
+{
|
|
|
462c49 |
+public:
|
|
|
462c49 |
+ QAbstractSystemTrayIconSys(QSystemTrayIcon *icon);
|
|
|
462c49 |
+ virtual ~QAbstractSystemTrayIconSys();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ virtual QRect geometry() const = 0;
|
|
|
462c49 |
+ virtual void updateVisibility() = 0;
|
|
|
462c49 |
+ virtual void updateIcon() = 0;
|
|
|
462c49 |
+ virtual void updateToolTip() = 0;
|
|
|
462c49 |
+ virtual void updateMenu() = 0;
|
|
|
462c49 |
+ virtual void showMessage(const QString &title, const QString &message,
|
|
|
462c49 |
+ QSystemTrayIcon::MessageIcon icon, int msecs) = 0;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void sendActivated(QSystemTrayIcon::ActivationReason);
|
|
|
462c49 |
+
|
|
|
462c49 |
+protected:
|
|
|
462c49 |
+ QSystemTrayIcon *trayIcon;
|
|
|
462c49 |
+};
|
|
|
462c49 |
+
|
|
|
462c49 |
+#endif // QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
+
|
|
|
462c49 |
+#endif // QABSTRACTSYSTEMTRAYICONSYS_P_H
|
|
|
462c49 |
+
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon.cpp.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon.cpp
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon.cpp.systemtrayicon 2014-03-30 15:36:49.000000000 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon.cpp 2014-03-31 18:16:39.708974924 -0500
|
|
|
462c49 |
@@ -287,12 +287,6 @@ bool QSystemTrayIcon::isVisible() const
|
|
|
462c49 |
*/
|
|
|
462c49 |
bool QSystemTrayIcon::event(QEvent *e)
|
|
|
462c49 |
{
|
|
|
462c49 |
-#if defined(Q_WS_X11)
|
|
|
462c49 |
- if (e->type() == QEvent::ToolTip) {
|
|
|
462c49 |
- Q_D(QSystemTrayIcon);
|
|
|
462c49 |
- return d->sys->deliverToolTipEvent(e);
|
|
|
462c49 |
- }
|
|
|
462c49 |
-#endif
|
|
|
462c49 |
return QObject::event(e);
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_p.h.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_p.h
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_p.h.systemtrayicon 2014-03-30 15:36:49.000000000 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_p.h 2014-03-31 18:16:39.708974924 -0500
|
|
|
462c49 |
@@ -62,10 +62,17 @@
|
|
|
462c49 |
#include "QtGui/qpixmap.h"
|
|
|
462c49 |
#include "QtCore/qstring.h"
|
|
|
462c49 |
#include "QtCore/qpointer.h"
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+#include "QtCore/qset.h"
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
|
|
|
462c49 |
QT_BEGIN_NAMESPACE
|
|
|
462c49 |
|
|
|
462c49 |
+#if defined(Q_WS_X11)
|
|
|
462c49 |
+class QAbstractSystemTrayIconSys;
|
|
|
462c49 |
+#else
|
|
|
462c49 |
class QSystemTrayIconSys;
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
class QToolButton;
|
|
|
462c49 |
class QLabel;
|
|
|
462c49 |
|
|
|
462c49 |
@@ -75,6 +82,9 @@ class QSystemTrayIconPrivate : public QO
|
|
|
462c49 |
|
|
|
462c49 |
public:
|
|
|
462c49 |
QSystemTrayIconPrivate() : sys(0), visible(false) { }
|
|
|
462c49 |
+ #if defined(Q_WS_X11)
|
|
|
462c49 |
+ ~QSystemTrayIconPrivate();
|
|
|
462c49 |
+ #endif
|
|
|
462c49 |
|
|
|
462c49 |
void install_sys();
|
|
|
462c49 |
void remove_sys();
|
|
|
462c49 |
@@ -90,7 +100,11 @@ public:
|
|
|
462c49 |
QPointer<QMenu> menu;
|
|
|
462c49 |
QIcon icon;
|
|
|
462c49 |
QString toolTip;
|
|
|
462c49 |
+ #if defined(Q_WS_X11)
|
|
|
462c49 |
+ QAbstractSystemTrayIconSys *sys;
|
|
|
462c49 |
+ #else
|
|
|
462c49 |
QSystemTrayIconSys *sys;
|
|
|
462c49 |
+ #endif
|
|
|
462c49 |
bool visible;
|
|
|
462c49 |
};
|
|
|
462c49 |
|
|
|
462c49 |
@@ -123,60 +137,37 @@ private:
|
|
|
462c49 |
};
|
|
|
462c49 |
|
|
|
462c49 |
#if defined(Q_WS_X11)
|
|
|
462c49 |
-QT_BEGIN_INCLUDE_NAMESPACE
|
|
|
462c49 |
-#include <QtCore/qcoreapplication.h>
|
|
|
462c49 |
-#include <X11/Xlib.h>
|
|
|
462c49 |
-#include <X11/Xatom.h>
|
|
|
462c49 |
-#include <X11/Xutil.h>
|
|
|
462c49 |
-QT_END_INCLUDE_NAMESPACE
|
|
|
462c49 |
+class QSystemTrayIconSysFactoryInterface;
|
|
|
462c49 |
|
|
|
462c49 |
-class QSystemTrayIconSys : public QWidget
|
|
|
462c49 |
+/**
|
|
|
462c49 |
+ * This class acts as a composite QSystemTrayIconSysFactory: It can create
|
|
|
462c49 |
+ * instances of QAbstractSystemTrayIconSys* using either a plugin or the
|
|
|
462c49 |
+ * builtin factory and will cause QSystemTrayIconPrivate to recreate their
|
|
|
462c49 |
+ * 'sys' instances if the plugin availability changes.
|
|
|
462c49 |
+ */
|
|
|
462c49 |
+class QSystemTrayIconSysFactory : public QObject
|
|
|
462c49 |
{
|
|
|
462c49 |
- friend class QSystemTrayIconPrivate;
|
|
|
462c49 |
-
|
|
|
462c49 |
+ Q_OBJECT
|
|
|
462c49 |
public:
|
|
|
462c49 |
- QSystemTrayIconSys(QSystemTrayIcon *q);
|
|
|
462c49 |
- ~QSystemTrayIconSys();
|
|
|
462c49 |
- enum {
|
|
|
462c49 |
- SYSTEM_TRAY_REQUEST_DOCK = 0,
|
|
|
462c49 |
- SYSTEM_TRAY_BEGIN_MESSAGE = 1,
|
|
|
462c49 |
- SYSTEM_TRAY_CANCEL_MESSAGE =2
|
|
|
462c49 |
- };
|
|
|
462c49 |
-
|
|
|
462c49 |
- void addToTray();
|
|
|
462c49 |
- void updateIcon();
|
|
|
462c49 |
- XVisualInfo* getSysTrayVisualInfo();
|
|
|
462c49 |
-
|
|
|
462c49 |
- // QObject::event is public but QWidget's ::event() re-implementation
|
|
|
462c49 |
- // is protected ;(
|
|
|
462c49 |
- inline bool deliverToolTipEvent(QEvent *e)
|
|
|
462c49 |
- { return QWidget::event(e); }
|
|
|
462c49 |
-
|
|
|
462c49 |
- static Window sysTrayWindow;
|
|
|
462c49 |
- static QList<QSystemTrayIconSys *> trayIcons;
|
|
|
462c49 |
- static QCoreApplication::EventFilter oldEventFilter;
|
|
|
462c49 |
- static bool sysTrayTracker(void *message, long *result);
|
|
|
462c49 |
- static Window locateSystemTray();
|
|
|
462c49 |
- static Atom sysTraySelection;
|
|
|
462c49 |
- static XVisualInfo sysTrayVisual;
|
|
|
462c49 |
+ QSystemTrayIconSysFactory();
|
|
|
462c49 |
+ void registerSystemTrayIconPrivate(QSystemTrayIconPrivate *iconPrivate);
|
|
|
462c49 |
+ void unregisterSystemTrayIconPrivate(QSystemTrayIconPrivate *iconPrivate);
|
|
|
462c49 |
|
|
|
462c49 |
-protected:
|
|
|
462c49 |
- void paintEvent(QPaintEvent *pe);
|
|
|
462c49 |
- void resizeEvent(QResizeEvent *re);
|
|
|
462c49 |
- bool x11Event(XEvent *event);
|
|
|
462c49 |
- void mousePressEvent(QMouseEvent *event);
|
|
|
462c49 |
- void mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
462c49 |
-#ifndef QT_NO_WHEELEVENT
|
|
|
462c49 |
- void wheelEvent(QWheelEvent *event);
|
|
|
462c49 |
-#endif
|
|
|
462c49 |
- bool event(QEvent *e);
|
|
|
462c49 |
+ QAbstractSystemTrayIconSys *create(QSystemTrayIcon *) const;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ bool isAvailable() const;
|
|
|
462c49 |
+
|
|
|
462c49 |
+private Q_SLOTS:
|
|
|
462c49 |
+ void refreshTrayIconPrivates();
|
|
|
462c49 |
|
|
|
462c49 |
private:
|
|
|
462c49 |
- QPixmap background;
|
|
|
462c49 |
- QSystemTrayIcon *q;
|
|
|
462c49 |
- Colormap colormap;
|
|
|
462c49 |
+ QSystemTrayIconSysFactoryInterface *factory() const;
|
|
|
462c49 |
+ void loadPluginFactory();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ QSystemTrayIconSysFactoryInterface *pluginFactory;
|
|
|
462c49 |
+ QSet<QSystemTrayIconPrivate *> trayIconPrivates;
|
|
|
462c49 |
};
|
|
|
462c49 |
-#endif // Q_WS_X11
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
|
|
|
462c49 |
QT_END_NAMESPACE
|
|
|
462c49 |
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_x11.cpp.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_x11.cpp
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_x11.cpp.systemtrayicon 2014-03-30 15:36:49.000000000 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/qsystemtrayicon_x11.cpp 2014-03-31 18:16:39.709974914 -0500
|
|
|
462c49 |
@@ -38,311 +38,122 @@
|
|
|
462c49 |
** $QT_END_LICENSE$
|
|
|
462c49 |
**
|
|
|
462c49 |
****************************************************************************/
|
|
|
462c49 |
+#ifndef QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
+
|
|
|
462c49 |
+#include <private/qfactoryloader_p.h>
|
|
|
462c49 |
|
|
|
462c49 |
-#include "private/qt_x11_p.h"
|
|
|
462c49 |
-#include "qlabel.h"
|
|
|
462c49 |
-#include "qx11info_x11.h"
|
|
|
462c49 |
-#include "qpainter.h"
|
|
|
462c49 |
-#include "qpixmap.h"
|
|
|
462c49 |
-#include "qbitmap.h"
|
|
|
462c49 |
-#include "qevent.h"
|
|
|
462c49 |
-#include "qapplication.h"
|
|
|
462c49 |
-#include "qlist.h"
|
|
|
462c49 |
-#include "qmenu.h"
|
|
|
462c49 |
-#include "qtimer.h"
|
|
|
462c49 |
#include "qsystemtrayicon_p.h"
|
|
|
462c49 |
-#include "qpaintengine.h"
|
|
|
462c49 |
+#include "qabstractsystemtrayiconsys_p.h"
|
|
|
462c49 |
+#include "qcoreapplication.h"
|
|
|
462c49 |
+#include "qxembedsystemtrayicon_x11_p.h"
|
|
|
462c49 |
|
|
|
462c49 |
-#ifndef QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
QT_BEGIN_NAMESPACE
|
|
|
462c49 |
|
|
|
462c49 |
-Window QSystemTrayIconSys::sysTrayWindow = XNone;
|
|
|
462c49 |
-QList<QSystemTrayIconSys *> QSystemTrayIconSys::trayIcons;
|
|
|
462c49 |
-QCoreApplication::EventFilter QSystemTrayIconSys::oldEventFilter = 0;
|
|
|
462c49 |
-Atom QSystemTrayIconSys::sysTraySelection = XNone;
|
|
|
462c49 |
-XVisualInfo QSystemTrayIconSys::sysTrayVisual = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
|
462c49 |
-
|
|
|
462c49 |
-// Locate the system tray
|
|
|
462c49 |
-Window QSystemTrayIconSys::locateSystemTray()
|
|
|
462c49 |
-{
|
|
|
462c49 |
- Display *display = QX11Info::display();
|
|
|
462c49 |
- if (sysTraySelection == XNone) {
|
|
|
462c49 |
- int screen = QX11Info::appScreen();
|
|
|
462c49 |
- QString net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen);
|
|
|
462c49 |
- sysTraySelection = XInternAtom(display, net_sys_tray.toLatin1(), False);
|
|
|
462c49 |
- }
|
|
|
462c49 |
-
|
|
|
462c49 |
- return XGetSelectionOwner(QX11Info::display(), sysTraySelection);
|
|
|
462c49 |
-}
|
|
|
462c49 |
+Q_GLOBAL_STATIC(QSystemTrayIconSysFactory, qt_guiSystemTrayIconSysFactory)
|
|
|
462c49 |
|
|
|
462c49 |
-XVisualInfo* QSystemTrayIconSys::getSysTrayVisualInfo()
|
|
|
462c49 |
+QSystemTrayIconSysFactory::QSystemTrayIconSysFactory()
|
|
|
462c49 |
+: pluginFactory(0)
|
|
|
462c49 |
{
|
|
|
462c49 |
- Display *display = QX11Info::display();
|
|
|
462c49 |
-
|
|
|
462c49 |
- if (!sysTrayVisual.visual) {
|
|
|
462c49 |
- Window win = locateSystemTray();
|
|
|
462c49 |
- if (win != XNone) {
|
|
|
462c49 |
- Atom actual_type;
|
|
|
462c49 |
- int actual_format;
|
|
|
462c49 |
- ulong nitems, bytes_remaining;
|
|
|
462c49 |
- uchar *data = 0;
|
|
|
462c49 |
- int result = XGetWindowProperty(display, win, ATOM(_NET_SYSTEM_TRAY_VISUAL), 0, 1,
|
|
|
462c49 |
- False, XA_VISUALID, &actual_type,
|
|
|
462c49 |
- &actual_format, &nitems, &bytes_remaining, &data);
|
|
|
462c49 |
- VisualID vid = 0;
|
|
|
462c49 |
- if (result == Success && data && actual_type == XA_VISUALID && actual_format == 32 &&
|
|
|
462c49 |
- nitems == 1 && bytes_remaining == 0)
|
|
|
462c49 |
- vid = *(VisualID*)data;
|
|
|
462c49 |
- if (data)
|
|
|
462c49 |
- XFree(data);
|
|
|
462c49 |
- if (vid == 0)
|
|
|
462c49 |
- return 0;
|
|
|
462c49 |
-
|
|
|
462c49 |
- uint mask = VisualIDMask;
|
|
|
462c49 |
- XVisualInfo *vi, rvi;
|
|
|
462c49 |
- int count;
|
|
|
462c49 |
- rvi.visualid = vid;
|
|
|
462c49 |
- vi = XGetVisualInfo(display, mask, &rvi, &count);
|
|
|
462c49 |
- if (vi) {
|
|
|
462c49 |
- sysTrayVisual = vi[0];
|
|
|
462c49 |
- XFree((char*)vi);
|
|
|
462c49 |
- }
|
|
|
462c49 |
- if (sysTrayVisual.depth != 32)
|
|
|
462c49 |
- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
- }
|
|
|
462c49 |
- }
|
|
|
462c49 |
-
|
|
|
462c49 |
- return sysTrayVisual.visual ? &sysTrayVisual : 0;
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-bool QSystemTrayIconSys::sysTrayTracker(void *message, long *result)
|
|
|
462c49 |
+void QSystemTrayIconSysFactory::loadPluginFactory()
|
|
|
462c49 |
{
|
|
|
462c49 |
- bool retval = false;
|
|
|
462c49 |
- if (QSystemTrayIconSys::oldEventFilter)
|
|
|
462c49 |
- retval = QSystemTrayIconSys::oldEventFilter(message, result);
|
|
|
462c49 |
-
|
|
|
462c49 |
- if (trayIcons.isEmpty())
|
|
|
462c49 |
- return retval;
|
|
|
462c49 |
-
|
|
|
462c49 |
- Display *display = QX11Info::display();
|
|
|
462c49 |
- XEvent *ev = (XEvent *)message;
|
|
|
462c49 |
- if (ev->type == DestroyNotify && ev->xany.window == sysTrayWindow) {
|
|
|
462c49 |
- sysTrayWindow = locateSystemTray();
|
|
|
462c49 |
- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
- for (int i = 0; i < trayIcons.count(); i++) {
|
|
|
462c49 |
- if (sysTrayWindow == XNone) {
|
|
|
462c49 |
- QBalloonTip::hideBalloon();
|
|
|
462c49 |
- trayIcons[i]->hide(); // still no luck
|
|
|
462c49 |
- trayIcons[i]->destroy();
|
|
|
462c49 |
- trayIcons[i]->create();
|
|
|
462c49 |
- } else
|
|
|
462c49 |
- trayIcons[i]->addToTray(); // add it to the new tray
|
|
|
462c49 |
- }
|
|
|
462c49 |
- retval = true;
|
|
|
462c49 |
- } else if (ev->type == ClientMessage && sysTrayWindow == XNone) {
|
|
|
462c49 |
- static Atom manager_atom = XInternAtom(display, "MANAGER", False);
|
|
|
462c49 |
- XClientMessageEvent *cm = (XClientMessageEvent *)message;
|
|
|
462c49 |
- if ((cm->message_type == manager_atom) && ((Atom)cm->data.l[1] == sysTraySelection)) {
|
|
|
462c49 |
- sysTrayWindow = cm->data.l[2];
|
|
|
462c49 |
- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
- XSelectInput(display, sysTrayWindow, StructureNotifyMask);
|
|
|
462c49 |
- for (int i = 0; i < trayIcons.count(); i++) {
|
|
|
462c49 |
- trayIcons[i]->addToTray();
|
|
|
462c49 |
- }
|
|
|
462c49 |
- retval = true;
|
|
|
462c49 |
- }
|
|
|
462c49 |
- } else if (ev->type == PropertyNotify && ev->xproperty.atom == ATOM(_NET_SYSTEM_TRAY_VISUAL) &&
|
|
|
462c49 |
- ev->xproperty.window == sysTrayWindow) {
|
|
|
462c49 |
- memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
- for (int i = 0; i < trayIcons.count(); i++) {
|
|
|
462c49 |
- trayIcons[i]->addToTray();
|
|
|
462c49 |
- }
|
|
|
462c49 |
- }
|
|
|
462c49 |
-
|
|
|
462c49 |
- return retval;
|
|
|
462c49 |
-}
|
|
|
462c49 |
-
|
|
|
462c49 |
-QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *q)
|
|
|
462c49 |
- : QWidget(0, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint),
|
|
|
462c49 |
- q(q), colormap(0)
|
|
|
462c49 |
-{
|
|
|
462c49 |
- setAttribute(Qt::WA_AlwaysShowToolTips);
|
|
|
462c49 |
- setAttribute(Qt::WA_QuitOnClose, false);
|
|
|
462c49 |
- setAttribute(Qt::WA_NoSystemBackground, true);
|
|
|
462c49 |
- setAttribute(Qt::WA_PaintOnScreen);
|
|
|
462c49 |
-
|
|
|
462c49 |
- static bool eventFilterAdded = false;
|
|
|
462c49 |
- Display *display = QX11Info::display();
|
|
|
462c49 |
- if (!eventFilterAdded) {
|
|
|
462c49 |
- oldEventFilter = qApp->setEventFilter(sysTrayTracker);
|
|
|
462c49 |
- eventFilterAdded = true;
|
|
|
462c49 |
- Window root = QX11Info::appRootWindow();
|
|
|
462c49 |
- XWindowAttributes attr;
|
|
|
462c49 |
- XGetWindowAttributes(display, root, &attr);
|
|
|
462c49 |
- if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
|
|
|
462c49 |
- (void) QApplication::desktop(); // lame trick to ensure our event mask is not overridden
|
|
|
462c49 |
- XSelectInput(display, root, attr.your_event_mask | StructureNotifyMask); // for MANAGER selection
|
|
|
462c49 |
- }
|
|
|
462c49 |
+ if (pluginFactory) {
|
|
|
462c49 |
+ return;
|
|
|
462c49 |
}
|
|
|
462c49 |
- if (trayIcons.isEmpty()) {
|
|
|
462c49 |
- sysTrayWindow = locateSystemTray();
|
|
|
462c49 |
- if (sysTrayWindow != XNone)
|
|
|
462c49 |
- XSelectInput(display, sysTrayWindow, StructureNotifyMask); // track tray events
|
|
|
462c49 |
+#ifndef QT_NO_LIBRARY
|
|
|
462c49 |
+ QFactoryLoader loader(QSystemTrayIconSysFactoryInterface_iid, QLatin1String("/systemtrayicon"));
|
|
|
462c49 |
+ pluginFactory = qobject_cast<QSystemTrayIconSysFactoryInterface *>(loader.instance(QLatin1String("default")));
|
|
|
462c49 |
+ if (pluginFactory) {
|
|
|
462c49 |
+ // Set parent to ensure factory destructor is called when application
|
|
|
462c49 |
+ // is closed
|
|
|
462c49 |
+ pluginFactory->setParent(QCoreApplication::instance());
|
|
|
462c49 |
+ connect(pluginFactory, SIGNAL(availableChanged(bool)), SLOT(refreshTrayIconPrivates()));
|
|
|
462c49 |
}
|
|
|
462c49 |
- trayIcons.append(this);
|
|
|
462c49 |
- setMouseTracking(true);
|
|
|
462c49 |
-#ifndef QT_NO_TOOLTIP
|
|
|
462c49 |
- setToolTip(q->toolTip());
|
|
|
462c49 |
-#endif
|
|
|
462c49 |
- if (sysTrayWindow != XNone)
|
|
|
462c49 |
- addToTray();
|
|
|
462c49 |
+#endif // QT_NO_LIBRARY
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-QSystemTrayIconSys::~QSystemTrayIconSys()
|
|
|
462c49 |
+QSystemTrayIconSysFactoryInterface *QSystemTrayIconSysFactory::factory() const
|
|
|
462c49 |
{
|
|
|
462c49 |
- trayIcons.removeAt(trayIcons.indexOf(this));
|
|
|
462c49 |
- Display *display = QX11Info::display();
|
|
|
462c49 |
- if (trayIcons.isEmpty()) {
|
|
|
462c49 |
- if (sysTrayWindow == XNone)
|
|
|
462c49 |
- return;
|
|
|
462c49 |
- if (display)
|
|
|
462c49 |
- XSelectInput(display, sysTrayWindow, 0); // stop tracking the tray
|
|
|
462c49 |
- sysTrayWindow = XNone;
|
|
|
462c49 |
+ if (!pluginFactory) {
|
|
|
462c49 |
+ const_cast<QSystemTrayIconSysFactory*>(this)->loadPluginFactory();
|
|
|
462c49 |
}
|
|
|
462c49 |
- if (colormap)
|
|
|
462c49 |
- XFreeColormap(display, colormap);
|
|
|
462c49 |
+ if (pluginFactory && pluginFactory->isAvailable()) {
|
|
|
462c49 |
+ return pluginFactory;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ static QXEmbedSystemTrayIconSysFactory def;
|
|
|
462c49 |
+ return def.isAvailable() ? &def : 0;
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-void QSystemTrayIconSys::addToTray()
|
|
|
462c49 |
+void QSystemTrayIconSysFactory::refreshTrayIconPrivates()
|
|
|
462c49 |
{
|
|
|
462c49 |
- Q_ASSERT(sysTrayWindow != XNone);
|
|
|
462c49 |
- Display *display = QX11Info::display();
|
|
|
462c49 |
-
|
|
|
462c49 |
- XVisualInfo *vi = getSysTrayVisualInfo();
|
|
|
462c49 |
- if (vi && vi->visual) {
|
|
|
462c49 |
- Window root = RootWindow(display, vi->screen);
|
|
|
462c49 |
- Window p = root;
|
|
|
462c49 |
- if (QWidget *pw = parentWidget())
|
|
|
462c49 |
- p = pw->effectiveWinId();
|
|
|
462c49 |
- colormap = XCreateColormap(display, root, vi->visual, AllocNone);
|
|
|
462c49 |
- XSetWindowAttributes wsa;
|
|
|
462c49 |
- wsa.background_pixmap = 0;
|
|
|
462c49 |
- wsa.colormap = colormap;
|
|
|
462c49 |
- wsa.background_pixel = 0;
|
|
|
462c49 |
- wsa.border_pixel = 0;
|
|
|
462c49 |
- Window wid = XCreateWindow(display, p, -1, -1, 1, 1,
|
|
|
462c49 |
- 0, vi->depth, InputOutput, vi->visual,
|
|
|
462c49 |
- CWBackPixmap|CWBackPixel|CWBorderPixel|CWColormap, &wsa;;
|
|
|
462c49 |
- create(wid);
|
|
|
462c49 |
- } else {
|
|
|
462c49 |
- XSetWindowBackgroundPixmap(display, winId(), ParentRelative);
|
|
|
462c49 |
- }
|
|
|
462c49 |
-
|
|
|
462c49 |
- // GNOME, NET WM Specification
|
|
|
462c49 |
- static Atom netwm_tray_atom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", False);
|
|
|
462c49 |
- long l[5] = { CurrentTime, SYSTEM_TRAY_REQUEST_DOCK, static_cast<long>(winId()), 0, 0 };
|
|
|
462c49 |
- XEvent ev;
|
|
|
462c49 |
- memset(&ev, 0, sizeof(ev));
|
|
|
462c49 |
- ev.xclient.type = ClientMessage;
|
|
|
462c49 |
- ev.xclient.window = sysTrayWindow;
|
|
|
462c49 |
- ev.xclient.message_type = netwm_tray_atom;
|
|
|
462c49 |
- ev.xclient.format = 32;
|
|
|
462c49 |
- memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l));
|
|
|
462c49 |
- XSendEvent(display, sysTrayWindow, False, 0, &ev;;
|
|
|
462c49 |
- setMinimumSize(22, 22); // required at least on GNOME
|
|
|
462c49 |
-}
|
|
|
462c49 |
-
|
|
|
462c49 |
-void QSystemTrayIconSys::updateIcon()
|
|
|
462c49 |
-{
|
|
|
462c49 |
- update();
|
|
|
462c49 |
-}
|
|
|
462c49 |
-
|
|
|
462c49 |
-void QSystemTrayIconSys::resizeEvent(QResizeEvent *re)
|
|
|
462c49 |
-{
|
|
|
462c49 |
- QWidget::resizeEvent(re);
|
|
|
462c49 |
- updateIcon();
|
|
|
462c49 |
-}
|
|
|
462c49 |
-
|
|
|
462c49 |
-void QSystemTrayIconSys::paintEvent(QPaintEvent*)
|
|
|
462c49 |
-{
|
|
|
462c49 |
- QPainter p(this);
|
|
|
462c49 |
- if (!getSysTrayVisualInfo()) {
|
|
|
462c49 |
- const QRegion oldSystemClip = p.paintEngine()->systemClip();
|
|
|
462c49 |
- const QRect clearedRect = oldSystemClip.boundingRect();
|
|
|
462c49 |
- XClearArea(QX11Info::display(), winId(), clearedRect.x(), clearedRect.y(),
|
|
|
462c49 |
- clearedRect.width(), clearedRect.height(), False);
|
|
|
462c49 |
- QPaintEngine *pe = p.paintEngine();
|
|
|
462c49 |
- pe->setSystemClip(clearedRect);
|
|
|
462c49 |
- q->icon().paint(&p, rect());
|
|
|
462c49 |
- pe->setSystemClip(oldSystemClip);
|
|
|
462c49 |
- } else {
|
|
|
462c49 |
- p.setCompositionMode(QPainter::CompositionMode_Source);
|
|
|
462c49 |
- p.fillRect(rect(), Qt::transparent);
|
|
|
462c49 |
- p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
|
|
462c49 |
- q->icon().paint(&p, rect());
|
|
|
462c49 |
+ Q_FOREACH(QSystemTrayIconPrivate *trayIconPrivate, trayIconPrivates) {
|
|
|
462c49 |
+ if (trayIconPrivate->sys) {
|
|
|
462c49 |
+ delete trayIconPrivate->sys;
|
|
|
462c49 |
+ trayIconPrivate->sys = 0;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ // When visible is true, sys is usually not 0 but it can be 0 if the
|
|
|
462c49 |
+ // call to install_sys() failed.
|
|
|
462c49 |
+ if (trayIconPrivate->visible) {
|
|
|
462c49 |
+ trayIconPrivate->install_sys();
|
|
|
462c49 |
+ }
|
|
|
462c49 |
}
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev)
|
|
|
462c49 |
+void QSystemTrayIconSysFactory::registerSystemTrayIconPrivate(QSystemTrayIconPrivate* trayIconPrivate)
|
|
|
462c49 |
{
|
|
|
462c49 |
- QPoint globalPos = ev->globalPos();
|
|
|
462c49 |
- if (ev->button() == Qt::RightButton && q->contextMenu())
|
|
|
462c49 |
- q->contextMenu()->popup(globalPos);
|
|
|
462c49 |
-
|
|
|
462c49 |
- if (QBalloonTip::isBalloonVisible()) {
|
|
|
462c49 |
- emit q->messageClicked();
|
|
|
462c49 |
- QBalloonTip::hideBalloon();
|
|
|
462c49 |
- }
|
|
|
462c49 |
-
|
|
|
462c49 |
- if (ev->button() == Qt::LeftButton)
|
|
|
462c49 |
- emit q->activated(QSystemTrayIcon::Trigger);
|
|
|
462c49 |
- else if (ev->button() == Qt::RightButton)
|
|
|
462c49 |
- emit q->activated(QSystemTrayIcon::Context);
|
|
|
462c49 |
- else if (ev->button() == Qt::MidButton)
|
|
|
462c49 |
- emit q->activated(QSystemTrayIcon::MiddleClick);
|
|
|
462c49 |
+ trayIconPrivates.insert(trayIconPrivate);
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-void QSystemTrayIconSys::mouseDoubleClickEvent(QMouseEvent *ev)
|
|
|
462c49 |
+void QSystemTrayIconSysFactory::unregisterSystemTrayIconPrivate(QSystemTrayIconPrivate* trayIconPrivate)
|
|
|
462c49 |
{
|
|
|
462c49 |
- if (ev->button() == Qt::LeftButton)
|
|
|
462c49 |
- emit q->activated(QSystemTrayIcon::DoubleClick);
|
|
|
462c49 |
+ trayIconPrivates.remove(trayIconPrivate);
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-#ifndef QT_NO_WHEELEVENT
|
|
|
462c49 |
-void QSystemTrayIconSys::wheelEvent(QWheelEvent *e)
|
|
|
462c49 |
+QAbstractSystemTrayIconSys *QSystemTrayIconSysFactory::create(QSystemTrayIcon *trayIcon) const
|
|
|
462c49 |
{
|
|
|
462c49 |
- QApplication::sendEvent(q, e);
|
|
|
462c49 |
+ QSystemTrayIconSysFactoryInterface *f = factory();
|
|
|
462c49 |
+ if (!f) {
|
|
|
462c49 |
+ qWarning("No systemtrayicon available");
|
|
|
462c49 |
+ return 0;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ return f->create(trayIcon);
|
|
|
462c49 |
}
|
|
|
462c49 |
-#endif
|
|
|
462c49 |
|
|
|
462c49 |
-bool QSystemTrayIconSys::event(QEvent *e)
|
|
|
462c49 |
+bool QSystemTrayIconSysFactory::isAvailable() const
|
|
|
462c49 |
{
|
|
|
462c49 |
- if (e->type() == QEvent::ToolTip) {
|
|
|
462c49 |
- return QApplication::sendEvent(q, e);
|
|
|
462c49 |
- }
|
|
|
462c49 |
- return QWidget::event(e);
|
|
|
462c49 |
+ return factory();
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-bool QSystemTrayIconSys::x11Event(XEvent *event)
|
|
|
462c49 |
+////////////////////////////////////////////////
|
|
|
462c49 |
+QSystemTrayIconPrivate::~QSystemTrayIconPrivate()
|
|
|
462c49 |
{
|
|
|
462c49 |
- if (event->type == ReparentNotify)
|
|
|
462c49 |
- show();
|
|
|
462c49 |
- return QWidget::x11Event(event);
|
|
|
462c49 |
+ qt_guiSystemTrayIconSysFactory()->unregisterSystemTrayIconPrivate(this);
|
|
|
462c49 |
+ delete sys;
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
-////////////////////////////////////////////////////////////////////////////
|
|
|
462c49 |
void QSystemTrayIconPrivate::install_sys()
|
|
|
462c49 |
{
|
|
|
462c49 |
Q_Q(QSystemTrayIcon);
|
|
|
462c49 |
- if (!sys)
|
|
|
462c49 |
- sys = new QSystemTrayIconSys(q);
|
|
|
462c49 |
+ if (!sys) {
|
|
|
462c49 |
+ // Register ourself even if create() fails: our "sys" will get created
|
|
|
462c49 |
+ // later by refreshTrayIconPrivates() if a systemtray becomes
|
|
|
462c49 |
+ // available. This situation can happen for applications which are
|
|
|
462c49 |
+ // started at login time, while the desktop itself is starting up.
|
|
|
462c49 |
+ qt_guiSystemTrayIconSysFactory()->registerSystemTrayIconPrivate(this);
|
|
|
462c49 |
+ sys = qt_guiSystemTrayIconSysFactory()->create(q);
|
|
|
462c49 |
+ if (!sys) {
|
|
|
462c49 |
+ return;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ sys->updateVisibility();
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
QRect QSystemTrayIconPrivate::geometry_sys() const
|
|
|
462c49 |
{
|
|
|
462c49 |
- if (!sys)
|
|
|
462c49 |
- return QRect();
|
|
|
462c49 |
- return QRect(sys->mapToGlobal(QPoint(0, 0)), sys->size());
|
|
|
462c49 |
+ if (!sys || !visible)
|
|
|
462c49 |
+ return QRect();
|
|
|
462c49 |
+ return sys->geometry();
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
void QSystemTrayIconPrivate::remove_sys()
|
|
|
462c49 |
@@ -350,35 +161,35 @@ void QSystemTrayIconPrivate::remove_sys(
|
|
|
462c49 |
if (!sys)
|
|
|
462c49 |
return;
|
|
|
462c49 |
QBalloonTip::hideBalloon();
|
|
|
462c49 |
- sys->hide(); // this should do the trick, but...
|
|
|
462c49 |
- delete sys; // wm may resize system tray only for DestroyEvents
|
|
|
462c49 |
- sys = 0;
|
|
|
462c49 |
+ sys->updateVisibility();
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
void QSystemTrayIconPrivate::updateIcon_sys()
|
|
|
462c49 |
{
|
|
|
462c49 |
- if (!sys)
|
|
|
462c49 |
+ if (!sys || !visible)
|
|
|
462c49 |
return;
|
|
|
462c49 |
sys->updateIcon();
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
void QSystemTrayIconPrivate::updateMenu_sys()
|
|
|
462c49 |
{
|
|
|
462c49 |
-
|
|
|
462c49 |
+ if (!sys || !visible)
|
|
|
462c49 |
+ return;
|
|
|
462c49 |
+ sys->updateMenu();
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
void QSystemTrayIconPrivate::updateToolTip_sys()
|
|
|
462c49 |
{
|
|
|
462c49 |
- if (!sys)
|
|
|
462c49 |
+ if (!sys || !visible)
|
|
|
462c49 |
return;
|
|
|
462c49 |
#ifndef QT_NO_TOOLTIP
|
|
|
462c49 |
- sys->setToolTip(toolTip);
|
|
|
462c49 |
+ sys->updateToolTip();
|
|
|
462c49 |
#endif
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
|
|
|
462c49 |
{
|
|
|
462c49 |
- return QSystemTrayIconSys::locateSystemTray() != XNone;
|
|
|
462c49 |
+ return qt_guiSystemTrayIconSysFactory()->isAvailable();
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
bool QSystemTrayIconPrivate::supportsMessages_sys()
|
|
|
462c49 |
@@ -389,12 +200,9 @@ bool QSystemTrayIconPrivate::supportsMes
|
|
|
462c49 |
void QSystemTrayIconPrivate::showMessage_sys(const QString &message, const QString &title,
|
|
|
462c49 |
QSystemTrayIcon::MessageIcon icon, int msecs)
|
|
|
462c49 |
{
|
|
|
462c49 |
- if (!sys)
|
|
|
462c49 |
+ if (!sys || !visible)
|
|
|
462c49 |
return;
|
|
|
462c49 |
- QPoint g = sys->mapToGlobal(QPoint(0, 0));
|
|
|
462c49 |
- QBalloonTip::showBalloon(icon, message, title, sys->q,
|
|
|
462c49 |
- QPoint(g.x() + sys->width()/2, g.y() + sys->height()/2),
|
|
|
462c49 |
- msecs);
|
|
|
462c49 |
+ sys->showMessage(message, title, icon, msecs);
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
QT_END_NAMESPACE
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11.cpp.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11.cpp
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11.cpp.systemtrayicon 2014-03-31 18:16:39.709974914 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11.cpp 2014-03-31 18:16:39.709974914 -0500
|
|
|
462c49 |
@@ -0,0 +1,469 @@
|
|
|
462c49 |
+/****************************************************************************
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
462c49 |
+** All rights reserved.
|
|
|
462c49 |
+** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** This file is part of the QtGui module of the Qt Toolkit.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
462c49 |
+** GNU Lesser General Public License Usage
|
|
|
462c49 |
+** This file may be used under the terms of the GNU Lesser General Public
|
|
|
462c49 |
+** License version 2.1 as published by the Free Software Foundation and
|
|
|
462c49 |
+** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU Lesser
|
|
|
462c49 |
+** General Public License version 2.1 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** In addition, as a special exception, Nokia gives you certain additional
|
|
|
462c49 |
+** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
462c49 |
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** GNU General Public License Usage
|
|
|
462c49 |
+** Alternatively, this file may be used under the terms of the GNU General
|
|
|
462c49 |
+** Public License version 3.0 as published by the Free Software Foundation
|
|
|
462c49 |
+** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU General
|
|
|
462c49 |
+** Public License version 3.0 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/copyleft/gpl.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Other Usage
|
|
|
462c49 |
+** Alternatively, this file may be used in accordance with the terms and
|
|
|
462c49 |
+** conditions contained in a signed written agreement between you and Nokia.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_END_LICENSE$
|
|
|
462c49 |
+**
|
|
|
462c49 |
+****************************************************************************/
|
|
|
462c49 |
+#include "qxembedsystemtrayicon_x11_p.h"
|
|
|
462c49 |
+
|
|
|
462c49 |
+#ifndef QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
+
|
|
|
462c49 |
+#include "private/qt_x11_p.h"
|
|
|
462c49 |
+#include "qapplication.h"
|
|
|
462c49 |
+#include "qevent.h"
|
|
|
462c49 |
+#include "qlist.h"
|
|
|
462c49 |
+#include "qmenu.h"
|
|
|
462c49 |
+#include "qpainter.h"
|
|
|
462c49 |
+#include "qpaintengine.h"
|
|
|
462c49 |
+#include "qsystemtrayicon_p.h"
|
|
|
462c49 |
+#include "qx11info_x11.h"
|
|
|
462c49 |
+
|
|
|
462c49 |
+QT_BEGIN_INCLUDE_NAMESPACE
|
|
|
462c49 |
+#include <QtCore/qcoreapplication.h>
|
|
|
462c49 |
+#include <X11/Xlib.h>
|
|
|
462c49 |
+#include <X11/Xatom.h>
|
|
|
462c49 |
+#include <X11/Xutil.h>
|
|
|
462c49 |
+QT_END_INCLUDE_NAMESPACE
|
|
|
462c49 |
+
|
|
|
462c49 |
+QT_BEGIN_NAMESPACE
|
|
|
462c49 |
+
|
|
|
462c49 |
+class QSystemTrayIconWidget : public QWidget
|
|
|
462c49 |
+{
|
|
|
462c49 |
+public:
|
|
|
462c49 |
+ QSystemTrayIconWidget(QSystemTrayIcon *q, QXEmbedSystemTrayIconSys *s);
|
|
|
462c49 |
+ ~QSystemTrayIconWidget();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ static Window locateSystemTray();
|
|
|
462c49 |
+
|
|
|
462c49 |
+protected:
|
|
|
462c49 |
+ void paintEvent(QPaintEvent *pe);
|
|
|
462c49 |
+ void resizeEvent(QResizeEvent *re);
|
|
|
462c49 |
+ bool x11Event(XEvent *event);
|
|
|
462c49 |
+ void mousePressEvent(QMouseEvent *event);
|
|
|
462c49 |
+ void mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
462c49 |
+#ifndef QT_NO_WHEELEVENT
|
|
|
462c49 |
+ void wheelEvent(QWheelEvent *event);
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
+ bool event(QEvent *e);
|
|
|
462c49 |
+
|
|
|
462c49 |
+private:
|
|
|
462c49 |
+ enum {
|
|
|
462c49 |
+ SYSTEM_TRAY_REQUEST_DOCK = 0,
|
|
|
462c49 |
+ SYSTEM_TRAY_BEGIN_MESSAGE = 1,
|
|
|
462c49 |
+ SYSTEM_TRAY_CANCEL_MESSAGE =2
|
|
|
462c49 |
+ };
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void addToTray();
|
|
|
462c49 |
+ static XVisualInfo* getSysTrayVisualInfo();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ static Window sysTrayWindow;
|
|
|
462c49 |
+ static QList<QSystemTrayIconWidget *> trayIcons;
|
|
|
462c49 |
+ static QCoreApplication::EventFilter oldEventFilter;
|
|
|
462c49 |
+ static bool sysTrayTracker(void *message, long *result);
|
|
|
462c49 |
+ static Atom sysTraySelection;
|
|
|
462c49 |
+ static XVisualInfo sysTrayVisual;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ QSystemTrayIcon *q;
|
|
|
462c49 |
+ QXEmbedSystemTrayIconSys *sys;
|
|
|
462c49 |
+ Colormap colormap;
|
|
|
462c49 |
+};
|
|
|
462c49 |
+
|
|
|
462c49 |
+Window QSystemTrayIconWidget::sysTrayWindow = XNone;
|
|
|
462c49 |
+QList<QSystemTrayIconWidget *> QSystemTrayIconWidget::trayIcons;
|
|
|
462c49 |
+QCoreApplication::EventFilter QSystemTrayIconWidget::oldEventFilter = 0;
|
|
|
462c49 |
+Atom QSystemTrayIconWidget::sysTraySelection = XNone;
|
|
|
462c49 |
+XVisualInfo QSystemTrayIconWidget::sysTrayVisual = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
|
462c49 |
+
|
|
|
462c49 |
+QSystemTrayIconWidget::QSystemTrayIconWidget(QSystemTrayIcon* q, QXEmbedSystemTrayIconSys* sys)
|
|
|
462c49 |
+: QWidget(0, Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint)
|
|
|
462c49 |
+, q(q)
|
|
|
462c49 |
+, sys(sys)
|
|
|
462c49 |
+, colormap(0)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ setAttribute(Qt::WA_AlwaysShowToolTips);
|
|
|
462c49 |
+ setAttribute(Qt::WA_QuitOnClose, false);
|
|
|
462c49 |
+ setAttribute(Qt::WA_NoSystemBackground, true);
|
|
|
462c49 |
+ setAttribute(Qt::WA_PaintOnScreen);
|
|
|
462c49 |
+ setMouseTracking(true);
|
|
|
462c49 |
+#ifndef QT_NO_TOOLTIP
|
|
|
462c49 |
+ setToolTip(q->toolTip());
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
+
|
|
|
462c49 |
+ static bool eventFilterAdded = false;
|
|
|
462c49 |
+ Display *display = QX11Info::display();
|
|
|
462c49 |
+ if (!eventFilterAdded) {
|
|
|
462c49 |
+ oldEventFilter = qApp->setEventFilter(sysTrayTracker);
|
|
|
462c49 |
+ eventFilterAdded = true;
|
|
|
462c49 |
+ Window root = QX11Info::appRootWindow();
|
|
|
462c49 |
+ XWindowAttributes attr;
|
|
|
462c49 |
+ XGetWindowAttributes(display, root, &attr);
|
|
|
462c49 |
+ if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
|
|
|
462c49 |
+ (void) QApplication::desktop(); // lame trick to ensure our event mask is not overridden
|
|
|
462c49 |
+ XSelectInput(display, root, attr.your_event_mask | StructureNotifyMask); // for MANAGER selection
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ if (trayIcons.isEmpty()) {
|
|
|
462c49 |
+ sysTrayWindow = locateSystemTray();
|
|
|
462c49 |
+ if (sysTrayWindow != XNone)
|
|
|
462c49 |
+ XSelectInput(display, sysTrayWindow, StructureNotifyMask); // track tray events
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ trayIcons.append(this);
|
|
|
462c49 |
+ if (sysTrayWindow != XNone)
|
|
|
462c49 |
+ addToTray();
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+QSystemTrayIconWidget::~QSystemTrayIconWidget()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ trayIcons.removeAt(trayIcons.indexOf(this));
|
|
|
462c49 |
+ Display *display = QX11Info::display();
|
|
|
462c49 |
+ if (trayIcons.isEmpty()) {
|
|
|
462c49 |
+ if (sysTrayWindow == XNone)
|
|
|
462c49 |
+ return;
|
|
|
462c49 |
+ if (display)
|
|
|
462c49 |
+ XSelectInput(display, sysTrayWindow, 0); // stop tracking the tray
|
|
|
462c49 |
+ sysTrayWindow = XNone;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ if (colormap)
|
|
|
462c49 |
+ XFreeColormap(display, colormap);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QSystemTrayIconWidget::resizeEvent(QResizeEvent *re)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ QWidget::resizeEvent(re);
|
|
|
462c49 |
+ update();
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QSystemTrayIconWidget::paintEvent(QPaintEvent*)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ QPainter p(this);
|
|
|
462c49 |
+ if (!getSysTrayVisualInfo()) {
|
|
|
462c49 |
+ const QRegion oldSystemClip = p.paintEngine()->systemClip();
|
|
|
462c49 |
+ const QRect clearedRect = oldSystemClip.boundingRect();
|
|
|
462c49 |
+ XClearArea(QX11Info::display(), winId(), clearedRect.x(), clearedRect.y(),
|
|
|
462c49 |
+ clearedRect.width(), clearedRect.height(), False);
|
|
|
462c49 |
+ QPaintEngine *pe = p.paintEngine();
|
|
|
462c49 |
+ pe->setSystemClip(clearedRect);
|
|
|
462c49 |
+ q->icon().paint(&p, rect());
|
|
|
462c49 |
+ pe->setSystemClip(oldSystemClip);
|
|
|
462c49 |
+ } else {
|
|
|
462c49 |
+ p.setCompositionMode(QPainter::CompositionMode_Source);
|
|
|
462c49 |
+ p.fillRect(rect(), Qt::transparent);
|
|
|
462c49 |
+ p.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
|
|
462c49 |
+ q->icon().paint(&p, rect());
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QSystemTrayIconWidget::mousePressEvent(QMouseEvent *ev)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ QPoint globalPos = ev->globalPos();
|
|
|
462c49 |
+ if (ev->button() == Qt::RightButton && q->contextMenu())
|
|
|
462c49 |
+ q->contextMenu()->popup(globalPos);
|
|
|
462c49 |
+
|
|
|
462c49 |
+ if (QBalloonTip::isBalloonVisible()) {
|
|
|
462c49 |
+ QMetaObject::invokeMethod(q, "messageClicked");
|
|
|
462c49 |
+ QBalloonTip::hideBalloon();
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+
|
|
|
462c49 |
+ if (ev->button() == Qt::LeftButton)
|
|
|
462c49 |
+ qtsystray_sendActivated(q, QSystemTrayIcon::Trigger);
|
|
|
462c49 |
+ else if (ev->button() == Qt::RightButton)
|
|
|
462c49 |
+ qtsystray_sendActivated(q, QSystemTrayIcon::Context);
|
|
|
462c49 |
+ else if (ev->button() == Qt::MidButton)
|
|
|
462c49 |
+ qtsystray_sendActivated(q, QSystemTrayIcon::MiddleClick);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QSystemTrayIconWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ if (ev->button() == Qt::LeftButton)
|
|
|
462c49 |
+ qtsystray_sendActivated(q, QSystemTrayIcon::DoubleClick);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+#ifndef QT_NO_WHEELEVENT
|
|
|
462c49 |
+void QSystemTrayIconWidget::wheelEvent(QWheelEvent *e)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ sys->sendWheelEventToTrayIcon(e->delta(), e->orientation());
|
|
|
462c49 |
+}
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
+
|
|
|
462c49 |
+bool QSystemTrayIconWidget::event(QEvent *e)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ if (e->type() == QEvent::ToolTip) {
|
|
|
462c49 |
+ sys->sendToolTipEventToTrayIcon();
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ return QWidget::event(e);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+bool QSystemTrayIconWidget::x11Event(XEvent *event)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ if (event->type == ReparentNotify)
|
|
|
462c49 |
+ show();
|
|
|
462c49 |
+ return QWidget::x11Event(event);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+// Locate the system tray
|
|
|
462c49 |
+Window QSystemTrayIconWidget::locateSystemTray()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ Display *display = QX11Info::display();
|
|
|
462c49 |
+ if (sysTraySelection == XNone) {
|
|
|
462c49 |
+ int screen = QX11Info::appScreen();
|
|
|
462c49 |
+ QString net_sys_tray = QString::fromLatin1("_NET_SYSTEM_TRAY_S%1").arg(screen);
|
|
|
462c49 |
+ sysTraySelection = XInternAtom(display, net_sys_tray.toLatin1(), False);
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+
|
|
|
462c49 |
+ return XGetSelectionOwner(QX11Info::display(), sysTraySelection);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+XVisualInfo* QSystemTrayIconWidget::getSysTrayVisualInfo()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ Display *display = QX11Info::display();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ if (!sysTrayVisual.visual) {
|
|
|
462c49 |
+ Window win = locateSystemTray();
|
|
|
462c49 |
+ if (win != XNone) {
|
|
|
462c49 |
+ Atom actual_type;
|
|
|
462c49 |
+ int actual_format;
|
|
|
462c49 |
+ ulong nitems, bytes_remaining;
|
|
|
462c49 |
+ uchar *data = 0;
|
|
|
462c49 |
+ int result = XGetWindowProperty(display, win, ATOM(_NET_SYSTEM_TRAY_VISUAL), 0, 1,
|
|
|
462c49 |
+ False, XA_VISUALID, &actual_type,
|
|
|
462c49 |
+ &actual_format, &nitems, &bytes_remaining, &data);
|
|
|
462c49 |
+ VisualID vid = 0;
|
|
|
462c49 |
+ if (result == Success && data && actual_type == XA_VISUALID && actual_format == 32 &&
|
|
|
462c49 |
+ nitems == 1 && bytes_remaining == 0)
|
|
|
462c49 |
+ vid = *(VisualID*)data;
|
|
|
462c49 |
+ if (data)
|
|
|
462c49 |
+ XFree(data);
|
|
|
462c49 |
+ if (vid == 0)
|
|
|
462c49 |
+ return 0;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ uint mask = VisualIDMask;
|
|
|
462c49 |
+ XVisualInfo *vi, rvi;
|
|
|
462c49 |
+ int count;
|
|
|
462c49 |
+ rvi.visualid = vid;
|
|
|
462c49 |
+ vi = XGetVisualInfo(display, mask, &rvi, &count);
|
|
|
462c49 |
+ if (vi) {
|
|
|
462c49 |
+ sysTrayVisual = vi[0];
|
|
|
462c49 |
+ XFree((char*)vi);
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ if (sysTrayVisual.depth != 32)
|
|
|
462c49 |
+ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+
|
|
|
462c49 |
+ return sysTrayVisual.visual ? &sysTrayVisual : 0;
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+bool QSystemTrayIconWidget::sysTrayTracker(void *message, long *result)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ bool retval = false;
|
|
|
462c49 |
+ if (QSystemTrayIconWidget::oldEventFilter)
|
|
|
462c49 |
+ retval = QSystemTrayIconWidget::oldEventFilter(message, result);
|
|
|
462c49 |
+
|
|
|
462c49 |
+ if (trayIcons.isEmpty())
|
|
|
462c49 |
+ return retval;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ Display *display = QX11Info::display();
|
|
|
462c49 |
+ XEvent *ev = (XEvent *)message;
|
|
|
462c49 |
+ if (ev->type == DestroyNotify && ev->xany.window == sysTrayWindow) {
|
|
|
462c49 |
+ sysTrayWindow = locateSystemTray();
|
|
|
462c49 |
+ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
+ for (int i = 0; i < trayIcons.count(); i++) {
|
|
|
462c49 |
+ if (sysTrayWindow == XNone) {
|
|
|
462c49 |
+ QBalloonTip::hideBalloon();
|
|
|
462c49 |
+ trayIcons[i]->hide(); // still no luck
|
|
|
462c49 |
+ trayIcons[i]->destroy();
|
|
|
462c49 |
+ trayIcons[i]->create();
|
|
|
462c49 |
+ } else
|
|
|
462c49 |
+ trayIcons[i]->addToTray(); // add it to the new tray
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ retval = true;
|
|
|
462c49 |
+ } else if (ev->type == ClientMessage && sysTrayWindow == XNone) {
|
|
|
462c49 |
+ static Atom manager_atom = XInternAtom(display, "MANAGER", False);
|
|
|
462c49 |
+ XClientMessageEvent *cm = (XClientMessageEvent *)message;
|
|
|
462c49 |
+ if ((cm->message_type == manager_atom) && ((Atom)cm->data.l[1] == sysTraySelection)) {
|
|
|
462c49 |
+ sysTrayWindow = cm->data.l[2];
|
|
|
462c49 |
+ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
+ XSelectInput(display, sysTrayWindow, StructureNotifyMask);
|
|
|
462c49 |
+ for (int i = 0; i < trayIcons.count(); i++) {
|
|
|
462c49 |
+ trayIcons[i]->addToTray();
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ retval = true;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ } else if (ev->type == PropertyNotify && ev->xproperty.atom == ATOM(_NET_SYSTEM_TRAY_VISUAL) &&
|
|
|
462c49 |
+ ev->xproperty.window == sysTrayWindow) {
|
|
|
462c49 |
+ memset(&sysTrayVisual, 0, sizeof(sysTrayVisual));
|
|
|
462c49 |
+ for (int i = 0; i < trayIcons.count(); i++) {
|
|
|
462c49 |
+ trayIcons[i]->addToTray();
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+
|
|
|
462c49 |
+ return retval;
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QSystemTrayIconWidget::addToTray()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ Q_ASSERT(sysTrayWindow != XNone);
|
|
|
462c49 |
+ Display *display = QX11Info::display();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ XVisualInfo *vi = getSysTrayVisualInfo();
|
|
|
462c49 |
+ if (vi && vi->visual) {
|
|
|
462c49 |
+ Window root = RootWindow(display, vi->screen);
|
|
|
462c49 |
+ Window p = root;
|
|
|
462c49 |
+ if (QWidget *pw = parentWidget())
|
|
|
462c49 |
+ p = pw->effectiveWinId();
|
|
|
462c49 |
+ colormap = XCreateColormap(display, root, vi->visual, AllocNone);
|
|
|
462c49 |
+ XSetWindowAttributes wsa;
|
|
|
462c49 |
+ wsa.background_pixmap = 0;
|
|
|
462c49 |
+ wsa.colormap = colormap;
|
|
|
462c49 |
+ wsa.background_pixel = 0;
|
|
|
462c49 |
+ wsa.border_pixel = 0;
|
|
|
462c49 |
+ Window wid = XCreateWindow(display, p, -1, -1, 1, 1,
|
|
|
462c49 |
+ 0, vi->depth, InputOutput, vi->visual,
|
|
|
462c49 |
+ CWBackPixmap|CWBackPixel|CWBorderPixel|CWColormap, &wsa;;
|
|
|
462c49 |
+ create(wid);
|
|
|
462c49 |
+ } else {
|
|
|
462c49 |
+ XSetWindowBackgroundPixmap(display, winId(), ParentRelative);
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+
|
|
|
462c49 |
+ // GNOME, NET WM Specification
|
|
|
462c49 |
+ static Atom netwm_tray_atom = XInternAtom(display, "_NET_SYSTEM_TRAY_OPCODE", False);
|
|
|
462c49 |
+ long l[5] = { CurrentTime, SYSTEM_TRAY_REQUEST_DOCK, static_cast<long>(winId()), 0, 0 };
|
|
|
462c49 |
+ XEvent ev;
|
|
|
462c49 |
+ memset(&ev, 0, sizeof(ev));
|
|
|
462c49 |
+ ev.xclient.type = ClientMessage;
|
|
|
462c49 |
+ ev.xclient.window = sysTrayWindow;
|
|
|
462c49 |
+ ev.xclient.message_type = netwm_tray_atom;
|
|
|
462c49 |
+ ev.xclient.format = 32;
|
|
|
462c49 |
+ memcpy((char *)&ev.xclient.data, (const char *) l, sizeof(l));
|
|
|
462c49 |
+ XSendEvent(display, sysTrayWindow, False, 0, &ev;;
|
|
|
462c49 |
+ setMinimumSize(22, 22); // required at least on GNOME
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+////////////////////////////////////////////////////////////////////////////
|
|
|
462c49 |
+QXEmbedSystemTrayIconSys::QXEmbedSystemTrayIconSys(QSystemTrayIcon *q)
|
|
|
462c49 |
+: QAbstractSystemTrayIconSys(q)
|
|
|
462c49 |
+, widget(0)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+QXEmbedSystemTrayIconSys::~QXEmbedSystemTrayIconSys()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ delete widget;
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+QRect QXEmbedSystemTrayIconSys::geometry() const
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ if (!widget)
|
|
|
462c49 |
+ return QRect();
|
|
|
462c49 |
+ return QRect(widget->mapToGlobal(QPoint(0, 0)), widget->size());
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QXEmbedSystemTrayIconSys::updateIcon()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ if (!widget)
|
|
|
462c49 |
+ return;
|
|
|
462c49 |
+ widget->update();
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QXEmbedSystemTrayIconSys::updateToolTip()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ if (!widget)
|
|
|
462c49 |
+ return;
|
|
|
462c49 |
+ widget->setToolTip(trayIcon->toolTip());
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QXEmbedSystemTrayIconSys::showMessage(const QString &message, const QString &title,
|
|
|
462c49 |
+ QSystemTrayIcon::MessageIcon icon, int msecs)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ if (!widget)
|
|
|
462c49 |
+ return;
|
|
|
462c49 |
+ QPoint point = geometry().center();
|
|
|
462c49 |
+ QBalloonTip::showBalloon(icon, message, title, trayIcon, point, msecs);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QXEmbedSystemTrayIconSys::updateVisibility()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ bool visible = trayIcon->isVisible();
|
|
|
462c49 |
+ if (visible && !widget)
|
|
|
462c49 |
+ widget = new QSystemTrayIconWidget(trayIcon, this);
|
|
|
462c49 |
+ else if (!visible && widget) {
|
|
|
462c49 |
+ delete widget;
|
|
|
462c49 |
+ widget = 0;
|
|
|
462c49 |
+ }
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QXEmbedSystemTrayIconSys::sendToolTipEventToTrayIcon()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+#ifndef QT_NO_TOOLTIP
|
|
|
462c49 |
+ // Pass the event through QSystemTrayIcon so that it gets a chance to
|
|
|
462c49 |
+ // update the tooltip, then asks widget to show the tooltip
|
|
|
462c49 |
+ Q_ASSERT(widget);
|
|
|
462c49 |
+ QPoint globalPos = QCursor::pos();
|
|
|
462c49 |
+ QPoint pos = widget->mapFromGlobal(globalPos);
|
|
|
462c49 |
+ QHelpEvent event(QEvent::ToolTip, pos, globalPos);
|
|
|
462c49 |
+ QApplication::sendEvent(trayIcon, &event);
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QXEmbedSystemTrayIconSys::sendWheelEventToTrayIcon(int delta, Qt::Orientation orientation)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+#ifndef QT_NO_WHEELEVENT
|
|
|
462c49 |
+ Q_ASSERT(widget);
|
|
|
462c49 |
+ QPoint globalPos = QCursor::pos();
|
|
|
462c49 |
+ QPoint pos = widget->mapFromGlobal(globalPos);
|
|
|
462c49 |
+ QWheelEvent event(pos, globalPos, delta, Qt::NoButton, Qt::NoModifier, orientation);
|
|
|
462c49 |
+ QApplication::sendEvent(trayIcon, &event);
|
|
|
462c49 |
+#endif
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+void QXEmbedSystemTrayIconSys::updateMenu()
|
|
|
462c49 |
+{
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+/////////////////////////////////////////////////////////////
|
|
|
462c49 |
+QAbstractSystemTrayIconSys * QXEmbedSystemTrayIconSysFactory::create(QSystemTrayIcon *icon)
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ return new QXEmbedSystemTrayIconSys(icon);
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+bool QXEmbedSystemTrayIconSysFactory::isAvailable() const
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ return QSystemTrayIconWidget::locateSystemTray() != XNone;
|
|
|
462c49 |
+}
|
|
|
462c49 |
+
|
|
|
462c49 |
+QT_END_NAMESPACE
|
|
|
462c49 |
+#endif //QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11_p.h.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11_p.h
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11_p.h.systemtrayicon 2014-03-31 18:16:39.709974914 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/qxembedsystemtrayicon_x11_p.h 2014-03-31 18:16:39.709974914 -0500
|
|
|
462c49 |
@@ -0,0 +1,104 @@
|
|
|
462c49 |
+/****************************************************************************
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
462c49 |
+** All rights reserved.
|
|
|
462c49 |
+** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** This file is part of the QtGui module of the Qt Toolkit.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_BEGIN_LICENSE:LGPL$
|
|
|
462c49 |
+** GNU Lesser General Public License Usage
|
|
|
462c49 |
+** This file may be used under the terms of the GNU Lesser General Public
|
|
|
462c49 |
+** License version 2.1 as published by the Free Software Foundation and
|
|
|
462c49 |
+** appearing in the file LICENSE.LGPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU Lesser
|
|
|
462c49 |
+** General Public License version 2.1 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** In addition, as a special exception, Nokia gives you certain additional
|
|
|
462c49 |
+** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
462c49 |
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** GNU General Public License Usage
|
|
|
462c49 |
+** Alternatively, this file may be used under the terms of the GNU General
|
|
|
462c49 |
+** Public License version 3.0 as published by the Free Software Foundation
|
|
|
462c49 |
+** and appearing in the file LICENSE.GPL included in the packaging of this
|
|
|
462c49 |
+** file. Please review the following information to ensure the GNU General
|
|
|
462c49 |
+** Public License version 3.0 requirements will be met:
|
|
|
462c49 |
+** http://www.gnu.org/copyleft/gpl.html.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** Other Usage
|
|
|
462c49 |
+** Alternatively, this file may be used in accordance with the terms and
|
|
|
462c49 |
+** conditions contained in a signed written agreement between you and Nokia.
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+**
|
|
|
462c49 |
+** $QT_END_LICENSE$
|
|
|
462c49 |
+**
|
|
|
462c49 |
+****************************************************************************/
|
|
|
462c49 |
+
|
|
|
462c49 |
+#ifndef QXEMBEDSYSTEMTRAYICON_X11_P_H
|
|
|
462c49 |
+#define QXEMBEDSYSTEMTRAYICON_X11_P_H
|
|
|
462c49 |
+
|
|
|
462c49 |
+//
|
|
|
462c49 |
+// W A R N I N G
|
|
|
462c49 |
+// -------------
|
|
|
462c49 |
+//
|
|
|
462c49 |
+// This file is not part of the Qt API. It exists for the convenience
|
|
|
462c49 |
+// of a number of Qt sources files. This header file may change from
|
|
|
462c49 |
+// version to version without notice, or even be removed.
|
|
|
462c49 |
+//
|
|
|
462c49 |
+// We mean it.
|
|
|
462c49 |
+//
|
|
|
462c49 |
+
|
|
|
462c49 |
+#ifndef QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
+
|
|
|
462c49 |
+#include "qabstractsystemtrayiconsys_p.h"
|
|
|
462c49 |
+
|
|
|
462c49 |
+QT_BEGIN_NAMESPACE
|
|
|
462c49 |
+
|
|
|
462c49 |
+class QSystemTrayIconWidget;
|
|
|
462c49 |
+
|
|
|
462c49 |
+class QXEmbedSystemTrayIconSys : public QAbstractSystemTrayIconSys
|
|
|
462c49 |
+{
|
|
|
462c49 |
+public:
|
|
|
462c49 |
+ QXEmbedSystemTrayIconSys(QSystemTrayIcon *);
|
|
|
462c49 |
+ ~QXEmbedSystemTrayIconSys();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ QRect geometry() const;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void updateVisibility();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void updateIcon();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void updateToolTip();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void updateMenu();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void showMessage(const QString &message, const QString &title,
|
|
|
462c49 |
+ QSystemTrayIcon::MessageIcon icon, int msecs);
|
|
|
462c49 |
+
|
|
|
462c49 |
+private:
|
|
|
462c49 |
+ friend class QSystemTrayIconWidget;
|
|
|
462c49 |
+ QSystemTrayIconWidget *widget;
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void sendToolTipEventToTrayIcon();
|
|
|
462c49 |
+
|
|
|
462c49 |
+ void sendWheelEventToTrayIcon(int delta, Qt::Orientation orientation);
|
|
|
462c49 |
+};
|
|
|
462c49 |
+
|
|
|
462c49 |
+struct QXEmbedSystemTrayIconSysFactory : public QSystemTrayIconSysFactoryInterface
|
|
|
462c49 |
+{
|
|
|
462c49 |
+ QAbstractSystemTrayIconSys * create(QSystemTrayIcon *trayIcon);
|
|
|
462c49 |
+ bool isAvailable() const;
|
|
|
462c49 |
+};
|
|
|
462c49 |
+
|
|
|
462c49 |
+
|
|
|
462c49 |
+QT_END_NAMESPACE
|
|
|
462c49 |
+
|
|
|
462c49 |
+#endif // QT_NO_SYSTEMTRAYICON
|
|
|
462c49 |
+
|
|
|
462c49 |
+#endif // QXEMBEDSYSTEMTRAYICON_X11_P_H
|
|
|
462c49 |
+
|
|
|
462c49 |
diff -up qt-everywhere-opensource-src-4.8.6/src/gui/util/util.pri.systemtrayicon qt-everywhere-opensource-src-4.8.6/src/gui/util/util.pri
|
|
|
462c49 |
--- qt-everywhere-opensource-src-4.8.6/src/gui/util/util.pri.systemtrayicon 2014-03-30 15:36:49.000000000 -0500
|
|
|
462c49 |
+++ qt-everywhere-opensource-src-4.8.6/src/gui/util/util.pri 2014-03-31 18:16:39.710974903 -0500
|
|
|
462c49 |
@@ -29,8 +29,13 @@ wince* {
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
unix:x11 {
|
|
|
462c49 |
+ HEADERS += \
|
|
|
462c49 |
+ util/qabstractsystemtrayiconsys_p.h \
|
|
|
462c49 |
+ util/qxembedsystemtrayicon_x11_p.h
|
|
|
462c49 |
SOURCES += \
|
|
|
462c49 |
- util/qsystemtrayicon_x11.cpp
|
|
|
462c49 |
+ util/qabstractsystemtrayiconsys.cpp \
|
|
|
462c49 |
+ util/qsystemtrayicon_x11.cpp \
|
|
|
462c49 |
+ util/qxembedsystemtrayicon_x11.cpp
|
|
|
462c49 |
}
|
|
|
462c49 |
|
|
|
462c49 |
embedded|qpa {
|