add the MANAGER 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     /* NETWM atoms */
37      
38     /* root window properties */
39     Atom net_supported;
40     Atom net_client_list;
41     Atom net_client_list_stacking;
42     Atom net_number_of_desktops;
43     Atom net_desktop_geometry;
44     Atom net_desktop_viewport;
45     Atom net_current_desktop;
46     Atom net_desktop_names;
47     Atom net_active_window;
48     Atom net_workarea;
49     Atom net_supporting_wm_check;
50     Atom net_desktop_layout;
51     Atom net_showing_desktop;
52     /* root window messages */
53     Atom net_close_window;
54     Atom net_wm_moveresize;
55     Atom net_moveresize_window;
56     /* application window properties */
57     Atom net_wm_name;
58     Atom net_wm_visible_name;
59     Atom net_wm_icon_name;
60     Atom net_wm_visible_icon_name;
61     Atom net_wm_desktop;
62     Atom net_wm_window_type;
63     Atom net_wm_state;
64     Atom net_wm_strut;
65     Atom net_wm_icon;
66 /*  Atom net_wm_pid; */
67     Atom net_wm_allowed_actions;
68     /* application protocols */
69 /*  Atom   Atom net_wm_ping; */
70
71     Atom net_wm_window_type_desktop;
72     Atom net_wm_window_type_dock;
73     Atom net_wm_window_type_toolbar;
74     Atom net_wm_window_type_menu;
75     Atom net_wm_window_type_utility;
76     Atom net_wm_window_type_splash;
77     Atom net_wm_window_type_dialog;
78     Atom net_wm_window_type_normal;
79
80     Atom net_wm_moveresize_size_topleft; 
81     Atom net_wm_moveresize_size_top;
82     Atom net_wm_moveresize_size_topright;
83     Atom net_wm_moveresize_size_right;
84     Atom net_wm_moveresize_size_bottomright;
85     Atom net_wm_moveresize_size_bottom;
86     Atom net_wm_moveresize_size_bottomleft;
87     Atom net_wm_moveresize_size_left;
88     Atom net_wm_moveresize_move;
89     Atom net_wm_moveresize_size_keyboard;
90     Atom net_wm_moveresize_move_keyboard;
91
92     Atom net_wm_action_move;
93     Atom net_wm_action_resize;
94     Atom net_wm_action_minimize;
95     Atom net_wm_action_shade;
96     Atom net_wm_action_stick;
97     Atom net_wm_action_maximize_horz;
98     Atom net_wm_action_maximize_vert;
99     Atom net_wm_action_fullscreen;
100     Atom net_wm_action_change_desktop;
101     Atom net_wm_action_close;
102
103     Atom net_wm_state_modal;
104     Atom net_wm_state_sticky;
105     Atom net_wm_state_maximized_vert;
106     Atom net_wm_state_maximized_horz;
107     Atom net_wm_state_shaded;
108     Atom net_wm_state_skip_taskbar;
109     Atom net_wm_state_skip_pager;
110     Atom net_wm_state_hidden;
111     Atom net_wm_state_fullscreen;
112     Atom net_wm_state_above;
113     Atom net_wm_state_below;
114
115     Atom net_wm_state_add;
116     Atom net_wm_state_remove;
117     Atom net_wm_state_toggle;
118
119     Atom net_wm_orientation_horz;
120     Atom net_wm_orientation_vert;
121     Atom net_wm_topleft;
122     Atom net_wm_topright;
123     Atom net_wm_bottomright;
124     Atom net_wm_bottomleft;
125
126     /* Extra atoms */
127
128     Atom kde_net_system_tray_windows;
129     Atom kde_net_wm_system_tray_window_for;
130     Atom kde_net_wm_window_type_override;
131
132     Atom kwm_win_icon;
133
134     Atom rootpmapid;
135     Atom esetrootid;
136
137     /* Openbox specific atoms */
138      
139     Atom openbox_pid;
140     Atom openbox_premax;
141 } Atoms;
142 Atoms prop_atoms;
143
144 void prop_startup();
145
146 gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
147 gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
148                           guint *nret);
149 gboolean prop_get_string_locale(Window win, Atom prop, char **ret);
150 gboolean prop_get_string_utf8(Window win, Atom prop, char **ret);
151 gboolean prop_get_strings_locale(Window win, Atom prop, char ***ret);
152 gboolean prop_get_strings_utf8(Window win, Atom prop, char ***ret);
153
154 void prop_set32(Window win, Atom prop, Atom type, guint32 val);
155 void prop_set_array32(Window win, Atom prop, Atom type, guint32 *val,
156                       guint num);
157 void prop_set_string_utf8(Window win, Atom prop, char *val);
158 void prop_set_strings_utf8(Window win, Atom prop, char **strs);
159
160 void prop_erase(Window win, Atom prop);
161
162 void prop_message(Window about, Atom messagetype, long data0, long data1,
163                   long data2, long data3, long mask);
164
165 #define PROP_GET32(win, prop, type, ret) \
166     (prop_get32(win, prop_atoms.prop, prop_atoms.type, ret))
167 #define PROP_GETA32(win, prop, type, ret, nret) \
168     (prop_get_array32(win, prop_atoms.prop, prop_atoms.type, ret, \
169                       nret))
170 #define PROP_GETS(win, prop, type, ret) \
171     (prop_get_string_##type(win, prop_atoms.prop, ret))
172 #define PROP_GETSS(win, prop, type, ret) \
173     (prop_get_strings_##type(win, prop_atoms.prop, ret))
174
175 #define PROP_SET32(win, prop, type, val) \
176     prop_set32(win, prop_atoms.prop, prop_atoms.type, val)
177 #define PROP_SETA32(win, prop, type, val, num) \
178     prop_set_array32(win, prop_atoms.prop, prop_atoms.type, val, num)
179 #define PROP_SETS(win, prop, val) \
180     prop_set_string_utf8(win, prop_atoms.prop, val)
181 #define PROP_SETSS(win, prop, strs) \
182     prop_set_strings_utf8(win, prop_atoms.prop, strs)
183
184 #define PROP_ERASE(win, prop) prop_erase(win, prop_atoms.prop)
185
186 #define PROP_MSG(about, msgtype, data0, data1, data2, data3) \
187   (prop_message(about, prop_atoms.msgtype, data0, data1, data2, data3, \
188                 SubstructureNotifyMask | SubstructureRedirectMask))
189
190 #endif