Allow delayed focus to work while in a menu or move/resize since it wont kill them now
[dana/openbox.git] / openbox / prop.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    prop.h for the Openbox window manager
4    Copyright (c) 2006        Mikael Magnusson
5    Copyright (c) 2003-2007   Dana Jansens
6
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.
11
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.
16
17    See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef __atoms_h
21 #define __atoms_h
22
23 #include <X11/Xlib.h>
24 #include <glib.h>
25 #ifdef HAVE_STRING_H
26 #  include <string.h>
27 #endif
28
29 /*! The atoms on the X server which this class will cache */
30 typedef struct Atoms {
31     /* types */
32     Atom cardinal; /*!< The atom which represents the Cardinal data type */
33     Atom window;   /*!< The atom which represents window ids */
34     Atom pixmap;   /*!< The atom which represents pixmap ids */
35     Atom atom;     /*!< The atom which represents atom values */
36     Atom string;   /*!< The atom which represents ascii strings */
37     Atom utf8;     /*!< The atom which represents utf8-encoded strings */
38
39     /* selection stuff */
40     Atom manager;
41
42     /* window hints */
43     Atom wm_colormap_windows;
44     Atom wm_protocols;
45     Atom wm_state;
46     Atom wm_delete_window;
47     Atom wm_take_focus;
48     Atom wm_change_state;
49     Atom wm_name;
50     Atom wm_icon_name;
51     Atom wm_class;
52     Atom wm_window_role;
53     Atom wm_client_machine;
54     Atom wm_command;
55     Atom wm_client_leader;
56     Atom wm_transient_for;
57     Atom motif_wm_hints;
58     Atom motif_wm_info;
59
60     /* SM atoms */
61     Atom sm_client_id;
62
63     /* NETWM atoms */
64
65     /* Atoms that are used inside messages - these don't go in net_supported */
66
67     Atom net_wm_moveresize_size_topleft;
68     Atom net_wm_moveresize_size_top;
69     Atom net_wm_moveresize_size_topright;
70     Atom net_wm_moveresize_size_right;
71     Atom net_wm_moveresize_size_bottomright;
72     Atom net_wm_moveresize_size_bottom;
73     Atom net_wm_moveresize_size_bottomleft;
74     Atom net_wm_moveresize_size_left;
75     Atom net_wm_moveresize_move;
76     Atom net_wm_moveresize_size_keyboard;
77     Atom net_wm_moveresize_move_keyboard;
78     Atom net_wm_moveresize_cancel;
79
80     Atom net_wm_state_add;
81     Atom net_wm_state_remove;
82     Atom net_wm_state_toggle;
83
84     Atom net_wm_orientation_horz;
85     Atom net_wm_orientation_vert;
86     Atom net_wm_topleft;
87     Atom net_wm_topright;
88     Atom net_wm_bottomright;
89     Atom net_wm_bottomleft;
90
91     /* types that we use but don't support */
92
93     Atom net_wm_window_type_popup_menu;
94
95     /* Everything below here must go in net_supported on the root window */
96
97     /* root window properties */
98     Atom net_supported;
99     Atom net_client_list;
100     Atom net_client_list_stacking;
101     Atom net_number_of_desktops;
102     Atom net_desktop_geometry;
103     Atom net_desktop_viewport;
104     Atom net_current_desktop;
105     Atom net_desktop_names;
106     Atom net_active_window;
107 /*    Atom net_restack_window;*/
108     Atom net_workarea;
109     Atom net_supporting_wm_check;
110     Atom net_desktop_layout;
111     Atom net_showing_desktop;
112
113     /* root window messages */
114     Atom net_close_window;
115     Atom net_wm_moveresize;
116     Atom net_moveresize_window;
117     Atom net_request_frame_extents;
118     Atom net_restack_window;
119
120     /* helpful hints to apps that aren't used for anything */
121     Atom net_wm_full_placement;
122
123     /* startup-notification extension */
124     Atom net_startup_id;
125
126     /* application window properties */
127     Atom net_wm_name;
128     Atom net_wm_visible_name;
129     Atom net_wm_icon_name;
130     Atom net_wm_visible_icon_name;
131     Atom net_wm_desktop;
132     Atom net_wm_window_type;
133     Atom net_wm_state;
134     Atom net_wm_strut;
135     Atom net_wm_strut_partial;
136     Atom net_wm_icon;
137     Atom net_wm_icon_geometry;
138     Atom net_wm_pid;
139     Atom net_wm_allowed_actions;
140     Atom net_wm_user_time;
141 /*  Atom net_wm_user_time_window; */
142     Atom net_frame_extents;
143
144     /* application protocols */
145     Atom net_wm_ping;
146 #ifdef SYNC
147     Atom net_wm_sync_request;
148     Atom net_wm_sync_request_counter;
149 #endif
150
151     Atom net_wm_window_type_desktop;
152     Atom net_wm_window_type_dock;
153     Atom net_wm_window_type_toolbar;
154     Atom net_wm_window_type_menu;
155     Atom net_wm_window_type_utility;
156     Atom net_wm_window_type_splash;
157     Atom net_wm_window_type_dialog;
158     Atom net_wm_window_type_normal;
159
160     Atom net_wm_action_move;
161     Atom net_wm_action_resize;
162     Atom net_wm_action_minimize;
163     Atom net_wm_action_shade;
164 /*    Atom net_wm_action_stick;*/
165     Atom net_wm_action_maximize_horz;
166     Atom net_wm_action_maximize_vert;
167     Atom net_wm_action_fullscreen;
168     Atom net_wm_action_change_desktop;
169     Atom net_wm_action_close;
170     Atom net_wm_action_above;
171     Atom net_wm_action_below;
172
173     Atom net_wm_state_modal;
174 /*    Atom net_wm_state_sticky;*/
175     Atom net_wm_state_maximized_vert;
176     Atom net_wm_state_maximized_horz;
177     Atom net_wm_state_shaded;
178     Atom net_wm_state_skip_taskbar;
179     Atom net_wm_state_skip_pager;
180     Atom net_wm_state_hidden;
181     Atom net_wm_state_fullscreen;
182     Atom net_wm_state_above;
183     Atom net_wm_state_below;
184     Atom net_wm_state_demands_attention;
185
186     /* KDE atoms */
187
188     Atom kde_wm_change_state;
189     Atom kde_net_wm_frame_strut;
190     Atom kde_net_wm_window_type_override;
191
192 /*
193     Atom rootpmapid;
194     Atom esetrootid;
195 */
196
197     /* Openbox specific atoms */
198
199     Atom ob_wm_action_undecorate;
200     Atom ob_wm_state_undecorated;
201     Atom openbox_pid; /* this is depreecated in favour of ob_control */
202     Atom ob_theme;
203     Atom ob_config_file;
204     Atom ob_control;
205     Atom ob_role;
206     Atom ob_name;
207     Atom ob_class;
208 } Atoms;
209 extern Atoms prop_atoms;
210
211 void prop_startup();
212
213 gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
214 gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
215                           guint *nret);
216 gboolean prop_get_string_locale(Window win, Atom prop, gchar **ret);
217 gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret);
218 gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret);
219 gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret);
220
221 void prop_set32(Window win, Atom prop, Atom type, gulong val);
222 void prop_set_array32(Window win, Atom prop, Atom type, gulong *val,
223                       guint num);
224 void prop_set_string_utf8(Window win, Atom prop, const gchar *val);
225 void prop_set_strings_utf8(Window win, Atom prop, gchar **strs);
226
227 void prop_erase(Window win, Atom prop);
228
229 void prop_message(Window about, Atom messagetype, glong data0, glong data1,
230                   glong data2, glong data3, glong mask);
231 void prop_message_to(Window to, Window about, Atom messagetype,
232                      glong data0, glong data1, glong data2,
233                      glong data3, glong data4, glong mask);
234
235 #define PROP_GET32(win, prop, type, ret) \
236     (prop_get32(win, prop_atoms.prop, prop_atoms.type, ret))
237 #define PROP_GETA32(win, prop, type, ret, nret) \
238     (prop_get_array32(win, prop_atoms.prop, prop_atoms.type, ret, \
239                       nret))
240 #define PROP_GETS(win, prop, type, ret) \
241     (prop_get_string_##type(win, prop_atoms.prop, ret))
242 #define PROP_GETSS(win, prop, type, ret) \
243     (prop_get_strings_##type(win, prop_atoms.prop, ret))
244
245 #define PROP_SET32(win, prop, type, val) \
246     prop_set32(win, prop_atoms.prop, prop_atoms.type, val)
247 #define PROP_SETA32(win, prop, type, val, num) \
248     prop_set_array32(win, prop_atoms.prop, prop_atoms.type, val, num)
249 #define PROP_SETS(win, prop, val) \
250     prop_set_string_utf8(win, prop_atoms.prop, val)
251 #define PROP_SETSS(win, prop, strs) \
252     prop_set_strings_utf8(win, prop_atoms.prop, strs)
253
254 #define PROP_ERASE(win, prop) prop_erase(win, prop_atoms.prop)
255
256 #define PROP_MSG(about, msgtype, data0, data1, data2, data3) \
257   (prop_message(about, prop_atoms.msgtype, data0, data1, data2, data3, \
258                 SubstructureNotifyMask | SubstructureRedirectMask))
259
260 #define PROP_MSG_TO(to, about, msgtype, data0, data1, data2, data3, data4, \
261                     mask) \
262     (prop_message_to(to, about, prop_atoms.msgtype,                        \
263                      data0, data1, data2, data3, data4, mask))
264
265 #endif