| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "qxcbconnection.h" |
| 7 | |
| 8 | #include <xcb/xcb.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | class QXcbConnection; |
| 13 | class QScreen; |
| 14 | |
| 15 | class QXcbSystemTrayTracker : public QObject, public QXcbWindowEventListener |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | public: |
| 19 | static QXcbSystemTrayTracker *create(QXcbConnection *connection); |
| 20 | |
| 21 | xcb_window_t trayWindow(); |
| 22 | void requestSystemTrayWindowDock(xcb_window_t window) const; |
| 23 | |
| 24 | void notifyManagerClientMessageEvent(const xcb_client_message_event_t *); |
| 25 | |
| 26 | void handleDestroyNotifyEvent(const xcb_destroy_notify_event_t *) override; |
| 27 | |
| 28 | xcb_visualid_t visualId(); |
| 29 | signals: |
| 30 | void systemTrayWindowChanged(QScreen *screen); |
| 31 | |
| 32 | private: |
| 33 | explicit QXcbSystemTrayTracker(QXcbConnection *connection, |
| 34 | xcb_atom_t trayAtom, |
| 35 | xcb_atom_t selection); |
| 36 | |
| 37 | void emitSystemTrayWindowChanged(); |
| 38 | xcb_visualid_t netSystemTrayVisual(); |
| 39 | |
| 40 | const xcb_atom_t m_selection; |
| 41 | const xcb_atom_t m_trayAtom; |
| 42 | QXcbConnection *m_connection; |
| 43 | xcb_window_t m_trayWindow = 0; |
| 44 | }; |
| 45 | |
| 46 | QT_END_NAMESPACE |
| 47 |
