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