1 #ifndef __ECORE_XCB_PRIVATE_H__
2 # define __ECORE_XCB_PRIVATE_H__
19 # include <unistd.h> // included for close & gethostname functions
21 /* generic xcb includes */
23 # include <xcb/bigreq.h>
25 # include <xcb/xcb_image.h>
29 # include "Ecore_Input.h"
33 extern int _ecore_xcb_log_dom;
35 # ifdef ECORE_XCB_DEFAULT_LOG_COLOR
36 # undef ECORE_XCB_DEFAULT_LOG_COLOR
38 # define ECORE_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
43 # define ERR(...) EINA_LOG_DOM_ERR(_ecore_xcb_log_dom, __VA_ARGS__)
48 # define DBG(...) EINA_LOG_DOM_DBG(_ecore_xcb_log_dom, __VA_ARGS__)
53 # define INF(...) EINA_LOG_DOM_INFO(_ecore_xcb_log_dom, __VA_ARGS__)
58 # define WRN(...) EINA_LOG_DOM_WARN(_ecore_xcb_log_dom, __VA_ARGS__)
63 # define CRI(...) EINA_LOG_DOM_CRIT(_ecore_xcb_log_dom, __VA_ARGS__)
67 # define LOGFN(fl, ln, fn) printf("-ECORE-XCB: %25s: %5i - %s\n", fl, ln, fn);
69 # define LOGFN(fl, ln, fn)
72 # ifndef MAXHOSTNAMELEN
73 # define MAXHOSTNAMELEN 256
76 #define CHECK_XCB_CONN \
78 if (!_ecore_xcb_conn || xcb_connection_has_error(_ecore_xcb_conn)) \
80 DBG("XCB Connection Has Error !!"); \
81 _ecore_xcb_io_error_handle(NULL); \
86 typedef enum _Ecore_Xcb_Encoding_Style Ecore_Xcb_Encoding_Style;
88 enum _Ecore_Xcb_Encoding_Style
98 typedef struct _Ecore_X_DND_Source Ecore_X_DND_Source;
99 typedef struct _Ecore_X_DND_Target Ecore_X_DND_Target;
100 typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
101 typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
102 typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
103 typedef struct _Ecore_Xcb_Textproperty Ecore_Xcb_Textproperty;
105 struct _Ecore_X_DND_Source
108 Ecore_X_Window win, dest;
112 ECORE_X_DND_SOURCE_IDLE,
113 ECORE_X_DND_SOURCE_DRAGGING,
114 ECORE_X_DND_SOURCE_DROPPED,
115 ECORE_X_DND_SOURCE_CONVERTING
121 unsigned short width, height;
126 Ecore_X_Window window;
132 Ecore_X_Atom action, accepted_action;
134 int will_accept, suppress;
138 struct _Ecore_X_DND_Target
141 Ecore_X_Window win, source;
145 ECORE_X_DND_TARGET_IDLE,
146 ECORE_X_DND_TARGET_ENTERED
156 Ecore_X_Atom action, accepted_action;
160 struct _Ecore_X_Selection_Intern
163 Ecore_X_Atom selection;
169 struct _Ecore_X_Selection_Converter
172 Eina_Bool (*convert)(char *target,
179 Ecore_X_Selection_Converter *next;
182 struct _Ecore_X_Selection_Parser
185 void *(*parse)(const char *target, void *data, int size, int format);
186 Ecore_X_Selection_Parser *next;
189 struct _Ecore_Xcb_Textproperty
192 Ecore_X_Atom encoding;
193 unsigned int format, nitems;
196 /* external variables */
197 extern Ecore_X_Connection *_ecore_xcb_conn;
198 extern Ecore_X_Screen *_ecore_xcb_screen;
199 extern double _ecore_xcb_double_click_time;
200 extern int16_t _ecore_xcb_event_last_root_x;
201 extern int16_t _ecore_xcb_event_last_root_y;
203 /* external variables for extension events */
204 extern int _ecore_xcb_event_damage;
205 extern int _ecore_xcb_event_randr;
206 extern int _ecore_xcb_event_screensaver;
207 extern int _ecore_xcb_event_shape;
208 extern int _ecore_xcb_event_sync;
209 extern int _ecore_xcb_event_xfixes;
210 extern int _ecore_xcb_event_input;
211 extern int _ecore_xcb_event_gesture;
213 extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM];
215 extern int _ecore_xcb_button_grabs_num;
216 extern int _ecore_xcb_key_grabs_num;
217 extern Ecore_X_Window *_ecore_xcb_button_grabs;
218 extern Ecore_X_Window *_ecore_xcb_key_grabs;
219 extern Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data,
222 extern void *_ecore_xcb_window_grab_replay_data;
224 /* private function prototypes */
225 void _ecore_xcb_error_handler_init(void);
226 void _ecore_xcb_error_handler_shutdown(void);
228 void _ecore_xcb_atoms_init(void);
229 void _ecore_xcb_atoms_finalize(void);
231 void _ecore_xcb_extensions_init(void);
232 void _ecore_xcb_extensions_finalize(void);
234 void _ecore_xcb_shape_init(void);
235 void _ecore_xcb_shape_finalize(void);
237 void _ecore_xcb_screensaver_init(void);
238 void _ecore_xcb_screensaver_finalize(void);
240 void _ecore_xcb_sync_init(void);
241 void _ecore_xcb_sync_finalize(void);
242 void _ecore_xcb_sync_magic_send(int val,
245 void _ecore_xcb_render_init(void);
246 void _ecore_xcb_render_finalize(void);
247 Eina_Bool _ecore_xcb_render_argb_get(void);
248 Eina_Bool _ecore_xcb_render_anim_get(void);
249 Eina_Bool _ecore_xcb_render_avail_get(void);
251 Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual);
252 uint32_t _ecore_xcb_render_find_visual_id(int type,
253 Eina_Bool check_alpha);
254 Ecore_X_Visual *_ecore_xcb_render_visual_get(int visual_id);
256 void _ecore_xcb_randr_init(void);
257 void _ecore_xcb_randr_finalize(void);
259 void _ecore_xcb_gesture_init(void);
260 void _ecore_xcb_gesture_finalize(void);
261 void _ecore_xcb_gesture_shutdown(void);
263 void _ecore_xcb_xfixes_init(void);
264 void _ecore_xcb_xfixes_finalize(void);
265 Eina_Bool _ecore_xcb_xfixes_avail_get(void);
267 void _ecore_xcb_damage_init(void);
268 void _ecore_xcb_damage_finalize(void);
270 void _ecore_xcb_composite_init(void);
271 void _ecore_xcb_composite_finalize(void);
273 void _ecore_xcb_present_init(void);
274 void _ecore_xcb_present_finalize(void);
275 void _ecore_xcb_event_handle_present_event(xcb_ge_event_t *ev);
276 extern int _ecore_xcb_event_xpresent;
278 void _ecore_xcb_dpms_init(void);
279 void _ecore_xcb_dpms_finalize(void);
281 void _ecore_xcb_cursor_init(void);
282 void _ecore_xcb_cursor_finalize(void);
284 void _ecore_xcb_xinerama_init(void);
285 void _ecore_xcb_xinerama_finalize(void);
287 void _ecore_xcb_dnd_init(void);
288 void _ecore_xcb_dnd_shutdown(void);
289 Ecore_X_DND_Source *_ecore_xcb_dnd_source_get(void);
290 Ecore_X_DND_Target *_ecore_xcb_dnd_target_get(void);
291 void _ecore_xcb_dnd_drag(Ecore_X_Window root,
295 void _ecore_xcb_selection_init(void);
296 void _ecore_xcb_selection_shutdown(void);
297 void *_ecore_xcb_selection_parse(const char *target,
301 char *_ecore_xcb_selection_target_get(Ecore_X_Atom target);
302 Ecore_X_Selection_Intern *_ecore_xcb_selection_get(Ecore_X_Atom selection);
305 Eina_Bool _ecore_xcb_utf8_textlist_to_textproperty(char **list,
307 Ecore_Xcb_Encoding_Style style,
308 Ecore_Xcb_Textproperty *ret);
310 Eina_Bool _ecore_xcb_mb_textlist_to_textproperty(char **list,
312 Ecore_Xcb_Encoding_Style style,
313 Ecore_Xcb_Textproperty *ret);
314 Eina_Bool _ecore_xcb_textlist_to_textproperty(const char *type,
317 Ecore_Xcb_Encoding_Style style,
318 Ecore_Xcb_Textproperty *ret);
321 Eina_Bool _ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
325 Eina_Bool _ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
328 Eina_Bool _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
333 void _ecore_xcb_events_init(void);
334 void _ecore_xcb_events_shutdown(void);
335 void _ecore_xcb_events_handle(xcb_generic_event_t *ev);
336 Ecore_X_Time _ecore_xcb_events_last_time_get(void);
337 unsigned int _ecore_xcb_events_modifiers_get(unsigned int state);
338 void _ecore_xcb_event_mouse_move(uint16_t timestamp,
344 xcb_window_t event_win,
346 xcb_window_t root_win,
357 Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event,
360 xcb_button_t buttons,
365 xcb_window_t event_win,
367 xcb_window_t root_win,
379 void _ecore_xcb_keymap_init(void);
380 void _ecore_xcb_keymap_finalize(void);
381 void _ecore_xcb_keymap_shutdown(void);
382 void _ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event);
383 xcb_keysym_t _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode,
385 xcb_keycode_t *_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym);
386 char *_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym);
387 xcb_keycode_t _ecore_xcb_keymap_string_to_keycode(const char *key);
388 int _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode,
394 void _ecore_xcb_input_init(void);
395 void _ecore_xcb_input_finalize(void);
396 void _ecore_xcb_input_shutdown(void);
397 # ifdef ECORE_XCB_XINPUT
398 void _ecore_xcb_input_handle_event(xcb_generic_event_t *event);
400 void _ecore_xcb_input_handle_event(xcb_generic_event_t *event);
403 void _ecore_xcb_dri_init(void);
404 void _ecore_xcb_dri_finalize(void);
406 void _ecore_xcb_xtest_init(void);
407 void _ecore_xcb_xtest_finalize(void);
409 Ecore_X_Window _ecore_xcb_window_root_of_screen_get(int screen);
410 void _ecore_xcb_window_prop_string_utf8_set(Ecore_X_Window win,
413 Ecore_X_Visual _ecore_xcb_window_visual_get(Ecore_X_Window win);
414 void _ecore_xcb_window_button_grab_remove(Ecore_X_Window win);
415 void _ecore_xcb_window_key_grab_remove(Ecore_X_Window win);
416 void _ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win,
417 Ecore_X_Window child_win,
420 Ecore_X_Time timestamp);
422 int _ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win,
424 int _ecore_xcb_netwm_startup_info(Ecore_X_Window win,
426 Ecore_X_Window_State _ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom);
428 int _ecore_xcb_error_handle(xcb_generic_error_t *err);
429 int _ecore_xcb_io_error_handle(xcb_generic_error_t *err);
431 xcb_image_t *_ecore_xcb_image_create_native(int w,
433 xcb_image_format_t format,
439 void _ecore_xcb_xdefaults_init(void);
440 void _ecore_xcb_xdefaults_shutdown(void);
441 char *_ecore_xcb_xdefaults_string_get(const char *prog,
443 int _ecore_xcb_xdefaults_int_get(const char *prog,
446 void _ecore_xcb_modifiers_get(void);