1 #ifndef __ECORE_XCB_PRIVATE_H__
2 # define __ECORE_XCB_PRIVATE_H__
10 # include <unistd.h> // included for close & gethostname functions
12 /* generic xcb includes */
14 # include <xcb/bigreq.h>
16 # include <xcb/xcb_image.h>
20 # include "Ecore_Input.h"
24 extern int _ecore_xcb_log_dom;
26 # ifdef ECORE_XCB_DEFAULT_LOG_COLOR
27 # undef ECORE_XCB_DEFAULT_LOG_COLOR
29 # define ECORE_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
34 # define ERR(...) EINA_LOG_DOM_ERR(_ecore_xcb_log_dom, __VA_ARGS__)
39 # define DBG(...) EINA_LOG_DOM_DBG(_ecore_xcb_log_dom, __VA_ARGS__)
44 # define INF(...) EINA_LOG_DOM_INFO(_ecore_xcb_log_dom, __VA_ARGS__)
49 # define WRN(...) EINA_LOG_DOM_WARN(_ecore_xcb_log_dom, __VA_ARGS__)
54 # define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xcb_log_dom, __VA_ARGS__)
58 # define LOGFN(fl, ln, fn) printf("-ECORE-XCB: %25s: %5i - %s\n", fl, ln, fn);
60 # define LOGFN(fl, ln, fn)
63 # ifndef MAXHOSTNAMELEN
64 # define MAXHOSTNAMELEN 256
68 # define MIN(x, y) (((x) > (y)) ? (y) : (x))
72 # define MAX(a, b) ((a < b) ? b : a)
75 #define CHECK_XCB_CONN \
77 if (xcb_connection_has_error(_ecore_xcb_conn)) \
79 DBG("XCB Connection Has Error !!"); \
80 _ecore_xcb_io_error_handle(NULL); \
85 typedef enum _Ecore_Xcb_Encoding_Style Ecore_Xcb_Encoding_Style;
87 enum _Ecore_Xcb_Encoding_Style
97 typedef struct _Ecore_X_DND_Source Ecore_X_DND_Source;
98 typedef struct _Ecore_X_DND_Target Ecore_X_DND_Target;
99 typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
100 typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
101 typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
102 typedef struct _Ecore_Xcb_Textproperty Ecore_Xcb_Textproperty;
104 struct _Ecore_X_DND_Source
107 Ecore_X_Window win, dest;
111 ECORE_X_DND_SOURCE_IDLE,
112 ECORE_X_DND_SOURCE_DRAGGING,
113 ECORE_X_DND_SOURCE_DROPPED,
114 ECORE_X_DND_SOURCE_CONVERTING
120 unsigned short width, height;
125 Ecore_X_Window window;
131 Ecore_X_Atom action, accepted_action;
133 int will_accept, suppress;
137 struct _Ecore_X_DND_Target
140 Ecore_X_Window win, source;
144 ECORE_X_DND_TARGET_IDLE,
145 ECORE_X_DND_TARGET_ENTERED
155 Ecore_X_Atom action, accepted_action;
159 struct _Ecore_X_Selection_Intern
162 Ecore_X_Atom selection;
168 struct _Ecore_X_Selection_Converter
171 Eina_Bool (*convert)(char *target,
178 Ecore_X_Selection_Converter *next;
181 struct _Ecore_X_Selection_Parser
184 void *(*parse)(const char *target, void *data, int size, int format);
185 Ecore_X_Selection_Parser *next;
188 struct _Ecore_Xcb_Textproperty
191 Ecore_X_Atom encoding;
192 unsigned int format, nitems;
195 /* external variables */
196 extern Ecore_X_Connection *_ecore_xcb_conn;
197 extern Ecore_X_Screen *_ecore_xcb_screen;
198 extern double _ecore_xcb_double_click_time;
199 extern int16_t _ecore_xcb_event_last_root_x;
200 extern int16_t _ecore_xcb_event_last_root_y;
202 /* external variables for extension events */
203 extern int _ecore_xcb_event_damage;
204 extern int _ecore_xcb_event_randr;
205 extern int _ecore_xcb_event_screensaver;
206 extern int _ecore_xcb_event_shape;
207 extern int _ecore_xcb_event_sync;
208 extern int _ecore_xcb_event_xfixes;
209 extern int _ecore_xcb_event_input;
210 extern int _ecore_xcb_event_gesture;
212 extern int ECORE_X_MODIFIER_SHIFT;
213 extern int ECORE_X_MODIFIER_CTRL;
214 extern int ECORE_X_MODIFIER_ALT;
215 extern int ECORE_X_MODIFIER_WIN;
216 extern int ECORE_X_MODIFIER_MODE;
217 extern int ECORE_X_LOCK_SCROLL;
218 extern int ECORE_X_LOCK_NUM;
219 extern int ECORE_X_LOCK_CAPS;
220 extern int ECORE_X_LOCK_SHIFT;
222 extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM];
224 extern int _ecore_xcb_button_grabs_num;
225 extern int _ecore_xcb_key_grabs_num;
226 extern Ecore_X_Window *_ecore_xcb_button_grabs;
227 extern Ecore_X_Window *_ecore_xcb_key_grabs;
228 extern Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data,
231 extern void *_ecore_xcb_window_grab_replay_data;
233 /* private function prototypes */
234 void _ecore_xcb_error_handler_init(void);
235 void _ecore_xcb_error_handler_shutdown(void);
237 void _ecore_xcb_atoms_init(void);
238 void _ecore_xcb_atoms_finalize(void);
240 void _ecore_xcb_extensions_init(void);
241 void _ecore_xcb_extensions_finalize(void);
243 void _ecore_xcb_shape_init(void);
244 void _ecore_xcb_shape_finalize(void);
246 void _ecore_xcb_screensaver_init(void);
247 void _ecore_xcb_screensaver_finalize(void);
249 void _ecore_xcb_sync_init(void);
250 void _ecore_xcb_sync_finalize(void);
251 void _ecore_xcb_sync_magic_send(int val,
254 void _ecore_xcb_render_init(void);
255 void _ecore_xcb_render_finalize(void);
256 Eina_Bool _ecore_xcb_render_argb_get(void);
257 Eina_Bool _ecore_xcb_render_anim_get(void);
258 Eina_Bool _ecore_xcb_render_avail_get(void);
260 Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual);
261 uint32_t _ecore_xcb_render_find_visual_id(int type,
262 Eina_Bool check_alpha);
263 Ecore_X_Visual *_ecore_xcb_render_visual_get(int visual_id);
265 void _ecore_xcb_randr_init(void);
266 void _ecore_xcb_randr_finalize(void);
268 void _ecore_xcb_gesture_init(void);
269 void _ecore_xcb_gesture_finalize(void);
270 void _ecore_xcb_gesture_shutdown(void);
272 void _ecore_xcb_xfixes_init(void);
273 void _ecore_xcb_xfixes_finalize(void);
274 Eina_Bool _ecore_xcb_xfixes_avail_get(void);
276 void _ecore_xcb_damage_init(void);
277 void _ecore_xcb_damage_finalize(void);
279 void _ecore_xcb_composite_init(void);
280 void _ecore_xcb_composite_finalize(void);
282 void _ecore_xcb_dpms_init(void);
283 void _ecore_xcb_dpms_finalize(void);
285 void _ecore_xcb_cursor_init(void);
286 void _ecore_xcb_cursor_finalize(void);
288 void _ecore_xcb_xinerama_init(void);
289 void _ecore_xcb_xinerama_finalize(void);
291 void _ecore_xcb_dnd_init(void);
292 void _ecore_xcb_dnd_shutdown(void);
293 Ecore_X_DND_Source *_ecore_xcb_dnd_source_get(void);
294 Ecore_X_DND_Target *_ecore_xcb_dnd_target_get(void);
295 void _ecore_xcb_dnd_drag(Ecore_X_Window root,
299 void _ecore_xcb_selection_init(void);
300 void _ecore_xcb_selection_shutdown(void);
301 void *_ecore_xcb_selection_parse(const char *target,
305 char *_ecore_xcb_selection_target_get(Ecore_X_Atom target);
306 Ecore_X_Selection_Intern *_ecore_xcb_selection_get(Ecore_X_Atom selection);
309 Eina_Bool _ecore_xcb_utf8_textlist_to_textproperty(char **list,
311 Ecore_Xcb_Encoding_Style style,
312 Ecore_Xcb_Textproperty *ret);
314 Eina_Bool _ecore_xcb_mb_textlist_to_textproperty(char **list,
316 Ecore_Xcb_Encoding_Style style,
317 Ecore_Xcb_Textproperty *ret);
318 Eina_Bool _ecore_xcb_textlist_to_textproperty(const char *type,
321 Ecore_Xcb_Encoding_Style style,
322 Ecore_Xcb_Textproperty *ret);
325 Eina_Bool _ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
329 Eina_Bool _ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
332 Eina_Bool _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop,
337 void _ecore_xcb_events_init(void);
338 void _ecore_xcb_events_shutdown(void);
339 void _ecore_xcb_events_handle(xcb_generic_event_t *ev);
340 Ecore_X_Time _ecore_xcb_events_last_time_get(void);
341 unsigned int _ecore_xcb_events_modifiers_get(unsigned int state);
342 void _ecore_xcb_event_mouse_move(uint16_t timestamp,
348 xcb_window_t event_win,
350 xcb_window_t root_win,
361 Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event,
364 xcb_button_t buttons,
369 xcb_window_t event_win,
371 xcb_window_t root_win,
383 void _ecore_xcb_keymap_init(void);
384 void _ecore_xcb_keymap_finalize(void);
385 void _ecore_xcb_keymap_shutdown(void);
386 void _ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event);
387 xcb_keysym_t _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode,
389 xcb_keycode_t *_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym);
390 char *_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym);
391 xcb_keycode_t _ecore_xcb_keymap_string_to_keycode(const char *key);
392 int _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode,
398 void _ecore_xcb_input_init(void);
399 void _ecore_xcb_input_finalize(void);
400 void _ecore_xcb_input_shutdown(void);
401 # ifdef ECORE_XCB_XINPUT
402 void _ecore_xcb_input_handle_event(xcb_generic_event_t *event);
404 void _ecore_xcb_input_handle_event(xcb_generic_event_t *event __UNUSED__);
407 void _ecore_xcb_dri_init(void);
408 void _ecore_xcb_dri_finalize(void);
410 void _ecore_xcb_xtest_init(void);
411 void _ecore_xcb_xtest_finalize(void);
413 Ecore_X_Window _ecore_xcb_window_root_of_screen_get(int screen);
414 void _ecore_xcb_window_prop_string_utf8_set(Ecore_X_Window win,
417 Ecore_X_Visual _ecore_xcb_window_visual_get(Ecore_X_Window win);
418 void _ecore_xcb_window_button_grab_remove(Ecore_X_Window win);
419 void _ecore_xcb_window_key_grab_remove(Ecore_X_Window win);
420 void _ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win,
421 Ecore_X_Window child_win,
424 Ecore_X_Time timestamp);
426 int _ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__,
427 uint8_t data __UNUSED__);
428 int _ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__,
429 uint8_t data __UNUSED__);
430 Ecore_X_Window_State _ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom);
432 int _ecore_xcb_error_handle(xcb_generic_error_t *err);
433 int _ecore_xcb_io_error_handle(xcb_generic_error_t *err);
435 xcb_image_t *_ecore_xcb_image_create_native(int w,
437 xcb_image_format_t format,
443 void _ecore_xcb_xdefaults_init(void);
444 void _ecore_xcb_xdefaults_shutdown(void);
445 char *_ecore_xcb_xdefaults_string_get(const char *prog,
447 int _ecore_xcb_xdefaults_int_get(const char *prog,
450 void _ecore_xcb_modifiers_get(void);