#include <dlfcn.h>
/* local function prototypes */
-static int _ecore_xcb_shutdown(Eina_Bool close_display);
-static Eina_Bool _ecore_xcb_fd_handle(void *data,
- Ecore_Fd_Handler *hdlr __UNUSED__);
-static Eina_Bool _ecore_xcb_fd_handle_buff(void *data,
- Ecore_Fd_Handler *hdlr __UNUSED__);
+static int _ecore_xcb_shutdown(Eina_Bool close_display);
+static Eina_Bool _ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr __UNUSED__);
+static Eina_Bool _ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr __UNUSED__);
static Eina_Bool _ecore_xcb_idle_enter(void *data __UNUSED__);
/* local variables */
/* we found the env var that says 'Yes, we are not ever gonna try
* OpenGL so it is safe to not use XLib at all' */
- /* try to connect to the display server */
- _ecore_xcb_conn = xcb_connect(name, NULL);
+ /* try to connect to the display server */
+ _ecore_xcb_conn = xcb_connect(name, NULL);
}
else
{
/* env var was not specified, so we will assume that the user
* may want opengl @ some point. connect this way for opengl to work */
- void *libxcb, *libxlib;
- Display *(*_real_display)(const char *display);
- xcb_connection_t *(*_real_connection)(Display * dpy);
- void (*_real_queue)(Display *dpy,
- enum XEventQueueOwner owner);
- int (*_real_close)(Display *dpy);
+ void *libxcb, *libxlib;
+ Display *(*_real_display)(const char *display);
+ xcb_connection_t *(*_real_connection)(Display * dpy);
+ void (*_real_queue)(Display *dpy, enum XEventQueueOwner owner);
+ int (*_real_close)(Display *dpy);
#ifdef EVAS_FRAME_QUEUING
- Status (*_real_threads)(void);
+ Status (*_real_threads)(void);
#endif
- /* want to dlopen here to avoid actual library linkage */
- libxlib = dlopen("libX11.so", (RTLD_LAZY | RTLD_GLOBAL));
- if (!libxlib)
- libxlib = dlopen("libX11.so.6", (RTLD_LAZY | RTLD_GLOBAL));
- if (!libxlib)
- libxlib = dlopen("libX11.so.6.3.0", (RTLD_LAZY | RTLD_GLOBAL));
- if (!libxlib)
- {
- ERR("Could not dlsym to libX11");
- /* unregister log domain */
- eina_log_domain_unregister(_ecore_xcb_log_dom);
- _ecore_xcb_log_dom = -1;
- ecore_event_shutdown();
- ecore_shutdown();
- eina_shutdown();
- return --_ecore_xcb_init_count;
- }
-
- libxcb = dlopen("libX11-xcb.so", (RTLD_LAZY | RTLD_GLOBAL));
- if (!libxcb)
- libxcb = dlopen("libX11-xcb.so.1", (RTLD_LAZY | RTLD_GLOBAL));
- if (!libxcb)
- libxcb = dlopen("libX11-xcb.so.1.0.0", (RTLD_LAZY | RTLD_GLOBAL));
- if (!libxcb)
- {
- ERR("Could not dlsym to libX11-xcb");
- /* unregister log domain */
- eina_log_domain_unregister(_ecore_xcb_log_dom);
- _ecore_xcb_log_dom = -1;
- ecore_event_shutdown();
- ecore_shutdown();
- eina_shutdown();
- return --_ecore_xcb_init_count;
- }
-
- _real_display = dlsym(libxlib, "XOpenDisplay");
- _real_close = dlsym(libxlib, "XCloseDisplay");
- _real_connection = dlsym(libxcb, "XGetXCBConnection");
- _real_queue = dlsym(libxcb, "XSetEventQueueOwner");
+ /* want to dlopen here to avoid actual library linkage */
+ libxlib = dlopen("libX11.so", (RTLD_LAZY | RTLD_GLOBAL));
+ if (!libxlib)
+ libxlib = dlopen("libX11.so.6", (RTLD_LAZY | RTLD_GLOBAL));
+ if (!libxlib)
+ libxlib = dlopen("libX11.so.6.3.0", (RTLD_LAZY | RTLD_GLOBAL));
+ if (!libxlib)
+ {
+ ERR("Could not dlsym to libX11");
+ /* unregister log domain */
+ eina_log_domain_unregister(_ecore_xcb_log_dom);
+ _ecore_xcb_log_dom = -1;
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_xcb_init_count;
+ }
+
+ libxcb = dlopen("libX11-xcb.so", (RTLD_LAZY | RTLD_GLOBAL));
+ if (!libxcb)
+ libxcb = dlopen("libX11-xcb.so.1", (RTLD_LAZY | RTLD_GLOBAL));
+ if (!libxcb)
+ libxcb = dlopen("libX11-xcb.so.1.0.0", (RTLD_LAZY | RTLD_GLOBAL));
+ if (!libxcb)
+ {
+ ERR("Could not dlsym to libX11-xcb");
+ /* unregister log domain */
+ eina_log_domain_unregister(_ecore_xcb_log_dom);
+ _ecore_xcb_log_dom = -1;
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_xcb_init_count;
+ }
+
+ _real_display = dlsym(libxlib, "XOpenDisplay");
+ _real_close = dlsym(libxlib, "XCloseDisplay");
+ _real_connection = dlsym(libxcb, "XGetXCBConnection");
+ _real_queue = dlsym(libxcb, "XSetEventQueueOwner");
#ifdef EVAS_FRAME_QUEUING
- _real_threads = dlsym(libxlib, "XInitThreads");
+ _real_threads = dlsym(libxlib, "XInitThreads");
#endif
- if (_real_display)
- {
+ if (_real_display)
+ {
#ifdef EVAS_FRAME_QUEUING
- if (_real_threads) _real_threads();
+ if (_real_threads) _real_threads();
#endif
- _ecore_xcb_display = _real_display(name);
- if (!_ecore_xcb_display)
- {
- ERR("Could not open Display via XLib");
- /* unregister log domain */
- eina_log_domain_unregister(_ecore_xcb_log_dom);
- _ecore_xcb_log_dom = -1;
- ecore_event_shutdown();
- ecore_shutdown();
- eina_shutdown();
- return --_ecore_xcb_init_count;
- }
- if (_real_connection)
- _ecore_xcb_conn = _real_connection(_ecore_xcb_display);
- if (!_ecore_xcb_conn)
- {
- ERR("Could not get XCB Connection from XLib");
-
- if (_real_close) _real_close(_ecore_xcb_display);
-
- /* unregister log domain */
- eina_log_domain_unregister(_ecore_xcb_log_dom);
- _ecore_xcb_log_dom = -1;
- ecore_event_shutdown();
- ecore_shutdown();
- eina_shutdown();
- return --_ecore_xcb_init_count;
- }
- if (_real_queue)
- _real_queue(_ecore_xcb_display, XCBOwnsEventQueue);
- }
+ _ecore_xcb_display = _real_display(name);
+ if (!_ecore_xcb_display)
+ {
+ ERR("Could not open Display via XLib");
+ /* unregister log domain */
+ eina_log_domain_unregister(_ecore_xcb_log_dom);
+ _ecore_xcb_log_dom = -1;
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_xcb_init_count;
+ }
+ if (_real_connection)
+ _ecore_xcb_conn = _real_connection(_ecore_xcb_display);
+ if (!_ecore_xcb_conn)
+ {
+ ERR("Could not get XCB Connection from XLib");
+
+ if (_real_close) _real_close(_ecore_xcb_display);
+
+ /* unregister log domain */
+ eina_log_domain_unregister(_ecore_xcb_log_dom);
+ _ecore_xcb_log_dom = -1;
+ ecore_event_shutdown();
+ ecore_shutdown();
+ eina_shutdown();
+ return --_ecore_xcb_init_count;
+ }
+ if (_real_queue)
+ _real_queue(_ecore_xcb_display, XCBOwnsEventQueue);
+ }
}
if (xcb_connection_has_error(_ecore_xcb_conn))
{
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
- CHECK_XCB_CONN;
- xcb_flush(_ecore_xcb_conn);
+ CHECK_XCB_CONN;
+ xcb_flush(_ecore_xcb_conn);
}
/**
* @return EINA_TRUE on success EINA_FALSE otherwise.
*/
EAPI Eina_Bool
-ecore_x_client_message32_send(Ecore_X_Window win,
- Ecore_X_Atom type,
+ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type,
Ecore_X_Event_Mask mask,
- long d0,
- long d1,
- long d2,
- long d3,
- long d4)
+ long d0, long d1, long d2, long d3, long d4)
{
xcb_client_message_event_t ev;
xcb_void_cookie_t cookie;
* @return EINA_TRUE on success EINA_FALSE otherwise.
*/
EAPI Eina_Bool
-ecore_x_client_message8_send(Ecore_X_Window win,
- Ecore_X_Atom type,
- const void *data,
- int len)
+ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type,
+ const void *data, int len)
{
xcb_client_message_event_t ev;
xcb_void_cookie_t cookie;
}
EAPI Eina_Bool
-ecore_x_mouse_down_send(Ecore_X_Window win,
- int x,
- int y,
- int b)
+ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b)
{
xcb_translate_coordinates_cookie_t cookie;
xcb_translate_coordinates_reply_t *reply;
}
EAPI Eina_Bool
-ecore_x_mouse_up_send(Ecore_X_Window win,
- int x,
- int y,
- int b)
+ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b)
{
xcb_translate_coordinates_cookie_t cookie;
xcb_translate_coordinates_reply_t *reply;
}
EAPI Eina_Bool
-ecore_x_mouse_move_send(Ecore_X_Window win,
- int x,
- int y)
+ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y)
{
xcb_translate_coordinates_cookie_t cookie;
xcb_translate_coordinates_reply_t *reply;
}
EAPI void
-ecore_x_pointer_xy_get(Ecore_X_Window win,
- int *x,
- int *y)
+ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y)
{
xcb_query_pointer_cookie_t cookie;
xcb_query_pointer_reply_t *reply;
}
EAPI Eina_Bool
-ecore_x_pointer_control_set(int accel_num,
- int accel_denom,
- int threshold)
+ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold)
{
xcb_void_cookie_t vcookie;
xcb_generic_error_t *err;
}
EAPI Eina_Bool
-ecore_x_pointer_control_get(int *accel_num,
- int *accel_denom,
- int *threshold)
+ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold)
{
xcb_get_pointer_control_cookie_t cookie;
xcb_get_pointer_control_reply_t *reply;
}
EAPI Eina_Bool
-ecore_x_pointer_mapping_set(unsigned char *map,
- int nmap)
+ecore_x_pointer_mapping_set(unsigned char *map, int nmap)
{
xcb_set_pointer_mapping_cookie_t cookie;
xcb_set_pointer_mapping_reply_t *reply;
}
EAPI Eina_Bool
-ecore_x_pointer_mapping_get(unsigned char *map,
- int nmap)
+ecore_x_pointer_mapping_get(unsigned char *map, int nmap)
{
xcb_get_pointer_mapping_cookie_t cookie;
xcb_get_pointer_mapping_reply_t *reply;
}
EAPI Eina_Bool
-ecore_x_pointer_warp(Ecore_X_Window win,
- int x,
- int y)
+ecore_x_pointer_warp(Ecore_X_Window win, int x, int y)
{
xcb_void_cookie_t vcookie;
xcb_generic_error_t *err;
}
EAPI void
-ecore_x_display_size_get(Ecore_X_Display *dsp __UNUSED__,
- int *w,
- int *h)
+ecore_x_display_size_get(Ecore_X_Display *dsp __UNUSED__, int *w, int *h)
{
xcb_screen_t *screen;
}
EAPI void
-ecore_x_pointer_last_xy_get(int *x,
- int *y)
+ecore_x_pointer_last_xy_get(int *x, int *y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
}
EAPI void
-ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
- int type,
- void *event),
- void *data)
+ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, int type, void *event),
+ void *data)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
* @since 1.1
*/
EAPI void
-ecore_x_screen_size_get(const Ecore_X_Screen *screen,
- int *w,
- int *h)
+ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h)
{
xcb_screen_t *s;
* @since 1.1.0
*/
EAPI Ecore_X_Visual
-ecore_x_default_visual_get(Ecore_X_Display *disp __UNUSED__,
- Ecore_X_Screen *screen)
+ecore_x_default_visual_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen)
{
xcb_screen_t *s;
xcb_depth_iterator_t diter;
* @since 1.1.0
*/
EAPI Ecore_X_Colormap
-ecore_x_default_colormap_get(Ecore_X_Display *disp __UNUSED__,
- Ecore_X_Screen *screen)
+ecore_x_default_colormap_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen)
{
xcb_screen_t *s;
* @since 1.1.0
*/
EAPI int
-ecore_x_default_depth_get(Ecore_X_Display *disp __UNUSED__,
- Ecore_X_Screen *screen)
+ecore_x_default_depth_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen)
{
xcb_screen_t *s;
}
static Eina_Bool
-_ecore_xcb_fd_handle(void *data,
- Ecore_Fd_Handler *hdlr __UNUSED__)
+_ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr __UNUSED__)
{
xcb_connection_t *conn;
xcb_generic_event_t *ev = NULL;
-// xcb_generic_event_t *ev_mouse = NULL;
conn = (xcb_connection_t *)data;
}
else
{
- /* trap mouse motion events and filter out all but the last one.
- * we do this because handling every one is fairly cpu intensive
- * (especially on under-powered devices).
- *
- * NB: I've tested this extensively and have found no ill effects,
- * but if someone notices something, please report it */
- /* if ((ev->response_type & ~0x80) == XCB_MOTION_NOTIFY) */
- /* { */
- /* if (ev_mouse) free(ev_mouse); */
- /* ev_mouse = ev; */
- /* } */
- /* else */
- /* { */
- /* FIXME: Filter event for XIM */
- _ecore_xcb_events_handle(ev);
- free(ev);
- /* } */
+ /* FIXME: Filter event for XIM */
+ _ecore_xcb_events_handle(ev);
+ free(ev);
}
}
- /* if (ev_mouse) */
- /* { */
- /* _ecore_xcb_events_handle(ev_mouse); */
- /* free(ev_mouse); */
- /* } */
-
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
-_ecore_xcb_fd_handle_buff(void *data,
- Ecore_Fd_Handler *hdlr __UNUSED__)
+_ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr __UNUSED__)
{
xcb_connection_t *conn;
xcb_generic_event_t *ev = NULL;
if (ev)
{
/* check for errors first */
- if (xcb_connection_has_error(conn))
- {
- xcb_generic_error_t *err;
-
- err = (xcb_generic_error_t *)ev;
- _ecore_xcb_io_error_handle(err);
- return ECORE_CALLBACK_CANCEL;
- }
- /* trap mouse motion events and filter out all but the last one.
- * we do this because handling every one is fairly cpu intensive
- * (especially on under-powered devices).
- *
- * NB: I've tested this extensively and have found no ill effects,
- * but if someone notices something, please report it */
- /* else if ((ev->response_type & ~0x80) == XCB_MOTION_NOTIFY) */
- /* { */
- /* free(ev); */
- /* return ECORE_CALLBACK_CANCEL; */
- /* } */
- /* else */
- {
- _ecore_xcb_event_buffered = ev;
- return ECORE_CALLBACK_RENEW;
- }
+ if (xcb_connection_has_error(conn))
+ {
+ xcb_generic_error_t *err;
+
+ err = (xcb_generic_error_t *)ev;
+ _ecore_xcb_io_error_handle(err);
+ return ECORE_CALLBACK_CANCEL;
+ }
+ _ecore_xcb_event_buffered = ev;
+ return ECORE_CALLBACK_RENEW;
}
return ECORE_CALLBACK_CANCEL;
}
xcb_flush(_ecore_xcb_conn);
return ECORE_CALLBACK_RENEW;
}
-