180010c92882df38994dcadff881ef191c7e10e3
[framework/uifw/ecore.git] / src / lib / ecore_x / xcb / ecore_xcb_private.h
1 #ifndef __ECORE_XCB_PRIVATE_H__
2 #define __ECORE_XCB_PRIVATE_H__
3
4 #include "config.h"
5
6 #include <sys/param.h>
7
8 #ifndef MAXHOSTNAMELEN
9 # define MAXHOSTNAMELEN 256
10 #endif
11
12 #ifndef XK_MISCELLANY
13 # define XK_MISCELLANY 1
14 #endif /* XK_MISCELLANY */
15
16 #include <xcb/xcb.h>
17 #include <xcb/xcb_icccm.h>
18 #include <xcb/xcb_keysyms.h>
19 #include <xcb/bigreq.h>
20 #ifdef ECORE_XCB_CURSOR
21 # include <xcb/cursor.h>
22 #endif /* ECORE_XCB_CURSOR */
23 #ifdef ECORE_XCB_DAMAGE
24 # include <xcb/damage.h>
25 #endif /* ECORE_XCB_DAMAGE */
26 #ifdef ECORE_XCB_COMPOSITE
27 # include <xcb/composite.h>
28 #endif /* ECORE_XCB_COMPOSITE */
29 #ifdef ECORE_XCB_DPMS
30 # include <xcb/dpms.h>
31 #endif /* ECORE_XCB_DPMS */
32 #ifdef ECORE_XCB_RANDR
33 # include <xcb/randr.h>
34 #endif /* ECORE_XCB_RANDR */
35 #ifdef ECORE_XCB_RENDER
36 # include <xcb/render.h>
37 #endif /* ECORE_XCB_RENDER */
38 #ifdef ECORE_XCB_SCREENSAVER
39 # include <xcb/screensaver.h>
40 #endif /* ECORE_XCB_SCREENSAVER */
41 #ifdef ECORE_XCB_SHAPE
42 # include <xcb/shape.h>
43 #endif /* ECORE_XCB_SHAPE */
44 #ifdef ECORE_XCB_SYNC
45 # include <xcb/sync.h>
46 #endif /* ECORE_XCB_SYNC */
47 #ifdef ECORE_XCB_XFIXES
48 # include <xcb/xfixes.h>
49 #endif /* ECORE_XCB_XFIXES */
50 #ifdef ECORE_XCB_XINERAMA
51 # include <xcb/xinerama.h>
52 #endif /* ECORE_XCB_XINERAMA */
53 #ifdef ECORE_XCB_XPRINT
54 # include <xcb/xprint.h>
55 #endif /* ECORE_XCB_XPRINT */
56
57 #include "ecore_private.h"
58 #include "Ecore_X.h"
59
60 /* FIXME: this is for simulation only */
61 #include "Ecore_Txt.h"
62
63 typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
64
65 struct _Ecore_X_Selection_Intern
66 {
67    Ecore_X_Window    win;
68    Ecore_X_Atom      selection;
69    unsigned char     *data;
70    int               length;
71    Ecore_X_Time      time;
72 };
73
74 typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
75
76 struct _Ecore_X_Selection_Converter
77 {
78    Ecore_X_Atom target;
79    int (*convert)(char *target, void *data, int size,
80                   void **data_ret, int *size_ret);
81    Ecore_X_Selection_Converter *next;
82 };
83
84 typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
85
86 struct _Ecore_X_Selection_Parser
87 {
88    char     *target;
89    void *(*parse)(const char *target, void *data, int size, int format);
90    Ecore_X_Selection_Parser *next;
91 };
92
93 typedef struct _Ecore_X_DND_Source
94 {
95    int version;
96    Ecore_X_Window win, dest;
97
98    enum {
99       ECORE_X_DND_SOURCE_IDLE,
100       ECORE_X_DND_SOURCE_DRAGGING,
101       ECORE_X_DND_SOURCE_DROPPED,
102       ECORE_X_DND_SOURCE_CONVERTING
103    } state;
104
105    struct {
106       short x, y;
107       unsigned short width, height;
108    } rectangle;
109
110    Ecore_X_Time time;
111
112    Ecore_X_Atom action, accepted_action;
113
114    int will_accept;
115    int suppress;
116
117    int await_status;
118 } Ecore_X_DND_Source;
119
120 typedef struct _Ecore_X_DND_Target
121 {
122    int version;
123    Ecore_X_Window win, source;
124
125    enum {
126       ECORE_X_DND_TARGET_IDLE,
127       ECORE_X_DND_TARGET_ENTERED
128    } state;
129
130    struct {
131       int x, y;
132    } pos;
133
134    Ecore_X_Time time;
135
136    Ecore_X_Atom action, accepted_action;
137
138    int will_accept;
139 } Ecore_X_DND_Target;
140
141
142 extern Ecore_X_Connection *_ecore_xcb_conn;
143 extern Ecore_X_Screen     *_ecore_xcb_screen;
144 extern double              _ecore_xcb_double_click_time;
145 extern Ecore_X_Time        _ecore_xcb_event_last_time;
146 extern Ecore_X_Window      _ecore_xcb_event_last_window;
147 extern int16_t             _ecore_xcb_event_last_root_x;
148 extern int16_t             _ecore_xcb_event_last_root_y;
149 extern int                 _ecore_xcb_xcursor;
150
151 extern Ecore_X_Atom        _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
152
153 extern int                 _ecore_window_grabs_num;
154 extern Ecore_X_Window     *_ecore_window_grabs;
155 extern int               (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
156 extern void               *_ecore_window_grab_replay_data;
157
158 extern Ecore_X_Window      _ecore_xcb_private_window;
159
160
161 void _ecore_x_error_handler_init(void);
162
163 void _ecore_x_event_handle_key_press          (xcb_generic_event_t *event);
164 void _ecore_x_event_handle_key_release        (xcb_generic_event_t *event);
165 void _ecore_x_event_handle_button_press       (xcb_generic_event_t *event);
166 void _ecore_x_event_handle_button_release     (xcb_generic_event_t *event);
167 void _ecore_x_event_handle_motion_notify      (xcb_generic_event_t *event);
168 void _ecore_x_event_handle_enter_notify       (xcb_generic_event_t *event);
169 void _ecore_x_event_handle_leave_notify       (xcb_generic_event_t *event);
170 void _ecore_x_event_handle_focus_in           (xcb_generic_event_t *event);
171 void _ecore_x_event_handle_focus_out          (xcb_generic_event_t *event);
172 void _ecore_x_event_handle_keymap_notify      (xcb_generic_event_t *event);
173 void _ecore_x_event_handle_expose             (xcb_generic_event_t *event);
174 void _ecore_x_event_handle_graphics_expose    (xcb_generic_event_t *event);
175 void _ecore_x_event_handle_visibility_notify  (xcb_generic_event_t *event);
176 void _ecore_x_event_handle_create_notify      (xcb_generic_event_t *event);
177 void _ecore_x_event_handle_destroy_notify     (xcb_generic_event_t *event);
178 void _ecore_x_event_handle_unmap_notify       (xcb_generic_event_t *event);
179 void _ecore_x_event_handle_map_notify         (xcb_generic_event_t *event);
180 void _ecore_x_event_handle_map_request        (xcb_generic_event_t *event);
181 void _ecore_x_event_handle_reparent_notify    (xcb_generic_event_t *event);
182 void _ecore_x_event_handle_configure_notify   (xcb_generic_event_t *event);
183 void _ecore_x_event_handle_configure_request  (xcb_generic_event_t *event);
184 void _ecore_x_event_handle_gravity_notify     (xcb_generic_event_t *event);
185 void _ecore_x_event_handle_resize_request     (xcb_generic_event_t *event);
186 void _ecore_x_event_handle_circulate_notify   (xcb_generic_event_t *event);
187 void _ecore_x_event_handle_circulate_request  (xcb_generic_event_t *event);
188 void _ecore_x_event_handle_property_notify    (xcb_generic_event_t *event);
189 void _ecore_x_event_handle_selection_clear    (xcb_generic_event_t *event);
190 void _ecore_x_event_handle_selection_request  (xcb_generic_event_t *event);
191 void _ecore_x_event_handle_selection_notify   (xcb_generic_event_t *event);
192 void _ecore_x_event_handle_colormap_notify    (xcb_generic_event_t *event);
193 void _ecore_x_event_handle_client_message     (xcb_generic_event_t *event);
194 void _ecore_x_event_handle_mapping_notify     (xcb_generic_event_t *event);
195 #ifdef ECORE_XCB_DAMAGE
196 void _ecore_x_event_handle_damage_notify      (xcb_generic_event_t *event);
197 #endif /* ECORE_XCB_DAMAGE */
198 #ifdef ECORE_XCB_RANDR
199 void _ecore_x_event_handle_randr_change       (xcb_generic_event_t *event);
200 #endif /* ECORE_XCB_RANDR */
201 #ifdef ECORE_XCB_SCREENSAVER
202 void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
203 #endif /* ECORE_XCB_SCREENSAVER */
204 #ifdef ECORE_XCB_SHAPE
205 void _ecore_x_event_handle_shape_change       (xcb_generic_event_t *event);
206 #endif /* ECORE_XCB_SHAPE */
207 #ifdef ECORE_XCB_SYNC
208 void _ecore_x_event_handle_sync_counter       (xcb_generic_event_t *event);
209 void _ecore_x_event_handle_sync_alarm         (xcb_generic_event_t *event);
210 #endif /* ECORE_XCB_SYNC */
211 #ifdef ECORE_XCB_FIXES
212 void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
213 #endif /* ECORE_XCB_FIXES */
214
215
216 /* requests / replies */
217 int          _ecore_x_reply_init ();
218 void         _ecore_x_reply_shutdown ();
219 void         _ecore_xcb_cookie_cache (unsigned int cookie);
220 unsigned int _ecore_xcb_cookie_get (void);
221 void         _ecore_xcb_reply_cache (void *reply);
222 void        *_ecore_xcb_reply_get (void);
223
224
225 /* atoms */
226 extern Ecore_X_Atom ECORE_X_ATOM_ATOM;
227 extern Ecore_X_Atom ECORE_X_ATOM_CARDINAL;
228 extern Ecore_X_Atom ECORE_X_ATOM_STRING;
229 extern Ecore_X_Atom ECORE_X_ATOM_WINDOW;
230 extern Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE;
231 extern Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS;
232
233 #define ECORE_X_ATOMS_COUNT 115
234
235 void _ecore_x_atom_init          (xcb_intern_atom_cookie_t *);
236 void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
237
238
239 /* damage */
240 void _ecore_x_damage_init          (const xcb_query_extension_reply_t *reply);
241 void _ecore_x_damage_init_finalize (void);
242
243 /* composite */
244 void _ecore_x_composite_init       (const xcb_query_extension_reply_t *reply);
245 void _ecore_x_composite_init_finalize (void);
246
247 /* from dnd */
248 void                _ecore_x_dnd_init       (void);
249 void                _ecore_x_dnd_shutdown   (void);
250 Ecore_X_DND_Source *_ecore_x_dnd_source_get (void);
251 Ecore_X_DND_Target *_ecore_x_dnd_target_get (void);
252 void                _ecore_x_dnd_drag       (Ecore_X_Window root,
253                                              int x,
254                                              int y);
255
256
257 /* dpms */
258 void _ecore_x_dpms_init          (const xcb_query_extension_reply_t *reply);
259 void _ecore_x_dpms_init_finalize (void);
260
261
262 /* netwm */
263 Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
264 int                  _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, char *data);
265 int                  _ecore_x_netwm_startup_info(Ecore_X_Window win, char *data);
266
267
268 /* randr */
269 void _ecore_x_randr_init          (const xcb_query_extension_reply_t *reply);
270 void _ecore_x_randr_init_finalize (void);
271
272
273 /* selection */
274 void                      _ecore_x_selection_init(void);
275 void                      _ecore_x_selection_shutdown(void);
276 Ecore_X_Atom              _ecore_x_selection_target_atom_get(const char *target);
277 char                     *_ecore_x_selection_target_get(Ecore_X_Atom target);
278 Ecore_X_Selection_Intern *_ecore_x_selection_get(Ecore_X_Atom selection);
279 int                       _ecore_x_selection_set(Ecore_X_Window w, const void *data, int len, Ecore_X_Atom selection);
280 int                       _ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret);
281 void                     *_ecore_x_selection_parse(const char *target, void *data, int size, int format);
282
283
284 /* screensaver */
285 void _ecore_x_screensaver_init          (const xcb_query_extension_reply_t *reply);
286 void _ecore_x_screensaver_init_finalize (void);
287
288
289 /* shape */
290 void _ecore_x_shape_init          (const xcb_query_extension_reply_t *reply);
291 void _ecore_x_shape_init_finalize (void);
292
293
294 /* sync */
295 void _ecore_x_sync_init          (const xcb_query_extension_reply_t *reply);
296 void _ecore_x_sync_init_finalize (void);
297
298
299 /* xfixes */
300 void _ecore_x_xfixes_init          (const xcb_query_extension_reply_t *reply);
301 void _ecore_x_xfixes_init_finalize (void);
302
303
304 /* xinerama */
305 void _ecore_x_xinerama_init          (const xcb_query_extension_reply_t *reply);
306 void _ecore_x_xinerama_init_finalize (void);
307
308
309 /* xprint */
310 void _ecore_x_xprint_init          (const xcb_query_extension_reply_t *reply);
311 void _ecore_x_xprint_init_finalize (void);
312
313 /* to categorize */
314 void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin);
315 void _ecore_x_window_grab_remove(Ecore_X_Window win);
316 void _ecore_x_key_grab_remove(Ecore_X_Window win);
317
318
319 #endif /* __ECORE_XCB_PRIVATE_H__*/