42 #include "private/qt_x11_p.h" 56 #ifndef QT_NO_SYSTEMTRAYICON 87 ulong nitems, bytes_remaining;
90 False, XA_VISUALID, &actual_type,
91 &actual_format, &nitems, &bytes_remaining, &data);
93 if (result ==
Success && data && actual_type == XA_VISUALID && actual_format == 32 &&
94 nitems == 1 && bytes_remaining == 0)
95 vid = *(VisualID*)data;
102 XVisualInfo *vi, rvi;
105 vi = XGetVisualInfo(display, mask, &rvi, &count);
129 if (ev->type == DestroyNotify && ev->xany.window ==
sysTrayWindow) {
143 static Atom manager_atom = XInternAtom(display,
"MANAGER", False);
144 XClientMessageEvent *cm = (XClientMessageEvent *)message;
174 static bool eventFilterAdded =
false;
176 if (!eventFilterAdded) {
178 eventFilterAdded =
true;
180 XWindowAttributes attr;
181 XGetWindowAttributes(display, root, &attr);
182 if ((attr.your_event_mask & StructureNotifyMask) != StructureNotifyMask) {
184 XSelectInput(display, root, attr.your_event_mask | StructureNotifyMask);
194 #ifndef QT_NO_TOOLTIP 222 if (vi && vi->visual) {
223 Window root = RootWindow(display, vi->screen);
226 p = pw->effectiveWinId();
227 colormap = XCreateColormap(display, root, vi->visual, AllocNone);
228 XSetWindowAttributes wsa;
229 wsa.background_pixmap = 0;
231 wsa.background_pixel = 0;
232 wsa.border_pixel = 0;
233 Window wid = XCreateWindow(display, p, -1, -1, 1, 1,
234 0, vi->depth, InputOutput, vi->visual,
235 CWBackPixmap|CWBackPixel|CWBorderPixel|CWColormap, &wsa);
238 XSetWindowBackgroundPixmap(display,
winId(), ParentRelative);
242 static Atom netwm_tray_atom = XInternAtom(display,
"_NET_SYSTEM_TRAY_OPCODE", False);
245 memset(&ev, 0,
sizeof(ev));
246 ev.xclient.type = ClientMessage;
248 ev.xclient.message_type = netwm_tray_atom;
249 ev.xclient.format = 32;
250 memcpy((
char *)&ev.xclient.data, (
const char *) l,
sizeof(l));
277 pe->setSystemClip(oldSystemClip);
311 #ifndef QT_NO_WHEELEVENT 328 if (event->type == ReparentNotify)
345 return QRect(sys->mapToGlobal(
QPoint(0, 0)), sys->size());
374 #ifndef QT_NO_TOOLTIP 396 QPoint(g.
x() + sys->width()/2, g.
y() + sys->height()/2),
401 #endif //QT_NO_SYSTEMTRAYICON The QPainter class performs low-level painting on widgets and other paint devices.
void showMessage_sys(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs)
#define QT_END_NAMESPACE
This macro expands to.
static int appScreen()
Returns the number of the screen where the application is being displayed.
The QWheelEvent class contains parameters that describe a wheel event.
void paintEvent(QPaintEvent *pe)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
static Qt::HANDLE appRootWindow(int screen=-1)
Returns a handle for the applications root window on the given screen.
QRect geometry_sys() const
int width() const
Returns the width of the rectangle.
static void hideBalloon()
int count(const T &t) const
Returns the number of occurrences of value in the list.
QRect boundingRect() const
Returns the bounding rectangle of this region.
int height() const
Returns the height of the rectangle.
static Window sysTrayWindow
The QString class provides a Unicode character string.
static bool supportsMessages_sys()
void activated(QSystemTrayIcon::ActivationReason reason)
This signal is emitted when the user activates the system tray icon.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static void showBalloon(QSystemTrayIcon::MessageIcon icon, const QString &title, const QString &msg, QSystemTrayIcon *trayIcon, const QPoint &pos, int timeout, bool showArrow=true)
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString toolTip
the tooltip for the system tray entry
Q_GUI_EXPORT EGLDisplay display()
static Window locateSystemTray()
static bool isSystemTrayAvailable_sys()
static QList< QSystemTrayIconSys * > trayIcons
The QResizeEvent class contains event parameters for resize events.
QMenu * contextMenu() const
Returns the current context menu for the system tray entry.
bool event(QEvent *e)
This is the main event handler; it handles event event.
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QRegion class specifies a clip region for a painter.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
void setSystemClip(const QRegion &baseClip)
Sets the system clip for this engine.
Qt::MouseButton button() const
Returns the button that caused the event.
QIcon icon
the system tray icon
static bool sysTrayTracker(void *message, long *result)
void mouseDoubleClickEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse double click...
The QMouseEvent class contains parameters that describe a mouse event.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
bool x11Event(XEvent *event)
This special event handler can be reimplemented in a subclass to receive native X11 events passed in ...
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
void resizeEvent(QResizeEvent *re)
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
int y() const
Returns the y-coordinate of the rectangle's top edge.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
bool(* EventFilter)(void *message, long *result)
A function with the following signature that can be used as an event filter:
The QRect class defines a rectangle in the plane using integer precision.
int y() const
Returns the y coordinate of this point.
XVisualInfo * getSysTrayVisualInfo()
int x() const
Returns the x coordinate of this point.
static Atom sysTraySelection
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
QRegion systemClip() const
Returns the system clip.
QSystemTrayIconSys(QSystemTrayIcon *icon, QSystemTrayIconPrivate *d)
static QCoreApplication::EventFilter oldEventFilter
static bool isBalloonVisible()
static Display * display()
Returns the default display for the application.
void wheelEvent(QWheelEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive wheel events for t...
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
The QSystemTrayIcon class provides an icon for an application in the system tray. ...
The QList class is a template class that provides lists.
void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment=Qt::AlignCenter, Mode mode=Normal, State state=Off) const
Uses the painter to paint the icon with specified alignment, required mode, and state into the rectan...
void mousePressEvent(QMouseEvent *event)
This event handler, for event event, can be reimplemented in a subclass to receive mouse press events...
void messageClicked()
This signal is emitted when the message displayed using showMessage() was clicked by the user...
static XVisualInfo sysTrayVisual
void removeAt(int i)
Removes the item at index position i.