]> icculus.org git repositories - dana/openbox.git/blob - openbox/prop.h
save session state for old clients that dont use XSMP. more session improvements...
[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 motif_wm_hints;
56
57     /* SM atoms */
58     Atom sm_client_id;
59
60     /* NETWM atoms */
61
62     /* Atoms that are used inside messages - these don't go in net_supported */
63
64     Atom net_wm_moveresize_size_topleft; 
65     Atom net_wm_moveresize_size_top;
66     Atom net_wm_moveresize_size_topright;
67     Atom net_wm_moveresize_size_right;
68     Atom net_wm_moveresize_size_bottomright;
69     Atom net_wm_moveresize_size_bottom;
70     Atom net_wm_moveresize_size_bottomleft;
71     Atom net_wm_moveresize_size_left;
72     Atom net_wm_moveresize_move;
73     Atom net_wm_moveresize_size_keyboard;
74     Atom net_wm_moveresize_move_keyboard;
75     Atom net_wm_moveresize_cancel;
76
77     Atom net_wm_state_add;
78     Atom net_wm_state_remove;
79     Atom net_wm_state_toggle;
80
81     Atom net_wm_orientation_horz;
82     Atom net_wm_orientation_vert;
83     Atom net_wm_topleft;
84     Atom net_wm_topright;
85     Atom net_wm_bottomright;
86     Atom net_wm_bottomleft;
87
88     /* Everything below here must go in net_supported on the root window */
89
90     /* root window properties */
91     Atom net_supported;
92     Atom net_client_list;
93     Atom net_client_list_stacking;
94     Atom net_number_of_desktops;
95     Atom net_desktop_geometry;
96     Atom net_desktop_viewport;
97     Atom net_current_desktop;
98     Atom net_desktop_names;
99     Atom net_active_window;
100 /*    Atom net_restack_window;*/
101     Atom net_workarea;
102     Atom net_supporting_wm_check;
103     Atom net_desktop_layout;
104     Atom net_showing_desktop;
105
106     /* root window messages */
107     Atom net_close_window;
108     Atom net_wm_moveresize;
109     Atom net_moveresize_window;
110
111     /* helpful hints to apps that aren't used for anything */
112     Atom net_wm_full_placement;
113
114     /* startup-notification extension */
115     Atom net_startup_id;
116
117     /* application window properties */
118     Atom net_wm_name;
119     Atom net_wm_visible_name;
120     Atom net_wm_icon_name;
121     Atom net_wm_visible_icon_name;
122     Atom net_wm_desktop;
123     Atom net_wm_window_type;
124     Atom net_wm_state;
125     Atom net_wm_strut;
126     Atom net_wm_strut_partial;
127     Atom net_wm_icon;
128     Atom net_wm_icon_geometry;
129 /*  Atom net_wm_pid; */
130     Atom net_wm_allowed_actions;
131     Atom net_wm_user_time;
132     Atom net_frame_extents;
133
134     /* application protocols */
135 /*  Atom net_wm_ping; */
136 #ifdef SYNC
137     Atom net_wm_sync_request;
138     Atom net_wm_sync_request_counter;
139 #endif
140
141     Atom net_wm_window_type_desktop;
142     Atom net_wm_window_type_dock;
143     Atom net_wm_window_type_toolbar;
144     Atom net_wm_window_type_menu;
145     Atom net_wm_window_type_utility;
146     Atom net_wm_window_type_splash;
147     Atom net_wm_window_type_dialog;
148     Atom net_wm_window_type_normal;
149
150     Atom net_wm_action_move;
151     Atom net_wm_action_resize;
152     Atom net_wm_action_minimize;
153     Atom net_wm_action_shade;
154     Atom net_wm_action_maximize_horz;
155     Atom net_wm_action_maximize_vert;
156     Atom net_wm_action_fullscreen;
157     Atom net_wm_action_change_desktop;
158     Atom net_wm_action_close;
159
160     Atom net_wm_state_modal;
161 /*    Atom net_wm_state_sticky;*/
162     Atom net_wm_state_maximized_vert;
163     Atom net_wm_state_maximized_horz;
164     Atom net_wm_state_shaded;
165     Atom net_wm_state_skip_taskbar;
166     Atom net_wm_state_skip_pager;
167     Atom net_wm_state_hidden;
168     Atom net_wm_state_fullscreen;
169     Atom net_wm_state_above;
170     Atom net_wm_state_below;
171     Atom net_wm_state_demands_attention;
172
173     /* KDE atoms */
174
175     Atom kde_wm_change_state;
176     Atom kde_net_wm_frame_strut;
177     Atom kde_net_wm_window_type_override;
178
179 /*
180     Atom rootpmapid;
181     Atom esetrootid;
182 */
183
184     /* Openbox specific atoms */
185      
186     Atom openbox_wm_state_undecorated;
187     Atom openbox_pid;
188     Atom openbox_config;
189     Atom openbox_control;
190 } Atoms;
191 Atoms prop_atoms;
192
193 void prop_startup();
194
195 gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
196 gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
197                           guint *nret);
198 gboolean prop_get_string_locale(Window win, Atom prop, gchar **ret);
199 gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret);
200 gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret);
201 gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret);
202
203 void prop_set32(Window win, Atom prop, Atom type, gulong val);
204 void prop_set_array32(Window win, Atom prop, Atom type, gulong *val,
205                       guint num);
206 void prop_set_string_utf8(Window win, Atom prop, const gchar *val);
207 void prop_set_strings_utf8(Window win, Atom prop, gchar **strs);
208
209 void prop_erase(Window win, Atom prop);
210
211 void prop_message(Window about, Atom messagetype, glong data0, glong data1,
212                   glong data2, glong data3, glong mask);
213
214 #define PROP_GET32(win, prop, type, ret) \
215     (prop_get32(win, prop_atoms.prop, prop_atoms.type, ret))
216 #define PROP_GETA32(win, prop, type, ret, nret) \
217     (prop_get_array32(win, prop_atoms.prop, prop_atoms.type, ret, \
218                       nret))
219 #define PROP_GETS(win, prop, type, ret) \
220     (prop_get_string_##type(win, prop_atoms.prop, ret))
221 #define PROP_GETSS(win, prop, type, ret) \
222     (prop_get_strings_##type(win, prop_atoms.prop, ret))
223
224 #define PROP_SET32(win, prop, type, val) \
225     prop_set32(win, prop_atoms.prop, prop_atoms.type, val)
226 #define PROP_SETA32(win, prop, type, val, num) \
227     prop_set_array32(win, prop_atoms.prop, prop_atoms.type, val, num)
228 #define PROP_SETS(win, prop, val) \
229     prop_set_string_utf8(win, prop_atoms.prop, val)
230 #define PROP_SETSS(win, prop, strs) \
231     prop_set_strings_utf8(win, prop_atoms.prop, strs)
232
233 #define PROP_ERASE(win, prop) prop_erase(win, prop_atoms.prop)
234
235 #define PROP_MSG(about, msgtype, data0, data1, data2, data3) \
236   (prop_message(about, prop_atoms.msgtype, data0, data1, data2, data3, \
237                 SubstructureNotifyMask | SubstructureRedirectMask))
238
239 #endif