add the startup_id atom
[mikachu/openbox.git] / openbox / prop.h
1 #ifndef __atoms_h
2 #define __atoms_h
3
4 #include <X11/Xlib.h>
5 #include <glib.h>
6 #ifdef HAVE_STRING_H
7 #  include <string.h>
8 #endif
9
10 /*! The atoms on the X server which this class will cache */
11 typedef struct Atoms {
12     /* types */
13     Atom cardinal; /*!< The atom which represents the Cardinal data type */
14     Atom window;   /*!< The atom which represents window ids */
15     Atom pixmap;   /*!< The atom which represents pixmap ids */
16     Atom atom;     /*!< The atom which represents atom values */
17     Atom string;   /*!< The atom which represents ascii strings */
18     Atom utf8;     /*!< The atom which represents utf8-encoded strings */
19
20     /* selection stuff */
21     Atom manager;
22
23     /* window hints */
24     Atom wm_colormap_windows;
25     Atom wm_protocols;
26     Atom wm_state;
27     Atom wm_delete_window;
28     Atom wm_take_focus;
29     Atom wm_change_state;
30     Atom wm_name;
31     Atom wm_icon_name;
32     Atom wm_class;
33     Atom wm_window_role;
34     Atom motif_wm_hints;
35
36     /* SM atoms */
37     Atom sm_client_id;
38
39     /* NETWM atoms */
40      
41     /* root window properties */
42     Atom net_supported;
43     Atom net_client_list;
44     Atom net_client_list_stacking;
45     Atom net_number_of_desktops;
46     Atom net_desktop_geometry;
47     Atom net_desktop_viewport;
48     Atom net_current_desktop;
49     Atom net_desktop_names;
50     Atom net_active_window;
51     Atom net_workarea;
52     Atom net_supporting_wm_check;
53     Atom net_desktop_layout;
54     Atom net_showing_desktop;
55     /* root window messages */
56     Atom net_close_window;
57     Atom net_wm_moveresize;
58     Atom net_moveresize_window;
59
60     /* startup-notification extension */
61     Atom net_startup_id;
62
63     /* application window properties */
64     Atom net_wm_name;
65     Atom net_wm_visible_name;
66     Atom net_wm_icon_name;
67     Atom net_wm_visible_icon_name;
68     Atom net_wm_desktop;
69     Atom net_wm_window_type;
70     Atom net_wm_state;
71     Atom net_wm_strut;
72     Atom net_wm_strut_partial;
73     Atom net_wm_icon;
74 /*  Atom net_wm_pid; */
75     Atom net_wm_allowed_actions;
76     /* application protocols */
77 /*  Atom   Atom net_wm_ping; */
78
79     Atom net_wm_window_type_desktop;
80     Atom net_wm_window_type_dock;
81     Atom net_wm_window_type_toolbar;
82     Atom net_wm_window_type_menu;
83     Atom net_wm_window_type_utility;
84     Atom net_wm_window_type_splash;
85     Atom net_wm_window_type_dialog;
86     Atom net_wm_window_type_normal;
87
88     Atom net_wm_moveresize_size_topleft; 
89     Atom net_wm_moveresize_size_top;
90     Atom net_wm_moveresize_size_topright;
91     Atom net_wm_moveresize_size_right;
92     Atom net_wm_moveresize_size_bottomright;
93     Atom net_wm_moveresize_size_bottom;
94     Atom net_wm_moveresize_size_bottomleft;
95     Atom net_wm_moveresize_size_left;
96     Atom net_wm_moveresize_move;
97     Atom net_wm_moveresize_size_keyboard;
98     Atom net_wm_moveresize_move_keyboard;
99
100     Atom net_wm_action_move;
101     Atom net_wm_action_resize;
102     Atom net_wm_action_minimize;
103     Atom net_wm_action_shade;
104     Atom net_wm_action_stick;
105     Atom net_wm_action_maximize_horz;
106     Atom net_wm_action_maximize_vert;
107     Atom net_wm_action_fullscreen;
108     Atom net_wm_action_change_desktop;
109     Atom net_wm_action_close;
110
111     Atom net_wm_state_modal;
112     Atom net_wm_state_sticky;
113     Atom net_wm_state_maximized_vert;
114     Atom net_wm_state_maximized_horz;
115     Atom net_wm_state_shaded;
116     Atom net_wm_state_skip_taskbar;
117     Atom net_wm_state_skip_pager;
118     Atom net_wm_state_hidden;
119     Atom net_wm_state_fullscreen;
120     Atom net_wm_state_above;
121     Atom net_wm_state_below;
122
123     Atom net_wm_state_add;
124     Atom net_wm_state_remove;
125     Atom net_wm_state_toggle;
126
127     Atom net_wm_orientation_horz;
128     Atom net_wm_orientation_vert;
129     Atom net_wm_topleft;
130     Atom net_wm_topright;
131     Atom net_wm_bottomright;
132     Atom net_wm_bottomleft;
133
134     /* Extra atoms */
135
136     Atom kde_net_system_tray_windows;
137     Atom kde_net_wm_system_tray_window_for;
138     Atom kde_net_wm_window_type_override;
139
140     Atom kwm_win_icon;
141
142     Atom rootpmapid;
143     Atom esetrootid;
144
145     /* Openbox specific atoms */
146      
147     Atom openbox_pid;
148     Atom openbox_premax;
149 } Atoms;
150 Atoms prop_atoms;
151
152 void prop_startup();
153
154 gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
155 gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
156                           guint *nret);
157 gboolean prop_get_string_locale(Window win, Atom prop, char **ret);
158 gboolean prop_get_string_utf8(Window win, Atom prop, char **ret);
159 gboolean prop_get_strings_locale(Window win, Atom prop, char ***ret);
160 gboolean prop_get_strings_utf8(Window win, Atom prop, char ***ret);
161
162 void prop_set32(Window win, Atom prop, Atom type, guint32 val);
163 void prop_set_array32(Window win, Atom prop, Atom type, guint32 *val,
164                       guint num);
165 void prop_set_string_utf8(Window win, Atom prop, char *val);
166 void prop_set_strings_utf8(Window win, Atom prop, char **strs);
167
168 void prop_erase(Window win, Atom prop);
169
170 void prop_message(Window about, Atom messagetype, long data0, long data1,
171                   long data2, long data3, long mask);
172
173 #define PROP_GET32(win, prop, type, ret) \
174     (prop_get32(win, prop_atoms.prop, prop_atoms.type, ret))
175 #define PROP_GETA32(win, prop, type, ret, nret) \
176     (prop_get_array32(win, prop_atoms.prop, prop_atoms.type, ret, \
177                       nret))
178 #define PROP_GETS(win, prop, type, ret) \
179     (prop_get_string_##type(win, prop_atoms.prop, ret))
180 #define PROP_GETSS(win, prop, type, ret) \
181     (prop_get_strings_##type(win, prop_atoms.prop, ret))
182
183 #define PROP_SET32(win, prop, type, val) \
184     prop_set32(win, prop_atoms.prop, prop_atoms.type, val)
185 #define PROP_SETA32(win, prop, type, val, num) \
186     prop_set_array32(win, prop_atoms.prop, prop_atoms.type, val, num)
187 #define PROP_SETS(win, prop, val) \
188     prop_set_string_utf8(win, prop_atoms.prop, val)
189 #define PROP_SETSS(win, prop, strs) \
190     prop_set_strings_utf8(win, prop_atoms.prop, strs)
191
192 #define PROP_ERASE(win, prop) prop_erase(win, prop_atoms.prop)
193
194 #define PROP_MSG(about, msgtype, data0, data1, data2, data3) \
195   (prop_message(about, prop_atoms.msgtype, data0, data1, data2, data3, \
196                 SubstructureNotifyMask | SubstructureRedirectMask))
197
198 #endif