1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 #ifndef QXCBATOM_H
40 #define QXCBATOM_H
41 
42 #include <xcb/xcb.h>
43 
44 class QXcbAtom
45 {
46 public:
47     enum Atom {
48         // window-manager <-> client protocols
49         WM_PROTOCOLS,
50         WM_DELETE_WINDOW,
51         WM_TAKE_FOCUS,
52         _NET_WM_PING,
53         _NET_WM_CONTEXT_HELP,
54         _NET_WM_SYNC_REQUEST,
55         _NET_WM_SYNC_REQUEST_COUNTER,
56         MANAGER, // System tray notification
57         _NET_SYSTEM_TRAY_OPCODE, // System tray operation
58 
59         // ICCCM window state
60         WM_STATE,
61         WM_CHANGE_STATE,
62         WM_CLASS,
63         WM_NAME,
64 
65         // Session management
66         WM_CLIENT_LEADER,
67         WM_WINDOW_ROLE,
68         SM_CLIENT_ID,
69         WM_CLIENT_MACHINE,
70 
71         // Clipboard
72         CLIPBOARD,
73         INCR,
74         TARGETS,
75         MULTIPLE,
76         TIMESTAMP,
77         SAVE_TARGETS,
78         CLIP_TEMPORARY,
79         _QT_SELECTION,
80         _QT_CLIPBOARD_SENTINEL,
81         _QT_SELECTION_SENTINEL,
82         CLIPBOARD_MANAGER,
83 
84         RESOURCE_MANAGER,
85 
86         _XSETROOT_ID,
87 
88         _QT_SCROLL_DONE,
89         _QT_INPUT_ENCODING,
90 
91         // Qt/XCB specific
92         _QT_CLOSE_CONNECTION,
93 
94         _MOTIF_WM_HINTS,
95 
96         DTWM_IS_RUNNING,
97         ENLIGHTENMENT_DESKTOP,
98         _DT_SAVE_MODE,
99         _SGI_DESKS_MANAGER,
100 
101         // EWMH (aka NETWM)
102         _NET_SUPPORTED,
103         _NET_VIRTUAL_ROOTS,
104         _NET_WORKAREA,
105 
106         _NET_MOVERESIZE_WINDOW,
107         _NET_WM_MOVERESIZE,
108 
109         _NET_WM_NAME,
110         _NET_WM_ICON_NAME,
111         _NET_WM_ICON,
112 
113         _NET_WM_PID,
114 
115         _NET_WM_WINDOW_OPACITY,
116 
117         _NET_WM_STATE,
118         _NET_WM_STATE_ABOVE,
119         _NET_WM_STATE_BELOW,
120         _NET_WM_STATE_FULLSCREEN,
121         _NET_WM_STATE_MAXIMIZED_HORZ,
122         _NET_WM_STATE_MAXIMIZED_VERT,
123         _NET_WM_STATE_MODAL,
124         _NET_WM_STATE_STAYS_ON_TOP,
125         _NET_WM_STATE_DEMANDS_ATTENTION,
126         _NET_WM_STATE_HIDDEN,
127 
128         _NET_WM_USER_TIME,
129         _NET_WM_USER_TIME_WINDOW,
130         _NET_WM_FULL_PLACEMENT,
131 
132         _NET_WM_WINDOW_TYPE,
133         _NET_WM_WINDOW_TYPE_DESKTOP,
134         _NET_WM_WINDOW_TYPE_DOCK,
135         _NET_WM_WINDOW_TYPE_TOOLBAR,
136         _NET_WM_WINDOW_TYPE_MENU,
137         _NET_WM_WINDOW_TYPE_UTILITY,
138         _NET_WM_WINDOW_TYPE_SPLASH,
139         _NET_WM_WINDOW_TYPE_DIALOG,
140         _NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
141         _NET_WM_WINDOW_TYPE_POPUP_MENU,
142         _NET_WM_WINDOW_TYPE_TOOLTIP,
143         _NET_WM_WINDOW_TYPE_NOTIFICATION,
144         _NET_WM_WINDOW_TYPE_COMBO,
145         _NET_WM_WINDOW_TYPE_DND,
146         _NET_WM_WINDOW_TYPE_NORMAL,
147         _KDE_NET_WM_WINDOW_TYPE_OVERRIDE,
148 
149         _KDE_NET_WM_FRAME_STRUT,
150         _NET_FRAME_EXTENTS,
151 
152         _NET_STARTUP_INFO,
153         _NET_STARTUP_INFO_BEGIN,
154 
155         _NET_SUPPORTING_WM_CHECK,
156 
157         _NET_WM_CM_S0,
158 
159         _NET_SYSTEM_TRAY_VISUAL,
160 
161         _NET_ACTIVE_WINDOW,
162 
163         // Property formats
164         TEXT,
165         UTF8_STRING,
166         CARDINAL,
167 
168         // Xdnd
169         XdndEnter,
170         XdndPosition,
171         XdndStatus,
172         XdndLeave,
173         XdndDrop,
174         XdndFinished,
175         XdndTypelist,
176         XdndActionList,
177 
178         XdndSelection,
179 
180         XdndAware,
181         XdndProxy,
182 
183         XdndActionCopy,
184         XdndActionLink,
185         XdndActionMove,
186         XdndActionAsk,
187         XdndActionPrivate,
188 
189         // Xkb
190         _XKB_RULES_NAMES,
191 
192         // XEMBED
193         _XEMBED,
194         _XEMBED_INFO,
195 
196         // XInput2
197         ButtonLeft,
198         ButtonMiddle,
199         ButtonRight,
200         ButtonWheelUp,
201         ButtonWheelDown,
202         ButtonHorizWheelLeft,
203         ButtonHorizWheelRight,
204         AbsMTPositionX,
205         AbsMTPositionY,
206         AbsMTTouchMajor,
207         AbsMTTouchMinor,
208         AbsMTOrientation,
209         AbsMTPressure,
210         AbsMTTrackingID,
211         MaxContacts,
212         RelX,
213         RelY,
214         // XInput2 tablet
215         AbsX,
216         AbsY,
217         AbsPressure,
218         AbsTiltX,
219         AbsTiltY,
220         AbsWheel,
221         AbsDistance,
222         WacomSerialIDs,
223         INTEGER,
224         RelHorizWheel,
225         RelVertWheel,
226         RelHorizScroll,
227         RelVertScroll,
228 
229         _XSETTINGS_SETTINGS,
230 
231         _COMPIZ_DECOR_PENDING,
232         _COMPIZ_DECOR_REQUEST,
233         _COMPIZ_DECOR_DELETE_PIXMAP,
234         _COMPIZ_TOOLKIT_ACTION,
235         _GTK_LOAD_ICONTHEMES,
236 
237         AT_SPI_BUS,
238 
239         EDID,
240         EDID_DATA,
241         XFree86_DDC_EDID1_RAWDATA,
242 
243         NAtoms
244     };
245 
246     QXcbAtom();
247     void initialize(xcb_connection_t *connection);
248 
atom(QXcbAtom::Atom atom)249     inline xcb_atom_t atom(QXcbAtom::Atom atom) const { return m_allAtoms[atom]; }
250     QXcbAtom::Atom qatom(xcb_atom_t atom) const;
251 
252 protected:
253     void initializeAllAtoms(xcb_connection_t *connection);
254 
255 private:
256     xcb_atom_t m_allAtoms[QXcbAtom::NAtoms];
257 };
258 
259 #endif // QXCBATOM_H
260