]> Dogcows Code - chaz/openbox/blob - c/prop.h
stop using python internally. add an event dispatcher
[chaz/openbox] / c / 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 #include "openbox.h"
11
12 /*! The atoms on the X server which this class will cache */
13 typedef struct Atoms {
14 /* types */
15 Atom cardinal; /*!< The atom which represents the Cardinal data type */
16 Atom window; /*!< The atom which represents window ids */
17 Atom pixmap; /*!< The atom which represents pixmap ids */
18 Atom atom; /*!< The atom which represents atom values */
19 Atom string; /*!< The atom which represents ascii strings */
20 Atom utf8; /*!< The atom which represents utf8-encoded strings */
21
22 /* window hints */
23 Atom wm_colormap_windows;
24 Atom wm_protocols;
25 Atom wm_state;
26 Atom wm_delete_window;
27 Atom wm_take_focus;
28 Atom wm_change_state;
29 Atom wm_name;
30 Atom wm_icon_name;
31 Atom wm_class;
32 Atom wm_window_role;
33 Atom motif_wm_hints;
34
35 /* NETWM atoms */
36
37 /* root window properties */
38 Atom net_supported;
39 Atom net_client_list;
40 Atom net_client_list_stacking;
41 Atom net_number_of_desktops;
42 Atom net_desktop_geometry;
43 Atom net_desktop_viewport;
44 Atom net_current_desktop;
45 Atom net_desktop_names;
46 Atom net_active_window;
47 Atom net_workarea;
48 Atom net_supporting_wm_check;
49 /* Atom net_virtual_roots; */
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 /* application window properties */
56 /* Atom net_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_geometry; */
66 Atom net_wm_icon;
67 /* Atom net_wm_pid; */
68 /* Atom net_wm_handled_icons; */
69 Atom net_wm_allowed_actions;
70 /* application protocols */
71 /* Atom Atom net_wm_ping; */
72
73 Atom net_wm_window_type_desktop;
74 Atom net_wm_window_type_dock;
75 Atom net_wm_window_type_toolbar;
76 Atom net_wm_window_type_menu;
77 Atom net_wm_window_type_utility;
78 Atom net_wm_window_type_splash;
79 Atom net_wm_window_type_dialog;
80 Atom net_wm_window_type_normal;
81
82 Atom net_wm_moveresize_size_topleft;
83 Atom net_wm_moveresize_size_topright;
84 Atom net_wm_moveresize_size_bottomleft;
85 Atom net_wm_moveresize_size_bottomright;
86 Atom net_wm_moveresize_move;
87
88 Atom net_wm_action_move;
89 Atom net_wm_action_resize;
90 Atom net_wm_action_minimize;
91 Atom net_wm_action_shade;
92 Atom net_wm_action_stick;
93 Atom net_wm_action_maximize_horz;
94 Atom net_wm_action_maximize_vert;
95 Atom net_wm_action_fullscreen;
96 Atom net_wm_action_change_desktop;
97 Atom net_wm_action_close;
98
99 Atom net_wm_state_modal;
100 Atom net_wm_state_sticky;
101 Atom net_wm_state_maximized_vert;
102 Atom net_wm_state_maximized_horz;
103 Atom net_wm_state_shaded;
104 Atom net_wm_state_skip_taskbar;
105 Atom net_wm_state_skip_pager;
106 Atom net_wm_state_hidden;
107 Atom net_wm_state_fullscreen;
108 Atom net_wm_state_above;
109 Atom net_wm_state_below;
110
111 Atom net_wm_state_add;
112 Atom net_wm_state_remove;
113 Atom net_wm_state_toggle;
114
115 Atom net_wm_orientation_horz;
116 Atom net_wm_orientation_vert;
117 Atom net_wm_topleft;
118 Atom net_wm_topright;
119 Atom net_wm_bottomright;
120 Atom net_wm_bottomleft;
121
122 /* Extra atoms */
123
124 Atom kde_net_system_tray_windows;
125 Atom kde_net_wm_system_tray_window_for;
126 Atom kde_net_wm_window_type_override;
127
128 Atom kwm_win_icon;
129
130 Atom rootpmapid;
131 Atom esetrootid;
132
133 /* Openbox specific atoms */
134
135 Atom openbox_pid;
136 Atom openbox_premax;
137 } Atoms;
138 Atoms prop_atoms;
139
140 void prop_init();
141
142 gboolean prop_get(Window win, Atom prop, Atom type, int size,
143 guchar **data, gulong num);
144
145 gboolean prop_get_prealloc(Window win, Atom prop, Atom type, int size,
146 guchar *data, gulong num);
147
148 gboolean prop_get_all(Window win, Atom prop, Atom type, int size,
149 guchar **data, gulong *num);
150
151 gboolean prop_get_string(Window win, Atom prop, Atom type, guchar **data);
152 gboolean prop_get_strings(Window win, Atom prop, Atom type,
153 GPtrArray *data);
154
155 void prop_erase(Window win, Atom prop);
156
157 /* Set an 8-bit property from a string */
158 #define PROP_SETS(win, prop, type, value) \
159 (XChangeProperty(ob_display, win, prop_atoms.prop, prop_atoms.type, 8, \
160 PropModeReplace, (guchar*)value, strlen(value)))
161 /* Set a 32-bit property from a single value */
162 #define PROP_SET32(win, prop, type, value) \
163 (XChangeProperty(ob_display, win, prop_atoms.prop, prop_atoms.type, 32, \
164 PropModeReplace, (guchar*)&value, 1))
165 /* Set a 32-bit property from an array */
166 #define PROP_SET32A(win, prop, type, value, num) \
167 (XChangeProperty(ob_display, win, prop_atoms.prop, prop_atoms.type, 32, \
168 PropModeReplace, (guchar*)value, num))
169
170 /* Get an 8-bit property into a string */
171 #define PROP_GETS(win, prop, type, value) \
172 (prop_get_string(win, prop_atoms.prop, prop_atoms.type, \
173 (guchar**)&value))
174 /* Get an 8-bit property into a GPtrArray of strings
175 (The strings must be freed, the GPtrArray must already be created.) */
176 #define PROP_GETSA(win, prop, type, value) \
177 (prop_get_strings(win, prop_atoms.prop, prop_atoms.type, \
178 value))
179
180 /* Get an entire 8-bit property into an array (which must be freed) */
181 #define PROP_GET8U(win, prop, type, value, num) \
182 (prop_get_all(win, prop_atoms.prop, prop_atoms.type, 8, \
183 (guchar**)&value, &num))
184
185 /* Get 1 element of a 32-bit property into a given variable */
186 #define PROP_GET32(win, prop, type, value) \
187 (prop_get_prealloc(win, prop_atoms.prop, prop_atoms.type, 32, \
188 (guchar*)&value, 1))
189
190 /* Get an amount of a 32-bit property into an array (which must be freed) */
191 #define PROP_GET32A(win, prop, type, value, num) \
192 (prop_get(win, prop_atoms.prop, prop_atoms.type, 32, \
193 (guchar**)&value, num))
194
195 /* Get an entire 32-bit property into an array (which must be freed) */
196 #define PROP_GET32U(win, prop, type, value, num) \
197 (prop_get_all(win, prop_atoms.prop, prop_atoms.type, 32, \
198 (guchar**)&value, &num))
199
200 #define PROP_ERASE(win, prop) (prop_erase(win, prop_atoms.prop))
201
202 #endif
This page took 0.04332 seconds and 4 git commands to generate.