1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 obt/prop.h for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 See the COPYING file for a copy of the GNU General Public License.
30 OBT_PROP_CARDINAL
, /*!< The atom which represents the Cardinal data type */
31 OBT_PROP_WINDOW
, /*!< The atom which represents window ids */
32 OBT_PROP_PIXMAP
, /*!< The atom which represents pixmap ids */
33 OBT_PROP_ATOM
, /*!< The atom which represents atom values */
34 OBT_PROP_STRING
, /*!< The atom which represents latin1 strings */
35 OBT_PROP_COMPOUND_TEXT
, /*!< The atom which represents locale-encoded
37 OBT_PROP_UTF8_STRING
, /*!< The atom which represents utf8-encoded strings*/
43 OBT_PROP_WM_COLORMAP_WINDOWS
,
44 OBT_PROP_WM_PROTOCOLS
,
46 OBT_PROP_WM_DELETE_WINDOW
,
47 OBT_PROP_WM_TAKE_FOCUS
,
48 OBT_PROP_WM_CHANGE_STATE
,
50 OBT_PROP_WM_ICON_NAME
,
52 OBT_PROP_WM_WINDOW_ROLE
,
53 OBT_PROP_WM_CLIENT_MACHINE
,
55 OBT_PROP_WM_CLIENT_LEADER
,
56 OBT_PROP_WM_TRANSIENT_FOR
,
57 OBT_PROP_MOTIF_WM_HINTS
,
58 OBT_PROP_MOTIF_WM_INFO
,
61 OBT_PROP_SM_CLIENT_ID
,
65 /* Atoms that are used inside messages - these don't go in net_supported */
67 OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOPLEFT
,
68 OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOP
,
69 OBT_PROP_NET_WM_MOVERESIZE_SIZE_TOPRIGHT
,
70 OBT_PROP_NET_WM_MOVERESIZE_SIZE_RIGHT
,
71 OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT
,
72 OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOM
,
73 OBT_PROP_NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT
,
74 OBT_PROP_NET_WM_MOVERESIZE_SIZE_LEFT
,
75 OBT_PROP_NET_WM_MOVERESIZE_MOVE
,
76 OBT_PROP_NET_WM_MOVERESIZE_SIZE_KEYBOARD
,
77 OBT_PROP_NET_WM_MOVERESIZE_MOVE_KEYBOARD
,
78 OBT_PROP_NET_WM_MOVERESIZE_CANCEL
,
80 OBT_PROP_NET_WM_STATE_ADD
,
81 OBT_PROP_NET_WM_STATE_REMOVE
,
82 OBT_PROP_NET_WM_STATE_TOGGLE
,
84 OBT_PROP_NET_WM_ORIENTATION_HORZ
,
85 OBT_PROP_NET_WM_ORIENTATION_VERT
,
86 OBT_PROP_NET_WM_TOPLEFT
,
87 OBT_PROP_NET_WM_TOPRIGHT
,
88 OBT_PROP_NET_WM_BOTTOMRIGHT
,
89 OBT_PROP_NET_WM_BOTTOMLEFT
,
91 OBT_PROP_NET_WM_WINDOW_TYPE_POPUP_MENU
,
93 OBT_PROP_PRIVATE_PADDING1
,
94 OBT_PROP_PRIVATE_PADDING2
,
95 OBT_PROP_PRIVATE_PADDING3
,
96 OBT_PROP_PRIVATE_PADDING4
,
97 OBT_PROP_PRIVATE_PADDING5
,
98 OBT_PROP_PRIVATE_PADDING6
,
99 OBT_PROP_PRIVATE_PADDING7
,
100 OBT_PROP_PRIVATE_PADDING8
,
101 OBT_PROP_PRIVATE_PADDING9
,
102 OBT_PROP_PRIVATE_PADDING10
,
103 OBT_PROP_PRIVATE_PADDING11
,
104 OBT_PROP_PRIVATE_PADDING12
,
106 /* Everything below here must go in net_supported on the root window */
108 /* root window properties */
109 OBT_PROP_NET_SUPPORTED
,
110 OBT_PROP_NET_CLIENT_LIST
,
111 OBT_PROP_NET_CLIENT_LIST_STACKING
,
112 OBT_PROP_NET_NUMBER_OF_DESKTOPS
,
113 OBT_PROP_NET_DESKTOP_GEOMETRY
,
114 OBT_PROP_NET_DESKTOP_VIEWPORT
,
115 OBT_PROP_NET_CURRENT_DESKTOP
,
116 OBT_PROP_NET_DESKTOP_NAMES
,
117 OBT_PROP_NET_ACTIVE_WINDOW
,
118 /* Atom net_restack_window;*/
119 OBT_PROP_NET_WORKAREA
,
120 OBT_PROP_NET_SUPPORTING_WM_CHECK
,
121 OBT_PROP_NET_DESKTOP_LAYOUT
,
122 OBT_PROP_NET_SHOWING_DESKTOP
,
124 /* root window messages */
125 OBT_PROP_NET_CLOSE_WINDOW
,
126 OBT_PROP_NET_WM_MOVERESIZE
,
127 OBT_PROP_NET_MOVERESIZE_WINDOW
,
128 OBT_PROP_NET_REQUEST_FRAME_EXTENTS
,
129 OBT_PROP_NET_RESTACK_WINDOW
,
131 /* helpful hints to apps that aren't used for anything */
132 OBT_PROP_NET_WM_FULL_PLACEMENT
,
134 /* startup-notification extension */
135 OBT_PROP_NET_STARTUP_ID
,
137 /* application window properties */
138 OBT_PROP_NET_WM_NAME
,
139 OBT_PROP_NET_WM_VISIBLE_NAME
,
140 OBT_PROP_NET_WM_ICON_NAME
,
141 OBT_PROP_NET_WM_VISIBLE_ICON_NAME
,
142 OBT_PROP_NET_WM_DESKTOP
,
143 OBT_PROP_NET_WM_WINDOW_TYPE
,
144 OBT_PROP_NET_WM_STATE
,
145 OBT_PROP_NET_WM_STRUT
,
146 OBT_PROP_NET_WM_STRUT_PARTIAL
,
147 OBT_PROP_NET_WM_ICON
,
148 OBT_PROP_NET_WM_ICON_GEOMETRY
,
150 OBT_PROP_NET_WM_ALLOWED_ACTIONS
,
151 OBT_PROP_NET_WM_USER_TIME
,
152 /* OBT_PROP_NET_WM_USER_TIME_WINDOW, */
153 OBT_PROP_NET_FRAME_EXTENTS
,
155 /* application protocols */
156 OBT_PROP_NET_WM_PING
,
158 OBT_PROP_NET_WM_SYNC_REQUEST
,
159 OBT_PROP_NET_WM_SYNC_REQUEST_COUNTER
,
162 OBT_PROP_NET_WM_WINDOW_TYPE_DESKTOP
,
163 OBT_PROP_NET_WM_WINDOW_TYPE_DOCK
,
164 OBT_PROP_NET_WM_WINDOW_TYPE_TOOLBAR
,
165 OBT_PROP_NET_WM_WINDOW_TYPE_MENU
,
166 OBT_PROP_NET_WM_WINDOW_TYPE_UTILITY
,
167 OBT_PROP_NET_WM_WINDOW_TYPE_SPLASH
,
168 OBT_PROP_NET_WM_WINDOW_TYPE_DIALOG
,
169 OBT_PROP_NET_WM_WINDOW_TYPE_NORMAL
,
171 OBT_PROP_NET_WM_ACTION_MOVE
,
172 OBT_PROP_NET_WM_ACTION_RESIZE
,
173 OBT_PROP_NET_WM_ACTION_MINIMIZE
,
174 OBT_PROP_NET_WM_ACTION_SHADE
,
175 /* OBT_PROP_NET_WM_ACTION_STICK,*/
176 OBT_PROP_NET_WM_ACTION_MAXIMIZE_HORZ
,
177 OBT_PROP_NET_WM_ACTION_MAXIMIZE_VERT
,
178 OBT_PROP_NET_WM_ACTION_FULLSCREEN
,
179 OBT_PROP_NET_WM_ACTION_CHANGE_DESKTOP
,
180 OBT_PROP_NET_WM_ACTION_CLOSE
,
181 OBT_PROP_NET_WM_ACTION_ABOVE
,
182 OBT_PROP_NET_WM_ACTION_BELOW
,
184 OBT_PROP_NET_WM_STATE_MODAL
,
185 /* OBT_PROP_NET_WM_STATE_STICKY,*/
186 OBT_PROP_NET_WM_STATE_MAXIMIZED_VERT
,
187 OBT_PROP_NET_WM_STATE_MAXIMIZED_HORZ
,
188 OBT_PROP_NET_WM_STATE_SHADED
,
189 OBT_PROP_NET_WM_STATE_SKIP_TASKBAR
,
190 OBT_PROP_NET_WM_STATE_SKIP_PAGER
,
191 OBT_PROP_NET_WM_STATE_HIDDEN
,
192 OBT_PROP_NET_WM_STATE_FULLSCREEN
,
193 OBT_PROP_NET_WM_STATE_ABOVE
,
194 OBT_PROP_NET_WM_STATE_BELOW
,
195 OBT_PROP_NET_WM_STATE_DEMANDS_ATTENTION
,
199 OBT_PROP_KDE_WM_CHANGE_STATE
,
200 OBT_PROP_KDE_NET_WM_FRAME_STRUT
,
201 OBT_PROP_KDE_NET_WM_WINDOW_TYPE_OVERRIDE
,
208 /* Openbox specific atoms */
210 OBT_PROP_OB_WM_ACTION_UNDECORATE
,
211 OBT_PROP_OB_WM_STATE_UNDECORATED
,
212 OBT_PROP_OPENBOX_PID
, /* this is depreecated in favour of ob_control */
214 OBT_PROP_OB_CONFIG_FILE
,
217 OBT_PROP_OB_APP_ROLE
,
218 OBT_PROP_OB_APP_TITLE
,
219 OBT_PROP_OB_APP_NAME
,
220 OBT_PROP_OB_APP_CLASS
,
221 OBT_PROP_OB_APP_TYPE
,
226 Atom
obt_prop_atom(ObtPropAtom a
);
229 /*! STRING is latin1 encoded. It cannot contain control characters except
230 for tab and line-feed. */
231 OBT_PROP_TEXT_STRING
= 1,
232 /*! STRING text restricted to characters in the X Portable Character
233 Set, which is a subset of latin1.
234 http://static.cray-cyber.org/Documentation/NEC_SX_R10_1/G1AE02E/CHAP1.HTML
236 OBT_PROP_TEXT_STRING_XPCS
= 2,
237 /*! STRING text restricted to not allow any control characters to be
239 OBT_PROP_TEXT_STRING_NO_CC
= 3,
240 /* COMPOUND_TEXT is encoded in the current locale setting. */
241 OBT_PROP_TEXT_COMPOUND_TEXT
= 4,
242 /* UTF8_STRING is encoded as utf-8. */
243 OBT_PROP_TEXT_UTF8_STRING
= 5,
246 gboolean
obt_prop_get32(Window win
, Atom prop
, Atom type
, guint32
*ret
);
247 gboolean
obt_prop_get_array32(Window win
, Atom prop
, Atom type
, guint32
**ret
,
250 gboolean
obt_prop_get_text(Window win
, Atom prop
, ObtPropTextType type
,
252 gboolean
obt_prop_get_array_text(Window win
, Atom prop
,
253 ObtPropTextType type
,
256 void obt_prop_set32(Window win
, Atom prop
, Atom type
, gulong val
);
257 void obt_prop_set_array32(Window win
, Atom prop
, Atom type
, gulong
*val
,
259 void obt_prop_set_text(Window win
, Atom prop
, const gchar
*str
);
260 void obt_prop_set_array_text(Window win
, Atom prop
, const gchar
*const *strs
);
262 void obt_prop_erase(Window win
, Atom prop
);
264 void obt_prop_message(gint screen
, Window about
, Atom messagetype
,
265 glong data0
, glong data1
, glong data2
, glong data3
,
266 glong data4
, glong mask
);
267 void obt_prop_message_to(Window to
, Window about
, Atom messagetype
,
268 glong data0
, glong data1
, glong data2
, glong data3
,
269 glong data4
, glong mask
);
271 #define OBT_PROP_ATOM(prop) obt_prop_atom(OBT_PROP_##prop)
273 #define OBT_PROP_GET32(win, prop, type, ret) \
274 (obt_prop_get32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), ret))
275 #define OBT_PROP_GETA32(win, prop, type, ret, nret) \
276 (obt_prop_get_array32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), \
278 #define OBT_PROP_GETS(win, prop, ret) \
279 (obt_prop_get_text(win, OBT_PROP_ATOM(prop), 0, ret))
280 #define OBT_PROP_GETSS(win, prop, ret) \
281 (obt_prop_get_array_text(win, OBT_PROP_ATOM(prop), 0, ret))
283 #define OBT_PROP_GETS_TYPE(win, prop, type, ret) \
284 (obt_prop_get_text(win, OBT_PROP_ATOM(prop), OBT_PROP_TEXT_##type, ret))
285 #define OBT_PROP_GETSS_TYPE(win, prop, type, ret) \
286 (obt_prop_get_array_text(win, OBT_PROP_ATOM(prop), \
287 OBT_PROP_TEXT_##type, ret))
289 #define OBT_PROP_GETS_UTF8(win, prop, ret) \
290 OBT_PROP_GETS_TYPE(win, prop, UTF8_STRING, ret)
291 #define OBT_PROP_GETSS_UTF8(win, prop, ret) \
292 OBT_PROP_GETSS_TYPE(win, prop, UTF8_STRING, ret)
293 #define OBT_PROP_GETS_XPCS(win, prop, ret) \
294 OBT_PROP_GETS_TYPE(win, prop, STRING_XPCS, ret)
296 #define OBT_PROP_SET32(win, prop, type, val) \
297 (obt_prop_set32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), val))
298 #define OBT_PROP_SETA32(win, prop, type, val, num) \
299 (obt_prop_set_array32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), \
301 #define OBT_PROP_SETS(win, prop, val) \
302 (obt_prop_set_text(win, OBT_PROP_ATOM(prop), val))
303 #define OBT_PROP_SETSS(win, prop, strs) \
304 (obt_prop_set_array_text(win, OBT_PROP_ATOM(prop), strs))
306 #define OBT_PROP_ERASE(win, prop) (obt_prop_erase(win, OBT_PROP_ATOM(prop)))
308 #define OBT_PROP_MSG(screen, about, msgtype, data0, data1, data2, data3, \
310 (obt_prop_message(screen, about, OBT_PROP_ATOM(msgtype), \
311 data0, data1, data2, data3, data4, \
312 SubstructureNotifyMask | SubstructureRedirectMask))
314 #define OBT_PROP_MSG_TO(to, about, msgtype, data0, data1, data2, data3, \
316 (obt_prop_message_to(to, about, OBT_PROP_ATOM(msgtype), \
317 data0, data1, data2, data3, data4, mask))
321 #endif /* __obt_prop_h */