EAPI Ecore_X_Time ecore_x_current_time_get(void);
-EAPI void ecore_x_error_handler_set(void (*func)(void *data), const void *data);
-EAPI void ecore_x_io_error_handler_set(void (*func)(
- void *data), const void *data);
+EAPI void ecore_x_error_handler_set(void (*func)(void *data), const void *data);
+EAPI void ecore_x_io_error_handler_set(void (*func)(
+ void *data), const void *data);
EAPI int ecore_x_error_request_get(void);
EAPI int ecore_x_error_code_get(void);
int *len,
Ecore_X_Atom *targprop,
int *targsize);
-EAPI void ecore_x_selection_converter_add(char *target, int (*func)(
- char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
- Ecore_X_Atom *,
- int *));
-EAPI void ecore_x_selection_converter_atom_add(Ecore_X_Atom target, int (*func)(
- char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
- Ecore_X_Atom *tprop,
- int *tsize));
+EAPI void ecore_x_selection_converter_add(char *target, int (*func)(
+ char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *,
+ int *));
+EAPI void ecore_x_selection_converter_atom_add(Ecore_X_Atom target, int (*func)(
+ char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *tprop,
+ int *tsize));
EAPI void ecore_x_selection_converter_del(char *target);
EAPI void ecore_x_selection_converter_atom_del(
Ecore_X_Atom target);
-EAPI void ecore_x_selection_parser_add(const char *target,
- void *(*func)(const char *target,
- void *data, int size,
- int format));
+EAPI void ecore_x_selection_parser_add(const char *target,
+ void *(*func)(const char *target,
+ void *data, int size,
+ int format));
EAPI void ecore_x_selection_parser_del(const char *target);
EAPI void ecore_x_dnd_aware_set(Ecore_X_Window win, int on);
EAPI void ecore_x_keyboard_ungrab(void);
EAPI void ecore_x_grab(void);
EAPI void ecore_x_ungrab(void);
-EAPI void ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
- int event_type,
- void *event),
- void *data);
+EAPI void ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
+ int event_type,
+ void *event),
+ void *data);
EAPI void ecore_x_window_button_grab(Ecore_X_Window win, int button,
Ecore_X_Event_Mask event_mask,
int mod, int any_mod);
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-static Eina_Bool _ecore_xcb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
-static Eina_Bool _ecore_xcb_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler);
-static int _ecore_xcb_key_mask_get(xcb_keysym_t sym);
-static int _ecore_xcb_event_modifier(unsigned int state);
+static Eina_Bool _ecore_xcb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
+static Eina_Bool _ecore_xcb_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler);
+static int _ecore_xcb_key_mask_get(xcb_keysym_t sym);
+static int _ecore_xcb_event_modifier(unsigned int state);
-static void *_ecore_xcb_event_filter_start(void *data);
-static Eina_Bool _ecore_xcb_event_filter_filter(void *data, void *loop_data,int type, void *event);
-static void _ecore_xcb_event_filter_end(void *data, void *loop_data);
+static void * _ecore_xcb_event_filter_start(void *data);
+static Eina_Bool _ecore_xcb_event_filter_filter(void *data, void *loop_data,int type, void *event);
+static void _ecore_xcb_event_filter_end(void *data, void *loop_data);
static Ecore_Fd_Handler *_ecore_xcb_fd_handler_handle = NULL;
static Ecore_Event_Filter *_ecore_xcb_filter_handler = NULL;
int _ecore_x11xcb_log_dom = -1;
Ecore_X_Connection *_ecore_xcb_conn = NULL;
-Ecore_X_Screen *_ecore_xcb_screen = NULL;
-double _ecore_xcb_double_click_time = 0.25;
-Ecore_X_Time _ecore_xcb_event_last_time = XCB_NONE;
-Ecore_X_Window _ecore_xcb_event_last_window = XCB_NONE;
-int16_t _ecore_xcb_event_last_root_x = 0;
-int16_t _ecore_xcb_event_last_root_y = 0;
-int _ecore_xcb_xcursor = 0;
+Ecore_X_Screen *_ecore_xcb_screen = NULL;
+double _ecore_xcb_double_click_time = 0.25;
+Ecore_X_Time _ecore_xcb_event_last_time = XCB_NONE;
+Ecore_X_Window _ecore_xcb_event_last_window = XCB_NONE;
+int16_t _ecore_xcb_event_last_root_x = 0;
+int16_t _ecore_xcb_event_last_root_y = 0;
+int _ecore_xcb_xcursor = 0;
-Ecore_X_Window _ecore_xcb_private_window = 0;
+Ecore_X_Window _ecore_xcb_private_window = 0;
/* FIXME - These are duplicates after making ecore atoms public */
-Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
+Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
-
-EAPI int ECORE_X_EVENT_ANY = 0;
-EAPI int ECORE_X_EVENT_MOUSE_IN = 0;
-EAPI int ECORE_X_EVENT_MOUSE_OUT = 0;
-EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0;
-EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
-EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0;
-EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0;
+EAPI int ECORE_X_EVENT_ANY = 0;
+EAPI int ECORE_X_EVENT_MOUSE_IN = 0;
+EAPI int ECORE_X_EVENT_MOUSE_OUT = 0;
+EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0;
+EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0;
+EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0;
+EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0;
EAPI int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0;
-EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0;
-EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0;
-EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0;
-EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0;
+EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0;
+EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0;
+EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0;
+EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0;
+EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0;
+EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0;
+EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0;
EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0;
-EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0;
-EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0;
-EAPI int ECORE_X_EVENT_WINDOW_STACK = 0;
-EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0;
-EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0;
-EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0;
-EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0;
-EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0;
-EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0;
-EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0;
-EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0;
-EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0;
-EAPI int ECORE_X_EVENT_SYNC_ALARM = 0;
-EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0;
-EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0;
-
-EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0;
+EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0;
+EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0;
+EAPI int ECORE_X_EVENT_WINDOW_STACK = 0;
+EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0;
+EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0;
+EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0;
+EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0;
+EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0;
+EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0;
+EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0;
+EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0;
+EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0;
+EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0;
+EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0;
+EAPI int ECORE_X_EVENT_SYNC_ALARM = 0;
+EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0;
+EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0;
+
+EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0;
/*
-EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
-EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0;
-*/
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = 0;
+ EAPI int ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = 0;
+ */
EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0;
-EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0;
-EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0;
-EAPI int ECORE_X_EVENT_PING = 0;
-EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0;
+EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0;
+EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0;
+EAPI int ECORE_X_EVENT_PING = 0;
+EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0;
-EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0;
-EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0;
-EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0;
+EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0;
+EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0;
+EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0;
-EAPI int ECORE_X_MODIFIER_SHIFT = 0;
-EAPI int ECORE_X_MODIFIER_CTRL = 0;
-EAPI int ECORE_X_MODIFIER_ALT = 0;
-EAPI int ECORE_X_MODIFIER_WIN = 0;
+EAPI int ECORE_X_MODIFIER_SHIFT = 0;
+EAPI int ECORE_X_MODIFIER_CTRL = 0;
+EAPI int ECORE_X_MODIFIER_ALT = 0;
+EAPI int ECORE_X_MODIFIER_WIN = 0;
-EAPI int ECORE_X_LOCK_SCROLL = 0;
-EAPI int ECORE_X_LOCK_NUM = 0;
-EAPI int ECORE_X_LOCK_CAPS = 0;
+EAPI int ECORE_X_LOCK_SCROLL = 0;
+EAPI int ECORE_X_LOCK_NUM = 0;
+EAPI int ECORE_X_LOCK_CAPS = 0;
/**
* @defgroup Ecore_Xcb_Init_Group X Library Init and Shutdown Functions
EAPI int
ecore_x_init(const char *name)
{
- xcb_screen_iterator_t iter;
- int screen;
- uint32_t max_request_length;
+ xcb_screen_iterator_t iter;
+ int screen;
+ uint32_t max_request_length;
const xcb_query_extension_reply_t *reply_big_requests;
#ifdef ECORE_XCB_DAMAGE
const xcb_query_extension_reply_t *reply_damage;
const xcb_query_extension_reply_t *reply_shape;
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
- xcb_sync_initialize_cookie_t cookie_sync_init;
- xcb_sync_initialize_reply_t *reply_sync_init;
+ xcb_sync_initialize_cookie_t cookie_sync_init;
+ xcb_sync_initialize_reply_t *reply_sync_init;
const xcb_query_extension_reply_t *reply_sync;
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
const xcb_query_extension_reply_t *reply_xprint;
#endif /* ECORE_XCB_XPRINT */
- xcb_intern_atom_cookie_t atom_cookies[ECORE_X_ATOMS_COUNT];
+ xcb_intern_atom_cookie_t atom_cookies[ECORE_X_ATOMS_COUNT];
if (++_ecore_xcb_init_count != 1)
- return _ecore_xcb_init_count;
+ return _ecore_xcb_init_count;
+
_ecore_x11xcb_log_dom = eina_log_domain_register("EcoreXCB", ECORE_XLIB_XCB_DEFAULT_LOG_COLOR);
if(_ecore_x11xcb_log_dom < 0)
{
- EINA_LOG_ERR("Impossible to create a log domain the Ecore XCB module.");
- return --_ecore_xcb_init_count;
+ EINA_LOG_ERR("Impossible to create a log domain the Ecore XCB module.");
+ return --_ecore_xcb_init_count;
}
+
_ecore_xcb_conn = xcb_connect(name, &screen);
- if (xcb_connection_has_error(_ecore_xcb_conn)) {
- eina_log_domain_unregister(_ecore_x11xcb_log_dom);
- _ecore_x11xcb_log_dom = -1;
- return --_ecore_xcb_init_count;
- }
+ if (xcb_connection_has_error(_ecore_xcb_conn))
+ {
+ eina_log_domain_unregister(_ecore_x11xcb_log_dom);
+ _ecore_x11xcb_log_dom = -1;
+ return --_ecore_xcb_init_count;
+ }
+
/* FIXME: no error code right now */
/* _ecore_xcb_error_handler_init(); */
*
*/
-
/* We request the atoms (non blocking) */
_ecore_x_atom_init(atom_cookies);
/* We init some components (not related to XCB) */
if (!ecore_event_init())
- goto close_connection;
+ goto close_connection;
_ecore_x_reply_init();
_ecore_x_dnd_init();
/* We get the default screen */
iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
for (; iter.rem; --screen, xcb_screen_next (&iter))
- if (screen == 0)
- {
- _ecore_xcb_screen = iter.data;
- break;
- }
+ if (screen == 0)
+ {
+ _ecore_xcb_screen = iter.data;
+ break;
+ }
/*
* Blocking stuff:
#ifdef ECORE_XCB_DAMAGE
reply_damage = xcb_get_extension_data(_ecore_xcb_conn, &xcb_damage_id);
if (reply_damage)
- _ecore_xcb_event_damage_id = reply_damage->first_event + XCB_DAMAGE_NOTIFY;
+ _ecore_xcb_event_damage_id = reply_damage->first_event + XCB_DAMAGE_NOTIFY;
+
if (_ecore_xcb_event_damage_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_damage_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_damage_id + 1;
+
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_COMPOSITE
#ifdef ECORE_XCB_RANDR
reply_randr = xcb_get_extension_data(_ecore_xcb_conn, &xcb_randr_id);
if (reply_randr)
- _ecore_xcb_event_randr_id = reply_randr->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY;
+ _ecore_xcb_event_randr_id = reply_randr->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY;
+
if (_ecore_xcb_event_randr_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_randr_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_randr_id + 1;
+
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_SCREENSAVER
reply_screensaver = xcb_get_extension_data(_ecore_xcb_conn, &xcb_screensaver_id);
if (reply_screensaver)
- _ecore_xcb_event_screensaver_id = reply_screensaver->first_event + XCB_SCREENSAVER_NOTIFY;
+ _ecore_xcb_event_screensaver_id = reply_screensaver->first_event + XCB_SCREENSAVER_NOTIFY;
+
if (_ecore_xcb_event_screensaver_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_screensaver_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_screensaver_id + 1;
+
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
reply_shape = xcb_get_extension_data(_ecore_xcb_conn, &xcb_shape_id);
if (reply_shape)
- _ecore_xcb_event_shape_id = reply_shape->first_event + XCB_SHAPE_NOTIFY;
+ _ecore_xcb_event_shape_id = reply_shape->first_event + XCB_SHAPE_NOTIFY;
+
if (_ecore_xcb_event_shape_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_shape_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_shape_id + 1;
+
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
reply_sync = xcb_get_extension_data(_ecore_xcb_conn, &xcb_sync_id);
if (reply_sync)
{
- _ecore_xcb_event_sync_id = reply_sync->first_event;
+ _ecore_xcb_event_sync_id = reply_sync->first_event;
reply_sync_init = xcb_sync_initialize_reply(_ecore_xcb_conn,
cookie_sync_init, NULL);
- if (!reply_sync_init)
- _ecore_xcb_event_sync_id = 0;
+ if (!reply_sync_init)
+ _ecore_xcb_event_sync_id = 0;
else
- free(reply_sync_init);
+ free(reply_sync_init);
}
+
if (_ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY + 1;
+
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
reply_xfixes = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xfixes_id);
if (reply_xfixes)
- _ecore_xcb_event_fixes_selection_id = reply_xfixes->first_event + XCB_XFIXES_SELECTION_NOTIFY;
+ _ecore_xcb_event_fixes_selection_id = reply_xfixes->first_event + XCB_XFIXES_SELECTION_NOTIFY;
+
if (_ecore_xcb_event_fixes_selection_id >= _ecore_xcb_event_handlers_num)
- _ecore_xcb_event_handlers_num = _ecore_xcb_event_fixes_selection_id + 1;
+ _ecore_xcb_event_handlers_num = _ecore_xcb_event_fixes_selection_id + 1;
+
#endif /* ECORE_XCB_FIXES */
#ifdef ECORE_XCB_XINERAMA
_ecore_xcb_event_handlers = calloc(_ecore_xcb_event_handlers_num, sizeof(void *));
if (!_ecore_xcb_event_handlers)
- goto finalize_extensions;
+ goto finalize_extensions;
#ifdef ECORE_XCB_CURSOR
_ecore_xcb_xcursor = XcursorSupportsARGB(_ecore_xcb_conn);
#endif /* ECORE_XCB_CURSOR */
- _ecore_xcb_event_handlers[XCB_EVENT_ANY] = _ecore_x_event_handle_any_event;
- _ecore_xcb_event_handlers[XCB_KEY_PRESS] = _ecore_x_event_handle_key_press;
- _ecore_xcb_event_handlers[XCB_KEY_RELEASE] = _ecore_x_event_handle_key_release;
- _ecore_xcb_event_handlers[XCB_BUTTON_PRESS] = _ecore_x_event_handle_button_press;
- _ecore_xcb_event_handlers[XCB_BUTTON_RELEASE] = _ecore_x_event_handle_button_release;
- _ecore_xcb_event_handlers[XCB_MOTION_NOTIFY] = _ecore_x_event_handle_motion_notify;
- _ecore_xcb_event_handlers[XCB_ENTER_NOTIFY] = _ecore_x_event_handle_enter_notify;
- _ecore_xcb_event_handlers[XCB_LEAVE_NOTIFY] = _ecore_x_event_handle_leave_notify;
- _ecore_xcb_event_handlers[XCB_FOCUS_IN] = _ecore_x_event_handle_focus_in;
- _ecore_xcb_event_handlers[XCB_FOCUS_OUT] = _ecore_x_event_handle_focus_out;
- _ecore_xcb_event_handlers[XCB_KEYMAP_NOTIFY] = _ecore_x_event_handle_keymap_notify;
- _ecore_xcb_event_handlers[XCB_EXPOSE] = _ecore_x_event_handle_expose;
+ _ecore_xcb_event_handlers[XCB_EVENT_ANY] = _ecore_x_event_handle_any_event;
+ _ecore_xcb_event_handlers[XCB_KEY_PRESS] = _ecore_x_event_handle_key_press;
+ _ecore_xcb_event_handlers[XCB_KEY_RELEASE] = _ecore_x_event_handle_key_release;
+ _ecore_xcb_event_handlers[XCB_BUTTON_PRESS] = _ecore_x_event_handle_button_press;
+ _ecore_xcb_event_handlers[XCB_BUTTON_RELEASE] = _ecore_x_event_handle_button_release;
+ _ecore_xcb_event_handlers[XCB_MOTION_NOTIFY] = _ecore_x_event_handle_motion_notify;
+ _ecore_xcb_event_handlers[XCB_ENTER_NOTIFY] = _ecore_x_event_handle_enter_notify;
+ _ecore_xcb_event_handlers[XCB_LEAVE_NOTIFY] = _ecore_x_event_handle_leave_notify;
+ _ecore_xcb_event_handlers[XCB_FOCUS_IN] = _ecore_x_event_handle_focus_in;
+ _ecore_xcb_event_handlers[XCB_FOCUS_OUT] = _ecore_x_event_handle_focus_out;
+ _ecore_xcb_event_handlers[XCB_KEYMAP_NOTIFY] = _ecore_x_event_handle_keymap_notify;
+ _ecore_xcb_event_handlers[XCB_EXPOSE] = _ecore_x_event_handle_expose;
_ecore_xcb_event_handlers[XCB_GRAPHICS_EXPOSURE] = _ecore_x_event_handle_graphics_expose;
_ecore_xcb_event_handlers[XCB_VISIBILITY_NOTIFY] = _ecore_x_event_handle_visibility_notify;
- _ecore_xcb_event_handlers[XCB_CREATE_NOTIFY] = _ecore_x_event_handle_create_notify;
- _ecore_xcb_event_handlers[XCB_DESTROY_NOTIFY] = _ecore_x_event_handle_destroy_notify;
- _ecore_xcb_event_handlers[XCB_UNMAP_NOTIFY] = _ecore_x_event_handle_unmap_notify;
- _ecore_xcb_event_handlers[XCB_MAP_NOTIFY] = _ecore_x_event_handle_map_notify;
- _ecore_xcb_event_handlers[XCB_MAP_REQUEST] = _ecore_x_event_handle_map_request;
- _ecore_xcb_event_handlers[XCB_REPARENT_NOTIFY] = _ecore_x_event_handle_reparent_notify;
- _ecore_xcb_event_handlers[XCB_CONFIGURE_NOTIFY] = _ecore_x_event_handle_configure_notify;
+ _ecore_xcb_event_handlers[XCB_CREATE_NOTIFY] = _ecore_x_event_handle_create_notify;
+ _ecore_xcb_event_handlers[XCB_DESTROY_NOTIFY] = _ecore_x_event_handle_destroy_notify;
+ _ecore_xcb_event_handlers[XCB_UNMAP_NOTIFY] = _ecore_x_event_handle_unmap_notify;
+ _ecore_xcb_event_handlers[XCB_MAP_NOTIFY] = _ecore_x_event_handle_map_notify;
+ _ecore_xcb_event_handlers[XCB_MAP_REQUEST] = _ecore_x_event_handle_map_request;
+ _ecore_xcb_event_handlers[XCB_REPARENT_NOTIFY] = _ecore_x_event_handle_reparent_notify;
+ _ecore_xcb_event_handlers[XCB_CONFIGURE_NOTIFY] = _ecore_x_event_handle_configure_notify;
_ecore_xcb_event_handlers[XCB_CONFIGURE_REQUEST] = _ecore_x_event_handle_configure_request;
- _ecore_xcb_event_handlers[XCB_GRAVITY_NOTIFY] = _ecore_x_event_handle_gravity_notify;
- _ecore_xcb_event_handlers[XCB_RESIZE_REQUEST] = _ecore_x_event_handle_resize_request;
- _ecore_xcb_event_handlers[XCB_CIRCULATE_NOTIFY] = _ecore_x_event_handle_circulate_notify;
+ _ecore_xcb_event_handlers[XCB_GRAVITY_NOTIFY] = _ecore_x_event_handle_gravity_notify;
+ _ecore_xcb_event_handlers[XCB_RESIZE_REQUEST] = _ecore_x_event_handle_resize_request;
+ _ecore_xcb_event_handlers[XCB_CIRCULATE_NOTIFY] = _ecore_x_event_handle_circulate_notify;
_ecore_xcb_event_handlers[XCB_CIRCULATE_REQUEST] = _ecore_x_event_handle_circulate_request;
- _ecore_xcb_event_handlers[XCB_PROPERTY_NOTIFY] = _ecore_x_event_handle_property_notify;
- _ecore_xcb_event_handlers[XCB_SELECTION_CLEAR] = _ecore_x_event_handle_selection_clear;
+ _ecore_xcb_event_handlers[XCB_PROPERTY_NOTIFY] = _ecore_x_event_handle_property_notify;
+ _ecore_xcb_event_handlers[XCB_SELECTION_CLEAR] = _ecore_x_event_handle_selection_clear;
_ecore_xcb_event_handlers[XCB_SELECTION_REQUEST] = _ecore_x_event_handle_selection_request;
- _ecore_xcb_event_handlers[XCB_SELECTION_NOTIFY] = _ecore_x_event_handle_selection_notify;
- _ecore_xcb_event_handlers[XCB_COLORMAP_NOTIFY] = _ecore_x_event_handle_colormap_notify;
- _ecore_xcb_event_handlers[XCB_CLIENT_MESSAGE] = _ecore_x_event_handle_client_message;
- _ecore_xcb_event_handlers[XCB_MAPPING_NOTIFY] = _ecore_x_event_handle_mapping_notify;
+ _ecore_xcb_event_handlers[XCB_SELECTION_NOTIFY] = _ecore_x_event_handle_selection_notify;
+ _ecore_xcb_event_handlers[XCB_COLORMAP_NOTIFY] = _ecore_x_event_handle_colormap_notify;
+ _ecore_xcb_event_handlers[XCB_CLIENT_MESSAGE] = _ecore_x_event_handle_client_message;
+ _ecore_xcb_event_handlers[XCB_MAPPING_NOTIFY] = _ecore_x_event_handle_mapping_notify;
#ifdef ECORE_XCB_DAMAGE
if (_ecore_xcb_event_damage_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_damage_id] = _ecore_x_event_handle_damage_notify;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_damage_id] = _ecore_x_event_handle_damage_notify;
+
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_RANDR
if (_ecore_xcb_event_randr_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_randr_id] = _ecore_x_event_handle_randr_change;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_randr_id] = _ecore_x_event_handle_randr_change;
+
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_SCREENSAVER
if (_ecore_xcb_event_screensaver_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_screensaver_id] = _ecore_x_event_handle_screensaver_notify;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_screensaver_id] = _ecore_x_event_handle_screensaver_notify;
+
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
if (_ecore_xcb_event_shape_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_shape_id] = _ecore_x_event_handle_shape_change;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_shape_id] = _ecore_x_event_handle_shape_change;
+
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
if (_ecore_xcb_event_sync_id)
{
- _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_COUNTER_NOTIFY] =
- _ecore_x_event_handle_sync_counter;
- _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY] =
- _ecore_x_event_handle_sync_alarm;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_COUNTER_NOTIFY] =
+ _ecore_x_event_handle_sync_counter;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_sync_id + XCB_SYNC_ALARM_NOTIFY] =
+ _ecore_x_event_handle_sync_alarm;
}
+
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
if (_ecore_xcb_event_fixes_selection_id)
- _ecore_xcb_event_handlers[_ecore_xcb_event_fixes_selection_id] = _ecore_x_event_handle_fixes_selection_notify;
+ _ecore_xcb_event_handlers[_ecore_xcb_event_fixes_selection_id] = _ecore_x_event_handle_fixes_selection_notify;
+
#endif /* ECORE_XCB_FIXES */
if (!ECORE_X_EVENT_ANY)
{
- ECORE_X_EVENT_ANY = ecore_event_type_new();
- ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new();
- ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new();
- ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new();
- ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new();
- ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new();
- ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new();
- ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new();
- ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new();
- ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new();
-
- ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
- /*
- ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = ecore_event_type_new();
- */
-
- ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new();
- ECORE_X_EVENT_PING = ecore_event_type_new();
-
- ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new();
- ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new();
- ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new();
+ ECORE_X_EVENT_ANY = ecore_event_type_new();
+ ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new();
+ ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new();
+ ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new();
+ ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new();
+ ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new();
+ ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new();
+ ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new();
+ ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new();
+ ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new();
+
+ ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
+ /*
+ ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_PROP_DESKTOP_CHANGE = ecore_event_type_new();
+ */
+
+ ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new();
+ ECORE_X_EVENT_PING = ecore_event_type_new();
+
+ ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new();
+ ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new();
+ ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new();
}
/* everything has these... unless its like a pda... :) */
ECORE_X_MODIFIER_SHIFT = _ecore_xcb_key_mask_get(XK_Shift_L);
- ECORE_X_MODIFIER_CTRL = _ecore_xcb_key_mask_get(XK_Control_L);
+ ECORE_X_MODIFIER_CTRL = _ecore_xcb_key_mask_get(XK_Control_L);
/* apple's xdarwin has no alt!!!! */
- ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Alt_L);
+ ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Alt_L);
if (!ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Meta_L);
+ ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Meta_L);
+
if (!ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Super_L);
+ ECORE_X_MODIFIER_ALT = _ecore_xcb_key_mask_get(XK_Super_L);
/* the windows key... a valid modifier :) */
- ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Super_L);
+ ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Super_L);
if (!ECORE_X_MODIFIER_WIN)
- ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Mode_switch);
+ ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Mode_switch);
+
if (!ECORE_X_MODIFIER_WIN)
- ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Meta_L);
+ ECORE_X_MODIFIER_WIN = _ecore_xcb_key_mask_get(XK_Meta_L);
if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT)
- ECORE_X_MODIFIER_WIN = 0;
+ ECORE_X_MODIFIER_WIN = 0;
+
if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL)
- ECORE_X_MODIFIER_ALT = 0;
+ ECORE_X_MODIFIER_ALT = 0;
- ECORE_X_LOCK_SCROLL = _ecore_xcb_key_mask_get(XK_Scroll_Lock);
- ECORE_X_LOCK_NUM = _ecore_xcb_key_mask_get(XK_Num_Lock);
- ECORE_X_LOCK_CAPS = _ecore_xcb_key_mask_get(XK_Caps_Lock);
+ ECORE_X_LOCK_SCROLL = _ecore_xcb_key_mask_get(XK_Scroll_Lock);
+ ECORE_X_LOCK_NUM = _ecore_xcb_key_mask_get(XK_Num_Lock);
+ ECORE_X_LOCK_CAPS = _ecore_xcb_key_mask_get(XK_Caps_Lock);
_ecore_xcb_fd_handler_handle =
- ecore_main_fd_handler_add(xcb_get_file_descriptor(_ecore_xcb_conn),
- ECORE_FD_READ,
- _ecore_xcb_fd_handler, _ecore_xcb_conn,
- _ecore_xcb_fd_handler_buf, _ecore_xcb_conn);
+ ecore_main_fd_handler_add(xcb_get_file_descriptor(_ecore_xcb_conn),
+ ECORE_FD_READ,
+ _ecore_xcb_fd_handler, _ecore_xcb_conn,
+ _ecore_xcb_fd_handler_buf, _ecore_xcb_conn);
if (!_ecore_xcb_fd_handler_handle)
- goto free_event_handlers;
+ goto free_event_handlers;
_ecore_xcb_filter_handler = ecore_event_filter_add(_ecore_xcb_event_filter_start, _ecore_xcb_event_filter_filter, _ecore_xcb_event_filter_end, NULL);
return _ecore_xcb_init_count;
- free_event_handlers:
+free_event_handlers:
free(_ecore_xcb_event_handlers);
_ecore_xcb_event_handlers = NULL;
- finalize_extensions:
+finalize_extensions:
/* We get the replies of the QueryVersion request because we leave */
#ifdef ECORE_XCB_DAMAGE
_ecore_x_damage_init_finalize();
_ecore_x_xinerama_init_finalize();
#endif /* ECORE_XCB_XINERAMA */
ecore_event_shutdown();
- close_connection:
+close_connection:
_ecore_x_atom_init_finalize(atom_cookies);
xcb_disconnect(_ecore_xcb_conn);
_ecore_xcb_fd_handler_handle = NULL;
_ecore_xcb_conn = NULL;
return --_ecore_xcb_init_count;
-}
+} /* ecore_x_init */
static int
_ecore_x_shutdown(int close_display)
{
if (--_ecore_xcb_init_count != 0)
- return _ecore_xcb_init_count;
+ return _ecore_xcb_init_count;
- if (!_ecore_xcb_conn) return _ecore_xcb_init_count;
+ if (!_ecore_xcb_conn)
+ return _ecore_xcb_init_count;
ecore_main_fd_handler_del(_ecore_xcb_fd_handler_handle);
if (close_display)
xcb_disconnect(_ecore_xcb_conn);
else
close(xcb_get_file_descriptor(_ecore_xcb_conn));
+
ecore_event_shutdown();
free(_ecore_xcb_event_handlers);
ecore_event_filter_del(_ecore_xcb_filter_handler);
_ecore_x_reply_shutdown();
return _ecore_xcb_init_count;
-}
+} /* _ecore_x_shutdown */
/**
* Shuts down the Ecore X library.
ecore_x_shutdown(void)
{
return _ecore_x_shutdown(1);
-}
+} /* ecore_x_shutdown */
/**
* Shuts down the Ecore X library.
ecore_x_disconnect(void)
{
return _ecore_x_shutdown(0);
-}
+} /* ecore_x_disconnect */
/**
* @defgroup Ecore_Xcb_Display_Attr_Group X Display Attributes
ecore_x_display_get(void)
{
return NULL;
-}
+} /* ecore_x_display_get */
/**
* Retrieves the Ecore_X_Connection handle used for the current X connection.
ecore_x_connection_get(void)
{
return (Ecore_X_Connection *)_ecore_xcb_conn;
-}
+} /* ecore_x_connection_get */
/**
* Retrieves the X display file descriptor.
ecore_x_fd_get(void)
{
return xcb_get_file_descriptor(_ecore_xcb_conn);
-}
+} /* ecore_x_fd_get */
/**
* Retrieves the Ecore_X_Screen handle used for the current X connection.
ecore_x_default_screen_get(void)
{
return (Ecore_X_Screen *)_ecore_xcb_screen;
-}
+} /* ecore_x_default_screen_get */
/**
* Sets the timeout for a double and triple clicks to be flagged.
EAPI void
ecore_x_double_click_time_set(double t)
{
- if (t < 0.0) t = 0.0;
+ if (t < 0.0)
+ t = 0.0;
+
_ecore_xcb_double_click_time = t;
-}
+} /* ecore_x_double_click_time_set */
/**
* Retrieves the double and triple click flag timeout.
ecore_x_double_click_time_get(void)
{
return _ecore_xcb_double_click_time;
-}
+} /* ecore_x_double_click_time_get */
/**
* @defgroup Ecore_Xcb_Flush_Group X Synchronization Functions
ecore_x_flush(void)
{
xcb_flush(_ecore_xcb_conn);
-}
+} /* ecore_x_flush */
/**
* Flushes the command buffer and waits until all requests have been
ecore_x_sync(void)
{
free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
-}
+} /* ecore_x_sync */
/**
* Kill all clients with subwindows under a given window.
reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
if (reply)
{
- xcb_window_t *wins = NULL;
- int tree_c_len;
- int i;
-
- wins = xcb_query_tree_children(reply);
- tree_c_len = xcb_query_tree_children_length(reply);
- for (i = 0; i < tree_c_len; i++)
- xcb_kill_client(_ecore_xcb_conn, wins[i]);
- free(reply);
+ xcb_window_t *wins = NULL;
+ int tree_c_len;
+ int i;
+
+ wins = xcb_query_tree_children(reply);
+ tree_c_len = xcb_query_tree_children_length(reply);
+ for (i = 0; i < tree_c_len; i++)
+ xcb_kill_client(_ecore_xcb_conn, wins[i]);
+ free(reply);
}
}
xcb_ungrab_server(_ecore_xcb_conn);
free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
-}
+} /* ecore_x_killall */
/**
* Kill a specific client
ecore_x_kill(Ecore_X_Window window)
{
xcb_kill_client(_ecore_xcb_conn, window);
-}
+} /* ecore_x_kill */
/**
* TODO: Invoke the standard system beep to alert users
ecore_x_bell(int percent)
{
return 0;
-}
+} /* ecore_x_bell */
/**
* Return the last event time
ecore_x_current_time_get(void)
{
return _ecore_xcb_event_last_time;
-}
+} /* ecore_x_current_time_get */
static void
handle_event(xcb_generic_event_t *ev)
if (response_type < _ecore_xcb_event_handlers_num)
{
- if (_ecore_xcb_event_handlers[XCB_EVENT_ANY])
- _ecore_xcb_event_handlers[XCB_EVENT_ANY] (ev);
+ if (_ecore_xcb_event_handlers[XCB_EVENT_ANY])
+ _ecore_xcb_event_handlers[XCB_EVENT_ANY] (ev);
- if (_ecore_xcb_event_handlers[response_type])
- _ecore_xcb_event_handlers[response_type] (ev);
+ if (_ecore_xcb_event_handlers[response_type])
+ _ecore_xcb_event_handlers[response_type] (ev);
}
-}
+} /* handle_event */
static Eina_Bool
_ecore_xcb_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
{
- xcb_connection_t *c;
+ xcb_connection_t *c;
xcb_generic_event_t *ev;
c = (xcb_connection_t *)data;
}
while ((ev = xcb_poll_for_event(c)))
- handle_event(ev);
+ handle_event(ev);
return ECORE_CALLBACK_RENEW;
-}
+} /* _ecore_xcb_fd_handler */
static Eina_Bool
_ecore_xcb_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
_ecore_xcb_event_buffered = xcb_poll_for_event(c);
if (!_ecore_xcb_event_buffered)
- return ECORE_CALLBACK_CANCEL;
+ return ECORE_CALLBACK_CANCEL;
return ECORE_CALLBACK_RENEW;
-}
+} /* _ecore_xcb_fd_handler_buf */
/* FIXME: possible roundtrip */
/* FIXME: fix xcb_keysyms. It's ugly !! (reply in xcb_key_symbols_get_keysym) */
{
xcb_get_modifier_mapping_cookie_t cookie;
xcb_get_modifier_mapping_reply_t *reply;
- xcb_key_symbols_t *symbols;
- xcb_keysym_t sym2;
- int i, j;
- xcb_keycode_t *keycodes = NULL;
- int mod_keys_len;
- const int masks[8] =
- {
- XCB_MOD_MASK_SHIFT,
- XCB_MOD_MASK_LOCK,
- XCB_MOD_MASK_CONTROL,
- XCB_MOD_MASK_1,
- XCB_MOD_MASK_2,
- XCB_MOD_MASK_3,
- XCB_MOD_MASK_4,
- XCB_MOD_MASK_5
- };
+ xcb_key_symbols_t *symbols;
+ xcb_keysym_t sym2;
+ int i, j;
+ xcb_keycode_t *keycodes = NULL;
+ int mod_keys_len;
+ const int masks[8] =
+ {
+ XCB_MOD_MASK_SHIFT,
+ XCB_MOD_MASK_LOCK,
+ XCB_MOD_MASK_CONTROL,
+ XCB_MOD_MASK_1,
+ XCB_MOD_MASK_2,
+ XCB_MOD_MASK_3,
+ XCB_MOD_MASK_4,
+ XCB_MOD_MASK_5
+ };
cookie = xcb_get_modifier_mapping_unchecked(_ecore_xcb_conn);
symbols = xcb_key_symbols_alloc(_ecore_xcb_conn);
mod_keys_len = xcb_get_modifier_mapping_keycodes_length(reply);
for (i = 0; i < mod_keys_len; i++)
{
- for (j = 0; j < 8; j++)
- {
- sym2 = xcb_key_symbols_get_keysym(symbols, keycodes[i], j);
- if (sym2 != 0) break;
- }
- if (sym2 == sym)
- {
- int mask;
-
- mask = masks[j];
- free(reply);
- xcb_key_symbols_free(symbols);
- return mask;
- }
+ for (j = 0; j < 8; j++)
+ {
+ sym2 = xcb_key_symbols_get_keysym(symbols, keycodes[i], j);
+ if (sym2 != 0)
+ break;
+ }
+ if (sym2 == sym)
+ {
+ int mask;
+
+ mask = masks[j];
+ free(reply);
+ xcb_key_symbols_free(symbols);
+ return mask;
+ }
}
free(reply);
xcb_key_symbols_free(symbols);
- return 0;
-}
+ return 0;
+} /* _ecore_xcb_key_mask_get */
-typedef struct _Ecore_X_Filter_Data Ecore_X_Filter_Data;
+typedef struct _Ecore_X_Filter_Data Ecore_X_Filter_Data;
struct _Ecore_X_Filter_Data
{
filter_data = calloc(1, sizeof(Ecore_X_Filter_Data));
return filter_data;
-}
+} /* _ecore_xcb_event_filter_start */
static Eina_Bool
_ecore_xcb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, void *event __UNUSED__)
Ecore_X_Filter_Data *filter_data;
filter_data = loop_data;
- if (!filter_data) return EINA_TRUE;
+ if (!filter_data)
+ return EINA_TRUE;
+
if (type == ECORE_EVENT_MOUSE_MOVE)
{
- if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE)
- {
- filter_data->last_event_type = type;
- return EINA_FALSE;
- }
+ if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE)
+ {
+ filter_data->last_event_type = type;
+ return EINA_FALSE;
+ }
}
+
filter_data->last_event_type = type;
return EINA_TRUE;
-}
+} /* _ecore_xcb_event_filter_filter */
static void
_ecore_xcb_event_filter_end(void *data __UNUSED__, void *loop_data)
Ecore_X_Filter_Data *filter_data;
filter_data = loop_data;
- if (filter_data) free(filter_data);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ if (filter_data)
+ free(filter_data);
+} /* _ecore_xcb_event_filter_end */
/*****************************************************************************/
/*****************************************************************************/
/* FIXME: these funcs need categorising */
/*****************************************************************************/
-
-
-
/**
* Get a list of all the root windows on the server.
*
ecore_x_window_root_list(int *num_ret)
{
xcb_screen_iterator_t iter;
- const xcb_setup_t *setup;
- uint8_t i;
- uint8_t num;
- Ecore_X_Window *roots;
+ const xcb_setup_t *setup;
+ uint8_t i;
+ uint8_t num;
+ Ecore_X_Window *roots;
/* #ifdef ECORE_XCBXPRINT */
/* int xp_base, xp_err_base; */
/* #endif /\* ECORE_XCBXPRINT *\/ */
- if (!num_ret) return NULL;
+ if (!num_ret)
+ return NULL;
+
*num_ret = 0;
/* FIXME: todo... */
iter = xcb_setup_roots_iterator (setup);
num = setup->roots_len;
roots = malloc(num * sizeof(Ecore_X_Window));
- if (!roots) return NULL;
+ if (!roots)
+ return NULL;
*num_ret = num;
for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
- roots[i] = iter.data->root;
+ roots[i] = iter.data->root;
/* #endif /\* ECORE_XCBXPRINT *\/ */
return roots;
-}
+} /* ecore_x_window_root_list */
EAPI Ecore_X_Window
ecore_x_window_root_first_get(void)
{
Ecore_X_Window *roots = NULL;
- Ecore_X_Window root;
- int num;
+ Ecore_X_Window root;
+ int num;
roots = ecore_x_window_root_list(&num);
- if(!(roots)) return 0;
+ if(!(roots))
+ return 0;
if (num > 0)
root = roots[0];
free(roots);
return root;
-}
+} /* ecore_x_window_root_first_get */
/* FIXME: todo */
-static void _ecore_x_window_manage_error(void *data);
+static void _ecore_x_window_manage_error(void *data);
static int _ecore_xcb_window_manage_failed = 0;
static void
/* if ((ecore_xcb_error_request_get() == X_ChangeWindowAttributes) && */
/* (ecore_xcb_error_code_get() == BadAccess)) */
/* _ecore_xcb_window_manage_failed = 1; */
-}
+} /* _ecore_x_window_manage_error */
/* FIXME: round trip */
EAPI int
ecore_x_window_manage(Ecore_X_Window window)
{
xcb_get_window_attributes_cookie_t cookie_attr;
- xcb_get_input_focus_cookie_t cookie_sync;
+ xcb_get_input_focus_cookie_t cookie_sync;
xcb_get_window_attributes_reply_t *reply_attr;
- xcb_get_input_focus_reply_t *reply_sync;
- uint32_t value_list;
+ xcb_get_input_focus_reply_t *reply_sync;
+ uint32_t value_list;
cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
cookie_sync = xcb_get_input_focus_unchecked(_ecore_xcb_conn);
if (!reply_attr)
{
reply_sync = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie_sync, NULL);
- if (reply_sync) free(reply_sync);
+ if (reply_sync)
+ free(reply_sync);
+
return 0;
}
reply_sync = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie_sync, NULL);
- if (reply_sync) free(reply_sync);
+ if (reply_sync)
+ free(reply_sync);
_ecore_xcb_window_manage_failed = 0;
/* FIXME: no error code yet */
/* ecore_xcb_error_handler_set(_ecore_xcb_window_manage_error, NULL); */
value_list =
- XCB_EVENT_MASK_KEY_PRESS |
- XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW |
- XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_RESIZE_REDIRECT |
- XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
- XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
- XCB_EVENT_MASK_PROPERTY_CHANGE |
- reply_attr->your_event_mask;
+ XCB_EVENT_MASK_KEY_PRESS |
+ XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW |
+ XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_RESIZE_REDIRECT |
+ XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
+ XCB_EVENT_MASK_PROPERTY_CHANGE |
+ reply_attr->your_event_mask;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK,
&value_list);
free(reply_attr);
cookie_sync = xcb_get_input_focus_unchecked(_ecore_xcb_conn);
- if (reply_sync) free(reply_sync);
+ if (reply_sync)
+ free(reply_sync);
/* FIXME: no error code yet */
/* ecore_xcb_error_handler_set(NULL, NULL); */
if (_ecore_xcb_window_manage_failed)
{
- _ecore_xcb_window_manage_failed = 0;
- return 0;
+ _ecore_xcb_window_manage_failed = 0;
+ return 0;
}
return 1;
-}
-
-
-
-
-
-
-
+} /* ecore_x_window_manage */
EAPI int
ecore_x_pointer_control_set(int accel_num,
int accel_denom,
int threshold)
{
- xcb_change_pointer_control(_ecore_xcb_conn,
+ xcb_change_pointer_control(_ecore_xcb_conn,
accel_num, accel_denom, threshold,
1, 1);
return 1;
-}
+} /* ecore_x_pointer_control_set */
EAPI void
ecore_x_pointer_control_get_prefetch(void)
cookie = xcb_get_pointer_control_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_pointer_control_get_prefetch */
EAPI void
ecore_x_pointer_control_get_fetch(void)
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_pointer_control_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_pointer_control_get_fetch */
EAPI int
ecore_x_pointer_control_get(int *accel_num,
{
xcb_get_pointer_control_reply_t *reply;
- if (accel_num) *accel_num = 0;
- if (accel_denom) *accel_denom = 1;
- if (threshold) *threshold = 0;
+ if (accel_num)
+ *accel_num = 0;
+
+ if (accel_denom)
+ *accel_denom = 1;
+
+ if (threshold)
+ *threshold = 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
- if (accel_num) *accel_num = reply->acceleration_numerator;
- if (accel_denom) *accel_denom = reply->acceleration_denominator;
- if (threshold) *threshold = reply->threshold;
+ if (accel_num)
+ *accel_num = reply->acceleration_numerator;
+
+ if (accel_denom)
+ *accel_denom = reply->acceleration_denominator;
+
+ if (threshold)
+ *threshold = reply->threshold;
return 1;
-}
+} /* ecore_x_pointer_control_get */
EAPI int
ecore_x_pointer_mapping_set(unsigned char *map,
- int nmap)
+ int nmap)
{
xcb_set_pointer_mapping(_ecore_xcb_conn, nmap, map);
return 1;
-}
+} /* ecore_x_pointer_mapping_set */
EAPI void
ecore_x_pointer_mapping_get_prefetch(void)
cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_pointer_mapping_get_prefetch */
EAPI void
ecore_x_pointer_mapping_get_fetch(void)
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_pointer_mapping_get_fetch */
EAPI int
ecore_x_pointer_mapping_get(unsigned char *map,
- int nmap)
+ int nmap)
{
xcb_get_pointer_mapping_cookie_t cookie;
xcb_get_pointer_mapping_reply_t *reply;
- uint8_t *tmp;
- int i;
+ uint8_t *tmp;
+ int i;
cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn);
reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return 0;
+ if (!reply)
+ return 0;
if (nmap > xcb_get_pointer_mapping_map_length(reply))
- return 0;
+ return 0;
tmp = xcb_get_pointer_mapping_map(reply);
for (i = 0; i < nmap; i++)
- map[i] = tmp[i];
+ map[i] = tmp[i];
return 1;
-}
+} /* ecore_x_pointer_mapping_get */
EAPI int
ecore_x_pointer_grab(Ecore_X_Window window)
xcb_grab_pointer_reply_t *reply;
cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, window,
- XCB_EVENT_MASK_BUTTON_PRESS |
+ XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW |
- XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_ENTER_WINDOW |
+ XCB_EVENT_MASK_LEAVE_WINDOW |
XCB_EVENT_MASK_POINTER_MOTION,
XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC,
free(reply);
return 1;
-}
+} /* ecore_x_pointer_grab */
EAPI int
ecore_x_pointer_confine_grab(Ecore_X_Window window)
xcb_grab_pointer_reply_t *reply;
cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, window,
- XCB_EVENT_MASK_BUTTON_PRESS |
+ XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW |
- XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_ENTER_WINDOW |
+ XCB_EVENT_MASK_LEAVE_WINDOW |
XCB_EVENT_MASK_POINTER_MOTION,
XCB_GRAB_MODE_ASYNC,
XCB_GRAB_MODE_ASYNC,
free(reply);
return 1;
-}
+} /* ecore_x_pointer_confine_grab */
EAPI void
ecore_x_pointer_ungrab(void)
{
xcb_ungrab_pointer(_ecore_xcb_conn, XCB_CURRENT_TIME);
-}
+} /* ecore_x_pointer_ungrab */
EAPI int
ecore_x_pointer_warp(Ecore_X_Window window,
int x,
int y)
{
- xcb_warp_pointer(_ecore_xcb_conn, XCB_NONE, window, 0, 0, 0, 0, x, y);
+ xcb_warp_pointer(_ecore_xcb_conn, XCB_NONE, window, 0, 0, 0, 0, x, y);
- return 1;
-}
+ return 1;
+} /* ecore_x_pointer_warp */
EAPI int
ecore_x_keyboard_grab(Ecore_X_Window window)
free(reply);
return 1;
-}
+} /* ecore_x_keyboard_grab */
EAPI void
ecore_x_keyboard_ungrab(void)
{
xcb_ungrab_keyboard(_ecore_xcb_conn, XCB_CURRENT_TIME);
-}
+} /* ecore_x_keyboard_ungrab */
EAPI void
ecore_x_grab(void)
if (_ecore_xcb_grab_count == 1)
xcb_grab_server(_ecore_xcb_conn);
-}
+} /* ecore_x_grab */
EAPI void
ecore_x_ungrab(void)
_ecore_xcb_grab_count = 0;
if (_ecore_xcb_grab_count == 0)
- {
- xcb_ungrab_server(_ecore_xcb_conn);
- free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
- }
-}
+ {
+ xcb_ungrab_server(_ecore_xcb_conn);
+ free(xcb_get_input_focus_reply(_ecore_xcb_conn, xcb_get_input_focus(_ecore_xcb_conn), NULL));
+ }
+} /* ecore_x_ungrab */
-int _ecore_window_grabs_num = 0;
-Ecore_X_Window *_ecore_window_grabs = NULL;
-Eina_Bool (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
-void *_ecore_window_grab_replay_data;
+int _ecore_window_grabs_num = 0;
+Ecore_X_Window *_ecore_window_grabs = NULL;
+Eina_Bool (*_ecore_window_grab_replay_func)(void *data, int event_type, void *event);
+void *_ecore_window_grab_replay_data;
EAPI void
-ecore_x_passive_grab_replay_func_set(Eina_Bool (*func) (void *data,
- int event_type,
- void *event),
- void *data)
+ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data,
+ int event_type,
+ void *event),
+ void *data)
{
_ecore_window_grab_replay_func = func;
_ecore_window_grab_replay_data = data;
-}
+} /* ecore_x_passive_grab_replay_func_set */
EAPI void
ecore_x_window_button_grab(Ecore_X_Window window,
int mod,
int any_mod)
{
- int i;
+ int i;
uint16_t m;
uint16_t locks[8];
uint16_t ev;
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
+ locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
+ locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
ev = event_mask;
for (i = 0; i < 8; i++)
- xcb_grab_button(_ecore_xcb_conn, 0, window, ev,
- XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC,
- XCB_NONE, XCB_NONE, button, m | locks[i]);
+ xcb_grab_button(_ecore_xcb_conn, 0, window, ev,
+ XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC,
+ XCB_NONE, XCB_NONE, button, m | locks[i]);
_ecore_window_grabs_num++;
_ecore_window_grabs = realloc(_ecore_window_grabs,
- _ecore_window_grabs_num * sizeof(Ecore_X_Window));
+ _ecore_window_grabs_num * sizeof(Ecore_X_Window));
_ecore_window_grabs[_ecore_window_grabs_num - 1] = window;
-}
+} /* ecore_x_window_button_grab */
void
_ecore_x_sync_magic_send(int val,
xcb_send_event(_ecore_xcb_conn, 0, _ecore_xcb_private_window,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
-}
+} /* _ecore_x_sync_magic_send */
void
_ecore_x_window_grab_remove(Ecore_X_Window window)
if (_ecore_window_grabs_num > 0)
{
- for (i = 0; i < _ecore_window_grabs_num; i++)
- {
- if (shuffle) _ecore_window_grabs[i - 1] = _ecore_window_grabs[i];
- if ((!shuffle) && (_ecore_window_grabs[i] == window))
- shuffle = 1;
- }
- if (shuffle)
- {
- _ecore_window_grabs_num--;
- _ecore_window_grabs = realloc(_ecore_window_grabs,
- _ecore_window_grabs_num * sizeof(Ecore_X_Window));
- }
+ for (i = 0; i < _ecore_window_grabs_num; i++)
+ {
+ if (shuffle)
+ _ecore_window_grabs[i - 1] = _ecore_window_grabs[i];
+
+ if ((!shuffle) && (_ecore_window_grabs[i] == window))
+ shuffle = 1;
+ }
+ if (shuffle)
+ {
+ _ecore_window_grabs_num--;
+ _ecore_window_grabs = realloc(_ecore_window_grabs,
+ _ecore_window_grabs_num * sizeof(Ecore_X_Window));
+ }
}
-}
+} /* _ecore_x_window_grab_remove */
EAPI void
ecore_x_window_button_ungrab(Ecore_X_Window window,
int mod,
int any_mod)
{
- int i;
+ int i;
uint16_t m;
uint16_t locks[8];
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
+ locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
+ locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
for (i = 0; i < 8; i++)
- xcb_ungrab_button(_ecore_xcb_conn, button, window, m | locks[i]);
+ xcb_ungrab_button(_ecore_xcb_conn, button, window, m | locks[i]);
_ecore_x_sync_magic_send(1, window);
-}
+} /* ecore_x_window_button_ungrab */
-int _ecore_key_grabs_num = 0;
-Ecore_X_Window *_ecore_key_grabs = NULL;
+int _ecore_key_grabs_num = 0;
+Ecore_X_Window *_ecore_key_grabs = NULL;
EAPI void
ecore_x_window_key_grab(Ecore_X_Window window,
int any_mod)
{
xcb_keycode_t keycode = 0;
- uint16_t m;
- uint16_t locks[8];
- int i;
+ uint16_t m;
+ uint16_t locks[8];
+ int i;
if (!strncmp(key, "Keycode-", 8))
- keycode = atoi(key + 8);
+ keycode = atoi(key + 8);
+
/* FIXME: TODO... */
/* else */
/* if (keysym == NoSymbol) return; */
/* keycode = XKeysymToKeycode(_ecore_xcb_conn, XStringToKeysym(key)); */
/* } */
- if (keycode == 0) return;
+ if (keycode == 0)
+ return;
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
+ locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
+ locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
for (i = 0; i < 8; i++)
- xcb_grab_key(_ecore_xcb_conn, 1, window, m | locks[i], keycode,
- XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC);
+ xcb_grab_key(_ecore_xcb_conn, 1, window, m | locks[i], keycode,
+ XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC);
_ecore_key_grabs_num++;
_ecore_key_grabs = realloc(_ecore_key_grabs,
- _ecore_key_grabs_num * sizeof(Ecore_X_Window));
+ _ecore_key_grabs_num * sizeof(Ecore_X_Window));
_ecore_key_grabs[_ecore_key_grabs_num - 1] = window;
-}
+} /* ecore_x_window_key_grab */
void
_ecore_x_key_grab_remove(Ecore_X_Window window)
if (_ecore_key_grabs_num > 0)
{
- for (i = 0; i < _ecore_key_grabs_num; i++)
- {
- if (shuffle) _ecore_key_grabs[i - 1] = _ecore_key_grabs[i];
- if ((!shuffle) && (_ecore_key_grabs[i] == window))
- shuffle = 1;
- }
- if (shuffle)
- {
- _ecore_key_grabs_num--;
- _ecore_key_grabs = realloc(_ecore_key_grabs,
- _ecore_key_grabs_num * sizeof(Ecore_X_Window));
- }
+ for (i = 0; i < _ecore_key_grabs_num; i++)
+ {
+ if (shuffle)
+ _ecore_key_grabs[i - 1] = _ecore_key_grabs[i];
+
+ if ((!shuffle) && (_ecore_key_grabs[i] == window))
+ shuffle = 1;
+ }
+ if (shuffle)
+ {
+ _ecore_key_grabs_num--;
+ _ecore_key_grabs = realloc(_ecore_key_grabs,
+ _ecore_key_grabs_num * sizeof(Ecore_X_Window));
+ }
}
-}
+} /* _ecore_x_key_grab_remove */
EAPI void
ecore_x_window_key_ungrab(Ecore_X_Window window,
int any_mod)
{
xcb_keycode_t keycode = 0;
- uint16_t m;
- uint16_t locks[8];
- int i;
+ uint16_t m;
+ uint16_t locks[8];
+ int i;
if (!strncmp(key, "Keycode-", 8))
- keycode = atoi(key + 8);
+ keycode = atoi(key + 8);
+
/* FIXME: todo... */
/* else */
/* if (keysym == NoSymbol) return; */
/* keycode = XKeysymToKeycode(_ecore_xcb_conn, XStringToKeysym(key)); */
/* } */
- if (keycode == 0) return;
+ if (keycode == 0)
+ return;
m = _ecore_xcb_event_modifier(mod);
- if (any_mod) m = XCB_BUTTON_MASK_ANY;
+ if (any_mod)
+ m = XCB_BUTTON_MASK_ANY;
+
locks[0] = 0;
locks[1] = ECORE_X_LOCK_CAPS;
locks[2] = ECORE_X_LOCK_NUM;
locks[3] = ECORE_X_LOCK_SCROLL;
- locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
- locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
- locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
- locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM;
+ locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL;
+ locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
+ locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
for (i = 0; i < 8; i++)
- xcb_ungrab_key(_ecore_xcb_conn, keycode, window, m | locks[i]);
+ xcb_ungrab_key(_ecore_xcb_conn, keycode, window, m | locks[i]);
_ecore_x_sync_magic_send(2, window);
-}
+} /* ecore_x_window_key_ungrab */
/**
* Send client message with given type and format 32.
long d3,
long d4)
{
- xcb_client_message_event_t ev;
+ xcb_client_message_event_t ev;
- ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
- ev.format = 32;
- ev.window = window;
- ev.type = type;
- ev.data.data32[0] = d0;
- ev.data.data32[1] = d1;
- ev.data.data32[2] = d2;
- ev.data.data32[3] = d3;
- ev.data.data32[4] = d4;
+ ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
+ ev.format = 32;
+ ev.window = window;
+ ev.type = type;
+ ev.data.data32[0] = d0;
+ ev.data.data32[1] = d1;
+ ev.data.data32[2] = d2;
+ ev.data.data32[3] = d3;
+ ev.data.data32[4] = d4;
- xcb_send_event(_ecore_xcb_conn, 0, window, mask, (const char *)&ev);
+ xcb_send_event(_ecore_xcb_conn, 0, window, mask, (const char *)&ev);
- return 1;
-}
+ return 1;
+} /* ecore_x_client_message32_send */
/**
* Send client message with given type and format 8.
ev.type = type;
if (len > 20)
len = 20;
+
memcpy(ev.data.data8, data, len);
memset(ev.data.data8 + len, 0, 20 - len);
xcb_send_event(_ecore_xcb_conn, 0, window, XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
return 1;
-}
+} /* ecore_x_client_message8_send */
/* FIXME: round trip */
EAPI int
int x,
int y)
{
- xcb_motion_notify_event_t ev;
- xcb_get_geometry_cookie_t cookie_geom;
+ xcb_motion_notify_event_t ev;
+ xcb_get_geometry_cookie_t cookie_geom;
xcb_translate_coordinates_cookie_t cookie_trans;
- xcb_get_geometry_reply_t *reply_geom;
+ xcb_get_geometry_reply_t *reply_geom;
xcb_translate_coordinates_reply_t *reply_trans;
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (!reply_geom) return 0;
+ if (!reply_geom)
+ return 0;
cookie_trans = xcb_translate_coordinates_unchecked(_ecore_xcb_conn, window, reply_geom->root, x, y);
reply_trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie_trans, NULL);
free(reply_trans);
return 1;
-}
+} /* ecore_x_mouse_move_send */
/* FIXME: round trip */
EAPI int
ecore_x_mouse_down_send(Ecore_X_Window window,
int x,
int y,
- int button)
+ int button)
{
- xcb_button_press_event_t ev;
- xcb_get_geometry_cookie_t cookie_geom;
+ xcb_button_press_event_t ev;
+ xcb_get_geometry_cookie_t cookie_geom;
xcb_translate_coordinates_cookie_t cookie_trans;
- xcb_get_geometry_reply_t *reply_geom;
+ xcb_get_geometry_reply_t *reply_geom;
xcb_translate_coordinates_reply_t *reply_trans;
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (!reply_geom) return 0;
+ if (!reply_geom)
+ return 0;
cookie_trans = xcb_translate_coordinates_unchecked(_ecore_xcb_conn, window, reply_geom->root, x, y);
reply_trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie_trans, NULL);
free(reply_trans);
return 1;
-}
+} /* ecore_x_mouse_down_send */
/* FIXME: round trip */
EAPI int
int y,
int button)
{
- xcb_button_release_event_t ev;
- xcb_get_geometry_cookie_t cookie_geom;
+ xcb_button_release_event_t ev;
+ xcb_get_geometry_cookie_t cookie_geom;
xcb_translate_coordinates_cookie_t cookie_trans;
- xcb_get_geometry_reply_t *reply_geom;
+ xcb_get_geometry_reply_t *reply_geom;
xcb_translate_coordinates_reply_t *reply_trans;
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (!reply_geom) return 0;
+ if (!reply_geom)
+ return 0;
cookie_trans = xcb_translate_coordinates_unchecked(_ecore_xcb_conn, window, reply_geom->root, x, y);
reply_trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie_trans, NULL);
free(reply_trans);
return 1;
-}
+} /* ecore_x_mouse_up_send */
EAPI void
ecore_x_focus_reset(void)
(uint8_t)XCB_INPUT_FOCUS_POINTER_ROOT,
XCB_INPUT_FOCUS_POINTER_ROOT,
XCB_CURRENT_TIME);
-}
+} /* ecore_x_focus_reset */
EAPI void
ecore_x_events_allow_all(void)
{
xcb_allow_events(_ecore_xcb_conn, XCB_ALLOW_ASYNC_BOTH, XCB_CURRENT_TIME);
-}
+} /* ecore_x_events_allow_all */
EAPI void
ecore_x_pointer_last_xy_get(int *x,
int *y)
{
- if (x) *x = _ecore_xcb_event_last_root_x;
- if (y) *y = _ecore_xcb_event_last_root_y;
-}
+ if (x)
+ *x = _ecore_xcb_event_last_root_x;
+ if (y)
+ *y = _ecore_xcb_event_last_root_y;
+} /* ecore_x_pointer_last_xy_get */
/*****************************************************************************/
/*****************************************************************************/
{
int xmodifiers = 0;
- if (state & ECORE_EVENT_MODIFIER_SHIFT) xmodifiers |= ECORE_X_MODIFIER_SHIFT;
- if (state & ECORE_EVENT_MODIFIER_CTRL) xmodifiers |= ECORE_X_MODIFIER_CTRL;
- if (state & ECORE_EVENT_MODIFIER_ALT) xmodifiers |= ECORE_X_MODIFIER_ALT;
- if (state & ECORE_EVENT_MODIFIER_WIN) xmodifiers |= ECORE_X_MODIFIER_WIN;
- if (state & ECORE_EVENT_LOCK_SCROLL) xmodifiers |= ECORE_X_LOCK_SCROLL;
- if (state & ECORE_EVENT_LOCK_NUM) xmodifiers |= ECORE_X_LOCK_NUM;
- if (state & ECORE_EVENT_LOCK_CAPS) xmodifiers |= ECORE_X_LOCK_CAPS;
+ if (state & ECORE_EVENT_MODIFIER_SHIFT)
+ xmodifiers |= ECORE_X_MODIFIER_SHIFT;
+
+ if (state & ECORE_EVENT_MODIFIER_CTRL)
+ xmodifiers |= ECORE_X_MODIFIER_CTRL;
+
+ if (state & ECORE_EVENT_MODIFIER_ALT)
+ xmodifiers |= ECORE_X_MODIFIER_ALT;
+
+ if (state & ECORE_EVENT_MODIFIER_WIN)
+ xmodifiers |= ECORE_X_MODIFIER_WIN;
+
+ if (state & ECORE_EVENT_LOCK_SCROLL)
+ xmodifiers |= ECORE_X_LOCK_SCROLL;
+
+ if (state & ECORE_EVENT_LOCK_NUM)
+ xmodifiers |= ECORE_X_LOCK_NUM;
+
+ if (state & ECORE_EVENT_LOCK_CAPS)
+ xmodifiers |= ECORE_X_LOCK_CAPS;
return xmodifiers;
-}
+} /* _ecore_xcb_event_modifier */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Atom_Group XCB Atom Functions
*
_ecore_xcb_atom_init_finalize. The first one gets the cookies and
the second one gets the replies and set the atoms. */
-#define FETCH_ATOM(s) \
- atom_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0, strlen(s), s); \
+#define FETCH_ATOM(s)\
+ atom_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0, strlen(s), s);\
i++
-#define FETCH_ATOM_FINALIZE(x) \
- reply = xcb_intern_atom_reply(_ecore_xcb_conn, atom_cookies[i], NULL); \
- x = reply->atom; \
- free(reply); \
+#define FETCH_ATOM_FINALIZE(x)\
+ reply = xcb_intern_atom_reply(_ecore_xcb_conn, atom_cookies[i], NULL);\
+ x = reply->atom;\
+ free(reply);\
i++;
void
FETCH_ATOM("_ECORE_SELECTION_CLIPBOARD");
/* These atoms are already internally defined */
- ECORE_X_ATOM_SELECTION_PRIMARY = 1;
+ ECORE_X_ATOM_SELECTION_PRIMARY = 1;
ECORE_X_ATOM_SELECTION_SECONDARY = 2;
- ECORE_X_ATOM_ATOM = 4;
- ECORE_X_ATOM_CARDINAL = 6;
- ECORE_X_ATOM_STRING = 31;
- ECORE_X_ATOM_WINDOW = 33;
- ECORE_X_ATOM_WM_NAME = 39;
- ECORE_X_ATOM_WM_ICON_NAME = 37;
- ECORE_X_ATOM_WM_NORMAL_HINTS = 40;
- ECORE_X_ATOM_WM_SIZE_HINTS = 41;
- ECORE_X_ATOM_WM_HINTS = 35;
- ECORE_X_ATOM_WM_CLASS = 67;
- ECORE_X_ATOM_WM_TRANSIENT_FOR = 68;
- ECORE_X_ATOM_WM_COMMAND = 34;
- ECORE_X_ATOM_WM_CLIENT_MACHINE = 36;
- ECORE_X_ATOM_WM_ICON_SIZE = 38;
+ ECORE_X_ATOM_ATOM = 4;
+ ECORE_X_ATOM_CARDINAL = 6;
+ ECORE_X_ATOM_STRING = 31;
+ ECORE_X_ATOM_WINDOW = 33;
+ ECORE_X_ATOM_WM_NAME = 39;
+ ECORE_X_ATOM_WM_ICON_NAME = 37;
+ ECORE_X_ATOM_WM_NORMAL_HINTS = 40;
+ ECORE_X_ATOM_WM_SIZE_HINTS = 41;
+ ECORE_X_ATOM_WM_HINTS = 35;
+ ECORE_X_ATOM_WM_CLASS = 67;
+ ECORE_X_ATOM_WM_TRANSIENT_FOR = 68;
+ ECORE_X_ATOM_WM_COMMAND = 34;
+ ECORE_X_ATOM_WM_CLIENT_MACHINE = 36;
+ ECORE_X_ATOM_WM_ICON_SIZE = 38;
/* Initialize the globally defined xdnd atoms */
- ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY;
- ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE;
- ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
- ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
- ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
-}
+ ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY;
+ ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE;
+ ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
+ ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
+ ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
+} /* _ecore_x_atom_init */
void
_ecore_x_atom_init_finalize(xcb_intern_atom_cookie_t *atom_cookies)
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_PRIMARY);
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_SECONDARY);
FETCH_ATOM_FINALIZE(ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD);
-}
-
+} /* _ecore_x_atom_init_finalize */
/**
* Sends the InternAtom request.
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(name), name);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_atom_get_prefetch */
/**
* Gets the reply of the InternAtom request sent by ecore_x_atom_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_atom_get_fetch */
/**
* Retrieves the atom value associated to a name.
xcb_intern_atom_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return XCB_NONE;
+ if (!reply)
+ return XCB_NONE;
return reply->atom;
-}
-
+} /* ecore_x_atom_get */
/**
* Sends the GetAtomName request.
cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, atom);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_get_atom_name_prefetch */
/**
* Gets the reply of the GetAtomName request sent by ecore_x_get_atom_name_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_get_atom_name_fetch */
/**
* Retrieves the name of the given atom.
ecore_x_atom_name_get(Ecore_X_Atom atom)
{
xcb_get_atom_name_reply_t *reply;
- char *name;
- int length;
+ char *name;
+ int length;
reply = _ecore_xcb_reply_get();
- if (!reply) return NULL;
+ if (!reply)
+ return NULL;
length = xcb_get_atom_name_name_length(reply);
name = (char *)malloc(sizeof(char) * (length + 1));
- if (!name) return NULL;
+ if (!name)
+ return NULL;
memcpy(name, xcb_get_atom_name_name(reply), length);
name[length] = '\0';
return name;
-}
+} /* ecore_x_atom_name_get */
+
static xcb_composite_query_version_cookie_t _ecore_xcb_composite_init_cookie;
#endif /* ECORE_XCB_COMPOSITE */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_composite_init and
_ecore_xcb_composite_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_COMPOSITE
if (reply && reply->present)
_ecore_xcb_composite_init_cookie = xcb_composite_query_version_unchecked(_ecore_xcb_conn, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
+
#endif /* ECORE_XCB_COMPOSITE */
-}
+} /* _ecore_x_composite_init */
void
_ecore_x_composite_init_finalize(void)
xcb_composite_query_version_reply_t *reply;
reply = xcb_composite_query_version_reply(_ecore_xcb_conn,
- _ecore_xcb_composite_init_cookie,
- NULL);
+ _ecore_xcb_composite_init_cookie,
+ NULL);
if (reply)
{
if ((reply->major_version == XCB_COMPOSITE_MAJOR_VERSION) &&
- (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION))
- _composite_available = 1;
+ (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION))
+ _composite_available = 1;
+
free(reply);
}
+
#endif /* ECORE_XCB_COMPOSITE */
-}
+} /* _ecore_x_composite_init_finalize */
/**
* Return whether the Composite Extension is available.
{
#ifdef ECORE_XCB_COMPOSITE
return _composite_available;
-#else
+#else /* ifdef ECORE_XCB_COMPOSITE */
return 0;
#endif /* ECORE_XCB_COMPOSITE */
-}
+} /* ecore_x_composite_query */
+
#include <xcb/shm.h>
#include <xcb/xcb_image.h>
-
extern int _ecore_xcb_xcursor;
-
EAPI int
ecore_x_cursor_color_supported_get(void)
{
return _ecore_xcb_xcursor;
-}
+} /* ecore_x_cursor_color_supported_get */
EAPI Ecore_X_Cursor
ecore_x_cursor_new(Ecore_X_Window window,
#ifdef ECORE_XCB_CURSOR
if (_ecore_x_xcursor)
{
- Cursor c;
- XcursorImage *xci;
-
- xci = XcursorImageCreate(w, h);
- if (xci)
- {
- int i;
-
- xci->xhot = hot_x;
- xci->yhot = hot_y;
- xci->delay = 0;
- for (i = 0; i < (w * h); i++)
- {
+ Cursor c;
+ XcursorImage *xci;
+
+ xci = XcursorImageCreate(w, h);
+ if (xci)
+ {
+ int i;
+
+ xci->xhot = hot_x;
+ xci->yhot = hot_y;
+ xci->delay = 0;
+ for (i = 0; i < (w * h); i++)
+ {
// int r, g, b, a;
//
// a = (pixels[i] >> 24) & 0xff;
// r = (((pixels[i] >> 16) & 0xff) * a) / 0xff;
// g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff;
// b = (((pixels[i] ) & 0xff) * a) / 0xff;
- xci->pixels[i] = pixels[i];
+ xci->pixels[i] = pixels[i];
// (a << 24) | (r << 16) | (g << 8) | (b);
- }
- c = XcursorImageLoadCursor(_ecore_x_disp, xci);
- XcursorImageDestroy(xci);
- return c;
- }
+ }
+ c = XcursorImageLoadCursor(_ecore_x_disp, xci);
+ XcursorImageDestroy(xci);
+ return c;
+ }
}
else
#endif /* ECORE_XCB_CURSOR */
- {
- const uint32_t dither[2][2] =
- {
- {0, 2},
- {3, 1}
- };
- Ecore_X_Drawable draw;
- Ecore_X_Pixmap pixmap;
- Ecore_X_Pixmap mask;
- Ecore_X_GC gc;
- xcb_image_t *image;
- uint32_t *pix;
- uint8_t fr;
- uint8_t fg;
- uint8_t fb;
- uint8_t br;
- uint8_t bg;
- uint8_t bb;
- uint32_t brightest = 0;
- uint32_t darkest = 255 * 3;
- uint16_t x;
- uint16_t y;
-
- draw = window;
- pixmap = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_pixmap(_ecore_xcb_conn,
- 1, pixmap, draw,
- 1, 1);
- mask = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_pixmap(_ecore_xcb_conn,
- 1, mask, draw,
- 1, 1);
-
- image = xcb_image_create_native(_ecore_xcb_conn, w, h,
- XCB_IMAGE_FORMAT_Z_PIXMAP,
- 32, NULL, ~0, NULL);
- image->data = malloc(image->size);
-
- fr = 0x00; fg = 0x00; fb = 0x00;
- br = 0xff; bg = 0xff; bb = 0xff;
- pix = (uint32_t *)pixels;
- for (y = 0; y < h; y++)
- {
- for (x = 0; x < w; x++)
- {
- uint8_t r, g, b, a;
-
- a = (pix[0] >> 24) & 0xff;
- r = (pix[0] >> 16) & 0xff;
- g = (pix[0] >> 8 ) & 0xff;
- b = (pix[0] ) & 0xff;
- if (a > 0)
- {
- if ((uint32_t)(r + g + b) > brightest)
- {
- brightest = r + g + b;
- br = r;
- bg = g;
- bb = b;
- }
- if ((uint32_t)(r + g + b) < darkest)
- {
- darkest = r + g + b;
- fr = r;
- fg = g;
- fb = b;
- }
- }
- pix++;
- }
- }
-
- pix = (uint32_t *)pixels;
- for (y = 0; y < h; y++)
- {
- for (x = 0; x < w; x++)
- {
- uint32_t v;
- uint8_t r, g, b;
- int32_t d1, d2;
-
- r = (pix[0] >> 16) & 0xff;
- g = (pix[0] >> 8 ) & 0xff;
- b = (pix[0] ) & 0xff;
- d1 =
- ((r - fr) * (r - fr)) +
- ((g - fg) * (g - fg)) +
- ((b - fb) * (b - fb));
- d2 =
- ((r - br) * (r - br)) +
- ((g - bg) * (g - bg)) +
- ((b - bb) * (b - bb));
- if (d1 + d2)
- {
- v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
- if (v > dither[x & 0x1][y & 0x1]) v = 1;
- else v = 0;
- }
- else
- {
- v = 0;
- }
- xcb_image_put_pixel(image, x, y, v);
- pix++;
- }
- }
- draw = pixmap;
- gc = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_gc(_ecore_xcb_conn, gc, draw, 0, NULL);
- xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
- xcb_free_gc(_ecore_xcb_conn, gc);
-
- pix = (uint32_t *)pixels;
- for (y = 0; y < h; y++)
- {
- for (x = 0; x < w; x++)
- {
- uint32_t v;
-
- v = (((pix[0] >> 24) & 0xff) * 5) / 256;
- if (v > dither[x & 0x1][y & 0x1]) v = 1;
- else v = 0;
- xcb_image_put_pixel(image, x, y, v);
- pix++;
- }
- }
- draw = mask;
- gc = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_gc (_ecore_xcb_conn, gc, draw, 0, NULL);
- xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
- xcb_free_gc(_ecore_xcb_conn, gc);
-
- free(image->data);
- image->data = NULL;
- xcb_image_destroy(image);
-
- cursor = xcb_generate_id(_ecore_xcb_conn);
- xcb_create_cursor (_ecore_xcb_conn, cursor,
- pixmap, mask,
- fr << 8 | fr,
- fg << 8 | fg,
- fb << 8 | fb,
- br << 8 | br,
- bg << 8 | bg,
- bb << 8 | bb,
- hot_x,
- hot_y);
- xcb_free_pixmap(_ecore_xcb_conn, pixmap);
- xcb_free_pixmap(_ecore_xcb_conn, mask);
-
- return cursor;
- }
+ {
+ const uint32_t dither[2][2] =
+ {
+ {0, 2},
+ {3, 1}
+ };
+ Ecore_X_Drawable draw;
+ Ecore_X_Pixmap pixmap;
+ Ecore_X_Pixmap mask;
+ Ecore_X_GC gc;
+ xcb_image_t *image;
+ uint32_t *pix;
+ uint8_t fr;
+ uint8_t fg;
+ uint8_t fb;
+ uint8_t br;
+ uint8_t bg;
+ uint8_t bb;
+ uint32_t brightest = 0;
+ uint32_t darkest = 255 * 3;
+ uint16_t x;
+ uint16_t y;
+
+ draw = window;
+ pixmap = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_pixmap(_ecore_xcb_conn,
+ 1, pixmap, draw,
+ 1, 1);
+ mask = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_pixmap(_ecore_xcb_conn,
+ 1, mask, draw,
+ 1, 1);
+
+ image = xcb_image_create_native(_ecore_xcb_conn, w, h,
+ XCB_IMAGE_FORMAT_Z_PIXMAP,
+ 32, NULL, ~0, NULL);
+ image->data = malloc(image->size);
+
+ fr = 0x00; fg = 0x00; fb = 0x00;
+ br = 0xff; bg = 0xff; bb = 0xff;
+ pix = (uint32_t *)pixels;
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ uint8_t r, g, b, a;
+
+ a = (pix[0] >> 24) & 0xff;
+ r = (pix[0] >> 16) & 0xff;
+ g = (pix[0] >> 8) & 0xff;
+ b = (pix[0]) & 0xff;
+ if (a > 0)
+ {
+ if ((uint32_t)(r + g + b) > brightest)
+ {
+ brightest = r + g + b;
+ br = r;
+ bg = g;
+ bb = b;
+ }
+
+ if ((uint32_t)(r + g + b) < darkest)
+ {
+ darkest = r + g + b;
+ fr = r;
+ fg = g;
+ fb = b;
+ }
+ }
+
+ pix++;
+ }
+ }
+
+ pix = (uint32_t *)pixels;
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ uint32_t v;
+ uint8_t r, g, b;
+ int32_t d1, d2;
+
+ r = (pix[0] >> 16) & 0xff;
+ g = (pix[0] >> 8) & 0xff;
+ b = (pix[0]) & 0xff;
+ d1 =
+ ((r - fr) * (r - fr)) +
+ ((g - fg) * (g - fg)) +
+ ((b - fb) * (b - fb));
+ d2 =
+ ((r - br) * (r - br)) +
+ ((g - bg) * (g - bg)) +
+ ((b - bb) * (b - bb));
+ if (d1 + d2)
+ {
+ v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
+ if (v > dither[x & 0x1][y & 0x1])
+ v = 1;
+ else
+ v = 0;
+ }
+ else
+ {
+ v = 0;
+ }
+
+ xcb_image_put_pixel(image, x, y, v);
+ pix++;
+ }
+ }
+ draw = pixmap;
+ gc = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_gc(_ecore_xcb_conn, gc, draw, 0, NULL);
+ xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
+ xcb_free_gc(_ecore_xcb_conn, gc);
+
+ pix = (uint32_t *)pixels;
+ for (y = 0; y < h; y++)
+ {
+ for (x = 0; x < w; x++)
+ {
+ uint32_t v;
+
+ v = (((pix[0] >> 24) & 0xff) * 5) / 256;
+ if (v > dither[x & 0x1][y & 0x1])
+ v = 1;
+ else
+ v = 0;
+
+ xcb_image_put_pixel(image, x, y, v);
+ pix++;
+ }
+ }
+ draw = mask;
+ gc = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_gc (_ecore_xcb_conn, gc, draw, 0, NULL);
+ xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0);
+ xcb_free_gc(_ecore_xcb_conn, gc);
+
+ free(image->data);
+ image->data = NULL;
+ xcb_image_destroy(image);
+
+ cursor = xcb_generate_id(_ecore_xcb_conn);
+ xcb_create_cursor (_ecore_xcb_conn, cursor,
+ pixmap, mask,
+ fr << 8 | fr,
+ fg << 8 | fg,
+ fb << 8 | fb,
+ br << 8 | br,
+ bg << 8 | bg,
+ bb << 8 | bb,
+ hot_x,
+ hot_y);
+ xcb_free_pixmap(_ecore_xcb_conn, pixmap);
+ xcb_free_pixmap(_ecore_xcb_conn, mask);
+
+ return cursor;
+ }
+
return 0;
-}
+} /* ecore_x_cursor_new */
EAPI void
ecore_x_cursor_free(Ecore_X_Cursor cursor)
{
xcb_free_cursor(_ecore_xcb_conn, cursor);
-}
+} /* ecore_x_cursor_free */
/*
* Returns the cursor for the given shape.
ecore_x_cursor_shape_get(int shape)
{
Ecore_X_Cursor cursor;
- xcb_font_t font;
+ xcb_font_t font;
/* Shapes are defined in Ecore_X_Cursor.h */
font = xcb_generate_id(_ecore_xcb_conn);
xcb_close_font(_ecore_xcb_conn, font);
return cursor;
-}
+} /* ecore_x_cursor_shape_get */
EAPI void
ecore_x_cursor_size_set(int size)
{
#ifdef ECORE_XCB_CURSOR
XcursorSetDefaultSize(_ecore_x_disp, size);
-#else
+#else /* ifdef ECORE_XCB_CURSOR */
size = 0;
#endif /* ECORE_XCB_CURSOR */
-}
+} /* ecore_x_cursor_size_set */
EAPI int
ecore_x_cursor_size_get(void)
{
#ifdef ECORE_XCB_CURSOR
return XcursorGetDefaultSize(_ecore_x_disp);
-#else
+#else /* ifdef ECORE_XCB_CURSOR */
return 0;
#endif /* ECORE_XCB_CURSOR */
-}
+} /* ecore_x_cursor_size_get */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Damage_Group X Damage Extension Functions
*
* Functions related to the X Damage extension.
*/
-
#ifdef ECORE_XCB_DAMAGE
static uint8_t _damage_available = 0;
static xcb_damage_query_version_cookie_t _ecore_xcb_damage_init_cookie;
#endif /* ECORE_XCB_DAMAGE */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_damage_init and
_ecore_xcb_damage_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_DAMAGE
if (reply && (reply->present))
_ecore_xcb_damage_init_cookie = xcb_damage_query_version_unchecked(_ecore_xcb_conn, 1, 1);
+
#endif /* ECORE_XCB_DAMAGE */
-}
+} /* _ecore_x_damage_init */
void
_ecore_x_damage_init_finalize(void)
if (reply)
{
if (reply->major_version >= 1)
- _damage_available = 1;
+ _damage_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_DAMAGE */
-}
+#endif /* ECORE_XCB_DAMAGE */
+} /* _ecore_x_damage_init_finalize */
/**
* Return whether the Damage Extension is available.
{
#ifdef ECORE_XCB_DAMAGE
return _damage_available;
-#else
+#else /* ifdef ECORE_XCB_DAMAGE */
return 0;
#endif /* ECORE_XCB_DAMAGE */
-}
-
+} /* ecore_x_damage_query */
/**
* Creates a damage object.
#endif /* ECORE_XCB_DAMAGE */
return damage;
-}
-
+} /* ecore_x_damage_new */
/**
* Destroys a damage object.
#ifdef ECORE_XCB_DAMAGE
xcb_damage_destroy(_ecore_xcb_conn, damage);
#endif /* ECORE_XCB_DAMAGE */
-}
-
+} /* ecore_x_damage_free */
/**
* Synchronously modifies the region.
#ifdef ECORE_XCB_DAMAGE
xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts);
#endif /* ECORE_XCB_DAMAGE */
-}
+} /* ecore_x_damage_subtract */
+
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
-EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
+EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
EAPI int ECORE_X_EVENT_XDND_POSITION = 0;
-EAPI int ECORE_X_EVENT_XDND_STATUS = 0;
-EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
-EAPI int ECORE_X_EVENT_XDND_DROP = 0;
+EAPI int ECORE_X_EVENT_XDND_STATUS = 0;
+EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
+EAPI int ECORE_X_EVENT_XDND_DROP = 0;
EAPI int ECORE_X_EVENT_XDND_FINISHED = 0;
static Ecore_X_DND_Source *_source = NULL;
static Ecore_X_DND_Target *_target = NULL;
static int _ecore_x_dnd_init_count = 0;
-
void
_ecore_x_dnd_init(void)
{
if (!_ecore_x_dnd_init_count)
{
-
- _source = calloc(1, sizeof(Ecore_X_DND_Source));
- _source->version = ECORE_X_DND_VERSION;
- _source->win = XCB_NONE;
- _source->dest = XCB_NONE;
- _source->state = ECORE_X_DND_SOURCE_IDLE;
- _source->prev.window = 0;
-
- _target = calloc(1, sizeof(Ecore_X_DND_Target));
- _target->win = XCB_NONE;
- _target->source = XCB_NONE;
- _target->state = ECORE_X_DND_TARGET_IDLE;
-
- ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
- ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
- ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
- ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
- ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
- ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
+ _source = calloc(1, sizeof(Ecore_X_DND_Source));
+ _source->version = ECORE_X_DND_VERSION;
+ _source->win = XCB_NONE;
+ _source->dest = XCB_NONE;
+ _source->state = ECORE_X_DND_SOURCE_IDLE;
+ _source->prev.window = 0;
+
+ _target = calloc(1, sizeof(Ecore_X_DND_Target));
+ _target->win = XCB_NONE;
+ _target->source = XCB_NONE;
+ _target->state = ECORE_X_DND_TARGET_IDLE;
+
+ ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
+ ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
}
_ecore_x_dnd_init_count++;
-}
+} /* _ecore_x_dnd_init */
void
_ecore_x_dnd_shutdown(void)
{
_ecore_x_dnd_init_count--;
if (_ecore_x_dnd_init_count > 0)
- return;
+ return;
if (_source)
- free(_source);
+ free(_source);
+
_source = NULL;
if (_target)
- free(_target);
+ free(_target);
+
_target = NULL;
_ecore_x_dnd_init_count = 0;
-}
+} /* _ecore_x_dnd_shutdown */
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window window,
Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
if (on)
- ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_AWARE,
- ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
+ ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_AWARE,
+ ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
else
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_AWARE);
-}
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_AWARE);
+} /* ecore_x_dnd_aware_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_dnd_version_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_version_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_dnd_version_get_fetch */
/**
* Get the DnD version.
EAPI int
ecore_x_dnd_version_get(Ecore_X_Window window)
{
- unsigned char *prop_data;
- int num;
+ unsigned char *prop_data;
+ int num;
if (ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM, 32, &prop_data, &num))
{
- int version = (int) *prop_data;
- free(prop_data);
- return version;
+ int version = (int)*prop_data;
+ free(prop_data);
+ return version;
}
else
- return 0;
-}
+ return 0;
+} /* ecore_x_dnd_version_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_dnd_type_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_type_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_dnd_type_get_fetch */
/* FIXME: round trip (InternAtomGet request) */
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
- Ecore_X_Atom *atoms;
- unsigned char *data;
- int num;
- int i;
- uint8_t ret = 0;
+ Ecore_X_Atom *atoms;
+ unsigned char *data;
+ int num;
+ int i;
+ uint8_t ret = 0;
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(type), type);
if (!ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_TYPE_LIST,
- ECORE_X_ATOM_ATOM, 32, &data, &num))
+ ECORE_X_ATOM_ATOM, 32, &data, &num))
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return ret;
}
free(data);
return 0;
}
+
atoms = (Ecore_X_Atom *)data;
for (i = 0; i < num; ++i)
{
- if (reply->atom == atoms[i])
- {
- ret = 1;
- break;
- }
+ if (reply->atom == atoms[i])
+ {
+ ret = 1;
+ break;
+ }
}
free(data);
free(reply);
return ret;
-}
+} /* ecore_x_dnd_type_isset */
/* FIXME: round trip (InternAtomGet request) */
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
- Ecore_X_Atom *oldset = NULL;
- Ecore_X_Atom *newset = NULL;
- unsigned char *data = NULL;
- unsigned char *old_data = NULL;
- Ecore_X_Atom atom;
- int i, j = 0, num = 0;
+ Ecore_X_Atom *oldset = NULL;
+ Ecore_X_Atom *newset = NULL;
+ unsigned char *data = NULL;
+ unsigned char *old_data = NULL;
+ Ecore_X_Atom atom;
+ int i, j = 0, num = 0;
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(type), type);
32, &old_data, &num))
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return;
}
+
oldset = (Ecore_X_Atom *)old_data;
if (on)
{
- if (ecore_x_dnd_type_isset(window, type))
- {
- free(old_data);
+ if (ecore_x_dnd_type_isset(window, type))
+ {
+ free(old_data);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
- return;
- }
- data = calloc(num + 1, sizeof(Ecore_X_Atom));
- if (!data)
+ if (reply)
+ free(reply);
+
+ return;
+ }
+
+ data = calloc(num + 1, sizeof(Ecore_X_Atom));
+ if (!data)
{
- free(old_data);
+ free(old_data);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return;
}
- newset = (Ecore_X_Atom *)data;
- for (i = 0; i < num; i++)
- newset[i + 1] = oldset[i];
- /* prepend the new type */
+ newset = (Ecore_X_Atom *)data;
+
+ for (i = 0; i < num; i++)
+ newset[i + 1] = oldset[i];
+ /* prepend the new type */
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
{
- free(old_data);
- return;
+ free(old_data);
+ return;
}
- newset[0] = reply->atom;
+
+ newset[0] = reply->atom;
free(reply);
- ecore_x_window_prop_property_set(window,
+ ecore_x_window_prop_property_set(window,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, data, num + 1);
}
else
{
- if (!ecore_x_dnd_type_isset(window, type))
- {
- free(old_data);
- return;
- }
- newset = calloc(num - 1, sizeof(Ecore_X_Atom));
- if (!newset)
- {
- free(old_data);
- return;
- }
- data = (unsigned char *)newset;
- for (i = 0; i < num; i++)
- if (oldset[i] != atom)
- newset[j++] = oldset[i];
-
- ecore_x_window_prop_property_set(window,
+ if (!ecore_x_dnd_type_isset(window, type))
+ {
+ free(old_data);
+ return;
+ }
+
+ newset = calloc(num - 1, sizeof(Ecore_X_Atom));
+ if (!newset)
+ {
+ free(old_data);
+ return;
+ }
+
+ data = (unsigned char *)newset;
+ for (i = 0; i < num; i++)
+ if (oldset[i] != atom)
+ newset[j++] = oldset[i];
+
+ ecore_x_window_prop_property_set(window,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, data, num - 1);
free(oldset);
free(newset);
-}
+} /* ecore_x_dnd_type_set */
/* FIXME: round trips, but I don't think we can do much, here */
unsigned int num_types)
{
Ecore_X_Atom *newset = NULL;
- void *data = NULL;
- uint32_t i;
+ void *data = NULL;
+ uint32_t i;
if (!num_types)
{
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_TYPE_LIST);
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_TYPE_LIST);
}
else
{
xcb_intern_atom_cookie_t *cookies;
- xcb_intern_atom_reply_t *reply;
+ xcb_intern_atom_reply_t *reply;
cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t));
- if (!cookies) return;
- for (i = 0; i < num_types; i++)
- cookies[i] = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
- strlen(types[i]), types[i]);
+ if (!cookies)
+ return;
+
+ for (i = 0; i < num_types; i++)
+ cookies[i] = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
+ strlen(types[i]), types[i]);
data = calloc(num_types, sizeof(Ecore_X_Atom));
- if (!data)
+ if (!data)
{
- for (i = 0; i < num_types; i++)
- {
- reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
- if (reply) free(reply);
- }
- free(cookies);
- return;
+ for (i = 0; i < num_types; i++)
+ {
+ reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
+ if (reply)
+ free(reply);
+ }
+ free(cookies);
+ return;
}
- newset = data;
- for (i = 0; i < num_types; i++)
+
+ newset = data;
+ for (i = 0; i < num_types; i++)
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply)
free(reply);
}
else
- newset[i] = XCB_NONE;
+ newset[i] = XCB_NONE;
}
free(cookies);
- ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_TYPE_LIST,
+ ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, data, num_types);
- free(data);
+ free(data);
}
-}
+} /* ecore_x_dnd_types_set */
Ecore_X_DND_Source *
_ecore_x_dnd_source_get(void)
{
return _source;
-}
+} /* _ecore_x_dnd_source_get */
Ecore_X_DND_Target *
_ecore_x_dnd_target_get(void)
{
return _target;
-}
+} /* _ecore_x_dnd_target_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_dnd_begin_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_begin_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_dnd_begin_fetch */
/* FIXME: round trip */
ecore_x_selection_xdnd_prefetch();
ecore_x_selection_xdnd_fetch();
if (!ecore_x_selection_xdnd_set(source, data, size))
- return 0;
+ return 0;
_source->win = source;
ecore_x_window_ignore_set(_source->win, 1);
_source->action = ECORE_X_ATOM_XDND_ACTION_COPY;
_source->accepted_action = XCB_NONE;
return 1;
-}
+} /* ecore_x_dnd_begin */
EAPI int
ecore_x_dnd_drop(void)
{
xcb_client_message_event_t ev;
- ev.response_type = XCB_CLIENT_MESSAGE;
- ev.format = 32;
- ev.window = _source->dest;
-
- if (_source->will_accept)
- {
- ev.type = ECORE_X_ATOM_XDND_DROP;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
- ev.data.data32[2] = _source->time;
- xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
- _source->state = ECORE_X_DND_SOURCE_DROPPED;
- status = 1;
- }
- else
- {
- ev.type = ECORE_X_ATOM_XDND_LEAVE;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
- xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
- _source->state = ECORE_X_DND_SOURCE_IDLE;
- }
+ ev.response_type = XCB_CLIENT_MESSAGE;
+ ev.format = 32;
+ ev.window = _source->dest;
+
+ if (_source->will_accept)
+ {
+ ev.type = ECORE_X_ATOM_XDND_DROP;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
+ ev.data.data32[2] = _source->time;
+ xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
+ _source->state = ECORE_X_DND_SOURCE_DROPPED;
+ status = 1;
+ }
+ else
+ {
+ ev.type = ECORE_X_ATOM_XDND_LEAVE;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
+ xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
+ _source->state = ECORE_X_DND_SOURCE_IDLE;
+ }
}
else
{
- /* Dropping on nothing */
- ecore_x_selection_xdnd_clear();
- _source->state = ECORE_X_DND_SOURCE_IDLE;
+ /* Dropping on nothing */
+ ecore_x_selection_xdnd_clear();
+ _source->state = ECORE_X_DND_SOURCE_IDLE;
}
+
ecore_x_window_ignore_set(_source->win, 0);
_source->prev.window = 0;
_source->dest = XCB_NONE;
return status;
-}
+} /* ecore_x_dnd_drop */
EAPI void
ecore_x_dnd_send_status(int will_accept,
xcb_client_message_event_t ev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
- return;
+ return;
_target->will_accept = will_accept;
ev.data.data32[0] = _target->win;
ev.data.data32[1] = 0;
if (will_accept)
- ev.data.data32[1] |= 0x1UL;
+ ev.data.data32[1] |= 0x1UL;
+
if (!suppress)
- ev.data.data32[1] |= 0x2UL;
+ ev.data.data32[1] |= 0x2UL;
/* Set rectangle information */
ev.data.data32[2] = rectangle.x;
if (will_accept)
{
- ev.data.data32[4] = action;
- _target->accepted_action = action;
+ ev.data.data32[4] = action;
+ _target->accepted_action = action;
}
else
{
- ev.data.data32[4] = XCB_NONE;
- _target->accepted_action = action;
+ ev.data.data32[4] = XCB_NONE;
+ _target->accepted_action = action;
}
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
-}
+} /* ecore_x_dnd_send_status */
EAPI void
ecore_x_dnd_send_finished(void)
xcb_client_message_event_t ev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
- return;
+ return;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
ev.data.data32[2] = 0;
if (_target->will_accept)
{
- ev.data.data32[1] |= 0x1UL;
- ev.data.data32[2] = _target->accepted_action;
+ ev.data.data32[1] |= 0x1UL;
+ ev.data.data32[2] = _target->accepted_action;
}
+
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
_target->state = ECORE_X_DND_TARGET_IDLE;
-}
+} /* ecore_x_dnd_send_finished */
void
ecore_x_dnd_source_action_set(Ecore_X_Atom action)
{
_source->action = action;
if (_source->prev.window)
- _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
-}
+ _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y);
+} /* ecore_x_dnd_source_action_set */
Ecore_X_Atom
ecore_x_dnd_source_action_get(void)
{
return _source->action;
-}
+} /* ecore_x_dnd_source_action_get */
void
_ecore_x_dnd_drag(Ecore_X_Window root,
- int x,
- int y)
+ int x,
+ int y)
{
xcb_client_message_event_t ev;
- Ecore_X_Window win;
- Ecore_X_Window *skip;
- int num;
+ Ecore_X_Window win;
+ Ecore_X_Window *skip;
+ int num;
if (_source->state != ECORE_X_DND_SOURCE_DRAGGING)
- return;
+ return;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
if (ecore_x_dnd_version_get(win))
{
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
break;
}
+
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
if (reply_tree)
{
- win = reply_tree->parent;
- free(reply_tree);
+ win = reply_tree->parent;
+ free(reply_tree);
}
}
/* Send XdndLeave to current destination window if we have left it */
if ((_source->dest) && (win != _source->dest))
{
- ev.window = _source->dest;
- ev.type = ECORE_X_ATOM_XDND_LEAVE;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
+ ev.window = _source->dest;
+ ev.type = ECORE_X_ATOM_XDND_LEAVE;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
- xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
- _source->suppress = 0;
+ xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
+ _source->suppress = 0;
}
if (win)
{
- int16_t x1;
- int16_t x2;
- int16_t y1;
- int16_t y2;
+ int16_t x1;
+ int16_t x2;
+ int16_t y1;
+ int16_t y2;
ecore_x_dnd_version_get_prefetch(win);
ecore_x_dnd_type_get_prefetch(_source->win);
ecore_x_dnd_version_get_fetch();
if (!ecore_x_dnd_version_get(win))
{
- ecore_x_dnd_type_get_fetch();
- return;
+ ecore_x_dnd_type_get_fetch();
+ return;
}
- _source->version = MIN(ECORE_X_DND_VERSION,
+ _source->version = MIN(ECORE_X_DND_VERSION,
ecore_x_dnd_version_get(win));
- if (win != _source->dest)
- {
- unsigned char *data;
- Ecore_X_Atom *types;
- int num;
- int i;
+ if (win != _source->dest)
+ {
+ unsigned char *data;
+ Ecore_X_Atom *types;
+ int num;
+ int i;
ecore_x_dnd_type_get_fetch();
if (!ecore_x_window_prop_property_get(_source->win,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, &data, &num))
- return;
-
- types = (Ecore_X_Atom *)data;
-
- /* Entered new window, send XdndEnter */
- ev.window = win;
- ev.type = ECORE_X_ATOM_XDND_ENTER;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0;
- if (num > 3)
- ev.data.data32[1] |= 0x1UL;
- else
- ev.data.data32[1] &= 0xfffffffeUL;
- ev.data.data32[1] |= ((unsigned long) _source->version) << 24;
-
- for (i = 2; i < 5; i++)
- ev.data.data32[i] = 0;
- for (i = 0; i < MIN(num, 3); ++i)
- ev.data.data32[i + 2] = types[i];
- free(data);
- xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
- _source->await_status = 0;
- _source->will_accept = 0;
- }
+ return;
+
+ types = (Ecore_X_Atom *)data;
+
+ /* Entered new window, send XdndEnter */
+ ev.window = win;
+ ev.type = ECORE_X_ATOM_XDND_ENTER;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0;
+ if (num > 3)
+ ev.data.data32[1] |= 0x1UL;
+ else
+ ev.data.data32[1] &= 0xfffffffeUL;
+
+ ev.data.data32[1] |= ((unsigned long)_source->version) << 24;
+
+ for (i = 2; i < 5; i++)
+ ev.data.data32[i] = 0;
+ for (i = 0; i < MIN(num, 3); ++i)
+ ev.data.data32[i + 2] = types[i];
+ free(data);
+ xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
+ _source->await_status = 0;
+ _source->will_accept = 0;
+ }
else
- ecore_x_dnd_type_get_fetch();
-
- /* Determine if we're still in the rectangle from the last status */
- x1 = _source->rectangle.x;
- x2 = _source->rectangle.x + _source->rectangle.width;
- y1 = _source->rectangle.y;
- y2 = _source->rectangle.y + _source->rectangle.height;
-
- if ((!_source->await_status) ||
- (!_source->suppress) ||
- ((x < x1) || (x > x2) || (y < y1) || (y > y2)))
- {
- ev.window = win;
- ev.type = ECORE_X_ATOM_XDND_POSITION;
- ev.data.data32[0] = _source->win;
- ev.data.data32[1] = 0; /* Reserved */
- ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
- ev.data.data32[3] = _source->time; /* Version 1 */
- ev.data.data32[4] = _source->action; /* Version 2, Needs to be pre-set */
- xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
-
- _source->await_status = 1;
- }
+ ecore_x_dnd_type_get_fetch();
+
+ /* Determine if we're still in the rectangle from the last status */
+ x1 = _source->rectangle.x;
+ x2 = _source->rectangle.x + _source->rectangle.width;
+ y1 = _source->rectangle.y;
+ y2 = _source->rectangle.y + _source->rectangle.height;
+
+ if ((!_source->await_status) ||
+ (!_source->suppress) ||
+ ((x < x1) || (x > x2) || (y < y1) || (y > y2)))
+ {
+ ev.window = win;
+ ev.type = ECORE_X_ATOM_XDND_POSITION;
+ ev.data.data32[0] = _source->win;
+ ev.data.data32[1] = 0; /* Reserved */
+ ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
+ ev.data.data32[3] = _source->time; /* Version 1 */
+ ev.data.data32[4] = _source->action; /* Version 2, Needs to be pre-set */
+ xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
+
+ _source->await_status = 1;
+ }
}
_source->prev.x = x;
_source->prev.y = y;
_source->prev.window = root;
_source->dest = win;
-}
+} /* _ecore_x_dnd_drag */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
*
* Functions related to the X DPMS extension.
*/
-
#ifdef ECORE_XCB_DPMS
static int _dpms_available = 0;
static xcb_dpms_get_version_cookie_t _ecore_xcb_dpms_init_cookie;
#ifdef ECORE_XCB_DPMS
if (reply && (reply->present))
_ecore_xcb_dpms_init_cookie = xcb_dpms_get_version_unchecked(_ecore_xcb_conn, 0, 0);
+
#endif /* ECORE_XCB_DPMS */
-}
+} /* _ecore_x_dpms_init */
void
_ecore_x_dpms_init_finalize(void)
if (reply)
{
if (reply->server_major_version >= 1)
- _dpms_available = 1;
+ _dpms_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_DPMS */
-}
+#endif /* ECORE_XCB_DPMS */
+} /* _ecore_x_dpms_init_finalize */
/**
* Checks if the DPMS extension is available or not.
{
#ifdef ECORE_XCB_DPMS
return _dpms_available;
-#else
+#else /* ifdef ECORE_XCB_DPMS */
return 0;
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_query */
/**
* Sends the DPMSCapable request.
cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_capable_get_prefetch */
/**
* Gets the reply of the DPMSCapable request sent by ecore_x_dpms_capable_get_prefetch().
reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_capable_get_fetch */
/**
* Checks if the X server is capable of DPMS.
EAPI int
ecore_x_dpms_capable_get(void)
{
- int capable = 0;
+ int capable = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_capable_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
capable = reply->capable;
#endif /* ECORE_XCB_DPMS */
return capable;
-}
-
+} /* ecore_x_dpms_capable_get */
/**
* Sends the DPMSInfo request.
cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_enable_get_prefetch */
/**
* Gets the reply of the DPMSInfo request sent by ecore_x_dpms_enable_get_prefetch().
reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_enable_get_fetch */
/**
* Checks the DPMS state of the display.
EAPI int
ecore_x_dpms_enable_get(void)
{
- int enable = 0;
+ int enable = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
enable = reply->state;
#endif /* ECORE_XCB_DPMS */
return enable;
-}
-
+} /* ecore_x_dpms_enable_get */
/**
* Sets the DPMS state of the display.
xcb_dpms_enable(_ecore_xcb_conn);
else
xcb_dpms_disable(_ecore_xcb_conn);
-#endif /* ECORE_XCB_DPMS */
-}
+#endif /* ECORE_XCB_DPMS */
+} /* ecore_x_dpms_enabled_set */
/**
* Sets the timeouts. The values are in unit of seconds.
#endif /* ECORE_XCB_DPMS */
return 1;
-}
-
+} /* ecore_x_dpms_timeouts_set */
/**
* Sends the DPMSGetTimeouts request.
cookie = xcb_dpms_get_timeouts_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeouts_get_prefetch */
/**
* Gets the reply of the DPMSGetTimeouts request sent by ecore_x_dpms_timeouts_get_prefetch().
reply = xcb_dpms_get_timeouts_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeouts_get_fetch */
/**
* Gets the timeouts. The values are in unit of seconds.
reply = _ecore_xcb_reply_get();
if (reply)
{
- if (standby) *standby = reply->standby_timeout;
- if (suspend) *suspend = reply->suspend_timeout;
- if (off) *off = 0;
+ if (standby)
+ *standby = reply->standby_timeout;
+
+ if (suspend)
+ *suspend = reply->suspend_timeout;
+
+ if (off)
+ *off = 0;
}
else
#endif /* ECORE_XCB_DPMS */
- {
- if (standby) *standby = 0;
- if (suspend) *suspend = 0;
- if (off) *off = 0;
- }
-}
+ {
+ if (standby)
+ *standby = 0;
+ if (suspend)
+ *suspend = 0;
+
+ if (off)
+ *off = 0;
+ }
+} /* ecore_x_dpms_timeouts_get */
/**
* Returns the amount of time of inactivity before standby mode is invoked.
EAPI unsigned int
ecore_x_dpms_timeout_standby_get(void)
{
- int standby = 0;
+ int standby = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
standby = reply->standby_timeout;
#endif /* ECORE_XCB_DPMS */
return standby;
-}
-
+} /* ecore_x_dpms_timeout_standby_get */
/**
* Returns the amount of time of inactivity before the second level of
EAPI unsigned int
ecore_x_dpms_timeout_suspend_get(void)
{
- int suspend = 0;;
+ int suspend = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
suspend = reply->suspend_timeout;
#endif /* ECORE_XCB_DPMS */
return suspend;
-}
-
+} /* ecore_x_dpms_timeout_suspend_get */
/**
* Returns the amount of time of inactivity before the third and final
EAPI unsigned int
ecore_x_dpms_timeout_off_get(void)
{
- int off = 0;
+ int off = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
off = reply->off_timeout;
#endif /* ECORE_XCB_DPMS */
return off;
-}
-
+} /* ecore_x_dpms_timeout_off_get */
/**
* Sets the standby timeout (in unit of seconds).
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
new_standby,
reply->suspend_timeout,
reply->off_timeout);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeout_standby_set */
/**
* Sets the suspend timeout (in unit of seconds).
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
reply->standby_timeout,
new_suspend,
reply->off_timeout);
#endif /* ECORE_XCB_DPMS */
-}
-
+} /* ecore_x_dpms_timeout_suspend_set */
/**
* Sets the off timeout (in unit of seconds).
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
reply->standby_timeout,
reply->suspend_timeout,
new_off);
#endif /* ECORE_XCB_DPMS */
-}
+} /* ecore_x_dpms_timeout_off_set */
+
#include "ecore_xcb_private.h"
#include <xcb/xcb.h>
-
/**
* @defgroup Ecore_X_Drawable_Group X Drawable Functions
*
* Functions that operate on drawables.
*/
-
/**
* Sends the GetGeometry request.
* @param drawable Drawable whose characteristics are sought.
cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, drawable);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_drawable_geometry_get_prefetch */
/**
* Gets the reply of the GetGeometry request sent by ecore_x_atom_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_drawable_geometry_get_fetch */
/**
* Retrieves the geometry of the given drawable.
*/
EAPI void
ecore_x_drawable_geometry_get(Ecore_X_Drawable drawable __UNUSED__,
- int *x,
- int *y,
- int *width,
- int *height)
+ int *x,
+ int *y,
+ int *width,
+ int *height)
{
xcb_get_geometry_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (x) *x = 0;
- if (y) *y = 0;
- if (width) *width = 0;
- if (height) *height = 0;
+ if (x)
+ *x = 0;
+
+ if (y)
+ *y = 0;
+
+ if (width)
+ *width = 0;
+
+ if (height)
+ *height = 0;
+
return;
}
- if (x) *x = reply->x;
- if (y) *y = reply->y;
- if (width) *width = reply->width;
- if (height) *height = reply->height;
-}
+ if (x)
+ *x = reply->x;
+
+ if (y)
+ *y = reply->y;
+ if (width)
+ *width = reply->width;
+
+ if (height)
+ *height = reply->height;
+} /* ecore_x_drawable_geometry_get */
/**
* Retrieves the width of the border of the given drawable.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->border_width;
-}
-
+} /* ecore_x_drawable_border_width_get */
/**
* Retrieves the depth of the given drawable.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->depth;
-}
+} /* ecore_x_drawable_depth_get */
/**
* Fill the specified rectangle on a drawable.
rectangle.width = width;
rectangle.height = height;
xcb_poly_fill_rectangle(_ecore_xcb_conn, d, gc, 1, &rectangle);
-}
+} /* ecore_x_drawable_rectangle_fill */
+
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
EAPI void
ecore_x_e_frame_size_set(Ecore_X_Window window,
int fl,
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_E_FRAME_SIZE, ECORE_X_ATOM_CARDINAL, 32,
4, (const void *)frames);
-}
+} /* ecore_x_e_frame_size_set */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <stdio.h>
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/** OpenBSD does not define CODESET
* FIXME ??
*/
#ifndef CODESET
#define CODESET "INVALID"
-#endif
+#endif /* ifndef CODESET */
#if 0
-static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev);
-static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
-#endif
+static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_title_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev);
+static void _ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev);
+#endif /* if 0 */
static Ecore_X_Window _ecore_xcb_mouse_down_last_window = 0;
static Ecore_X_Window _ecore_xcb_mouse_down_last_last_window = 0;
static Ecore_X_Window _ecore_xcb_mouse_down_last_event_window = 0;
static Ecore_X_Window _ecore_xcb_mouse_down_last_last_event_window = 0;
-static Ecore_X_Time _ecore_xcb_mouse_down_last_time = 0;
-static Ecore_X_Time _ecore_xcb_mouse_down_last_last_time = 0;
-static int _ecore_xcb_mouse_up_count = 0;
-static int _ecore_xcb_mouse_down_did_triple = 0;
-static int _ecore_xcb_last_event_mouse_move = 0;
-static Ecore_Event *_ecore_xcb_last_event_mouse_move_event = NULL;
+static Ecore_X_Time _ecore_xcb_mouse_down_last_time = 0;
+static Ecore_X_Time _ecore_xcb_mouse_down_last_last_time = 0;
+static int _ecore_xcb_mouse_up_count = 0;
+static int _ecore_xcb_mouse_down_did_triple = 0;
+static int _ecore_xcb_last_event_mouse_move = 0;
+static Ecore_Event *_ecore_xcb_last_event_mouse_move_event = NULL;
static void
_ecore_x_event_free_mouse_move(void *data __UNUSED__, void *ev)
e = ev;
if (_ecore_xcb_last_event_mouse_move)
{
- _ecore_xcb_last_event_mouse_move_event = NULL;
- _ecore_xcb_last_event_mouse_move = 0;
+ _ecore_xcb_last_event_mouse_move_event = NULL;
+ _ecore_xcb_last_event_mouse_move = 0;
}
- free(e);
-}
+ free(e);
+} /* _ecore_x_event_free_mouse_move */
/* FIXME: roundtrip */
EAPI void
{
xcb_get_window_attributes_cookie_t cookie;
xcb_get_window_attributes_reply_t *reply;
- uint32_t value_list;
+ uint32_t value_list;
if (!window)
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return;
+ if (!reply)
+ return;
value_list = mask | reply->your_event_mask;
xcb_change_window_attributes(_ecore_xcb_conn, window, XCB_CW_EVENT_MASK, &value_list);
free(reply);
-}
+} /* ecore_x_event_mask_set */
/* FIXME: roundtrip */
EAPI void
cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
- if (!reply) return;
+ if (!reply)
+ return;
value_list = reply->your_event_mask & ~mask;
xcb_change_window_attributes(_ecore_xcb_conn, window, XCB_CW_EVENT_MASK, &value_list);
free(reply);
-}
+} /* ecore_x_event_mask_unset */
#if 0
static void
Ecore_X_Event_Window_Prop_Name_Class_Change *e;
e = ev;
- if (e->name) free(e->name);
- if (e->clas) free(e->clas);
+ if (e->name)
+ free(e->name);
+
+ if (e->clas)
+ free(e->clas);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_name_class_change */
static void
_ecore_x_event_free_window_prop_title_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Title_Change *e;
e = ev;
- if (e->title) free(e->title);
+ if (e->title)
+ free(e->title);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_title_change */
static void
_ecore_x_event_free_window_prop_visible_title_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
e = ev;
- if (e->title) free(e->title);
+ if (e->title)
+ free(e->title);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_visible_title_change */
static void
_ecore_x_event_free_window_prop_icon_name_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_icon_name_change */
static void
_ecore_x_event_free_window_prop_visible_icon_name_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
+} /* _ecore_x_event_free_window_prop_visible_icon_name_change */
static void
_ecore_x_event_free_window_prop_client_machine_change(void *data, void *ev)
Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
e = ev;
- if (e->name) free(e->name);
+ if (e->name)
+ free(e->name);
+
free(e);
-}
-#endif
+} /* _ecore_x_event_free_window_prop_client_machine_change */
+
+#endif /* if 0 */
static void
_ecore_x_event_free_xdnd_enter(void *data __UNUSED__, void *ev)
{
Ecore_X_Event_Xdnd_Enter *e;
- int i;
+ int i;
e = ev;
for (i = 0; i < e->num_types; i++)
- free(e->types[i]);
+ free(e->types[i]);
free(e->types);
free(e);
-}
+} /* _ecore_x_event_free_xdnd_enter */
static void
_ecore_x_event_free_selection_notify(void *data __UNUSED__, void *ev)
{
Ecore_X_Event_Selection_Notify *e;
- Ecore_X_Selection_Data *sel;
+ Ecore_X_Selection_Data *sel;
e = ev;
sel = e->data;
if (sel->free)
- sel->free(sel);
+ sel->free(sel);
+
free(e->target);
free(e);
-}
+} /* _ecore_x_event_free_selection_notify */
static unsigned int
_ecore_x_event_modifiers(unsigned int state)
{
- unsigned int modifiers = 0;
+ unsigned int modifiers = 0;
- if (state & ECORE_X_MODIFIER_SHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
- if (state & ECORE_X_MODIFIER_CTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL;
- if (state & ECORE_X_MODIFIER_ALT) modifiers |= ECORE_EVENT_MODIFIER_ALT;
- if (state & ECORE_X_MODIFIER_WIN) modifiers |= ECORE_EVENT_MODIFIER_WIN;
- if (state & ECORE_X_LOCK_SCROLL) modifiers |= ECORE_EVENT_LOCK_SCROLL;
- if (state & ECORE_X_LOCK_NUM) modifiers |= ECORE_EVENT_LOCK_NUM;
- if (state & ECORE_X_LOCK_CAPS) modifiers |= ECORE_EVENT_LOCK_CAPS;
+ if (state & ECORE_X_MODIFIER_SHIFT)
+ modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
+
+ if (state & ECORE_X_MODIFIER_CTRL)
+ modifiers |= ECORE_EVENT_MODIFIER_CTRL;
+
+ if (state & ECORE_X_MODIFIER_ALT)
+ modifiers |= ECORE_EVENT_MODIFIER_ALT;
+
+ if (state & ECORE_X_MODIFIER_WIN)
+ modifiers |= ECORE_EVENT_MODIFIER_WIN;
+
+ if (state & ECORE_X_LOCK_SCROLL)
+ modifiers |= ECORE_EVENT_LOCK_SCROLL;
+
+ if (state & ECORE_X_LOCK_NUM)
+ modifiers |= ECORE_EVENT_LOCK_NUM;
+
+ if (state & ECORE_X_LOCK_CAPS)
+ modifiers |= ECORE_EVENT_LOCK_CAPS;
return modifiers;
-}
+} /* _ecore_x_event_modifiers */
static void
_ecore_mouse_move(unsigned int timestamp, unsigned int xmodifiers,
- int x, int y,
- int x_root, int y_root,
- unsigned int event_window,
- unsigned int window,
- unsigned int root_win,
- int same_screen)
+ int x, int y,
+ int x_root, int y_root,
+ unsigned int event_window,
+ unsigned int window,
+ unsigned int root_win,
+ int same_screen)
{
Ecore_Event_Mouse_Move *e;
- Ecore_Event *event;
+ Ecore_Event *event;
e = malloc(sizeof(Ecore_Event_Mouse_Move));
- if (!e) return ;
+ if (!e)
+ return;
e->window = window;
e->root_window = root_win;
_ecore_xcb_event_last_root_y = y_root;
_ecore_xcb_last_event_mouse_move_event = event;
-}
+} /* _ecore_mouse_move */
static void
_ecore_key_press(int event,
- xcb_generic_event_t *ev)
+ xcb_generic_event_t *ev)
{
- /*
- Ecore_Event_Key *e;
- const char *compose = NULL;
- char *tmp = NULL;
- char *keyname;
- char *key;
- char keyname_buffer[256];
- char compose_buffer[256];
- KeySym sym;
- XComposeStatus status;
- int val;
-
- _ecore_xcb_last_event_mouse_move = 0;
- keyname = XKeysymToString(XKeycodeToKeysym(xevent->display,
- xevent->keycode, 0));
- if (!keyname)
- {
- snprintf(keyname_buffer, sizeof(keyname_buffer), "Keycode-%i", xevent->keycode);
- keyname = keyname_buffer;
- if (!keyname) return ;
- }
+ /*
+ Ecore_Event_Key *e;
+ const char *compose = NULL;
+ char *tmp = NULL;
+ char *keyname;
+ char *key;
+ char keyname_buffer[256];
+ char compose_buffer[256];
+ KeySym sym;
+ XComposeStatus status;
+ int val;
+
+ _ecore_xcb_last_event_mouse_move = 0;
+ keyname = XKeysymToString(XKeycodeToKeysym(xevent->display,
+ xevent->keycode, 0));
+ if (!keyname)
+ {
+ snprintf(keyname_buffer, sizeof(keyname_buffer), "Keycode-%i", xevent->keycode);
+ keyname = keyname_buffer;
+ if (!keyname) return ;
+ }
- sym = 0;
- key = NULL;
- compose = NULL;
- if (_ecore_x_ic)
- {
- Status mbstatus;
-#ifdef X_HAVE_UTF8_STRING
- val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
-#else
- val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
-#endif
- if (mbstatus == XBufferOverflow)
- {
- tmp = malloc(sizeof (char) * (val + 1));
- if (!tmp) return ;
-
- compose = tmp;
-
-#ifdef X_HAVE_UTF8_STRING
- val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
-#else
- val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
-#endif
- if (val > 0)
- {
- tmp[val] = 0;
-
-#ifndef X_HAVE_UTF8_STRING
- compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
- free(tmp);
- tmp = compose;
-#endif
- }
- else compose = NULL;
- }
- else
- if (val > 0)
- {
- compose_buffer[val] = 0;
-#ifdef X_HAVE_UTF8_STRING
- compose = compose_buffer;
-#else
- compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
- tmp = compose;
-#endif
- }
- }
- else
- {
- val = XLookupString(xevent, compose_buffer, sizeof(compose_buffer), &sym, &status);
- if (val > 0)
- {
- compose_buffer[val] = 0;
- compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
- tmp = compose;
- }
- }
+ sym = 0;
+ key = NULL;
+ compose = NULL;
+ if (_ecore_x_ic)
+ {
+ Status mbstatus;
+ #ifdef X_HAVE_UTF8_STRING
+ val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
+ #else
+ val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, compose_buffer, sizeof(compose_buffer) - 1, &sym, &mbstatus);
+ #endif
+ if (mbstatus == XBufferOverflow)
+ {
+ tmp = malloc(sizeof (char) * (val + 1));
+ if (!tmp) return ;
+
+ compose = tmp;
+
+ #ifdef X_HAVE_UTF8_STRING
+ val = Xutf8LookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
+ #else
+ val = XmbLookupString(_ecore_x_ic, (XKeyEvent *)xevent, tmp, val, &sym, &mbstatus);
+ #endif
+ if (val > 0)
+ {
+ tmp[val] = 0;
+
+ #ifndef X_HAVE_UTF8_STRING
+ compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", tmp);
+ free(tmp);
+ tmp = compose;
+ #endif
+ }
+ else compose = NULL;
+ }
+ else
+ if (val > 0)
+ {
+ compose_buffer[val] = 0;
+ #ifdef X_HAVE_UTF8_STRING
+ compose = compose_buffer;
+ #else
+ compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
+ tmp = compose;
+ #endif
+ }
+ }
+ else
+ {
+ val = XLookupString(xevent, compose_buffer, sizeof(compose_buffer), &sym, &status);
+ if (val > 0)
+ {
+ compose_buffer[val] = 0;
+ compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer);
+ tmp = compose;
+ }
+ }
- key = XKeysymToString(sym);
- if (!key) key = keyname;
- if (!key) goto on_error;
+ key = XKeysymToString(sym);
+ if (!key) key = keyname;
+ if (!key) goto on_error;
- e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
- if (!e) goto on_error;
+ e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
+ if (!e) goto on_error;
- e->keyname = (char*) (e + 1);
- e->key = e->keyname + strlen(keyname) + 1;
- e->compose = (compose) ? e->key + strlen(key) + 1 : NULL;
- e->string = e->compose;
+ e->keyname = (char*) (e + 1);
+ e->key = e->keyname + strlen(keyname) + 1;
+ e->compose = (compose) ? e->key + strlen(key) + 1 : NULL;
+ e->string = e->compose;
- strcpy((char *) e->keyname, keyname);
- strcpy((char *) e->key, key);
- if (compose) strcpy((char *) e->compose, compose);
+ strcpy((char *) e->keyname, keyname);
+ strcpy((char *) e->key, key);
+ if (compose) strcpy((char *) e->compose, compose);
- e->modifiers = _ecore_x_event_modifiers(xevent->state);
+ e->modifiers = _ecore_x_event_modifiers(xevent->state);
- e->timestamp = xevent->time;
- e->window = xevent->subwindow ? xevent->subwindow : xevent->window;
- e->event_window = xevent->window;
- e->same_screen = xevent->same_screen;
- e->root_window = xevent->root;
+ e->timestamp = xevent->time;
+ e->window = xevent->subwindow ? xevent->subwindow : xevent->window;
+ e->event_window = xevent->window;
+ e->same_screen = xevent->same_screen;
+ e->root_window = xevent->root;
- ecore_event_add(event, e, NULL, NULL);
+ ecore_event_add(event, e, NULL, NULL);
- _ecore_xcb_event_last_time = e->timestamp;
+ _ecore_xcb_event_last_time = e->timestamp;
- on_error:
- if (tmp) free(tmp);
- */
-}
+ on_error:
+ if (tmp) free(tmp);
+ */
+} /* _ecore_key_press */
-static Ecore_Event_Mouse_Button*
+static Ecore_Event_Mouse_Button *
_ecore_mouse_button(int event,
- unsigned int timestamp, unsigned int xmodifiers,
- unsigned int buttons,
- int x, int y,
- int x_root, int y_root,
- unsigned int event_window,
- unsigned int window,
- unsigned int root_win,
- int same_screen)
+ unsigned int timestamp, unsigned int xmodifiers,
+ unsigned int buttons,
+ int x, int y,
+ int x_root, int y_root,
+ unsigned int event_window,
+ unsigned int window,
+ unsigned int root_win,
+ int same_screen)
{
Ecore_Event_Mouse_Button *e;
e = malloc(sizeof(Ecore_Event_Mouse_Button));
- if (!e) return NULL;
+ if (!e)
+ return NULL;
e->window = window;
e->root_window = root_win;
if (event_window == window)
{
- if (((int)(timestamp - _ecore_xcb_mouse_down_last_time) <=
- (int)(1000 * _ecore_xcb_double_click_time)) &&
- (window == _ecore_xcb_mouse_down_last_window) &&
- (event_window == _ecore_xcb_mouse_down_last_event_window)
- )
- e->double_click = 1;
- if (((int)(timestamp - _ecore_xcb_mouse_down_last_last_time) <=
- (int)(2 * 1000 * _ecore_xcb_double_click_time)) &&
- (window == _ecore_xcb_mouse_down_last_window) &&
- (window == _ecore_xcb_mouse_down_last_last_window) &&
- (event_window == _ecore_xcb_mouse_down_last_event_window) &&
- (event_window == _ecore_xcb_mouse_down_last_last_event_window)
- )
- {
- e->triple_click = 1;
- _ecore_xcb_mouse_down_did_triple = 1;
- }
- else
- _ecore_xcb_mouse_down_did_triple = 0;
+ if (((int)(timestamp - _ecore_xcb_mouse_down_last_time) <=
+ (int)(1000 * _ecore_xcb_double_click_time)) &&
+ (window == _ecore_xcb_mouse_down_last_window) &&
+ (event_window == _ecore_xcb_mouse_down_last_event_window)
+ )
+ e->double_click = 1;
+
+ if (((int)(timestamp - _ecore_xcb_mouse_down_last_last_time) <=
+ (int)(2 * 1000 * _ecore_xcb_double_click_time)) &&
+ (window == _ecore_xcb_mouse_down_last_window) &&
+ (window == _ecore_xcb_mouse_down_last_last_window) &&
+ (event_window == _ecore_xcb_mouse_down_last_event_window) &&
+ (event_window == _ecore_xcb_mouse_down_last_last_event_window)
+ )
+ {
+ e->triple_click = 1;
+ _ecore_xcb_mouse_down_did_triple = 1;
+ }
+ else
+ _ecore_xcb_mouse_down_did_triple = 0;
}
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN
&& !e->double_click
&& !e->triple_click)
- _ecore_xcb_mouse_up_count = 0;
+ _ecore_xcb_mouse_up_count = 0;
_ecore_xcb_event_last_time = e->timestamp;
_ecore_xcb_event_last_window = e->window;
ecore_event_add(event, e, NULL, NULL);
return e;
-}
+} /* _ecore_mouse_button */
void
_ecore_x_event_handle_any_event(xcb_generic_event_t *event)
{
- xcb_generic_event_t* ev = malloc(sizeof(xcb_generic_event_t));
+ xcb_generic_event_t *ev = malloc(sizeof(xcb_generic_event_t));
memcpy(ev, event, sizeof(xcb_generic_event_t));
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
-}
+} /* _ecore_x_event_handle_any_event */
/* FIXME: handle this event */
void
_ecore_key_press(ECORE_EVENT_KEY_DOWN, event);
free(event);
-}
+} /* _ecore_x_event_handle_key_press */
/* FIXME: handle this event */
void
_ecore_key_press(ECORE_EVENT_KEY_DOWN, event);
free(event);
-}
+} /* _ecore_x_event_handle_key_release */
void
_ecore_x_event_handle_button_press(xcb_generic_event_t *event)
{
xcb_button_press_event_t *ev;
- int i;
+ int i;
ev = (xcb_button_press_event_t *)event;
if ((ev->detail > 3) && (ev->detail < 8))
{
- Ecore_Event_Mouse_Wheel *e;
-
- e = malloc(sizeof(Ecore_Event_Mouse_Wheel));
- if (!e) return;
-
- e->timestamp = ev->time;
- e->modifiers = _ecore_x_event_modifiers(ev->state);
- switch (ev->detail)
- {
- case 4: e->direction = 0; e->z = -1; break;
- case 5: e->direction = 0; e->z = 1; break;
- case 6: e->direction = 1; e->z = -1; break;
- case 7: e->direction = 1; e->z = 1; break;
+ Ecore_Event_Mouse_Wheel *e;
+
+ e = malloc(sizeof(Ecore_Event_Mouse_Wheel));
+ if (!e)
+ return;
+
+ e->timestamp = ev->time;
+ e->modifiers = _ecore_x_event_modifiers(ev->state);
+ switch (ev->detail)
+ {
+ case 4: e->direction = 0; e->z = -1; break;
+
+ case 5: e->direction = 0; e->z = 1; break;
+
+ case 6: e->direction = 1; e->z = -1; break;
+
+ case 7: e->direction = 1; e->z = 1; break;
+
default: e->direction = 0; e->z = 0; break;
- }
-
- e->x = ev->event_x;
- e->y = ev->event_y;
- e->root.x = ev->root_x;
- e->root.y = ev->root_y;
-
- if (ev->child)
- e->window = ev->child;
- else
- e->window = ev->event;
-
- e->event_window = ev->event;
- e->same_screen = ev->same_screen;
- e->root_window = ev->root;
- _ecore_xcb_event_last_time = e->timestamp;
- _ecore_xcb_event_last_window = e->window;
- _ecore_xcb_event_last_root_x = e->root.x;
- _ecore_xcb_event_last_root_y = e->root.y;
- ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
- for (i = 0; i < _ecore_window_grabs_num; i++)
- {
- if ((_ecore_window_grabs[i] == ev->event) ||
- (_ecore_window_grabs[i] == ev->child))
- {
- Eina_Bool replay = EINA_FALSE;
-
- if (_ecore_window_grab_replay_func)
- replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
- ECORE_EVENT_MOUSE_WHEEL,
- e);
+ } /* switch */
+
+ e->x = ev->event_x;
+ e->y = ev->event_y;
+ e->root.x = ev->root_x;
+ e->root.y = ev->root_y;
+
+ if (ev->child)
+ e->window = ev->child;
+ else
+ e->window = ev->event;
+
+ e->event_window = ev->event;
+ e->same_screen = ev->same_screen;
+ e->root_window = ev->root;
+ _ecore_xcb_event_last_time = e->timestamp;
+ _ecore_xcb_event_last_window = e->window;
+ _ecore_xcb_event_last_root_x = e->root.x;
+ _ecore_xcb_event_last_root_y = e->root.y;
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
+ for (i = 0; i < _ecore_window_grabs_num; i++)
+ {
+ if ((_ecore_window_grabs[i] == ev->event) ||
+ (_ecore_window_grabs[i] == ev->child))
+ {
+ Eina_Bool replay = EINA_FALSE;
+
+ if (_ecore_window_grab_replay_func)
+ replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
+ ECORE_EVENT_MOUSE_WHEEL,
+ e);
+
/* FIXME: xcb_key_press_event_t does not save the */
/* connection. So I use the current one */
- if (replay)
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_REPLAY_POINTER,
- ev->time);
- else
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_ASYNC_POINTER,
- ev->time);
- break;
- }
- }
+ if (replay)
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_REPLAY_POINTER,
+ ev->time);
+ else
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_ASYNC_POINTER,
+ ev->time);
+
+ break;
+ }
+ }
}
else
{
{
- _ecore_mouse_move(ev->time, ev->state,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
+ _ecore_mouse_move(ev->time, ev->state,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
}
{
Ecore_Event_Mouse_Button *e;
- Ecore_X_Window event_window;
- Ecore_X_Window child_window;
+ Ecore_X_Window event_window;
+ Ecore_X_Window child_window;
if (_ecore_xcb_mouse_down_did_triple)
{
_ecore_xcb_mouse_down_last_time = 0;
_ecore_xcb_mouse_down_last_last_time = 0;
}
+
event_window = ev->child;
child_window = ev->child ? ev->child : ev->event;
- e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
- ev->time, ev->state,
- ev->detail,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- event_window, child_window,
- ev->root, ev->same_screen);
+ e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ ev->time, ev->state,
+ ev->detail,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ event_window, child_window,
+ ev->root, ev->same_screen);
+
+ if (!e)
+ return;
- if (!e) return;
for (i = 0; i < _ecore_window_grabs_num; i++)
{
if ((_ecore_window_grabs[i] == ev->event) ||
Eina_Bool replay = EINA_FALSE;
if (_ecore_window_grab_replay_func)
- replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
- ECORE_EVENT_MOUSE_BUTTON_DOWN,
- e);
+ replay = _ecore_window_grab_replay_func(_ecore_window_grab_replay_data,
+ ECORE_EVENT_MOUSE_BUTTON_DOWN,
+ e);
+
/* FIXME: xcb_key_press_event_t does not save the */
/* connection. So I use the current one */
if (replay)
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_REPLAY_POINTER,
- ev->time);
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_REPLAY_POINTER,
+ ev->time);
else
- xcb_allow_events(_ecore_xcb_conn,
- XCB_ALLOW_ASYNC_POINTER,
- ev->time);
+ xcb_allow_events(_ecore_xcb_conn,
+ XCB_ALLOW_ASYNC_POINTER,
+ ev->time);
+
break;
}
}
{
_ecore_xcb_mouse_down_last_last_window = _ecore_xcb_mouse_down_last_window;
if (ev->child)
- _ecore_xcb_mouse_down_last_window = ev->child;
+ _ecore_xcb_mouse_down_last_window = ev->child;
else
- _ecore_xcb_mouse_down_last_window = ev->event;
+ _ecore_xcb_mouse_down_last_window = ev->event;
+
_ecore_xcb_mouse_down_last_last_event_window = _ecore_xcb_mouse_down_last_event_window;
_ecore_xcb_mouse_down_last_event_window = ev->event;
_ecore_xcb_mouse_down_last_last_time = _ecore_xcb_mouse_down_last_time;
}
free(event);
-}
+} /* _ecore_x_event_handle_button_press */
void
_ecore_x_event_handle_button_release(xcb_generic_event_t *event)
/* filter out wheel buttons */
if ((ev->detail <= 3) || (ev->detail > 7))
{
- _ecore_mouse_move(ev->time, ev->state,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
-
- _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
- ev->time, ev->state,
- ev->detail,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
+ _ecore_mouse_move(ev->time, ev->state,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
+
+ _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP,
+ ev->time, ev->state,
+ ev->detail,
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
}
free(event);
-}
+} /* _ecore_x_event_handle_button_release */
void
_ecore_x_event_handle_motion_notify(xcb_generic_event_t *event)
}
_ecore_mouse_move(ev->time, ev->state,
- ev->event_x, ev->event_y,
- ev->root_x, ev->root_y,
- ev->event,
- (ev->child ? ev->child : ev->event),
- ev->root,
- ev->same_screen);
+ ev->event_x, ev->event_y,
+ ev->root_x, ev->root_y,
+ ev->event,
+ (ev->child ? ev->child : ev->event),
+ ev->root,
+ ev->same_screen);
_ecore_xcb_last_event_mouse_move = 1;
_ecore_x_dnd_drag(ev->root, ev->root_x, ev->root_y);
free(event);
-}
+} /* _ecore_x_event_handle_motion_notify */
void
_ecore_x_event_handle_enter_notify(xcb_generic_event_t *event)
Ecore_X_Event_Mouse_In *e;
e = calloc(1, sizeof(Ecore_X_Event_Mouse_In));
- if (!e) return;
+ if (!e)
+ return;
+
e->modifiers = _ecore_x_event_modifiers(ev->state);
e->x = ev->event_x;
e->y = ev->event_y;
e->root.x = ev->root_x;
e->root.y = ev->root_y;
- if (ev->child) e->win = ev->child;
- else e->win = ev->event;
+ if (ev->child)
+ e->win = ev->child;
+ else
+ e->win = ev->event;
+
e->same_screen = ev->same_screen_focus;
e->root_win = ev->root;
e->event_win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- default:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ default:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- default:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ default:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+ } /* switch */
e->time = ev->time;
_ecore_xcb_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL);
}
free(event);
-}
+} /* _ecore_x_event_handle_enter_notify */
void
_ecore_x_event_handle_leave_notify(xcb_generic_event_t *event)
Ecore_X_Event_Mouse_Out *e;
e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out));
- if (!e) return;
+ if (!e)
+ return;
+
e->modifiers = _ecore_x_event_modifiers(ev->state);
e->x = ev->event_x;
e->y = ev->event_y;
e->root.x = ev->root_x;
e->root.y = ev->root_y;
- if (ev->child) e->win = ev->child;
- else e->win = ev->event;
+ if (ev->child)
+ e->win = ev->child;
+ else
+ e->win = ev->event;
+
e->same_screen = ev->same_screen_focus;
e->root_win = ev->root;
e->event_win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- default:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ default:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- default:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ default:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+ } /* switch */
e->time = ev->time;
_ecore_xcb_event_last_time = e->time;
_ecore_xcb_event_last_window = e->win;
}
free(event);
-}
+} /* _ecore_x_event_handle_leave_notify */
void
_ecore_x_event_handle_focus_in(xcb_generic_event_t *event)
{
- xcb_focus_in_event_t *ev;
+ xcb_focus_in_event_t *ev;
Ecore_X_Event_Window_Focus_In *e;
ev = (xcb_focus_in_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- case XCB_NOTIFY_MODE_WHILE_GRABBED:
- e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_WHILE_GRABBED:
+ e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_POINTER:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER;
- break;
- case XCB_NOTIFY_DETAIL_POINTER_ROOT:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
- break;
- case XCB_NOTIFY_DETAIL_NONE:
- e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER_ROOT:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONE:
+ e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
+ break;
+ } /* switch */
e->time = _ecore_xcb_event_last_time;
_ecore_xcb_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_focus_in */
void
_ecore_x_event_handle_focus_out(xcb_generic_event_t *event)
{
- xcb_focus_out_event_t *ev;
+ xcb_focus_out_event_t *ev;
Ecore_X_Event_Window_Focus_Out *e;
ev = (xcb_focus_out_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->event;
switch (ev->mode) {
- case XCB_NOTIFY_MODE_NORMAL:
- e->mode = ECORE_X_EVENT_MODE_NORMAL;
- break;
- case XCB_NOTIFY_MODE_GRAB:
- e->mode = ECORE_X_EVENT_MODE_GRAB;
- break;
- case XCB_NOTIFY_MODE_UNGRAB:
- e->mode = ECORE_X_EVENT_MODE_UNGRAB;
- break;
- case XCB_NOTIFY_MODE_WHILE_GRABBED:
- e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
- break;
- }
+ case XCB_NOTIFY_MODE_NORMAL:
+ e->mode = ECORE_X_EVENT_MODE_NORMAL;
+ break;
+
+ case XCB_NOTIFY_MODE_GRAB:
+ e->mode = ECORE_X_EVENT_MODE_GRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_UNGRAB:
+ e->mode = ECORE_X_EVENT_MODE_UNGRAB;
+ break;
+
+ case XCB_NOTIFY_MODE_WHILE_GRABBED:
+ e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED;
+ break;
+ } /* switch */
switch (ev->detail) {
- case XCB_NOTIFY_DETAIL_ANCESTOR:
- e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
- break;
- case XCB_NOTIFY_DETAIL_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_INFERIOR:
- e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
- break;
- case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
- e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
- break;
- case XCB_NOTIFY_DETAIL_POINTER:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER;
- break;
- case XCB_NOTIFY_DETAIL_POINTER_ROOT:
- e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
- break;
- case XCB_NOTIFY_DETAIL_NONE:
- e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
- break;
- }
+ case XCB_NOTIFY_DETAIL_ANCESTOR:
+ e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_INFERIOR:
+ e->detail = ECORE_X_EVENT_DETAIL_INFERIOR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL:
+ e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER;
+ break;
+
+ case XCB_NOTIFY_DETAIL_POINTER_ROOT:
+ e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT;
+ break;
+
+ case XCB_NOTIFY_DETAIL_NONE:
+ e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE;
+ break;
+ } /* switch */
e->time = _ecore_xcb_event_last_time;
_ecore_xcb_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_focus_out */
void
_ecore_x_event_handle_keymap_notify(xcb_generic_event_t *event)
/* FIXME: handle this event type */
free(event);
-}
+} /* _ecore_x_event_handle_keymap_notify */
void
_ecore_x_event_handle_expose(xcb_generic_event_t *event)
{
- xcb_expose_event_t *ev;
+ xcb_expose_event_t *ev;
Ecore_X_Event_Window_Damage *e;
ev = (xcb_expose_event_t *)event,
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
e->x = ev->x;
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_expose */
void
_ecore_x_event_handle_graphics_expose(xcb_generic_event_t *event)
ev = (xcb_graphics_exposure_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Damage));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->drawable;
e->time = _ecore_xcb_event_last_time;
e->x = ev->x;
ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_graphics_expose */
void
_ecore_x_event_handle_visibility_notify(xcb_generic_event_t *event)
ev = (xcb_visibility_notify_event_t *)event;
if (ev->state != XCB_VISIBILITY_PARTIALLY_OBSCURED)
- {
- Ecore_X_Event_Window_Visibility_Change *e;
+ {
+ Ecore_X_Event_Window_Visibility_Change *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
- if (!e) return;
- e->win = ev->window;
- e->time = _ecore_xcb_event_last_time;
- if (ev->state == XCB_VISIBILITY_FULLY_OBSCURED)
- e->fully_obscured = 1;
- else
- e->fully_obscured = 0;
- ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
- }
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ e->time = _ecore_xcb_event_last_time;
+ if (ev->state == XCB_VISIBILITY_FULLY_OBSCURED)
+ e->fully_obscured = 1;
+ else
+ e->fully_obscured = 0;
+
+ ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL);
+ }
free(event);
-}
+} /* _ecore_x_event_handle_visibility_notify */
void
_ecore_x_event_handle_create_notify(xcb_generic_event_t *event)
{
- xcb_create_notify_event_t *ev;
+ xcb_create_notify_event_t *ev;
Ecore_X_Event_Window_Create *e;
ev = (xcb_create_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Create));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
if (ev->override_redirect)
e->override = 1;
else
e->override = 0;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_create_notify */
void
_ecore_x_event_handle_destroy_notify(xcb_generic_event_t *event)
{
- xcb_destroy_notify_event_t *ev;
+ xcb_destroy_notify_event_t *ev;
Ecore_X_Event_Window_Destroy *e;
ev = (xcb_destroy_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy));
- if (!e) return;
- e->win = ev->window;
+ if (!e)
+ return;
+
+ e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
- if (e->win == _ecore_xcb_event_last_window) _ecore_xcb_event_last_window = 0;
+ if (e->win == _ecore_xcb_event_last_window)
+ _ecore_xcb_event_last_window = 0;
+
ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_destroy_notify */
void
_ecore_x_event_handle_unmap_notify(xcb_generic_event_t *event)
{
- xcb_unmap_notify_event_t *ev;
+ xcb_unmap_notify_event_t *ev;
Ecore_X_Event_Window_Hide *e;
ev = (xcb_unmap_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Hide));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_unmap_notify */
void
_ecore_x_event_handle_map_notify(xcb_generic_event_t *event)
{
- xcb_map_notify_event_t *ev;
+ xcb_map_notify_event_t *ev;
Ecore_X_Event_Window_Show *e;
ev = (xcb_map_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Show));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_map_notify */
void
_ecore_x_event_handle_map_request(xcb_generic_event_t *event)
{
- xcb_map_request_event_t *ev;
+ xcb_map_request_event_t *ev;
Ecore_X_Event_Window_Show_Request *e;
ev = (xcb_map_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->parent = ev->parent;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_map_request */
void
_ecore_x_event_handle_reparent_notify(xcb_generic_event_t *event)
{
- xcb_reparent_notify_event_t *ev;
+ xcb_reparent_notify_event_t *ev;
Ecore_X_Event_Window_Reparent *e;
ev = (xcb_reparent_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->parent = ev->parent;
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_reparent_notify */
void
_ecore_x_event_handle_configure_notify(xcb_generic_event_t *event)
{
- xcb_configure_notify_event_t *ev;
+ xcb_configure_notify_event_t *ev;
Ecore_X_Event_Window_Configure *e;
ev = (xcb_configure_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->abovewin = ev->above_sibling;
e->x = ev->x;
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_configure_notify */
void
_ecore_x_event_handle_configure_request(xcb_generic_event_t *event)
{
- xcb_configure_request_event_t *ev;
+ xcb_configure_request_event_t *ev;
Ecore_X_Event_Window_Configure_Request *e;
ev = (xcb_configure_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->abovewin = ev->sibling;
e->x = ev->x;
e->border = ev->border_width;
e->value_mask = ev->value_mask;
switch (ev->stack_mode) {
- case XCB_STACK_MODE_ABOVE:
- e->detail = ECORE_X_WINDOW_STACK_ABOVE;
- break;
- case XCB_STACK_MODE_BELOW:
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
- break;
- case XCB_STACK_MODE_TOP_IF:
- e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
- break;
- case XCB_STACK_MODE_BOTTOM_IF:
- e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
- break;
- case XCB_STACK_MODE_OPPOSITE:
- e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
- break;
- }
+ case XCB_STACK_MODE_ABOVE:
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
+ break;
+
+ case XCB_STACK_MODE_BELOW:
+ e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ break;
+
+ case XCB_STACK_MODE_TOP_IF:
+ e->detail = ECORE_X_WINDOW_STACK_TOP_IF;
+ break;
+
+ case XCB_STACK_MODE_BOTTOM_IF:
+ e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF;
+ break;
+
+ case XCB_STACK_MODE_OPPOSITE:
+ e->detail = ECORE_X_WINDOW_STACK_OPPOSITE;
+ break;
+ } /* switch */
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_configure_request */
void
_ecore_x_event_handle_gravity_notify(xcb_generic_event_t *event)
/* FIXME: handle this event type */
free(event);
-}
+} /* _ecore_x_event_handle_gravity_notify */
void
_ecore_x_event_handle_resize_request(xcb_generic_event_t *event)
{
- xcb_resize_request_event_t *ev;
+ xcb_resize_request_event_t *ev;
Ecore_X_Event_Window_Resize_Request *e;
ev = (xcb_resize_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->w = ev->width;
e->h = ev->height;
ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_resize_request */
void
_ecore_x_event_handle_circulate_notify(xcb_generic_event_t *event)
ev = (xcb_circulate_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->event_win = ev->event;
if (ev->place == XCB_PLACE_ON_TOP)
- e->detail = ECORE_X_WINDOW_STACK_ABOVE;
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
else
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ e->detail = ECORE_X_WINDOW_STACK_BELOW;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_circulate_notify */
void
_ecore_x_event_handle_circulate_request(xcb_generic_event_t *event)
{
- xcb_circulate_request_event_t *ev;
+ xcb_circulate_request_event_t *ev;
Ecore_X_Event_Window_Stack_Request *e;
ev = (xcb_circulate_request_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->parent = ev->event;
if (ev->place == XCB_PLACE_ON_TOP)
- e->detail = ECORE_X_WINDOW_STACK_ABOVE;
+ e->detail = ECORE_X_WINDOW_STACK_ABOVE;
else
- e->detail = ECORE_X_WINDOW_STACK_BELOW;
+ e->detail = ECORE_X_WINDOW_STACK_BELOW;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_circulate_request */
void
_ecore_x_event_handle_property_notify(xcb_generic_event_t *event)
*/
if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLASS)
{
- Ecore_X_Event_Window_Prop_Name_Class_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change));
- if (!e) return;
- ecore_x_window_prop_name_class_get(xevent->xproperty.window,
- &(e->name), &(e->clas));
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, _ecore_x_event_free_window_prop_name_class_change, NULL);
+ Ecore_X_Event_Window_Prop_Name_Class_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Name_Class_Change));
+ if (!e)
+ return;
+
+ ecore_x_window_prop_name_class_get(xevent->xproperty.window,
+ &(e->name), &(e->clas));
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, _ecore_x_event_free_window_prop_name_class_change, NULL);
}
else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_NAME))
{
- Ecore_X_Event_Window_Prop_Title_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change));
- if (!e) return;
- e->title = ecore_x_window_prop_title_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_title_change, NULL);
+ Ecore_X_Event_Window_Prop_Title_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Title_Change));
+ if (!e)
+ return;
+
+ e->title = ecore_x_window_prop_title_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_title_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_NAME)
{
- Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change));
- if (!e) return;
- e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_visible_title_change, NULL);
+ Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Title_Change));
+ if (!e)
+ return;
+
+ e->title = ecore_x_window_prop_visible_title_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_visible_title_change, NULL);
}
else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_ICON_NAME))
{
- Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_icon_name_change, NULL);
+ Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Icon_Name_Change));
+ if (!e)
+ return;
+
+ e->name = ecore_x_window_prop_icon_name_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_icon_name_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME)
{
- Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
+ Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change));
+ if (!e)
+ return;
+
+ e->name = ecore_x_window_prop_visible_icon_name_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
{
- Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
- if (!e) return;
- e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e, _ecore_x_event_free_window_prop_client_machine_change, NULL);
+ Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Client_Machine_Change));
+ if (!e)
+ return;
+
+ e->name = ecore_x_window_prop_client_machine_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e, _ecore_x_event_free_window_prop_client_machine_change, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_PID)
{
- Ecore_X_Event_Window_Prop_Pid_Change *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
- if (!e) return;
- e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
- e->time = xevent->xproperty.time;
- _ecore_x_event_last_time = e->time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
+ Ecore_X_Event_Window_Prop_Pid_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Pid_Change));
+ if (!e)
+ return;
+
+ e->pid = ecore_x_window_prop_pid_get(xevent->xproperty.window);
+ e->time = xevent->xproperty.time;
+ _ecore_x_event_last_time = e->time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
}
else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_DESKTOP)
{
- Ecore_X_Event_Window_Prop_Desktop_Change *e;
+ Ecore_X_Event_Window_Prop_Desktop_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Prop_Desktop_Change));
- if (!e) return;
- e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window);
- ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
+ e->desktop = ecore_x_window_prop_desktop_get(xevent->xproperty.window);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
}
else
-#endif
+#endif /* if 0 */
{
- xcb_property_notify_event_t *ev;
+ xcb_property_notify_event_t *ev;
Ecore_X_Event_Window_Property *e;
ev = (xcb_property_notify_event_t *)event;
e = calloc(1,sizeof(Ecore_X_Event_Window_Property));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->atom = ev->atom;
e->time = ev->time;
}
free(event);
-}
+} /* _ecore_x_event_handle_property_notify */
void
_ecore_x_event_handle_selection_clear(xcb_generic_event_t *event)
{
- xcb_selection_clear_event_t *ev;
- Ecore_X_Selection_Intern *d;
+ xcb_selection_clear_event_t *ev;
+ Ecore_X_Selection_Intern *d;
Ecore_X_Event_Selection_Clear *e;
- Ecore_X_Atom sel;
+ Ecore_X_Atom sel;
ev = (xcb_selection_clear_event_t *)event;
d = _ecore_x_selection_get(ev->selection);
if (d && (ev->time > d->time))
{
- _ecore_x_selection_set(XCB_NONE, NULL, 0,
+ _ecore_x_selection_set(XCB_NONE, NULL, 0,
ev->selection);
}
e->time = ev->time;
e->atom = sel = ev->selection;
if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
- e->selection = ECORE_X_SELECTION_PRIMARY;
+ e->selection = ECORE_X_SELECTION_PRIMARY;
else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
- e->selection = ECORE_X_SELECTION_SECONDARY;
+ e->selection = ECORE_X_SELECTION_SECONDARY;
else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- e->selection = ECORE_X_SELECTION_CLIPBOARD;
+ e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
- e->selection = ECORE_X_SELECTION_OTHER;
+ e->selection = ECORE_X_SELECTION_OTHER;
+
ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_selection_clear */
void
_ecore_x_event_handle_selection_request(xcb_generic_event_t *event)
{
- xcb_selection_request_event_t *ev;
+ xcb_selection_request_event_t *ev;
Ecore_X_Event_Selection_Request *e;
- Ecore_X_Selection_Intern *sd;
- void *data;
- int len;
- int typesize;
+ Ecore_X_Selection_Intern *sd;
+ void *data;
+ int len;
+ int typesize;
ev = (xcb_selection_request_event_t *)event;
_ecore_xcb_last_event_mouse_move = 0;
if ((sd = _ecore_x_selection_get(ev->selection)) &&
(sd->win == ev->owner))
{
- Ecore_X_Selection_Intern *si;
+ Ecore_X_Selection_Intern *si;
- si = _ecore_x_selection_get(ev->selection);
- if (si->data)
- {
- Ecore_X_Atom property;
- Ecore_X_Atom type;
+ si = _ecore_x_selection_get(ev->selection);
+ if (si->data)
+ {
+ Ecore_X_Atom property;
+ Ecore_X_Atom type;
- /* Set up defaults for strings first */
- type = ev->target;
- typesize = 8;
- len = sd->length;
+ /* Set up defaults for strings first */
+ type = ev->target;
+ typesize = 8;
+ len = sd->length;
if (!ecore_x_selection_convert(ev->selection, ev->target,
&data, &len, &type, &typesize))
{
/* Refuse selection, conversion to requested target failed */
- property = XCB_NONE;
+ property = XCB_NONE;
}
else
{
/* FIXME: This does not properly handle large data transfers */
- ecore_x_window_prop_property_set(ev->requestor,
- ev->property,
- ev->target,
- 8, data, sd->length);
- property = ev->property;
- free(data);
+ ecore_x_window_prop_property_set(ev->requestor,
+ ev->property,
+ ev->target,
+ 8, data, sd->length);
+ property = ev->property;
+ free(data);
}
- ecore_x_selection_notify_send(ev->requestor,
- ev->selection,
- ev->target,
- property,
- ev->time);
+ ecore_x_selection_notify_send(ev->requestor,
+ ev->selection,
+ ev->target,
+ property,
+ ev->time);
}
}
-}
+} /* _ecore_x_event_handle_selection_request */
/* FIXME: round trip */
void
_ecore_x_event_handle_selection_notify(xcb_generic_event_t *event)
{
- xcb_selection_notify_event_t *ev;
+ xcb_selection_notify_event_t *ev;
Ecore_X_Event_Selection_Notify *e;
- unsigned char *data = NULL;
- Ecore_X_Atom selection;
- int num_ret;
- uint8_t format;
+ unsigned char *data = NULL;
+ Ecore_X_Atom selection;
+ int num_ret;
+ uint8_t format;
ev = (xcb_selection_notify_event_t *)event;
selection = ev->selection;
32,
&data,
&num_ret);
- if (!format) return;
+ if (!format)
+ return;
}
else
{
8,
&data,
&num_ret);
- if (!format) return;
+ if (!format)
+ return;
}
e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->requestor;
e->time = ev->time;
e->atom = selection;
e->target = _ecore_x_selection_target_get(ev->target);
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- e->selection = ECORE_X_SELECTION_PRIMARY;
+ e->selection = ECORE_X_SELECTION_PRIMARY;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- e->selection = ECORE_X_SELECTION_SECONDARY;
+ e->selection = ECORE_X_SELECTION_SECONDARY;
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- e->selection = ECORE_X_SELECTION_XDND;
+ e->selection = ECORE_X_SELECTION_XDND;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- e->selection = ECORE_X_SELECTION_CLIPBOARD;
+ e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
- e->selection = ECORE_X_SELECTION_OTHER;
+ e->selection = ECORE_X_SELECTION_OTHER;
e->data = _ecore_x_selection_parse(e->target, data, num_ret, format);
ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, _ecore_x_event_free_selection_notify, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_selection_notify */
void
_ecore_x_event_handle_colormap_notify(xcb_generic_event_t *event)
{
- xcb_colormap_notify_event_t *ev;
+ xcb_colormap_notify_event_t *ev;
Ecore_X_Event_Window_Colormap *e;
ev = (xcb_colormap_notify_event_t *)event;
e = calloc(1,sizeof(Ecore_X_Event_Window_Colormap));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
e->cmap = ev->colormap;
if (ev->state == XCB_COLORMAP_STATE_INSTALLED)
e->installed = 1;
else
e->installed = 0;
+
e->time = _ecore_xcb_event_last_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL);
free(event);
-}
+} /* _ecore_x_event_handle_colormap_notify */
void
_ecore_x_event_handle_client_message(xcb_generic_event_t *event)
(ev->format == 32) &&
(ev->data.data32[0] == (uint32_t)ECORE_X_ATOM_WM_DELETE_WINDOW))
{
- Ecore_X_Event_Window_Delete_Request *e;
+ Ecore_X_Event_Window_Delete_Request *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request));
- if (!e) return;
- e->win = ev->window;
- e->time = _ecore_xcb_event_last_time;
- ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
- }
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request));
+ if (!e)
+ return;
+ e->win = ev->window;
+ e->time = _ecore_xcb_event_last_time;
+ ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
+ }
else if ((ev->type == ECORE_X_ATOM_NET_WM_MOVERESIZE) &&
- (ev->format == 32) &&
- /* Ignore move and resize with keyboard */
- (ev->data.data32[2] < 9))
+ (ev->format == 32) &&
+ /* Ignore move and resize with keyboard */
+ (ev->data.data32[2] < 9))
{
- Ecore_X_Event_Window_Move_Resize_Request *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request));
- if (!e) return;
- e->win = ev->window;
- e->x = ev->data.data32[0];
- e->y = ev->data.data32[1];
- e->direction = ev->data.data32[2];
- e->button = ev->data.data32[3];
- e->source = ev->data.data32[4];
- ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
+ Ecore_X_Event_Window_Move_Resize_Request *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ e->x = ev->data.data32[0];
+ e->y = ev->data.data32[1];
+ e->direction = ev->data.data32[2];
+ e->button = ev->data.data32[3];
+ e->source = ev->data.data32[4];
+ ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL);
}
-
/* Xdnd Client Message Handling Begin */
/* Message Type: XdndEnter target */
else if (ev->type == ECORE_X_ATOM_XDND_ENTER)
{
- Ecore_X_Event_Xdnd_Enter *e;
- Ecore_X_DND_Target *target;
- uint32_t three;
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
- if (!e) return;
-
- target = _ecore_x_dnd_target_get();
- target->state = ECORE_X_DND_TARGET_ENTERED;
-
- target = _ecore_x_dnd_target_get();
- target->source = ev->data.data32[0];
- target->win = ev->window;
- target->version = ev->data.data32[1] >> 24;
- if (target->version > ECORE_X_DND_VERSION)
- {
+ Ecore_X_Event_Xdnd_Enter *e;
+ Ecore_X_DND_Target *target;
+ uint32_t three;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter));
+ if (!e)
+ return;
+
+ target = _ecore_x_dnd_target_get();
+ target->state = ECORE_X_DND_TARGET_ENTERED;
+
+ target = _ecore_x_dnd_target_get();
+ target->source = ev->data.data32[0];
+ target->win = ev->window;
+ target->version = ev->data.data32[1] >> 24;
+ if (target->version > ECORE_X_DND_VERSION)
+ {
WRN("DND: Requested version %d, we only support up to %d", target->version,
- ECORE_X_DND_VERSION);
- return;
- }
+ ECORE_X_DND_VERSION);
+ return;
+ }
/* FIXME: roud trip, but I don't know how to suppress it */
- if ((three = ev->data.data32[1] & 0x1UL))
- {
- /* source supports more than 3 types, fetch property */
- unsigned char *data;
- Ecore_X_Atom *types;
- int num_ret;
- int i;
- uint8_t format;
+ if ((three = ev->data.data32[1] & 0x1UL))
+ {
+ /* source supports more than 3 types, fetch property */
+ unsigned char *data;
+ Ecore_X_Atom *types;
+ int num_ret;
+ int i;
+ uint8_t format;
ecore_x_window_prop_property_get_prefetch(target->source,
ECORE_X_ATOM_XDND_TYPE_LIST,
&data,
&num_ret);
if (!format)
- {
- ERR("DND: Could not fetch data type list from source window, aborting.");
- return;
- }
- types = (Ecore_X_Atom *)data;
- e->types = calloc(num_ret, sizeof(char *));
- if (e->types)
- {
+ {
+ ERR("DND: Could not fetch data type list from source window, aborting.");
+ return;
+ }
+
+ types = (Ecore_X_Atom *)data;
+ e->types = calloc(num_ret, sizeof(char *));
+ if (e->types)
+ {
xcb_get_atom_name_cookie_t *cookies;
cookies = (xcb_get_atom_name_cookie_t *)malloc(sizeof(xcb_get_atom_name_cookie_t) * num_ret);
for (i = 0; i < num_ret; i++)
- cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, types[i]);
- for (i = 0; i < num_ret; i++)
+ cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, types[i]);
+ for (i = 0; i < num_ret; i++)
{
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply)
}
}
free(cookies);
- }
- e->num_types = num_ret;
- }
- else
- {
- int i = 0;
-
- e->types = calloc(3, sizeof(char *));
- if (e->types)
- {
+ }
+
+ e->num_types = num_ret;
+ }
+ else
+ {
+ int i = 0;
+
+ e->types = calloc(3, sizeof(char *));
+ if (e->types)
+ {
xcb_get_atom_name_cookie_t cookies[3];
for (i = 0; i < 3; i++)
- cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[i + 2]);
+ cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[i + 2]);
for (i = 0; i < 3; i++)
{
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply && (ev->data.data32[i + 2]))
name[reply->name_len] = '\0';
e->types[i] = name;
}
- if (reply) free(reply);
+
+ if (reply)
+ free(reply);
}
- }
- e->num_types = i;
- }
+ }
- e->win = target->win;
- e->source = target->source;
- ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, _ecore_x_event_free_xdnd_enter, NULL);
- }
+ e->num_types = i;
+ }
+ e->win = target->win;
+ e->source = target->source;
+ ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, _ecore_x_event_free_xdnd_enter, NULL);
+ }
/* Message Type: XdndPosition target */
else if (ev->type == ECORE_X_ATOM_XDND_POSITION)
{
- Ecore_X_Event_Xdnd_Position *e;
- Ecore_X_DND_Target *target;
-
- target = _ecore_x_dnd_target_get();
- if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
- (target->win != ev->window))
- return;
-
- target->pos.x = (int16_t)ev->data.data32[2] >> 16;
- target->pos.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
- target->action = ev->data.data32[4]; /* Version 2 */
-
- target->time = (target->version >= 1) ?
- ev->data.data32[3] : XCB_CURRENT_TIME;
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
- if (!e) return;
- e->win = target->win;
- e->source = target->source;
- e->position.x = target->pos.x;
- e->position.y = target->pos.y;
- e->action = target->action;
- ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
+ Ecore_X_Event_Xdnd_Position *e;
+ Ecore_X_DND_Target *target;
+
+ target = _ecore_x_dnd_target_get();
+ if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
+ (target->win != ev->window))
+ return;
+
+ target->pos.x = (int16_t)ev->data.data32[2] >> 16;
+ target->pos.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
+ target->action = ev->data.data32[4]; /* Version 2 */
+
+ target->time = (target->version >= 1) ?
+ ev->data.data32[3] : XCB_CURRENT_TIME;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
+ if (!e)
+ return;
+
+ e->win = target->win;
+ e->source = target->source;
+ e->position.x = target->pos.x;
+ e->position.y = target->pos.y;
+ e->action = target->action;
+ ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL);
}
-
/* Message Type: XdndStatus source */
else if (ev->type == ECORE_X_ATOM_XDND_STATUS)
{
- Ecore_X_Event_Xdnd_Status *e;
- Ecore_X_DND_Source *source;
-
- source = _ecore_x_dnd_source_get();
- /* Make sure source/target match */
- if ((source->win != ev->window ) ||
- (source->dest != ev->data.data32[0]))
- return;
-
- source->await_status = 0;
-
- source->will_accept = ev->data.data32[1] & 0x1UL;
- source->suppress = (ev->data.data32[1] & 0x2UL) ? 0 : 1;
-
- source->rectangle.x = (int16_t)ev->data.data32[2] >> 16;
- source->rectangle.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
- source->rectangle.width = (uint16_t)ev->data.data32[3] >> 16;
- source->rectangle.height = (uint16_t)ev->data.data32[3] & 0xFFFFUL;
-
- source->accepted_action = ev->data.data32[4];
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
- if (!e) return;
- e->win = source->win;
- e->target = source->dest;
- e->will_accept = source->will_accept;
- e->rectangle.x = source->rectangle.x;
- e->rectangle.y = source->rectangle.y;
- e->rectangle.width = source->rectangle.width;
- e->rectangle.height = source->rectangle.height;
- e->action = source->accepted_action;
-
- ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
- }
+ Ecore_X_Event_Xdnd_Status *e;
+ Ecore_X_DND_Source *source;
+
+ source = _ecore_x_dnd_source_get();
+ /* Make sure source/target match */
+ if ((source->win != ev->window) ||
+ (source->dest != ev->data.data32[0]))
+ return;
+
+ source->await_status = 0;
+
+ source->will_accept = ev->data.data32[1] & 0x1UL;
+ source->suppress = (ev->data.data32[1] & 0x2UL) ? 0 : 1;
+
+ source->rectangle.x = (int16_t)ev->data.data32[2] >> 16;
+ source->rectangle.y = (int16_t)ev->data.data32[2] & 0xFFFFUL;
+ source->rectangle.width = (uint16_t)ev->data.data32[3] >> 16;
+ source->rectangle.height = (uint16_t)ev->data.data32[3] & 0xFFFFUL;
+
+ source->accepted_action = ev->data.data32[4];
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status));
+ if (!e)
+ return;
+
+ e->win = source->win;
+ e->target = source->dest;
+ e->will_accept = source->will_accept;
+ e->rectangle.x = source->rectangle.x;
+ e->rectangle.y = source->rectangle.y;
+ e->rectangle.width = source->rectangle.width;
+ e->rectangle.height = source->rectangle.height;
+ e->action = source->accepted_action;
+
+ ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL);
+ }
/* Message Type: XdndLeave target */
/* Pretend the whole thing never happened, sort of */
else if (ev->type == ECORE_X_ATOM_XDND_LEAVE)
{
- Ecore_X_Event_Xdnd_Leave *e;
- Ecore_X_DND_Target *target;
+ Ecore_X_Event_Xdnd_Leave *e;
+ Ecore_X_DND_Target *target;
- target = _ecore_x_dnd_target_get();
- if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
- (target->win != ev->window))
- return;
+ target = _ecore_x_dnd_target_get();
+ if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
+ (target->win != ev->window))
+ return;
- target->state = ECORE_X_DND_TARGET_IDLE;
+ target->state = ECORE_X_DND_TARGET_IDLE;
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
- if (!e) return;
- e->win = ev->window;
- e->source = ev->data.data32[0];
- ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
- }
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave));
+ if (!e)
+ return;
+ e->win = ev->window;
+ e->source = ev->data.data32[0];
+ ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
+ }
/* Message Type: XdndDrop target */
else if (ev->type == ECORE_X_ATOM_XDND_DROP)
{
- Ecore_X_Event_Xdnd_Drop *e;
- Ecore_X_DND_Target *target;
-
- target = _ecore_x_dnd_target_get();
- /* Match source/target */
- if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
- (target->win != ev->window))
- return;
-
- target->time = (target->version >= 1) ?
- ev->data.data32[2] : _ecore_xcb_event_last_time;
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
- if (!e) return;
- e->win = target->win;
- e->source = target->source;
- e->action = target->action;
- e->position.x = target->pos.x;
- e->position.y = target->pos.y;
- ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
+ Ecore_X_Event_Xdnd_Drop *e;
+ Ecore_X_DND_Target *target;
+
+ target = _ecore_x_dnd_target_get();
+ /* Match source/target */
+ if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
+ (target->win != ev->window))
+ return;
+
+ target->time = (target->version >= 1) ?
+ ev->data.data32[2] : _ecore_xcb_event_last_time;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop));
+ if (!e)
+ return;
+
+ e->win = target->win;
+ e->source = target->source;
+ e->action = target->action;
+ e->position.x = target->pos.x;
+ e->position.y = target->pos.y;
+ ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL);
}
-
/* Message Type: XdndFinished source */
else if (ev->type == ECORE_X_ATOM_XDND_FINISHED)
{
- Ecore_X_Event_Xdnd_Finished *e;
- Ecore_X_DND_Source *source;
- uint8_t completed = 1;
-
- source = _ecore_x_dnd_source_get();
- /* Match source/target */
- if ((source->win != ev->window) ||
- (source->dest != ev->data.data32[0]))
- return;
-
- if ((source->version >= 5) && (ev->data.data32[1] & 0x1UL))
- {
- /* Target successfully performed drop action */
- ecore_x_selection_xdnd_clear();
- source->state = ECORE_X_DND_SOURCE_IDLE;
- }
- else
- {
- completed = 0;
- source->state = ECORE_X_DND_SOURCE_CONVERTING;
-
- /* FIXME: Probably need to add a timer to switch back to idle
- * and discard the selection data */
- }
-
- e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished));
- if (!e) return;
- e->win = source->win;
- e->target = source->dest;
- e->completed = completed;
- if (source->version >= 5)
- {
- source->accepted_action = ev->data.data32[2];
- e->action = source->accepted_action;
- }
- else
- {
- source->accepted_action = 0;
- e->action = source->action;
- }
-
- ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
+ Ecore_X_Event_Xdnd_Finished *e;
+ Ecore_X_DND_Source *source;
+ uint8_t completed = 1;
+
+ source = _ecore_x_dnd_source_get();
+ /* Match source/target */
+ if ((source->win != ev->window) ||
+ (source->dest != ev->data.data32[0]))
+ return;
+
+ if ((source->version >= 5) && (ev->data.data32[1] & 0x1UL))
+ {
+ /* Target successfully performed drop action */
+ ecore_x_selection_xdnd_clear();
+ source->state = ECORE_X_DND_SOURCE_IDLE;
+ }
+ else
+ {
+ completed = 0;
+ source->state = ECORE_X_DND_SOURCE_CONVERTING;
+
+ /* FIXME: Probably need to add a timer to switch back to idle
+ * and discard the selection data */
+ }
+
+ e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished));
+ if (!e)
+ return;
+
+ e->win = source->win;
+ e->target = source->dest;
+ e->completed = completed;
+ if (source->version >= 5)
+ {
+ source->accepted_action = ev->data.data32[2];
+ e->action = source->accepted_action;
+ }
+ else
+ {
+ source->accepted_action = 0;
+ e->action = source->action;
+ }
+
+ ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL);
}
else if (ev->type == ECORE_X_ATOM_NET_WM_STATE)
{
- Ecore_X_Event_Window_State_Request *e;
-
- e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
- if (!e) return;
- e->win = ev->window;
- if (ev->data.data32[0] == 0)
- e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
- else if (ev->data.data32[0] == 1)
- e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
- else if (ev->data.data32[0] == 2)
- e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
- else
- {
- free(e);
- return;
- }
- e->state[0] = _ecore_x_netwm_state_get(ev->data.data32[1]);
- if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
- {
+ Ecore_X_Event_Window_State_Request *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ if (ev->data.data32[0] == 0)
+ e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE;
+ else if (ev->data.data32[0] == 1)
+ e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
+ else if (ev->data.data32[0] == 2)
+ e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE;
+ else
+ {
+ free(e);
+ return;
+ }
+
+ e->state[0] = _ecore_x_netwm_state_get(ev->data.data32[1]);
+ if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN)
+ {
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
/* FIXME: round trip */
reply = xcb_get_atom_name_reply(_ecore_xcb_conn,
xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[1]),
NULL);
- if (reply)
+ if (reply)
{
- name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
- memcpy(name,
- xcb_get_atom_name_name(reply),
- reply->name_len);
- name[reply->name_len] = '\0';
- ERR("Unknown state: %s", name);
- free(name);
- free(reply);
+ name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
+ memcpy(name,
+ xcb_get_atom_name_name(reply),
+ reply->name_len);
+ name[reply->name_len] = '\0';
+ ERR("Unknown state: %s", name);
+ free(name);
+ free(reply);
}
- }
- e->state[1] = _ecore_x_netwm_state_get(ev->data.data32[2]);
- if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
- {
+ }
+
+ e->state[1] = _ecore_x_netwm_state_get(ev->data.data32[2]);
+ if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN)
+ {
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
reply = xcb_get_atom_name_reply(_ecore_xcb_conn,
xcb_get_atom_name_unchecked(_ecore_xcb_conn, ev->data.data32[2]),
NULL);
- if (reply)
+ if (reply)
{
- name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
- memcpy(name,
- xcb_get_atom_name_name(reply),
- reply->name_len);
- name[reply->name_len] = '\0';
- WRN("Unknown state: %s", name);
- free(name);
+ name = (char *)malloc(sizeof (char) * (reply->name_len + 1));
+ memcpy(name,
+ xcb_get_atom_name_name(reply),
+ reply->name_len);
+ name[reply->name_len] = '\0';
+ WRN("Unknown state: %s", name);
+ free(name);
}
- }
- e->source = ev->data.data32[3];
+ }
+
+ e->source = ev->data.data32[3];
- ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
+ ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE)
- && (ev->format == 32)
- && (ev->data.data32[0] == XCB_WM_HINT_STATE))
+ && (ev->format == 32)
+ && (ev->data.data32[0] == XCB_WM_HINT_STATE))
{
- Ecore_X_Event_Window_State_Request *e;
+ Ecore_X_Event_Window_State_Request *e;
- e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
- if (!e) return;
- e->win = ev->window;
- e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
- e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
+ e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request));
+ if (!e)
+ return;
- ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
+ e->win = ev->window;
+ e->action = ECORE_X_WINDOW_STATE_ACTION_ADD;
+ e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED;
+
+ ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_NET_WM_DESKTOP)
- && (ev->format == 32))
+ && (ev->format == 32))
{
- Ecore_X_Event_Desktop_Change *e;
+ Ecore_X_Event_Desktop_Change *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change));
- if (!e) return;
- e->win = ev->window;
- e->desk = ev->data.data32[0];
- e->source = ev->data.data32[1];
+ e->win = ev->window;
+ e->desk = ev->data.data32[0];
+ e->source = ev->data.data32[1];
- ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
+ ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS))
{
- Ecore_X_Event_Frame_Extents_Request *e;
+ Ecore_X_Event_Frame_Extents_Request *e;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
+ if (!e)
+ return;
- e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request));
- if (!e) return;
- e->win = ev->window;
+ e->win = ev->window;
- ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
+ ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS)
- && ((Ecore_X_Atom)ev->data.data32[0] == ECORE_X_ATOM_NET_WM_PING)
- && (ev->format == 32))
+ && ((Ecore_X_Atom)ev->data.data32[0] == ECORE_X_ATOM_NET_WM_PING)
+ && (ev->format == 32))
{
- Ecore_X_Event_Ping *e;
+ Ecore_X_Event_Ping *e;
- e = calloc(1, sizeof(Ecore_X_Event_Ping));
- if (!e) return;
- e->win = ev->window;
- e->time = ev->data.data32[1];
- e->event_win = ev->data.data32[2];
+ e = calloc(1, sizeof(Ecore_X_Event_Ping));
+ if (!e)
+ return;
- ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
+ e->win = ev->window;
+ e->time = ev->data.data32[1];
+ e->event_win = ev->data.data32[2];
+
+ ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL);
}
else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) &&
- (ev->format == 8))
+ (ev->format == 8))
{
- _ecore_x_netwm_startup_info_begin(ev->window, (char *)ev->data.data8);
+ _ecore_x_netwm_startup_info_begin(ev->window, (char *)ev->data.data8);
}
else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO) &&
- (ev->format == 8))
+ (ev->format == 8))
{
- _ecore_x_netwm_startup_info(ev->window, (char *)ev->data.data8);
+ _ecore_x_netwm_startup_info(ev->window, (char *)ev->data.data8);
}
else if ((ev->type == 27777)
- && (ev->data.data32[0] == 0x7162534)
- && (ev->format == 32)
- && (ev->window == _ecore_xcb_private_window))
+ && (ev->data.data32[0] == 0x7162534)
+ && (ev->format == 32)
+ && (ev->window == _ecore_xcb_private_window))
{
- /* a grab sync marker */
- if (ev->data.data32[1] == 0x10000001)
- _ecore_x_window_grab_remove(ev->data.data32[2]);
- else if (ev->data.data32[1] == 0x10000002)
- _ecore_x_key_grab_remove(ev->data.data32[2]);
+ /* a grab sync marker */
+ if (ev->data.data32[1] == 0x10000001)
+ _ecore_x_window_grab_remove(ev->data.data32[2]);
+ else if (ev->data.data32[1] == 0x10000002)
+ _ecore_x_key_grab_remove(ev->data.data32[2]);
}
else
{
- Ecore_X_Event_Client_Message *e;
- int i;
-
- e = calloc(1, sizeof(Ecore_X_Event_Client_Message));
- if (!e) return;
- e->win = ev->window;
- e->message_type = ev->type;
- e->format = ev->format;
- for (i = 0; i < 5; i++)
- e->data.l[i] = ev->data.data32[i];
-
- ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
+ Ecore_X_Event_Client_Message *e;
+ int i;
+
+ e = calloc(1, sizeof(Ecore_X_Event_Client_Message));
+ if (!e)
+ return;
+
+ e->win = ev->window;
+ e->message_type = ev->type;
+ e->format = ev->format;
+ for (i = 0; i < 5; i++)
+ e->data.l[i] = ev->data.data32[i];
+
+ ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL);
}
free(event);
-}
+} /* _ecore_x_event_handle_client_message */
void
_ecore_x_event_handle_mapping_notify(xcb_generic_event_t *event)
/* FIXME: handle this event type */
free(event);
-}
+} /* _ecore_x_event_handle_mapping_notify */
void
_ecore_x_event_handle_shape_change(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SHAPE
- xcb_shape_notify_event_t *ev;
+ xcb_shape_notify_event_t *ev;
Ecore_X_Event_Window_Shape *e;
ev = (xcb_shape_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Window_Shape));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->affected_window;
e->time = ev->server_time;
ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL);
#endif /* ECORE_X_SHAPE */
free(event);
-}
+} /* _ecore_x_event_handle_shape_change */
void
_ecore_x_event_handle_screensaver_notify(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SCREENSAVER
- xcb_screensaver_notify_event_t *ev;
+ xcb_screensaver_notify_event_t *ev;
Ecore_X_Event_Screensaver_Notify *e;
ev = (xcb_screensaver_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->window;
if (ev->state == XCB_SCREENSAVER_STATE_ON)
- e->on = 1;
+ e->on = 1;
else
- e->on = 0;
+ e->on = 0;
+
e->time = ev->time;
ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL);
#endif /* ECORE_X_SCREENSAVER */
free(event);
-}
+} /* _ecore_x_event_handle_screensaver_notify */
void
_ecore_x_event_handle_sync_counter(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SYNC
xcb_sync_counter_notify_event_t *ev;
- Ecore_X_Event_Sync_Counter *e;
+ Ecore_X_Event_Sync_Counter *e;
ev = (xcb_sync_counter_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter));
- if (!e) return;
+ if (!e)
+ return;
+
e->time = ev->timestamp;
ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL);
#endif /* ECORE_X_SYNC */
free(event);
-}
+} /* _ecore_x_event_handle_sync_counter */
void
_ecore_x_event_handle_sync_alarm(xcb_generic_event_t *event)
{
#ifdef ECORE_X_SYNC
xcb_sync_alarm_notify_event_t *ev;
- Ecore_X_Event_Sync_Alarm *e;
+ Ecore_X_Event_Sync_Alarm *e;
ev = (xcb_sync_alarm_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm));
- if (!e) return;
+ if (!e)
+ return;
+
e->time = ev->timestamp;
e->alarm = ev->alarm;
ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL);
#endif /* ECORE_X_SYNC */
free(event);
-}
+} /* _ecore_x_event_handle_sync_alarm */
/* FIXME: round trip */
void
{
#ifdef ECORE_X_RANDR
xcb_randr_screen_change_notify_event_t *ev;
- Ecore_X_Event_Screen_Change *e;
+ Ecore_X_Event_Screen_Change *e;
ev = (xcb_randr_screen_change_notify_event_t *)event;
if ((ev->response_type & ~0x80) != XCB_CONFIGURE_NOTIFY)
{
- xcb_query_extension_reply_t *rep;
-
- rep = xcb_query_extension_reply(_ecore_xcb_conn,
- xcb_query_extension_unchecked(_ecore_xcb_conn,
- strlen("randr"),
- "randr"),
- NULL);
-
- if ((!rep) ||
- (((ev->response_type & ~0x80) - rep->first_event) != XCB_RANDR_SCREEN_CHANGE_NOTIFY))
- WRN("ERROR: Can't update RandR config!");
- if (rep)
- free(rep);
+ xcb_query_extension_reply_t *rep;
+
+ rep = xcb_query_extension_reply(_ecore_xcb_conn,
+ xcb_query_extension_unchecked(_ecore_xcb_conn,
+ strlen("randr"),
+ "randr"),
+ NULL);
+
+ if ((!rep) ||
+ (((ev->response_type & ~0x80) - rep->first_event) != XCB_RANDR_SCREEN_CHANGE_NOTIFY))
+ WRN("ERROR: Can't update RandR config!");
+
+ if (rep)
+ free(rep);
}
e = calloc(1, sizeof(Ecore_X_Event_Screen_Change));
- if (!e) return;
+ if (!e)
+ return;
+
e->win = ev->request_window;
e->root = ev->root;
e->width = ev->width;
#endif /* ECORE_X_RANDR */
free(event);
-}
+} /* _ecore_x_event_handle_randr_change */
void
_ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event)
#endif /* ECORE_X_FIXES */
free(event);
-}
+} /* _ecore_x_event_handle_fixes_selection_notify */
void
_ecore_x_event_handle_damage_notify(xcb_generic_event_t *event)
{
#ifdef ECORE_XCBDAMAGE
xcb_damage_notify_event_t *ev;
- Ecore_X_Event_Damage *e;
+ Ecore_X_Event_Damage *e;
ev = (xcb_damage_notify_event_t *)event;
e = calloc(1, sizeof(Ecore_X_Event_Damage));
- if (!e) return;
+ if (!e)
+ return;
e->level = ev->level;
e->drawable = ev->drawable;
#endif /* ECORE_XCBDAMAGE */
free(event);
-}
+} /* _ecore_x_event_handle_damage_notify */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Fixes_Group X Fixes Extension Functions
*
* Functions related to the X Fixes extension.
*/
-
#ifdef ECORE_XCB_FIXES
static int _xfixes_available = 0;
static xcb_xfixes_query_version_cookie_t _ecore_xcb_xfixes_init_cookie;
#endif /* ECORE_XCB_FIXES */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_xfixes_init and
_ecore_xcb_xfixes_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_FIXES
if (reply && (reply->present))
_ecore_xcb_xfixes_init_cookie = xcb_xfixes_query_version_unchecked(_ecore_xcb_conn, 4, 0);
+
#endif /* ECORE_XCB_FIXES */
-}
+} /* _ecore_x_xfixes_init */
void
_ecore_x_xfixes_init_finalize(void)
if (reply)
{
if (reply->major_version >= 3)
- _xfixes_available = 1;
+ _xfixes_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_FIXES */
-}
+#endif /* ECORE_XCB_FIXES */
+} /* _ecore_x_xfixes_init_finalize */
/**
* Return whether the X server supports the Fixes Extension.
{
#ifdef ECORE_XCB_FIXES
return _xfixes_available;
-#else
+#else /* ifdef ECORE_XCB_FIXES */
return 0;
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_xfixes_query */
/**
* Create a region from rectangles.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new */
/**
* Create a region from a pixmap.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_bitmap */
/**
* Create a region from a window.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_window */
/**
* Create a region from a graphic context.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_gc */
/**
* Create a region from a picture.
#endif /* ECORE_XCB_FIXES */
return region;
-}
-
+} /* ecore_x_region_new_from_picture */
/**
* Destroy a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_destroy_region(_ecore_xcb_conn, region);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_free */
/**
* Set the content of a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_region(_ecore_xcb_conn, region, num, (xcb_rectangle_t *)rects);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_set */
/**
* Copy the content of a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_copy */
/**
* Make the union of two regions.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_combine */
/**
* Make the intersection of two regions.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_intersect */
/**
* Make the substraction of two regions.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_subtract */
/**
* Make the substraction of regions by bounds.
rect.height = bounds->height;
xcb_xfixes_invert_region(_ecore_xcb_conn, source, rect, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_invert */
/**
* Translate a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_translate */
/**
* Extent a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_extents */
/**
* Sends the XFixesFetchRegion request.
cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_fetch_prefetch */
/**
* Gets the reply of the XFixesFetchRegion request sent by ecore_xcb_region_fetch_prefetch().
reply = xcb_xfixes_fetch_region_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_fetch_fetch */
/**
* Return the rectangles that compose a region.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Rectangle *
-ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
- int *num,
- Ecore_X_Rectangle *bounds)
+ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
+ int *num,
+ Ecore_X_Rectangle *bounds)
{
- Ecore_X_Rectangle extents = { 0, 0, 0, 0};
+ Ecore_X_Rectangle extents = { 0, 0, 0, 0};
Ecore_X_Rectangle *rects = NULL;
#ifdef ECORE_XCB_FIXES
- int n;
+ int n;
xcb_xfixes_fetch_region_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (num) *num = 0;
- if (bounds) *bounds = extents;
- return NULL;
+ if (num)
+ *num = 0;
+
+ if (bounds)
+ *bounds = extents;
+
+ return NULL;
}
+
n = xcb_xfixes_fetch_region_rectangles_length(reply);
rects = (Ecore_X_Rectangle *)malloc(n * sizeof(Ecore_X_Rectangle));
if (!rects)
{
- if (num) *num = 0;
- if (bounds) *bounds = extents;
+ if (num)
+ *num = 0;
- return NULL;
+ if (bounds)
+ *bounds = extents;
+
+ return NULL;
}
- if (num) *num = n;
+ if (num)
+ *num = n;
+
if (bounds)
{
bounds->x = reply->extents.x;
bounds->width = reply->extents.width;
bounds->height = reply->extents.height;
}
+
memcpy(rects,
xcb_xfixes_fetch_region_rectangles(reply),
sizeof(Ecore_X_Rectangle) * n);
return rects;
-#else
- if (num) *num = 0;
- if (bounds) *bounds = extents;
+#else /* ifdef ECORE_XCB_FIXES */
+ if (num)
+ *num = 0;
+
+ if (bounds)
+ *bounds = extents;
+
return NULL;
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_fetch */
/**
* Expand a region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_expand */
/**
* Change clip-mask in a graphic context to the specified region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x_origin, y_origin);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_gc_clip_set */
/**
* Change the shape extension of a window.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x_offset, y_offset, region);
#endif /* ECORE_XCB_FIXES */
-}
-
+} /* ecore_x_region_window_shape_set */
/**
* Change clip-mask in picture to the specified region.
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x_origin, y_origin);
#endif /* ECORE_XCB_FIXES */
-}
+} /* ecore_x_region_picture_clip_set */
+
#include "ecore_xcb_private.h"
-
/**
* Creates a new default graphics context associated with the given
* drawable.
{
xcb_gcontext_t gc;
- if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!drawable)
+ drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
gc = xcb_generate_id(_ecore_xcb_conn);
xcb_create_gc(_ecore_xcb_conn, gc, drawable, value_mask, value_list);
return gc;
-}
-
+} /* ecore_x_gc_new */
/**
* Deletes and frees the given graphics context.
ecore_x_gc_free(Ecore_X_GC gc)
{
xcb_free_gc(_ecore_xcb_conn, gc);
-}
+} /* ecore_x_gc_free */
+
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/**
* @defgroup Ecore_X_ICCCM_Group ICCCM related functions.
*
* Functions related to ICCCM.
*/
-
static int _ecore_x_icccm_size_hints_get (const void *reply,
Ecore_X_Atom property,
xcb_size_hints_t *hints)
{
uint32_t s;
- if (!hints) return 0;
+ if (!hints)
+ return 0;
+
+ if (!reply)
+ return 0;
- if (!reply) return 0;
if ((((xcb_get_property_reply_t *)reply)->type != ECORE_X_ATOM_WM_SIZE_HINTS) &&
- ((((xcb_get_property_reply_t *)reply)->format != 8) ||
+ ((((xcb_get_property_reply_t *)reply)->format != 8) ||
(((xcb_get_property_reply_t *)reply)->format != 16) ||
- (((xcb_get_property_reply_t *)reply)->format != 32)) &&
+ (((xcb_get_property_reply_t *)reply)->format != 32)) &&
(((xcb_get_property_reply_t *)reply)->value_len < 15)) /* OldNumPropSizeElements = 15 (pre-ICCCM) */
return 0;
xcb_get_property_value((xcb_get_property_reply_t *)reply),
((xcb_get_property_reply_t *)reply)->value_len);
- s = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE |
- XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE |
- XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE |
+ s = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE |
+ XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE |
+ XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE |
XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_P_ASPECT);
if (((xcb_get_property_reply_t *)reply)->value_len >= 18) /* NumPropSizeElements = 18 (ICCCM version 1) */
xcb_size_hints_set_base_size(hints, 0, 0);
xcb_size_hints_set_win_gravity(hints, 0);
}
+
/* FIXME: is it necessary ? */
/* hints->flags &= s; */ /* get rid of unwanted bits */
return 1;
-}
-
+} /* _ecore_x_icccm_size_hints_get */
/**
* Sets the state of a window.
c[0] = XCB_WM_STATE_NORMAL;
else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
c[0] = XCB_WM_STATE_ICONIC;
+
c[1] = 0;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE, 32,
2, c);
-}
+} /* ecore_x_icccm_state_set */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_STATE,
0L, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_state_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_state_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_state_get_fetch */
/**
* Gets the state of a window.
EAPI Ecore_X_Window_State_Hint
ecore_x_icccm_state_get(Ecore_X_Window window __UNUSED__)
{
- xcb_get_property_reply_t *reply;
- uint8_t *prop;
+ xcb_get_property_reply_t *reply;
+ uint8_t *prop;
Ecore_X_Window_State_Hint hint = ECORE_X_WINDOW_STATE_HINT_NONE;
reply = _ecore_xcb_reply_get();
if (!reply)
- return hint;
+ return hint;
if ((reply->type == 0) ||
(reply->format != 8) ||
prop = (uint8_t *)xcb_get_property_value(reply);
switch (prop[0]) {
- case XCB_WM_STATE_WITHDRAWN:
- hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
- break;
- case XCB_WM_STATE_NORMAL:
- hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
- break;
- case XCB_WM_STATE_ICONIC:
- hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
- break;
- default:
- hint = ECORE_X_WINDOW_STATE_HINT_NONE;
- break;
- }
+ case XCB_WM_STATE_WITHDRAWN:
+ hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
+ break;
+
+ case XCB_WM_STATE_NORMAL:
+ hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
+ break;
+
+ case XCB_WM_STATE_ICONIC:
+ hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
+ break;
+
+ default:
+ hint = ECORE_X_WINDOW_STATE_HINT_NONE;
+ break;
+ } /* switch */
return hint;
-}
+} /* ecore_x_icccm_state_get */
/**
* Sends the ClientMessage event with the DeleteWindow property.
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_DELETE_WINDOW,
time, 0, 0, 0);
-}
+} /* ecore_x_icccm_delete_window_send */
/**
* Sends the ClientMessage event with the TakeFocus property.
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_TAKE_FOCUS,
time, 0, 0, 0);
-}
+} /* ecore_x_icccm_take_focus_send */
/**
* Sends the ClientMessage event with the SaveYourself property.
ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_WM_SAVE_YOURSELF,
time, 0, 0, 0);
-}
+} /* ecore_x_icccm_save_yourself_send */
/**
* Sends the ConfigureNotify event with the StructureNotify property.
ev.override_redirect = 0;
xcb_send_event(_ecore_xcb_conn, 0, window,
XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&ev);
-}
+} /* ecore_x_icccm_move_resize_send */
/**
* Sets the hints of a window.
*/
EAPI void
ecore_x_icccm_hints_set(Ecore_X_Window window,
- int accepts_focus,
- Ecore_X_Window_State_Hint initial_state,
- Ecore_X_Pixmap icon_pixmap,
- Ecore_X_Pixmap icon_mask,
- Ecore_X_Window icon_window,
- Ecore_X_Window window_group,
+ int accepts_focus,
+ Ecore_X_Window_State_Hint initial_state,
+ Ecore_X_Pixmap icon_pixmap,
+ Ecore_X_Pixmap icon_mask,
+ Ecore_X_Window icon_window,
+ Ecore_X_Window window_group,
int is_urgent)
{
xcb_wm_hints_t hints;
xcb_wm_hints_set_normal(&hints);
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
xcb_wm_hints_set_iconic(&hints);
+
if (icon_pixmap != 0)
- xcb_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
+ xcb_wm_hints_set_icon_pixmap(&hints, icon_pixmap);
+
if (icon_mask != 0)
- xcb_wm_hints_set_icon_mask(&hints, icon_mask);
+ xcb_wm_hints_set_icon_mask(&hints, icon_mask);
+
if (icon_window != 0)
- xcb_wm_hints_set_icon_window(&hints, icon_window);
+ xcb_wm_hints_set_icon_window(&hints, icon_window);
+
if (window_group != 0)
- xcb_wm_hints_set_window_group(&hints, window_group);
+ xcb_wm_hints_set_window_group(&hints, window_group);
+
if (is_urgent)
- xcb_wm_hints_set_urgency(&hints);
+ xcb_wm_hints_set_urgency(&hints);
+
xcb_set_wm_hints(_ecore_xcb_conn, window, &hints);
-}
+} /* ecore_x_icccm_hints_set */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_HINTS,
0L, XCB_NUM_WM_HINTS_ELEMENTS);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_hints_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_hints_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_hints_get_fetch */
/**
* Gets the hints of a window.
* @ingroup Ecore_X_ICCCM_Group
*/
EAPI int
-ecore_x_icccm_hints_get(Ecore_X_Window window __UNUSED__,
- int *accepts_focus,
- Ecore_X_Window_State_Hint *initial_state,
- Ecore_X_Pixmap *icon_pixmap,
- Ecore_X_Pixmap *icon_mask,
- Ecore_X_Window *icon_window,
- Ecore_X_Window *window_group,
+ecore_x_icccm_hints_get(Ecore_X_Window window __UNUSED__,
+ int *accepts_focus,
+ Ecore_X_Window_State_Hint *initial_state,
+ Ecore_X_Pixmap *icon_pixmap,
+ Ecore_X_Pixmap *icon_mask,
+ Ecore_X_Window *icon_window,
+ Ecore_X_Window *window_group,
int *is_urgent)
{
- xcb_wm_hints_t hints;
+ xcb_wm_hints_t hints;
xcb_get_property_reply_t *reply;
- int32_t hints_flags;
- uint32_t hints_input;
- int32_t hints_initial_state;
- xcb_pixmap_t hints_icon_pixmap;
- xcb_pixmap_t hints_icon_mask;
- xcb_window_t hints_icon_window;
- xcb_window_t hints_window_group;
+ int32_t hints_flags;
+ uint32_t hints_input;
+ int32_t hints_initial_state;
+ xcb_pixmap_t hints_icon_pixmap;
+ xcb_pixmap_t hints_icon_mask;
+ xcb_window_t hints_icon_window;
+ xcb_window_t hints_window_group;
if (accepts_focus)
*accepts_focus = 1;
+
if (initial_state)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
+
if (icon_pixmap)
*icon_pixmap = 0;
+
if (icon_mask)
*icon_mask = 0;
+
if (icon_window)
*icon_window = 0;
+
if (window_group)
*window_group = 0;
+
if (is_urgent)
*is_urgent = 0;
(reply->format != 32))
return 0;
- memcpy(&hints, xcb_get_property_value(reply), reply->value_len);
- hints_flags = hints.flags;
- hints_input = hints.input;
- hints_initial_state = hints.initial_state;
- hints_icon_pixmap = hints.icon_pixmap;
- hints_icon_mask = hints.icon_mask;
- hints_icon_window = hints.icon_window;
- hints_window_group = hints.window_group;
+ memcpy(&hints, xcb_get_property_value(reply), reply->value_len);
+ hints_flags = hints.flags;
+ hints_input = hints.input;
+ hints_initial_state = hints.initial_state;
+ hints_icon_pixmap = hints.icon_pixmap;
+ hints_icon_mask = hints.icon_mask;
+ hints_icon_window = hints.icon_window;
+ hints_window_group = hints.window_group;
if ((hints_flags & XCB_WM_HINT_INPUT) && (accepts_focus))
{
else
*accepts_focus = 0;
}
+
if ((hints_flags & XCB_WM_HINT_STATE) && (initial_state))
{
- if (hints_initial_state == XCB_WM_STATE_WITHDRAWN)
+ if (hints_initial_state == XCB_WM_STATE_WITHDRAWN)
*initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
else if (hints_initial_state == XCB_WM_STATE_NORMAL)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
else if (hints_initial_state == XCB_WM_STATE_ICONIC)
*initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
+
if ((hints_flags & XCB_WM_HINT_ICON_PIXMAP) && (icon_pixmap))
{
*icon_pixmap = hints_icon_pixmap;
}
+
if ((hints_flags & XCB_WM_HINT_ICON_MASK) && (icon_mask))
{
*icon_mask = hints_icon_mask;
}
+
if ((hints_flags & XCB_WM_HINT_ICON_WINDOW) && (icon_window))
{
*icon_window = hints_icon_window;
}
+
if ((hints_flags & XCB_WM_HINT_WINDOW_GROUP) && (window_group))
{
if (reply->value_len < XCB_NUM_WM_HINTS_ELEMENTS)
else
*window_group = hints_window_group;
}
+
if ((hints_flags & XCB_WM_HINT_X_URGENCY) && (is_urgent))
{
*is_urgent = 1;
}
return 1;
-}
+} /* ecore_x_icccm_hints_get */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_SIZE_HINTS,
0L, 18);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_size_pos_hints_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_size_pos_hints_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_size_pos_hints_get_fetch */
/**
* Sets the hints of a window.
EAPI void
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window window,
int request_pos,
- Ecore_X_Gravity gravity,
- int min_w,
+ Ecore_X_Gravity gravity,
+ int min_w,
int min_h,
- int max_w,
+ int max_w,
int max_h,
- int base_w,
+ int base_w,
int base_h,
- int step_x,
+ int step_x,
int step_y,
- double min_aspect,
+ double min_aspect,
double max_aspect)
{
- xcb_size_hints_t hint;
+ xcb_size_hints_t hint;
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply ||
+ if (!reply ||
(reply->type != ECORE_X_ATOM_WM_SIZE_HINTS) ||
- ((reply->format != 8) &&
- (reply->format != 16) &&
- (reply->format != 32)) ||
+ ((reply->format != 8) &&
+ (reply->format != 16) &&
+ (reply->format != 32)) ||
(reply->value_len < 15))
return;
hint.flags = 0;
if (request_pos)
{
- hint.flags = XCB_SIZE_HINT_US_POSITION;
+ hint.flags = XCB_SIZE_HINT_US_POSITION;
}
+
if (gravity != ECORE_X_GRAVITY_NW)
{
- hint.win_gravity = (uint8_t)gravity;
+ hint.win_gravity = (uint8_t)gravity;
}
+
if ((min_w > 0) || (min_h > 0))
{
- hint.min_width = min_w;
- hint.min_height = min_h;
+ hint.min_width = min_w;
+ hint.min_height = min_h;
}
+
if ((max_w > 0) || (max_h > 0))
{
- hint.max_width = max_w;
- hint.max_height = max_h;
+ hint.max_width = max_w;
+ hint.max_height = max_h;
}
+
if ((base_w > 0) || (base_h > 0))
{
- hint.base_width = base_w;
- hint.base_height = base_h;
+ hint.base_width = base_w;
+ hint.base_height = base_h;
}
+
if ((step_x > 1) || (step_y > 1))
{
- hint.width_inc = step_x;
- hint.height_inc = step_y;
+ hint.width_inc = step_x;
+ hint.height_inc = step_y;
}
+
if ((min_aspect > 0.0) || (max_aspect > 0.0))
{
- xcb_size_hints_set_aspect(&hint,
+ xcb_size_hints_set_aspect(&hint,
(int32_t)(min_aspect * 10000),
10000,
(int32_t)(max_aspect * 10000),
10000);
}
+
xcb_set_wm_normal_hints(_ecore_xcb_conn, window, &hint);
-}
+} /* ecore_x_icccm_size_pos_hints_set */
/**
* Gets the hints of a window.
* @ingroup Ecore_X_ICCCM_Group
*/
EAPI int
-ecore_x_icccm_size_pos_hints_get(Ecore_X_Window window __UNUSED__,
- int *request_pos,
- Ecore_X_Gravity *gravity,
- int *min_w,
- int *min_h,
- int *max_w,
- int *max_h,
- int *base_w,
- int *base_h,
- int *step_x,
- int *step_y,
- double *min_aspect,
- double *max_aspect)
+ecore_x_icccm_size_pos_hints_get(Ecore_X_Window window __UNUSED__,
+ int *request_pos,
+ Ecore_X_Gravity *gravity,
+ int *min_w,
+ int *min_h,
+ int *max_w,
+ int *max_h,
+ int *base_w,
+ int *base_h,
+ int *step_x,
+ int *step_y,
+ double *min_aspect,
+ double *max_aspect)
{
- xcb_size_hints_t hint;
+ xcb_size_hints_t hint;
xcb_get_property_reply_t *reply;
- uint32_t flags;
- int32_t minw = 0;
- int32_t minh = 0;
- int32_t maxw = 32767;
- int32_t maxh = 32767;
- int32_t basew = -1;
- int32_t baseh = -1;
- int32_t stepx = -1;
- int32_t stepy = -1;
- double mina = 0.0;
- double maxa = 0.0;
-
- if (request_pos) *request_pos = 0;
- if (gravity) *gravity = ECORE_X_GRAVITY_NW;
- if (min_w) *min_w = minw;
- if (min_h) *min_h = minh;
- if (max_w) *max_w = maxw;
- if (max_h) *max_h = maxh;
- if (base_w) *base_w = basew;
- if (base_h) *base_h = baseh;
- if (step_x) *step_x = stepx;
- if (step_y) *step_y = stepy;
- if (min_aspect) *min_aspect = mina;
- if (max_aspect) *max_aspect = maxa;
+ uint32_t flags;
+ int32_t minw = 0;
+ int32_t minh = 0;
+ int32_t maxw = 32767;
+ int32_t maxh = 32767;
+ int32_t basew = -1;
+ int32_t baseh = -1;
+ int32_t stepx = -1;
+ int32_t stepy = -1;
+ double mina = 0.0;
+ double maxa = 0.0;
+ if (request_pos)
+ *request_pos = 0;
+
+ if (gravity)
+ *gravity = ECORE_X_GRAVITY_NW;
+
+ if (min_w)
+ *min_w = minw;
+
+ if (min_h)
+ *min_h = minh;
+
+ if (max_w)
+ *max_w = maxw;
+
+ if (max_h)
+ *max_h = maxh;
+
+ if (base_w)
+ *base_w = basew;
+
+ if (base_h)
+ *base_h = baseh;
+
+ if (step_x)
+ *step_x = stepx;
+
+ if (step_y)
+ *step_y = stepy;
+
+ if (min_aspect)
+ *min_aspect = mina;
+
+ if (max_aspect)
+ *max_aspect = maxa;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
if (!_ecore_x_icccm_size_hints_get(reply, ECORE_X_ATOM_WM_NORMAL_HINTS, &hint))
- return 0;
+ return 0;
flags = hint.flags;
- if ((flags & XCB_SIZE_HINT_US_POSITION) || (flags & XCB_SIZE_HINT_P_POSITION))
+ if ((flags & XCB_SIZE_HINT_US_POSITION) || (flags & XCB_SIZE_HINT_P_POSITION))
{
- if (request_pos)
- *request_pos = 1;
+ if (request_pos)
+ *request_pos = 1;
}
+
if (flags & XCB_SIZE_HINT_P_WIN_GRAVITY)
{
- if (gravity)
- *gravity = hint.win_gravity;
+ if (gravity)
+ *gravity = hint.win_gravity;
}
+
if (flags & XCB_SIZE_HINT_P_MIN_SIZE)
{
- minw = hint.min_width;
- minh = hint.min_height;
+ minw = hint.min_width;
+ minh = hint.min_height;
}
+
if (flags & XCB_SIZE_HINT_P_MAX_SIZE)
{
- maxw = hint.max_width;
- maxh = hint.max_height;
- if (maxw < minw)
- maxw = minw;
- if (maxh < minh)
- maxh = minh;
+ maxw = hint.max_width;
+ maxh = hint.max_height;
+ if (maxw < minw)
+ maxw = minw;
+
+ if (maxh < minh)
+ maxh = minh;
}
+
if (flags & XCB_SIZE_HINT_BASE_SIZE)
{
- basew = hint.base_width;
- baseh = hint.base_height;
- if (basew > minw)
- minw = basew;
- if (baseh > minh)
- minh = baseh;
+ basew = hint.base_width;
+ baseh = hint.base_height;
+ if (basew > minw)
+ minw = basew;
+
+ if (baseh > minh)
+ minh = baseh;
}
+
if (flags & XCB_SIZE_HINT_P_RESIZE_INC)
{
stepx = hint.width_inc;
stepy = hint.height_inc;
- if (stepx < 1)
- stepx = 1;
- if (stepy < 1)
- stepy = 1;
+ if (stepx < 1)
+ stepx = 1;
+
+ if (stepy < 1)
+ stepy = 1;
}
+
if (flags & XCB_SIZE_HINT_P_ASPECT)
{
- if (hint.min_aspect_den > 0)
- mina = ((double)hint.min_aspect_num) / ((double)hint.min_aspect_den);
- if (hint.max_aspect_den > 0)
- maxa = ((double)hint.max_aspect_num) / ((double)hint.max_aspect_den);
+ if (hint.min_aspect_den > 0)
+ mina = ((double)hint.min_aspect_num) / ((double)hint.min_aspect_den);
+
+ if (hint.max_aspect_den > 0)
+ maxa = ((double)hint.max_aspect_num) / ((double)hint.max_aspect_den);
}
if (min_w)
*min_w = minw;
+
if (min_h)
*min_h = minh;
+
if (max_w)
*max_w = maxw;
+
if (max_h)
*max_h = maxh;
+
if (base_w)
*base_w = basew;
+
if (base_h)
*base_h = baseh;
+
if (step_x)
*step_x = stepx;
+
if (step_y)
*step_y = stepy;
+
if (min_aspect)
*min_aspect = mina;
+
if (max_aspect)
*max_aspect = maxa;
return 1;
-}
+} /* ecore_x_icccm_size_pos_hints_get */
/**
* Set the title of a window
ecore_x_icccm_title_set(Ecore_X_Window window,
const char *title)
{
- if (!title) return;
+ if (!title)
+ return;
/* FIXME: to do: utf8 */
/* &xprop); */
/* #endif */
- xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
- ECORE_X_ATOM_WM_NAME, ECORE_X_ATOM_STRING, 8,
- strlen(title), title);
-}
+ xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
+ ECORE_X_ATOM_WM_NAME, ECORE_X_ATOM_STRING, 8,
+ strlen(title), title);
+} /* ecore_x_icccm_title_set */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 128);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_title_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_title_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_title_get_fetch */
/**
* Gets the title of a window.
EAPI char *
ecore_x_icccm_title_get(Ecore_X_Window window __UNUSED__)
{
- char *title = NULL;
+ char *title = NULL;
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
/* not in UTF8, so we convert */
else
{
- /* convert to utf8 */
+ /* convert to utf8 */
- /* FIXME: to do... */
+ /* FIXME: to do... */
/* #ifdef X_HAVE_UTF8_STRING */
/* ret = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xprop, */
}
return title;
-}
+} /* ecore_x_icccm_title_get */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_ATOM_ATOM, 0, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_protocol_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_protocol_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_protocol_get_fetch */
/**
* Set or unset a wm protocol property.
*/
EAPI void
ecore_x_icccm_protocol_set(Ecore_X_Window window,
- Ecore_X_WM_Protocol protocol,
+ Ecore_X_WM_Protocol protocol,
int on)
{
xcb_get_property_reply_t *reply;
- Ecore_X_Atom *protos = NULL;
- Ecore_X_Atom proto;
- uint32_t protos_count = 0;
- uint8_t already_set = 0;
+ Ecore_X_Atom *protos = NULL;
+ Ecore_X_Atom proto;
+ uint32_t protos_count = 0;
+ uint8_t already_set = 0;
/* Check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
proto = _ecore_xcb_atoms_wm_protocols[protocol];
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
if ((reply->type == ECORE_X_ATOM_ATOM) && (reply->format == 32))
{
if (on)
{
- Ecore_X_Atom *new_protos = NULL;
+ Ecore_X_Atom *new_protos = NULL;
+
+ if (already_set)
+ return;
+
+ new_protos = (Ecore_X_Atom *)malloc((protos_count + 1) * sizeof(Ecore_X_Atom));
+ if (!new_protos)
+ return;
- if (already_set)
- return;
- new_protos = (Ecore_X_Atom *)malloc((protos_count + 1) * sizeof(Ecore_X_Atom));
- if (!new_protos)
- return;
memcpy(new_protos, protos, reply->value_len);
- new_protos[protos_count] = proto;
- xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
+ new_protos[protos_count] = proto;
+ xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_ATOM_ATOM, 32,
protos_count + 1, new_protos);
- free(new_protos);
+ free(new_protos);
}
else
{
uint32_t i;
- if (!already_set)
- return;
- for (i = 0; i < protos_count; i++)
- {
- if (protos[i] == proto)
- {
- uint32_t j;
-
- for (j = i + 1; j < protos_count; j++)
- protos[j - 1] = protos[j];
- if (protos_count > 1)
+ if (!already_set)
+ return;
+
+ for (i = 0; i < protos_count; i++)
+ {
+ if (protos[i] == proto)
+ {
+ uint32_t j;
+
+ for (j = i + 1; j < protos_count; j++)
+ protos[j - 1] = protos[j];
+ if (protos_count > 1)
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_PROTOCOLS,
ECORE_X_ATOM_ATOM, 32,
protos_count - 1, protos);
- else
- xcb_delete_property(_ecore_xcb_conn, window,
+ else
+ xcb_delete_property(_ecore_xcb_conn, window,
ECORE_X_ATOM_WM_PROTOCOLS);
- return;
- }
- }
+
+ return;
+ }
+ }
}
-}
+} /* ecore_x_icccm_protocol_set */
/**
* Determines whether a protocol is set for a window.
* @ingroup Ecore_X_ICCCM_Group
*/
EAPI int
-ecore_x_icccm_protocol_isset(Ecore_X_Window window __UNUSED__,
- Ecore_X_WM_Protocol protocol)
+ecore_x_icccm_protocol_isset(Ecore_X_Window window __UNUSED__,
+ Ecore_X_WM_Protocol protocol)
{
xcb_get_property_reply_t *reply;
- Ecore_X_Atom *protos = NULL;
- Ecore_X_Atom proto;
- uint32_t i;
- uint8_t ret = 0;
+ Ecore_X_Atom *protos = NULL;
+ Ecore_X_Atom proto;
+ uint32_t i;
+ uint8_t ret = 0;
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
protos = (Ecore_X_Atom *)xcb_get_property_value(reply);
for (i = 0; i < reply->value_len; i++)
if (protos[i] == proto)
- {
- ret = 1;
- break;
- }
+ {
+ ret = 1;
+ break;
+ }
return ret;
-}
+} /* ecore_x_icccm_protocol_isset */
/**
* Set a window name & class.
{
char *class_string;
char *s;
- int length_name;
- int length_class;
+ int length_name;
+ int length_class;
length_name = strlen(name);
length_class = strlen(class);
class_string = (char *)malloc(sizeof(char) * (length_name + length_class + 2));
if (!class_string)
- return;
+ return;
+
s = class_string;
if (length_name)
{
- strcpy(s, name);
- s += length_name + 1;
+ strcpy(s, name);
+ s += length_name + 1;
}
else
- *s++ = '\0';
+ *s++ = '\0';
+
if(length_class)
- strcpy(s, class);
+ strcpy(s, class);
else
- *s = '\0';
+ *s = '\0';
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_CLASS, ECORE_X_ATOM_STRING, 8,
length_name + length_class + 2, (void *)class_string);
free(class_string);
-}
+} /* ecore_x_icccm_name_class_set */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_STRING,
0, 2048L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_name_class_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_name_class_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_name_class_get_fetch */
/**
* Get a window name and class.
*/
EAPI void
ecore_x_icccm_name_class_get(Ecore_X_Window window __UNUSED__,
- char **name,
- char **class)
+ char **name,
+ char **class)
{
xcb_get_property_reply_t *reply;
- void *data;
- char *n = NULL;
- char *c = NULL;
- int length;
- int length_name;
- int length_class;
+ void *data;
+ char *n = NULL;
+ char *c = NULL;
+ int length;
+ int length_name;
+ int length_class;
+ if (name)
+ *name = NULL;
- if (name) *name = NULL;
- if (class) *class = NULL;
+ if (class)
+ *class = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
n = (char *)malloc(sizeof(char) * (length_name + 1));
if (!n)
return;
+
length_class = length - length_name - 1;
c = (char *)malloc(sizeof(char) * (length_class + 1));
if (!c)
if (name)
*name = n;
+
if (class)
*class = c;
-}
+} /* ecore_x_icccm_name_class_get */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_client_machine_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_client_machine_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_client_machine_get_fetch */
/**
* Get a window client machine string.
name = ecore_x_window_prop_string_get(window, ECORE_X_ATOM_WM_CLIENT_MACHINE);
return name;
-}
+} /* ecore_x_icccm_client_machine_get */
/**
* Sets the WM_COMMAND property for @a win.
{
void *buf;
char *b;
- int nbytes;
- int i;
+ int nbytes;
+ int i;
for (i = 0, nbytes = 0; i < argc; i++)
{
}
buf = malloc(sizeof(char) * nbytes);
if (!buf)
- return;
+ return;
+
b = (char *)buf;
for (i = 0; i < argc; i++)
{
b += strlen(argv[i]) + 1;
}
else
- *b++ = '\0';
+ *b++ = '\0';
}
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8,
nbytes, buf);
free(buf);
-}
+} /* ecore_x_icccm_command_set */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_command_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_command_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_command_get_fetch */
/**
* Get the WM_COMMAND property for a window.
*/
EAPI void
ecore_x_icccm_command_get(Ecore_X_Window window __UNUSED__,
- int *argc,
- char ***argv)
+ int *argc,
+ char ***argv)
{
xcb_get_property_reply_t *reply;
- char **v;
- char *data;
- char *cp;
- char *start;
- uint32_t value_len;
- int c;
- int i;
- int j;
-
- if (argc) *argc = 0;
- if (argv) *argv = NULL;
+ char **v;
+ char *data;
+ char *cp;
+ char *start;
+ uint32_t value_len;
+ int c;
+ int i;
+ int j;
+
+ if (argc)
+ *argc = 0;
+
+ if (argv)
+ *argv = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
- return;
+ return;
if ((reply->type != ECORE_X_ATOM_STRING) ||
(reply->format != 8))
value_len = reply->value_len;
data = (char *)xcb_get_property_value(reply);
if (value_len && (data[value_len - 1] == '\0'))
- value_len--;
+ value_len--;
c = 1;
for (cp = (char *)data, i = value_len; i > 0; cp++, i--)
{
- if (*cp == '\0') c++;
+ if (*cp == '\0')
+ c++;
}
v = (char **)malloc((c + 1) * sizeof(char *));
if (!v)
start = (char *)malloc((value_len + 1) * sizeof(char));
if (!start)
{
- free(v);
- return;
+ free(v);
+ return;
}
- memcpy (start, (char *) data, value_len);
- start[value_len] = '\0';
- for (cp = start, i = value_len + 1, j = 0; i > 0; cp++, i--) {
- if (*cp == '\0') {
- v[j] = start;
- start = (cp + 1);
- j++;
- }
- }
+ memcpy (start, (char *)data, value_len);
+ start[value_len] = '\0';
+ for (cp = start, i = value_len + 1, j = 0; i > 0; cp++, i--) {
+ if (*cp == '\0')
+ {
+ v[j] = start;
+ start = (cp + 1);
+ j++;
+ }
+ }
if (c < 1)
{
- free(v);
- return;
+ free(v);
+ return;
}
- if (argc) *argc = c;
+ if (argc)
+ *argc = c;
+
if (argv)
{
- (*argv) = malloc(c * sizeof(char *));
- if (!*argv)
- {
- free(v);
- if (argc) *argc = 0;
- return;
- }
- for (i = 0; i < c; i++)
- {
- if (v[i])
- (*argv)[i] = strdup(v[i]);
- else
- (*argv)[i] = strdup("");
- }
+ (*argv) = malloc(c * sizeof(char *));
+ if (!*argv)
+ {
+ free(v);
+ if (argc)
+ *argc = 0;
+
+ return;
+ }
+
+ for (i = 0; i < c; i++)
+ {
+ if (v[i])
+ (*argv)[i] = strdup(v[i]);
+ else
+ (*argv)[i] = strdup("");
+ }
}
free(v);
-}
+} /* ecore_x_icccm_command_get */
/**
* Set a window icon name.
/* XStdICCTextStyle, &xprop); */
/* #endif */
- xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
- ECORE_X_ATOM_WM_ICON_NAME, ECORE_X_ATOM_WM_ICON_NAME,
- 8, strlen(title), title);
-}
+ xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
+ ECORE_X_ATOM_WM_ICON_NAME, ECORE_X_ATOM_WM_ICON_NAME,
+ 8, strlen(title), title);
+} /* ecore_x_icccm_icon_name_set */
/*
* Sends the GetProperty request.
XCB_GET_PROPERTY_TYPE_ANY,
0L, 128L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_icon_name_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_icon_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_icon_name_get_fetch */
/**
* Get a window icon name.
ecore_x_icccm_icon_name_get(Ecore_X_Window window __UNUSED__)
{
xcb_get_property_reply_t *reply;
- char *title = NULL;
+ char *title = NULL;
reply = _ecore_xcb_reply_get();
- if (!reply) return NULL;
+ if (!reply)
+ return NULL;
ERR("reply->bytes_afer (should be 0): %d", ((xcb_get_property_reply_t *)reply)->bytes_after);
{
/* FIXME: do the UTF8... */
- /* convert to utf8 */
+ /* convert to utf8 */
/* #ifdef X_HAVE_UTF8_STRING */
/* ret = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xprop, */
/* &list, &num); */
}
return title;
-}
+} /* ecore_x_icccm_icon_name_get */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0L, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_colormap_window_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_colormap_window_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_colormap_window_get_fetch */
/**
* Add a subwindow to the list of windows that need a different colormap installed.
ecore_x_icccm_colormap_window_set(Ecore_X_Window window,
Ecore_X_Window sub_window)
{
- void *data = NULL;
+ void *data = NULL;
xcb_get_property_reply_t *reply;
- uint32_t num;
+ uint32_t num;
if (window == 0)
- window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
reply = _ecore_xcb_reply_get();
if (!reply || (reply->format != 32) || (reply->value_len == 0))
data = calloc(1, sizeof(Ecore_X_Window));
if (!data)
{
- if (reply) free(reply);
+ if (reply)
+ free(reply);
+
return;
}
+
num = 1;
}
else
{
Ecore_X_Window *newset = NULL;
Ecore_X_Window *oldset = NULL;
- uint32_t i;
+ uint32_t i;
num = reply->value_len;
data = calloc(num + 1, sizeof(Ecore_X_Window));
if (!data)
- return;
+ return;
newset = (Ecore_X_Window *)data;
oldset = (Ecore_X_Window *)xcb_get_property_value(reply);
ECORE_X_ATOM_WINDOW,
32, num, data);
free(data);
-}
+} /* ecore_x_icccm_colormap_window_set */
/**
* Remove a window from the list of colormap windows.
ecore_x_icccm_colormap_window_unset(Ecore_X_Window window,
Ecore_X_Window sub_window)
{
- void *data = NULL;
- Ecore_X_Window *oldset = NULL;
- Ecore_X_Window *newset = NULL;
+ void *data = NULL;
+ Ecore_X_Window *oldset = NULL;
+ Ecore_X_Window *newset = NULL;
xcb_get_property_reply_t *reply;
- uint32_t num;
- uint32_t i;
- uint32_t j;
- uint32_t k = 0;
+ uint32_t num;
+ uint32_t i;
+ uint32_t j;
+ uint32_t k = 0;
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
reply = _ecore_xcb_reply_get();
if (!reply || (reply->format != 32) || (reply->value_len == 0))
- return;
+ return;
num = reply->value_len;
oldset = (Ecore_X_Window *)xcb_get_property_value(reply);
for (i = 0; i < num; i++)
{
- if (oldset[i] == sub_window)
- {
- if (num == 1)
- {
- xcb_delete_property(_ecore_xcb_conn, window,
+ if (oldset[i] == sub_window)
+ {
+ if (num == 1)
+ {
+ xcb_delete_property(_ecore_xcb_conn, window,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
- return;
- }
- else
- {
- data = calloc(num - 1, sizeof(Ecore_X_Window));
- newset = (Ecore_X_Window *)data;
- for (j = 0; j < num; ++j)
- if (oldset[j] != sub_window)
- newset[k++] = oldset[j];
+ return;
+ }
+ else
+ {
+ data = calloc(num - 1, sizeof(Ecore_X_Window));
+ newset = (Ecore_X_Window *)data;
+ for (j = 0; j < num; ++j)
+ if (oldset[j] != sub_window)
+ newset[k++] = oldset[j];
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
ECORE_X_ATOM_WINDOW,
32, k, data);
- free(newset);
- return;
- }
- }
+ free(newset);
+ return;
+ }
+ }
}
-}
+} /* ecore_x_icccm_colormap_window_unset */
/**
* Specify that a window is transient for another top-level window and should be handled accordingly.
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_TRANSIENT_FOR, ECORE_X_ATOM_WINDOW, 32,
1, (void *)&forwindow);
-}
+} /* ecore_x_icccm_transient_for_set */
/**
* Remove the transient_for setting from a window.
ecore_x_icccm_transient_for_unset(Ecore_X_Window window)
{
xcb_delete_property(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_TRANSIENT_FOR);
-}
+} /* ecore_x_icccm_transient_for_unset */
/*
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0L, 1L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_icccm_transient_for_get_prefetch */
/*
* Gets the reply of the GetProperty request sent by ecore_x_icccm_transient_for_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_transient_for_get_fetch */
/**
* Get the window this window is transient for, if any.
ecore_x_icccm_transient_for_get(Ecore_X_Window window __UNUSED__)
{
xcb_get_property_reply_t *reply;
- Ecore_X_Window forwin = 0;
+ Ecore_X_Window forwin = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return forwin;
+ return forwin;
if ((reply->format != 32) ||
(reply->value_len == 0) ||
(reply->type != ECORE_X_ATOM_WINDOW))
return forwin;
-
+
forwin = *(Ecore_X_Window *)xcb_get_property_value(reply);
return forwin;
-}
+} /* ecore_x_icccm_transient_for_get */
/**
* Set the window role hint.
const char *role)
{
ecore_x_window_prop_string_set(window, ECORE_X_ATOM_WM_WINDOW_ROLE,
- (char *)role);
-}
+ (char *)role);
+} /* ecore_x_icccm_window_role_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_WM_WINDOW_ROLE, XCB_GET_PROPERTY_TYPE_ANY,
0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_icccm_window_role_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icccm_window_role_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_window_role_get_fetch */
/**
* Get the window role.
ecore_x_icccm_window_role_get(Ecore_X_Window window)
{
return ecore_x_window_prop_string_get(window, ECORE_X_ATOM_WM_WINDOW_ROLE);
-}
+} /* ecore_x_icccm_window_role_get */
/**
* Set the window's client leader.
Ecore_X_Window leader)
{
ecore_x_window_prop_window_set(window, ECORE_X_ATOM_WM_CLIENT_LEADER,
- &leader, 1);
-}
+ &leader, 1);
+} /* ecore_x_icccm_client_leader_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_icccm_client_leader_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icccm_client_leader_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_icccm_client_leader_get_fetch */
/**
* Get the window's client leader.
Ecore_X_Window leader;
if (ecore_x_window_prop_window_get(window, ECORE_X_ATOM_WM_CLIENT_LEADER,
- &leader, 1) > 0)
+ &leader, 1) > 0)
return leader;
return 0;
-}
+} /* ecore_x_icccm_client_leader_get */
/**
* Send the ClientMessage event with the ChangeState property.
{
xcb_client_message_event_t ev;
- if (!window) return;
- if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!window)
+ return;
+
+ if (!root)
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
/* send_event is bit 7 (0x80) of response_type */
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
xcb_send_event(_ecore_xcb_conn, 0, root,
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
-}
+} /* ecore_x_icccm_iconic_request_send */
/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
/* hints. each should go in their own file/section so we know which */
/*
* Various MWM related functions.
- *
+ *
* This is ALL the code involving anything MWM related. for both WM and
* client.
*/
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/**
* @defgroup Ecore_X_MWM_Group MWM related functions.
*
* Functions related to MWM.
*/
-#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
-#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
-#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
-#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
+#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
+#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
+#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
+#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
typedef struct _mwmhints
{
}
MWMHints;
-
/**
* Sends the GetProperty request.
* @param window Window whose MWM hints are requested.
ECORE_X_ATOM_MOTIF_WM_HINTS,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_mwm_hints_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_mwm_hints_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_mwm_hints_get_fetch */
/**
* To document.
* @ingroup Ecore_X_MWM_Group
*/
EAPI int
-ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_MWM_Hint_Func *fhint,
- Ecore_X_MWM_Hint_Decor *dhint,
- Ecore_X_MWM_Hint_Input *ihint)
+ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
+ Ecore_X_MWM_Hint_Func *fhint,
+ Ecore_X_MWM_Hint_Decor *dhint,
+ Ecore_X_MWM_Hint_Input *ihint)
{
- MWMHints *mwmhints = NULL;
- int ret = 0;
+ MWMHints *mwmhints = NULL;
+ int ret = 0;
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (dhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
- *dhint = mwmhints->decorations;
+ *dhint = mwmhints->decorations;
else
- *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
+ *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
}
+
if (fhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
- *fhint = mwmhints->functions;
+ *fhint = mwmhints->functions;
else
- *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
+ *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
}
+
if (ihint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
- *ihint = mwmhints->inputmode;
+ *ihint = mwmhints->inputmode;
else
- *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
+ *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
}
+
ret = 1;
}
return ret;
-}
+} /* ecore_x_mwm_hints_get */
/**
* Sets the borderless flag of a window using MWM.
data[0] = 2; /* just set the decorations hint! */
data[2] = !borderless;
-
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_MOTIF_WM_HINTS, ECORE_X_ATOM_MOTIF_WM_HINTS,
32, 5, data);
-}
+} /* ecore_x_mwm_borderless_set */
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/**
* @defgroup Ecore_X_NetWM_Group Extended Window Manager Hint (EWMH) functions
*
* Functions related to the Extended Window Manager Hint (EWMH).
*/
-
-typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
+typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
struct _Ecore_X_Startup_Info
{
Ecore_X_Window win;
- int init;
+ int init;
- int buffer_size;
- char *buffer;
+ int buffer_size;
+ char *buffer;
- int length;
+ int length;
/* These are the sequence info fields */
- char *id;
- char *name;
- int screen;
- char *bin;
- char *icon;
- int desktop;
- int timestamp;
- char *description;
- char *wmclass;
- int silent;
+ char *id;
+ char *name;
+ int screen;
+ char *bin;
+ char *icon;
+ int desktop;
+ int timestamp;
+ char *description;
+ char *wmclass;
+ int silent;
};
#if 0
-static void _ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window, Ecore_X_Atom atom);
-static void _ecore_x_window_prop_string_utf8_get_fetch(void);
-#endif
-static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window window, Ecore_X_Atom atom, const char *str);
-static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window window, Ecore_X_Atom atom);
+static void _ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window, Ecore_X_Atom atom);
+static void _ecore_x_window_prop_string_utf8_get_fetch(void);
+#endif /* if 0 */
+static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window window, Ecore_X_Atom atom, const char *str);
+static char * _ecore_x_window_prop_string_utf8_get(Ecore_X_Window window, Ecore_X_Atom atom);
#if 0 /* Unused */
-static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
-static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char *data);
-#endif
-static void _ecore_x_netwm_startup_info_free(void *data);
+static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
+static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char *data);
+#endif /* if 0 */
+static void _ecore_x_netwm_startup_info_free(void *data);
/*
* Local variables
ecore_x_netwm_init(void)
{
startup_info = eina_hash_string_superfast_new(_ecore_x_netwm_startup_info_free);
-}
+} /* ecore_x_netwm_init */
/**
* Shutdown the NetWM module
ecore_x_netwm_shutdown(void)
{
if (startup_info)
- eina_hash_free(startup_info);
+ eina_hash_free(startup_info);
+
startup_info = NULL;
-}
+} /* ecore_x_netwm_shutdown */
/**
* Set the _NET_SUPPORTING_WM_CHECK property.
EAPI void
ecore_x_netwm_wm_identify(Ecore_X_Window root,
Ecore_X_Window check,
- const char *wm_name)
+ const char *wm_name)
{
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
ecore_x_window_prop_window_set(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
_ecore_x_window_prop_string_utf8_set(check, ECORE_X_ATOM_NET_WM_NAME, wm_name);
/* This one isn't mandatory */
_ecore_x_window_prop_string_utf8_set(root, ECORE_X_ATOM_NET_WM_NAME, wm_name);
-}
+} /* ecore_x_netwm_wm_identify */
/**
* Set the _NET_SUPPORTED property.
int num)
{
ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED, supported, num);
-}
+} /* ecore_x_netwm_supported_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_SUPPORTED, ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_supported_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_supported_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_supported_get_fetch */
/**
* Get the hints supported by the Window Manager.
{
int num_ret;
- if (num) *num = 0UL;
- if (supported) *supported = NULL;
+ if (num)
+ *num = 0UL;
+
+ if (supported)
+ *supported = NULL;
num_ret = ecore_x_window_prop_xid_list_get(root,
ECORE_X_ATOM_NET_SUPPORTED,
if (num_ret <= 0)
return 0;
- if (num) *num = (uint32_t)num_ret;
+ if (num)
+ *num = (uint32_t)num_ret;
+
return 1;
-}
+} /* ecore_x_netwm_supported_get */
/**
* Set the _NET_NUMBER_OF_DESKTOPS property.
unsigned int n_desks)
{
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
- &n_desks, 1);
-}
+ &n_desks, 1);
+} /* ecore_x_netwm_desk_count_set */
/**
* Set the _NET_VIRTUAL_ROOTS property.
*/
EAPI void
ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
- Ecore_X_Window *vroots,
+ Ecore_X_Window *vroots,
unsigned int n_desks)
{
ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, vroots, n_desks);
-}
+} /* ecore_x_netwm_desk_roots_set */
/**
* Set the _NET_DESKTOP_NAMES property.
*/
EAPI void
ecore_x_netwm_desk_names_set(Ecore_X_Window root,
- const char **names,
+ const char **names,
unsigned int n_desks)
{
- char ss[32];
- char *buf;
+ char ss[32];
+ char *buf;
const char *s;
- uint32_t i;
- uint32_t len;
- uint32_t l;
+ uint32_t i;
+ uint32_t len;
+ uint32_t l;
buf = NULL;
len = 0;
for (i = 0; i < n_desks; i++)
{
- s = (names) ? names[i] : NULL;
- if (!s)
- {
- /* Default to "Desk-<number>" */
- sprintf(ss, "Desk-%d", i);
- s = ss;
- }
-
- l = strlen(s) + 1;
- buf = realloc(buf, len + l);
- memcpy(buf + len, s, l);
- len += l;
+ s = (names) ? names[i] : NULL;
+ if (!s)
+ {
+ /* Default to "Desk-<number>" */
+ sprintf(ss, "Desk-%d", i);
+ s = ss;
+ }
+
+ l = strlen(s) + 1;
+ buf = realloc(buf, len + l);
+ memcpy(buf + len, s, l);
+ len += l;
}
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, root,
ECORE_X_ATOM_UTF8_STRING,
8, len, (const void *)buf);
free(buf);
-}
+} /* ecore_x_netwm_desk_names_set */
/**
* Set the _NET_DESKTOP_GEOMETRY property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_DESKTOP_GEOMETRY,
size, 2);
-}
+} /* ecore_x_netwm_desk_size_set */
/**
* Set the _NET_DESKTOP_VIEWPORT property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
origins, 2 * n_desks);
-}
+} /* ecore_x_netwm_desk_viewports_set */
/**
* Set the _NET_DESKTOP_LAYOUT property.
layout[2] = rows;
layout[3] = starting_corner;
ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, layout, 4);
-}
+} /* ecore_x_netwm_desk_layout_set */
/**
* Set the _NET_WORKAREA property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_WORKAREA,
areas, 4 * n_desks);
-}
+} /* ecore_x_netwm_desk_workareas_set */
/**
* Set the _NET_CURRENT_DESKTOP property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_CURRENT_DESKTOP,
&desk, 1);
-}
+} /* ecore_x_netwm_desk_current_set */
/**
* Set the _NET_SHOWING_DESKTOP property.
ecore_x_window_prop_card32_set(root,
ECORE_X_ATOM_NET_SHOWING_DESKTOP,
&val, 1);
-}
+} /* ecore_x_netwm_showing_desktop_set */
/*
* Client status
ecore_x_window_prop_window_set(root,
ECORE_X_ATOM_NET_CLIENT_LIST,
p_clients, n_clients);
-}
+} /* ecore_x_netwm_client_list_set */
/**
* Set the _NET_CLIENT_LIST_STACKING property.
ecore_x_window_prop_window_set(root,
ECORE_X_ATOM_NET_CLIENT_LIST_STACKING,
p_clients, n_clients);
-}
+} /* ecore_x_netwm_client_list_stacking_set */
/**
* Set the _NET_ACTIVE_WINDOW property.
ecore_x_window_prop_window_set(root,
ECORE_X_ATOM_NET_ACTIVE_WINDOW,
&window, 1);
-}
+} /* ecore_x_netwm_client_active_set */
/**
* Set the _NET_WM_NAME property.
const char *name)
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_NAME, name);
-}
+} /* ecore_x_netwm_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_name_get_fetch */
/**
* Get the title of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_WM_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_WM_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_name_get */
/**
* Set the _NET_STARTUP_ID property.
const char *id)
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_STARTUP_ID, id);
-}
+} /* ecore_x_netwm_startup_id_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_STARTUP_ID, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_startup_id_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_startup_id_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_startup_id_get_fetch */
/**
* Get the startup ID name of a window.
char **id)
{
if (id)
- *id = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_STARTUP_ID);
+ *id = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_STARTUP_ID);
+
return 1;
-}
+} /* ecore_x_netwm_startup_id_get */
/**
* Set the _NET_WM_VISIBLE_NAME property.
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
name);
-}
+} /* ecore_x_netwm_visible_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_VISIBLE_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_visible_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_visible_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_visible_name_get_fetch */
/**
* Get the visible title of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window,
- ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window,
+ ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_visible_name_get */
/**
* Set the _NET_WM_ICON_NAME property.
{
_ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_ICON_NAME,
name);
-}
+} /* ecore_x_netwm_icon_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ICON_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_icon_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_icon_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_icon_name_get_fetch */
/**
* Get the icon name of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window,
- ECORE_X_ATOM_NET_WM_ICON_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window,
+ ECORE_X_ATOM_NET_WM_ICON_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_icon_name_get */
/**
* Set the _NET_WM_VISIBLE_ICON_NAME property.
_ecore_x_window_prop_string_utf8_set(window,
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
name);
-}
+} /* ecore_x_netwm_visible_icon_name_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_visible_icon_name_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_visible_icon_name_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_visible_icon_name_get_fetch */
/**
* Get the visible icon name of a window.
char **name)
{
if (name)
- *name = _ecore_x_window_prop_string_utf8_get(window,
- ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
+ *name = _ecore_x_window_prop_string_utf8_get(window,
+ ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
+
return 1;
-}
+} /* ecore_x_netwm_visible_icon_name_get */
/**
* Set the _NET_WM_DESKTOP property.
unsigned int desk)
{
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
-}
+} /* ecore_x_netwm_desktop_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_DESKTOP, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_desktop_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_desktop_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_desktop_get_fetch */
/**
* Get the visible icon name of a window.
*/
EAPI int
ecore_x_netwm_desktop_get(Ecore_X_Window window,
- unsigned int *desk)
+ unsigned int *desk)
{
- int ret;
+ int ret;
uint32_t tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_DESKTOP,
- &tmp, 1);
+ &tmp, 1);
+
+ if (desk)
+ *desk = tmp;
- if (desk) *desk = tmp;
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_desktop_get */
/**
* Set the _NET_WM_STRUT property.
strut[2] = top;
strut[3] = bottom;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
-}
+} /* ecore_x_netwm_strut_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_STRUT, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_strut_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_strut_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_strut_get_fetch */
/*
* _NET_WM_STRUT is deprecated
int *bottom)
{
uint32_t strut[4];
- int ret = 0;
+ int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (left)
+ *left = strut[0];
+
+ if (right)
+ *right = strut[1];
+
+ if (top)
+ *top = strut[2];
- if (left) *left = strut[0];
- if (right) *right = strut[1];
- if (top) *top = strut[2];
- if (bottom) *bottom = strut[3];
+ if (bottom)
+ *bottom = strut[3];
return 1;
-}
+} /* ecore_x_netwm_strut_get */
/**
* Set the _NET_WM_STRUT_PARTIAL property.
strut[10] = bottom_start_x;
strut[11] = bottom_end_x;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
-}
+} /* ecore_x_netwm_strut_partial_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_strut_partial_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_strut_partial_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_strut_partial_get_fetch */
/**
* Get the space at the edje of the screen of a window.
int *bottom_end_x)
{
uint32_t strut[12];
- int ret = 0;
+ int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
if (ret != 12)
- return 0;
-
- if (left) *left = strut[0];
- if (right) *right = strut[1];
- if (top) *top = strut[2];
- if (bottom) *bottom = strut[3];
- if (left_start_y) *left_start_y = strut[4];
- if (left_end_y) *left_end_y = strut[5];
- if (right_start_y) *right_start_y = strut[6];
- if (right_end_y) *right_end_y = strut[7];
- if (top_start_x) *top_start_x = strut[8];
- if (top_end_x) *top_end_x = strut[9];
- if (bottom_start_x) *bottom_start_x = strut[10];
- if (bottom_end_x) *bottom_end_x = strut[11];
+ return 0;
+
+ if (left)
+ *left = strut[0];
+
+ if (right)
+ *right = strut[1];
+
+ if (top)
+ *top = strut[2];
+
+ if (bottom)
+ *bottom = strut[3];
+
+ if (left_start_y)
+ *left_start_y = strut[4];
+
+ if (left_end_y)
+ *left_end_y = strut[5];
+
+ if (right_start_y)
+ *right_start_y = strut[6];
+
+ if (right_end_y)
+ *right_end_y = strut[7];
+
+ if (top_start_x)
+ *top_start_x = strut[8];
+
+ if (top_end_x)
+ *top_end_x = strut[9];
+
+ if (bottom_start_x)
+ *bottom_start_x = strut[10];
+
+ if (bottom_end_x)
+ *bottom_end_x = strut[11];
+
return 1;
-}
+} /* ecore_x_netwm_strut_partial_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ICON, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_icons_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icons_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_icons_get_fetch */
/**
* Retrieve hte possible icons of a window.
uint32_t *data;
uint32_t *p;
uint32_t *src;
- uint32_t icons;
- uint32_t len;
- uint32_t i;
- int num_ret;
+ uint32_t icons;
+ uint32_t len;
+ uint32_t i;
+ int num_ret;
+
+ if (num)
+ *num = 0UL;
- if (num) *num = 0UL;
- if (icon) *icon = NULL;
+ if (icon)
+ *icon = NULL;
num_ret = ecore_x_window_prop_card32_list_get(window,
ECORE_X_ATOM_NET_WM_ICON,
&data);
if ((num_ret <= 0) || !data)
- return 0;
+ return 0;
if (num_ret < 2)
{
- free(data);
- return 0;
+ free(data);
+ return 0;
}
/* Check how many icons there are */
p = data;
while (p)
{
- len = p[0] * p[1];
- p += (len + 2);
- if ((p - data) > num_ret)
- {
- free(data);
- return 0;
- }
- icons++;
-
- if ((p - data) == num_ret)
- p = NULL;
+ len = p[0] * p[1];
+ p += (len + 2);
+ if ((p - data) > num_ret)
+ {
+ free(data);
+ return 0;
+ }
+
+ icons++;
+
+ if ((p - data) == num_ret)
+ p = NULL;
}
- if (num) *num = icons;
+ if (num)
+ *num = icons;
/* If the user doesn't want the icons, return */
if (!icon)
{
- free(data);
- return 1;
+ free(data);
+ return 1;
}
/* Allocate memory */
*icon = malloc(icons * sizeof(Ecore_X_Icon));
if (!(*icon))
{
- free(data);
- return 0;
+ free(data);
+ return 0;
}
/* Fetch the icons */
p = data;
for (i = 0; i < icons; i++)
{
- uint32_t *ps, *pd, *pe;
-
- len = p[0] * p[1];
- ((*icon)[i]).width = p[0];
- ((*icon)[i]).height = p[1];
- src = &(p[2]);
- ((*icon)[i]).data = malloc(len * sizeof(uint32_t));
- if (!((*icon)[i]).data)
- {
- while (i)
- free(((*icon)[--i]).data);
- free(*icon);
- free(data);
- return 0;
- }
-
- pd = ((*icon)[i]).data;
- ps = src;
- pe = ps + len;
- for (; ps < pe; ps++)
- {
- uint32_t r, g, b, a;
-
- a = (*ps >> 24) & 0xff;
- r = (((*ps >> 16) & 0xff) * a) / 255;
- g = (((*ps >> 8) & 0xff) * a) / 255;
- b = (((*ps ) & 0xff) * a) / 255;
- *pd = (a << 24) | (r << 16) | (g << 8) | (b);
- pd++;
- }
- p += (len + 2);
+ uint32_t *ps, *pd, *pe;
+
+ len = p[0] * p[1];
+ ((*icon)[i]).width = p[0];
+ ((*icon)[i]).height = p[1];
+ src = &(p[2]);
+ ((*icon)[i]).data = malloc(len * sizeof(uint32_t));
+ if (!((*icon)[i]).data)
+ {
+ while (i)
+ free(((*icon)[--i]).data);
+ free(*icon);
+ free(data);
+ return 0;
+ }
+
+ pd = ((*icon)[i]).data;
+ ps = src;
+ pe = ps + len;
+ for (; ps < pe; ps++)
+ {
+ uint32_t r, g, b, a;
+
+ a = (*ps >> 24) & 0xff;
+ r = (((*ps >> 16) & 0xff) * a) / 255;
+ g = (((*ps >> 8) & 0xff) * a) / 255;
+ b = (((*ps) & 0xff) * a) / 255;
+ *pd = (a << 24) | (r << 16) | (g << 8) | (b);
+ pd++;
+ }
+ p += (len + 2);
}
free(data);
return 1;
-}
+} /* ecore_x_netwm_icons_get */
/**
* Set the _NET_WM_ICON_GEOMETRY property.
geometry[2] = (uint32_t)width;
geometry[3] = (uint32_t)height;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
-}
+} /* ecore_x_netwm_icon_geometry_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_icon_geometry_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_icon_geometry_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_icon_geometry_get_fetch */
/**
* Get the geometry of an icon.
int *height)
{
uint32_t geometry[4];
- int ret;
+ int ret;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (x)
+ *x = geometry[0];
+
+ if (y)
+ *y = geometry[1];
- if (x) *x = geometry[0];
- if (y) *y = geometry[1];
- if (width) *width = geometry[2];
- if (height) *height = geometry[3];
+ if (width)
+ *width = geometry[2];
+
+ if (height)
+ *height = geometry[3];
return 1;
-}
+} /* ecore_x_netwm_icon_geometry_get */
/**
* Set the _NET_WM_PID property.
tmp = pid;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_PID,
- &tmp, 1);
-}
+ &tmp, 1);
+} /* ecore_x_netwm_pid_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_PID, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_pid_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_pid_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_pid_get_fetch */
/**
* Get the process ID of a client window.
uint32_t tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_PID,
- &tmp, 1);
- if (pid) *pid = tmp;
+ &tmp, 1);
+ if (pid)
+ *pid = tmp;
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_pid_get */
/**
* Set the _NET_WM_HANDLED_ICONS property.
ecore_x_netwm_handled_icons_set(Ecore_X_Window window)
{
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
- NULL, 0);
-}
+ NULL, 0);
+} /* ecore_x_netwm_handled_icons_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_HANDLED_ICONS, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_handled_icons_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_handled_icons_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_handled_icons_get_fetch */
/**
* Return wheter the Client handles icons or not.
{
int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
- NULL, 0);
+ NULL, 0);
return (ret == 0) ? 1 : 0;
-}
+} /* ecore_x_netwm_handled_icons_get */
/**
* Set the _NET_WM_USER_TIME property.
unsigned int time)
{
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_USER_TIME,
- &time, 1);
-}
+ &time, 1);
+} /* ecore_x_netwm_user_time_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_USER_TIME, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_user_time_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_user_time_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_user_time_get_fetch */
/**
* Get the last user activity time in the window.
uint32_t tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_USER_TIME,
- &tmp, 1);
- if (time) *time = tmp;
+ &tmp, 1);
+ if (time)
+ *time = tmp;
+
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_user_time_get */
Ecore_X_Window_State
_ecore_x_netwm_state_get(Ecore_X_Atom a)
{
if (a == ECORE_X_ATOM_NET_WM_STATE_MODAL)
- return ECORE_X_WINDOW_STATE_MODAL;
+ return ECORE_X_WINDOW_STATE_MODAL;
else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY)
- return ECORE_X_WINDOW_STATE_STICKY;
+ return ECORE_X_WINDOW_STATE_STICKY;
else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
- return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
+ return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
- return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
+ return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED)
- return ECORE_X_WINDOW_STATE_SHADED;
+ return ECORE_X_WINDOW_STATE_SHADED;
else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR)
- return ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
+ return ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER)
- return ECORE_X_WINDOW_STATE_SKIP_PAGER;
+ return ECORE_X_WINDOW_STATE_SKIP_PAGER;
else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
- return ECORE_X_WINDOW_STATE_HIDDEN;
+ return ECORE_X_WINDOW_STATE_HIDDEN;
else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
- return ECORE_X_WINDOW_STATE_FULLSCREEN;
+ return ECORE_X_WINDOW_STATE_FULLSCREEN;
else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
- return ECORE_X_WINDOW_STATE_ABOVE;
+ return ECORE_X_WINDOW_STATE_ABOVE;
else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW)
- return ECORE_X_WINDOW_STATE_BELOW;
+ return ECORE_X_WINDOW_STATE_BELOW;
else if (a == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION)
- return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
+ return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
else
- return ECORE_X_WINDOW_STATE_UNKNOWN;
-}
+ return ECORE_X_WINDOW_STATE_UNKNOWN;
+} /* _ecore_x_netwm_state_get */
static Ecore_X_Atom
_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
switch(s)
{
case ECORE_X_WINDOW_STATE_MODAL:
- return ECORE_X_ATOM_NET_WM_STATE_MODAL;
+ return ECORE_X_ATOM_NET_WM_STATE_MODAL;
+
case ECORE_X_WINDOW_STATE_STICKY:
- return ECORE_X_ATOM_NET_WM_STATE_STICKY;
+ return ECORE_X_ATOM_NET_WM_STATE_STICKY;
+
case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
- return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
+ return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
+
case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
- return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
+ return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
+
case ECORE_X_WINDOW_STATE_SHADED:
- return ECORE_X_ATOM_NET_WM_STATE_SHADED;
+ return ECORE_X_ATOM_NET_WM_STATE_SHADED;
+
case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
- return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
+ return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
+
case ECORE_X_WINDOW_STATE_SKIP_PAGER:
- return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
+ return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
+
case ECORE_X_WINDOW_STATE_HIDDEN:
- return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
+ return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
+
case ECORE_X_WINDOW_STATE_FULLSCREEN:
- return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
+ return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
+
case ECORE_X_WINDOW_STATE_ABOVE:
- return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
+ return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
+
case ECORE_X_WINDOW_STATE_BELOW:
- return ECORE_X_ATOM_NET_WM_STATE_BELOW;
+ return ECORE_X_ATOM_NET_WM_STATE_BELOW;
+
case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
- return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
+ return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_state_atom_get */
/**
* Set the _NET_WM_STATE property.
Ecore_X_Window_State *state,
unsigned int num)
{
- Ecore_X_Atom *set;
- uint32_t i;
+ Ecore_X_Atom *set;
+ uint32_t i;
if (!num)
{
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_STATE);
- return;
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_STATE);
+ return;
}
set = malloc(num * sizeof(Ecore_X_Atom));
- if (!set) return;
+ if (!set)
+ return;
for (i = 0; i < num; i++)
- set[i] = _ecore_x_netwm_state_atom_get(state[i]);
+ set[i] = _ecore_x_netwm_state_atom_get(state[i]);
ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_STATE, set, num);
free(set);
-}
+} /* ecore_x_netwm_window_state_set */
/**
* Sends the GetProperty request.
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
ECORE_X_ATOM_NET_WM_STATE, ECORE_X_ATOM_ATOM,
- 0, 0x7fffffff);;
+ 0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_window_state_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_state_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_window_state_get_fetch */
/**
* Get the hints describing the window state.
unsigned int *num)
{
Ecore_X_Atom *atoms;
- int num_ret;
- int i;
+ int num_ret;
+ int i;
- if (num) *num = 0;
- if (state) *state = NULL;
+ if (num)
+ *num = 0;
+
+ if (state)
+ *state = NULL;
num_ret = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_STATE,
- &atoms);
+ &atoms);
if (num_ret <= 0)
return 0;
if (state)
{
- *state = malloc(num_ret * sizeof(Ecore_X_Window_State));
- if (*state)
- for (i = 0; i < num_ret; ++i)
- (*state)[i] = _ecore_x_netwm_state_get(atoms[i]);
+ *state = malloc(num_ret * sizeof(Ecore_X_Window_State));
+ if (*state)
+ for (i = 0; i < num_ret; ++i)
+ (*state)[i] = _ecore_x_netwm_state_get(atoms[i]);
- if (num) *num = num_ret;
+ if (num)
+ *num = num_ret;
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_window_state_get */
static Ecore_X_Window_Type
_ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom)
{
if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP)
- return ECORE_X_WINDOW_TYPE_DESKTOP;
+ return ECORE_X_WINDOW_TYPE_DESKTOP;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
- return ECORE_X_WINDOW_TYPE_DOCK;
+ return ECORE_X_WINDOW_TYPE_DOCK;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR)
- return ECORE_X_WINDOW_TYPE_TOOLBAR;
+ return ECORE_X_WINDOW_TYPE_TOOLBAR;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
- return ECORE_X_WINDOW_TYPE_MENU;
+ return ECORE_X_WINDOW_TYPE_MENU;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY)
- return ECORE_X_WINDOW_TYPE_UTILITY;
+ return ECORE_X_WINDOW_TYPE_UTILITY;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
- return ECORE_X_WINDOW_TYPE_SPLASH;
+ return ECORE_X_WINDOW_TYPE_SPLASH;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG)
- return ECORE_X_WINDOW_TYPE_DIALOG;
+ return ECORE_X_WINDOW_TYPE_DIALOG;
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
- return ECORE_X_WINDOW_TYPE_NORMAL;
+ return ECORE_X_WINDOW_TYPE_NORMAL;
else
- return ECORE_X_WINDOW_TYPE_UNKNOWN;
-}
+ return ECORE_X_WINDOW_TYPE_UNKNOWN;
+} /* _ecore_x_netwm_window_type_type_get */
static Ecore_X_Atom
_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type)
switch (type)
{
case ECORE_X_WINDOW_TYPE_DESKTOP:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
+
case ECORE_X_WINDOW_TYPE_DOCK:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
+
case ECORE_X_WINDOW_TYPE_TOOLBAR:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
+
case ECORE_X_WINDOW_TYPE_MENU:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
+
case ECORE_X_WINDOW_TYPE_UTILITY:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
+
case ECORE_X_WINDOW_TYPE_SPLASH:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
+
case ECORE_X_WINDOW_TYPE_DIALOG:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
+
case ECORE_X_WINDOW_TYPE_NORMAL:
- return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
+ return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_window_type_atom_get */
/*
* FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR
atom = _ecore_x_netwm_window_type_atom_get(type);
ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
- &atom, 1);
-}
+ &atom, 1);
+} /* ecore_x_netwm_window_type_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_WINDOW_TYPE, ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_window_type_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_type_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_window_type_get_fetch */
/* FIXME: Maybe return 0 on some conditions? */
Ecore_X_Window_Type *type)
{
Ecore_X_Atom *atoms;
- int num;
- int i;
+ int num;
+ int i;
- if (type) *type = ECORE_X_WINDOW_TYPE_NORMAL;
+ if (type)
+ *type = ECORE_X_WINDOW_TYPE_NORMAL;
num = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
- &atoms);
+ &atoms);
if (num < 0)
{
- /* IMO this is not the place to mix netwm and icccm /kwo */
- /* Check if WM_TRANSIENT_FOR is set */
+ /* IMO this is not the place to mix netwm and icccm /kwo */
+ /* Check if WM_TRANSIENT_FOR is set */
/* Disable it for xcb */
if (type)
{
- for (i = 0; i < num; ++i)
- {
- *type = _ecore_x_netwm_window_type_type_get(atoms[i]);
- if (*type != ECORE_X_WINDOW_TYPE_UNKNOWN)
- break;
- }
+ for (i = 0; i < num; ++i)
+ {
+ *type = _ecore_x_netwm_window_type_type_get(atoms[i]);
+ if (*type != ECORE_X_WINDOW_TYPE_UNKNOWN)
+ break;
+ }
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_window_type_get */
static Ecore_X_Atom
_ecore_x_netwm_action_atom_get(Ecore_X_Action action)
switch (action)
{
case ECORE_X_ACTION_MOVE:
- return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
+ return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
+
case ECORE_X_ACTION_RESIZE:
- return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
+ return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
+
case ECORE_X_ACTION_MINIMIZE:
- return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
+ return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
+
case ECORE_X_ACTION_SHADE:
- return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
+ return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
+
case ECORE_X_ACTION_STICK:
- return ECORE_X_ATOM_NET_WM_ACTION_STICK;
+ return ECORE_X_ATOM_NET_WM_ACTION_STICK;
+
case ECORE_X_ACTION_MAXIMIZE_HORZ:
- return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
+ return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
+
case ECORE_X_ACTION_MAXIMIZE_VERT:
- return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
+ return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
+
case ECORE_X_ACTION_FULLSCREEN:
- return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
+ return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
+
case ECORE_X_ACTION_CHANGE_DESKTOP:
- return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
+ return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
+
case ECORE_X_ACTION_CLOSE:
- return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
+ return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
+
case ECORE_X_ACTION_ABOVE:
- return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
+ return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
+
case ECORE_X_ACTION_BELOW:
- return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
+ return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
+
default:
- return 0;
- }
-}
+ return 0;
+ } /* switch */
+} /* _ecore_x_netwm_action_atom_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_allowed_action_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_allowed_action_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_allowed_action_get_fetch */
/* FIXME: Get complete list */
Ecore_X_Action action)
{
Ecore_X_Atom *atoms;
- Ecore_X_Atom atom;
- int num;
- int ret = 0;
- int i;
+ Ecore_X_Atom atom;
+ int num;
+ int ret = 0;
+ int i;
num = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
- &atoms);
+ &atoms);
if (num <= 0)
- return ret;
+ return ret;
atom = _ecore_x_netwm_action_atom_get(action);
for (i = 0; i < num; ++i)
{
- if (atom == atoms[i])
- {
- ret = 1;
- break;
- }
+ if (atom == atoms[i])
+ {
+ ret = 1;
+ break;
+ }
}
free(atoms);
return ret;
-}
+} /* ecore_x_netwm_allowed_action_isset */
/* FIXME: Set complete list */
/**
Ecore_X_Action *action,
unsigned int num)
{
- Ecore_X_Atom *set;
- unsigned int i;
+ Ecore_X_Atom *set;
+ unsigned int i;
if (!num)
{
- ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
- return;
+ ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
+ return;
}
set = malloc(num * sizeof(Ecore_X_Atom));
- if (!set) return;
+ if (!set)
+ return;
for (i = 0; i < num; i++)
- set[i] = _ecore_x_netwm_action_atom_get(action[i]);
+ set[i] = _ecore_x_netwm_action_atom_get(action[i]);
ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, set, num);
free(set);
-}
+} /* ecore_x_netwm_allowed_action_set */
/**
* Get the allowed actions supported by a window.
unsigned int *num)
{
Ecore_X_Atom *atoms;
- int num_ret;
- int i;
+ int num_ret;
+ int i;
+
+ if (num)
+ *num = 0;
- if (num) *num = 0;
- if (action) *action = NULL;
+ if (action)
+ *action = NULL;
num_ret = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
- &atoms);
+ &atoms);
if (num_ret <= 0)
return 0;
if (action)
{
- *action = malloc(num_ret * sizeof(Ecore_X_Action));
- if (*action)
- for (i = 0; i < num_ret; ++i)
- (*action)[i] = _ecore_x_netwm_action_atom_get(atoms[i]);
+ *action = malloc(num_ret * sizeof(Ecore_X_Action));
+ if (*action)
+ for (i = 0; i < num_ret; ++i)
+ (*action)[i] = _ecore_x_netwm_action_atom_get(atoms[i]);
- if (num) *num = num_ret;
+ if (num)
+ *num = num_ret;
}
free(atoms);
return 1;
-}
+} /* ecore_x_netwm_allowed_action_get */
/**
* Set the _NET_WM_WINDOW_OPACITY property.
{
uint32_t op = opacity;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
- &op, 1);
-}
+ &op, 1);
+} /* ecore_x_netwm_opacity_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_opacity_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_opacity_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_opacity_get_fetch */
/**
* Get the opacity value of a window.
unsigned int tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
- &tmp, 1);
- if (opacity) *opacity = tmp;
+ &tmp, 1);
+ if (opacity)
+ *opacity = tmp;
+
return ret == 1 ? 1 : 0;
-}
+} /* ecore_x_netwm_opacity_get */
/**
* Set the _NET_FRAME_EXTENTS property.
frames[2] = ft;
frames[3] = fb;
ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
-}
+} /* ecore_x_netwm_frame_size_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_FRAME_EXTENTS, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_frame_size_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_frame_size_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_frame_size_get_fetch */
/**
* Get the frame extent of a window.
int *fb)
{
uint32_t frames[4];
- int ret = 0;
+ int ret = 0;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
if (ret != 4)
- return 0;
+ return 0;
+
+ if (fl)
+ *fl = frames[0];
+
+ if (fr)
+ *fr = frames[1];
+
+ if (ft)
+ *ft = frames[2];
+
+ if (fb)
+ *fb = frames[3];
- if (fl) *fl = frames[0];
- if (fr) *fr = frames[1];
- if (ft) *ft = frames[2];
- if (fb) *fb = frames[3];
return 1;
-}
+} /* ecore_x_netwm_frame_size_get */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_netwm_sync_counter_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_netwm_sync_counter_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_netwm_sync_counter_get_fetch */
/**
* Get the X ID of a X Sync counter.
ecore_x_netwm_sync_counter_get(Ecore_X_Window window,
Ecore_X_Sync_Counter *counter)
{
- int ret;
+ int ret;
unsigned int tmp;
ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
- &tmp, 1);
+ &tmp, 1);
+
+ if (counter)
+ *counter = tmp;
- if (counter) *counter = tmp;
return (ret == 1) ? 1 : 0;
-}
+} /* ecore_x_netwm_sync_counter_get */
/**
* Send a _NET_WM_PING property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
+ if (!window)
+ return;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
ev.data.data32[5] = 0;
xcb_send_event(_ecore_xcb_conn, 0, window, XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
-}
+} /* ecore_x_netwm_ping_send */
/**
* Send a _NET_WM_SYNC_REQUEST property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
+ if (!window)
+ return;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
ev.data.data32[4] = 0;
xcb_send_event(_ecore_xcb_conn, 0, window, 0, (const char *)&ev);
-}
+} /* ecore_x_netwm_sync_request_send */
/**
* Send a _NET_WM_STATE property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
- if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!window)
+ return;
+
+ if (!root)
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
xcb_send_event(_ecore_xcb_conn, 0, root,
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
-}
+} /* ecore_x_netwm_state_request_send */
/**
* Send a _NET_WM_DESKTOP property event.
{
xcb_client_message_event_t ev;
- if (!window) return;
- if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (!window)
+ return;
+
+ if (!root)
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
ev.format = 32;
xcb_send_event(_ecore_xcb_conn, 0, root,
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
-}
+} /* ecore_x_netwm_desktop_request_send */
int
_ecore_x_netwm_startup_info_begin(Ecore_X_Window window,
{
#if 0
Ecore_X_Startup_Info *info;
- unsigned char exists = 0;
+ unsigned char exists = 0;
+
+ if (!startup_info)
+ return 0;
- if (!startup_info) return 0;
info = eina_hash_find(startup_info, (void *)window);
if (info)
{
exists = 1;
- INF("Already got info for win: 0x%x", window);
- _ecore_x_netwm_startup_info_free(info);
+ INF("Already got info for win: 0x%x", window);
+ _ecore_x_netwm_startup_info_free(info);
}
+
info = calloc(1, sizeof(Ecore_X_Startup_Info));
- if (!info) return 0;
+ if (!info)
+ return 0;
+
info->win = win;
info->length = 0;
info->buffer_size = 161;
info->buffer = calloc(info->buffer_size, sizeof(char));
if (!info->buffer)
{
- _ecore_x_netwm_startup_info_free(info);
- return 0;
+ _ecore_x_netwm_startup_info_free(info);
+ return 0;
}
+
memcpy(info->buffer, data, 20);
info->length += 20;
info->buffer[info->length] = 0;
if (exists)
- eina_hash_modify(startup_info, (void *)info->win, info);
+ eina_hash_modify(startup_info, (void *)info->win, info);
else
- eina_hash_add(startup_info, (void *)info->win, info);
+ eina_hash_add(startup_info, (void *)info->win, info);
+
if (strlen(info->buffer) != 20)
{
- /* We have a '\0' in there, the message is done */
- _ecore_x_netwm_startup_info_process(info);
+ /* We have a '\0' in there, the message is done */
+ _ecore_x_netwm_startup_info_process(info);
}
-#else
+
+#else /* if 0 */
window = XCB_NONE;
data = NULL;
-#endif
+#endif /* if 0 */
return 1;
-}
+} /* _ecore_x_netwm_startup_info_begin */
int
_ecore_x_netwm_startup_info(Ecore_X_Window window,
Ecore_X_Startup_Info *info;
char *p;
- if (!startup_info) return 0;
+ if (!startup_info)
+ return 0;
+
info = eina_hash_find(startup_info, (void *)window);
- if (!info) return 0;
+ if (!info)
+ return 0;
+
if ((info->length + 20) > info->buffer_size)
{
- info->buffer_size += 160;
- info->buffer = realloc(info->buffer, info->buffer_size * sizeof(char));
- if (!info->buffer)
- {
- eina_hash_del(startup_info, (void *)info->win);
- _ecore_x_netwm_startup_info_free(info);
- return 0;
- }
+ info->buffer_size += 160;
+ info->buffer = realloc(info->buffer, info->buffer_size * sizeof(char));
+ if (!info->buffer)
+ {
+ eina_hash_del(startup_info, (void *)info->win);
+ _ecore_x_netwm_startup_info_free(info);
+ return 0;
+ }
}
+
memcpy(info->buffer + info->length, data, 20);
p = info->buffer + info->length;
info->length += 20;
info->buffer[info->length] = 0;
if (strlen(p) != 20)
{
- /* We have a '\0' in there, the message is done */
- _ecore_x_netwm_startup_info_process(info);
+ /* We have a '\0' in there, the message is done */
+ _ecore_x_netwm_startup_info_process(info);
}
-#else
+
+#else /* if 0 */
window = XCB_NONE;
data = NULL;
-#endif
+#endif /* if 0 */
return 1;
-}
+} /* _ecore_x_netwm_startup_info */
/*
* Set UTF-8 string property
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
atom, ECORE_X_ATOM_UTF8_STRING,
8, strlen(str), str);
-}
+} /* _ecore_x_window_prop_string_utf8_set */
static void
_ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom)
+ Ecore_X_Atom atom)
{
xcb_get_property_cookie_t cookie;
atom, ECORE_X_ATOM_UTF8_STRING,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* _ecore_x_window_prop_string_utf8_get_prefetch */
static void
_ecore_x_window_prop_string_utf8_get_fetch(void)
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* _ecore_x_window_prop_string_utf8_get_fetch */
/*
* Get UTF-8 string property
*/
static char *
_ecore_x_window_prop_string_utf8_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_Atom atom __UNUSED__)
+ Ecore_X_Atom atom __UNUSED__)
{
xcb_get_property_reply_t *reply;
- char *str;
- int length;
+ char *str;
+ int length;
reply = _ecore_xcb_reply_get();
- if (!reply) return NULL;
+ if (!reply)
+ return NULL;
if ((reply->format != 8) ||
(reply->value_len <= 0))
- return NULL;
+ return NULL;
length = reply->value_len;
str = (char *)malloc (sizeof (char) * (length + 1));
{
return NULL;
}
+
memcpy(str, xcb_get_property_value(reply), length);
str[length] = '\0';
return str;
-}
+} /* _ecore_x_window_prop_string_utf8_get */
#if 0 /* Unused */
/*
_ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info)
{
Ecore_X_Event_Startup_Sequence *e;
- int event;
- char *p;
+ int event;
+ char *p;
p = strchr(info->buffer, ':');
if (!p)
{
- eina_hash_del(startup_info, (void *)info->win);
- _ecore_x_netwm_startup_info_free(info);
- return 0;
+ eina_hash_del(startup_info, (void *)info->win);
+ _ecore_x_netwm_startup_info_free(info);
+ return 0;
}
+
*p = 0;
if (!strcmp(info->buffer, "new"))
{
- if (info->init)
- event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
- else
- event = ECORE_X_EVENT_STARTUP_SEQUENCE_NEW;
- info->init = 1;
+ if (info->init)
+ event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
+ else
+ event = ECORE_X_EVENT_STARTUP_SEQUENCE_NEW;
+
+ info->init = 1;
}
else if (!strcmp(info->buffer, "change"))
{
- event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
+ event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
}
else if (!strcmp(info->buffer, "remove"))
- event = ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE;
+ event = ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE;
else
{
- eina_hash_del(startup_info, (void *)info->win);
- _ecore_x_netwm_startup_info_free(info);
- return 0;
+ eina_hash_del(startup_info, (void *)info->win);
+ _ecore_x_netwm_startup_info_free(info);
+ return 0;
}
p++;
if (!_ecore_x_netwm_startup_info_parse(info, p))
{
- eina_hash_del(startup_info, (void *)info->win);
- _ecore_x_netwm_startup_info_free(info);
- return 0;
+ eina_hash_del(startup_info, (void *)info->win);
+ _ecore_x_netwm_startup_info_free(info);
+ return 0;
}
if (info->init)
{
- e = calloc(1, sizeof(Ecore_X_Event_Startup_Sequence));
- if (!e)
- {
- eina_hash_del(startup_info, (void *)info->win);
- _ecore_x_netwm_startup_info_free(info);
- return 0;
- }
- e->win = info->win;
- ecore_event_add(event, e, NULL, NULL);
+ e = calloc(1, sizeof(Ecore_X_Event_Startup_Sequence));
+ if (!e)
+ {
+ eina_hash_del(startup_info, (void *)info->win);
+ _ecore_x_netwm_startup_info_free(info);
+ return 0;
+ }
+
+ e->win = info->win;
+ ecore_event_add(event, e, NULL, NULL);
}
if (event == ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE)
{
eina_hash_del(startup_info, (void *)info->win);
- _ecore_x_netwm_startup_info_free(info);
+ _ecore_x_netwm_startup_info_free(info);
}
else
{
- /* Discard buffer */
- info->length = 0;
- info->buffer[0] = 0;
+ /* Discard buffer */
+ info->length = 0;
+ info->buffer[0] = 0;
}
+
return 1;
-}
+} /* _ecore_x_netwm_startup_info_process */
/*
* Parse startup info
_ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
char *data)
{
-
while (*data)
{
- int in_quot_sing, in_quot_dbl, escaped;
- char *p, *pp;
- char *key;
- char value[1024];
-
- /* Skip space */
- while (*data == ' ') data++;
- /* Get key */
- key = data;
- data = strchr(key, '=');
- if (!data) return 0;
- *data = 0;
- data++;
-
- /* Get value */
- p = data;
- pp = value;
- in_quot_dbl = 0;
- in_quot_sing = 0;
- escaped = 0;
- while (*p)
- {
- if ((pp - value) >= 1024) return 0;
- if (escaped)
- {
- *pp = *p;
- pp++;
- escaped = 0;
- }
- else if (in_quot_sing)
- {
- if (*p == '\\')
- escaped = 1;
- else if (*p == '\'')
- in_quot_sing = 0;
- else
- {
- *pp = *p;
- pp++;
- }
- }
- else if (in_quot_dbl)
- {
- if (*p == '\\')
- escaped = 1;
- else if (*p == '\"')
- in_quot_dbl = 0;
- else
- {
- *pp = *p;
- pp++;
- }
- }
- else
- {
- if (*p == '\\')
- escaped = 1;
- else if (*p == '\'')
- in_quot_sing = 1;
- else if (*p == '\"')
- in_quot_dbl = 1;
- else if (*p == ' ')
- {
- break;
- }
- else
- {
- *pp = *p;
- pp++;
- }
- }
- p++;
- }
- if ((in_quot_dbl) || (in_quot_sing)) return 0;
- data = p;
- *pp = 0;
-
- /* Parse info */
- if (!strcmp(key, "ID"))
- {
- if ((info->id) && (strcmp(info->id, value))) return 0;
- info->id = strdup(value);
- p = strstr(value, "_TIME");
- if (p)
- {
- info->timestamp = atoi(p + 5);
- }
- }
- else if (!strcmp(key, "NAME"))
- {
- if (info->name) free(info->name);
- info->name = strdup(value);
- }
- else if (!strcmp(key, "SCREEN"))
- {
- info->screen = atoi(value);
- }
- else if (!strcmp(key, "BIN"))
- {
- if (info->bin) free(info->bin);
- info->bin = strdup(value);
- }
- else if (!strcmp(key, "ICON"))
- {
- if (info->icon) free(info->icon);
- info->icon = strdup(value);
- }
- else if (!strcmp(key, "DESKTOP"))
- {
- info->desktop = atoi(value);
- }
- else if (!strcmp(key, "TIMESTAMP"))
- {
- if (!info->timestamp)
- info->timestamp = atoi(value);
- }
- else if (!strcmp(key, "DESCRIPTION"))
- {
- if (info->description) free(info->description);
- info->description = strdup(value);
- }
- else if (!strcmp(key, "WMCLASS"))
- {
- if (info->wmclass) free(info->wmclass);
- info->wmclass = strdup(value);
- }
- else if (!strcmp(key, "SILENT"))
- {
- info->silent = atoi(value);
- }
- else
- {
- WRN("Ecore X Sequence, Unknown: %s=%s", key, value);
- }
+ int in_quot_sing, in_quot_dbl, escaped;
+ char *p, *pp;
+ char *key;
+ char value[1024];
+
+ /* Skip space */
+ while (*data == ' ') data++;
+ /* Get key */
+ key = data;
+ data = strchr(key, '=');
+ if (!data)
+ return 0;
+
+ *data = 0;
+ data++;
+
+ /* Get value */
+ p = data;
+ pp = value;
+ in_quot_dbl = 0;
+ in_quot_sing = 0;
+ escaped = 0;
+ while (*p)
+ {
+ if ((pp - value) >= 1024)
+ return 0;
+
+ if (escaped)
+ {
+ *pp = *p;
+ pp++;
+ escaped = 0;
+ }
+ else if (in_quot_sing)
+ {
+ if (*p == '\\')
+ escaped = 1;
+ else if (*p == '\'')
+ in_quot_sing = 0;
+ else
+ {
+ *pp = *p;
+ pp++;
+ }
+ }
+ else if (in_quot_dbl)
+ {
+ if (*p == '\\')
+ escaped = 1;
+ else if (*p == '\"')
+ in_quot_dbl = 0;
+ else
+ {
+ *pp = *p;
+ pp++;
+ }
+ }
+ else
+ {
+ if (*p == '\\')
+ escaped = 1;
+ else if (*p == '\'')
+ in_quot_sing = 1;
+ else if (*p == '\"')
+ in_quot_dbl = 1;
+ else if (*p == ' ')
+ {
+ break;
+ }
+ else
+ {
+ *pp = *p;
+ pp++;
+ }
+ }
+
+ p++;
+ }
+ if ((in_quot_dbl) || (in_quot_sing))
+ return 0;
+
+ data = p;
+ *pp = 0;
+
+ /* Parse info */
+ if (!strcmp(key, "ID"))
+ {
+ if ((info->id) && (strcmp(info->id, value)))
+ return 0;
+
+ info->id = strdup(value);
+ p = strstr(value, "_TIME");
+ if (p)
+ {
+ info->timestamp = atoi(p + 5);
+ }
+ }
+ else if (!strcmp(key, "NAME"))
+ {
+ if (info->name)
+ free(info->name);
+
+ info->name = strdup(value);
+ }
+ else if (!strcmp(key, "SCREEN"))
+ {
+ info->screen = atoi(value);
+ }
+ else if (!strcmp(key, "BIN"))
+ {
+ if (info->bin)
+ free(info->bin);
+
+ info->bin = strdup(value);
+ }
+ else if (!strcmp(key, "ICON"))
+ {
+ if (info->icon)
+ free(info->icon);
+
+ info->icon = strdup(value);
+ }
+ else if (!strcmp(key, "DESKTOP"))
+ {
+ info->desktop = atoi(value);
+ }
+ else if (!strcmp(key, "TIMESTAMP"))
+ {
+ if (!info->timestamp)
+ info->timestamp = atoi(value);
+ }
+ else if (!strcmp(key, "DESCRIPTION"))
+ {
+ if (info->description)
+ free(info->description);
+
+ info->description = strdup(value);
+ }
+ else if (!strcmp(key, "WMCLASS"))
+ {
+ if (info->wmclass)
+ free(info->wmclass);
+
+ info->wmclass = strdup(value);
+ }
+ else if (!strcmp(key, "SILENT"))
+ {
+ info->silent = atoi(value);
+ }
+ else
+ {
+ WRN("Ecore X Sequence, Unknown: %s=%s", key, value);
+ }
}
- if (!info->id) return 0;
+ if (!info->id)
+ return 0;
+
return 1;
-}
-#endif
+} /* _ecore_x_netwm_startup_info_parse */
+
+#endif /* if 0 */
/*
* Free startup info struct
Ecore_X_Startup_Info *info;
info = data;
- if (!info) return;
- if (info->buffer) free(info->buffer);
- if (info->id) free(info->id);
- if (info->name) free(info->name);
- if (info->bin) free(info->bin);
- if (info->icon) free(info->icon);
- if (info->description) free(info->description);
- if (info->wmclass) free(info->wmclass);
+ if (!info)
+ return;
+
+ if (info->buffer)
+ free(info->buffer);
+
+ if (info->id)
+ free(info->id);
+
+ if (info->name)
+ free(info->name);
+
+ if (info->bin)
+ free(info->bin);
+
+ if (info->icon)
+ free(info->icon);
+
+ if (info->description)
+ free(info->description);
+
+ if (info->wmclass)
+ free(info->wmclass);
+
free(info);
-}
+} /* _ecore_x_netwm_startup_info_free */
/*
* Is screen composited?
EAPI int
ecore_x_screen_is_composited(int screen)
{
- char buf[32];
- xcb_intern_atom_cookie_t cookie_atom;
+ char buf[32];
+ xcb_intern_atom_cookie_t cookie_atom;
xcb_get_selection_owner_cookie_t cookie_owner;
- xcb_intern_atom_reply_t *reply_atom;
+ xcb_intern_atom_reply_t *reply_atom;
xcb_get_selection_owner_reply_t *reply_owner;
- Ecore_X_Window window;
- Ecore_X_Atom atom;
+ Ecore_X_Window window;
+ Ecore_X_Atom atom;
snprintf(buf, sizeof(buf), "_NET_WM_CM_S%d", screen);
cookie_atom = xcb_intern_atom_unchecked(_ecore_xcb_conn, 1,
strlen(buf), buf);
reply_atom = xcb_intern_atom_reply(_ecore_xcb_conn, cookie_atom, NULL);
- if (!reply_atom) return 0;
+ if (!reply_atom)
+ return 0;
+
atom = reply_atom->atom;
free(reply_atom);
cookie_owner = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, atom);
reply_owner = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie_owner, NULL);
- if (!reply_owner) return 0;
+ if (!reply_owner)
+ return 0;
window = reply_owner->owner;
free(reply_owner);
return window != XCB_NONE;
-}
+} /* ecore_x_screen_is_composited */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
*
* Functions that operate on pixmaps.
*/
-
/**
* Creates a new pixmap.
* @param win Window used to determine which screen of the display the
{
Ecore_X_Pixmap pmap;
- if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
- if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
+ if (win == 0)
+ win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
+ if (dep == 0)
+ dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
pmap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h);
return pmap;
-}
-
+} /* ecore_x_pixmap_new */
/**
* Deletes the reference to the given pixmap.
ecore_x_pixmap_free(Ecore_X_Pixmap pmap)
{
xcb_free_pixmap(_ecore_xcb_conn, pmap);
-}
-
+} /* ecore_x_pixmap_free */
/**
* Pastes a rectangular area of the given pixmap onto the given drawable.
EAPI void
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
Ecore_X_Drawable dest,
- Ecore_X_GC gc,
+ Ecore_X_GC gc,
int sx,
int sy,
- int w,
+ int w,
int h,
int dx,
int dy)
{
xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h);
-}
-
+} /* ecore_x_pixmap_paste */
/**
* Retrieves the size of the given pixmap.
{
if (pmap)
ecore_x_drawable_geometry_get(pmap, x, y, w, h);
-}
-
+} /* ecore_x_pixmap_geometry_get */
/**
* Retrieves the depth of the given pixmap.
ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
{
return ecore_x_drawable_depth_get(pmap);
-}
+} /* ecore_x_pixmap_depth_get */
+
#ifndef MAXHOSTNAMELEN
# define MAXHOSTNAMELEN 256
-#endif
+#endif /* ifndef MAXHOSTNAMELEN */
#ifndef XK_MISCELLANY
-# define XK_MISCELLANY 1
+# define XK_MISCELLANY 1
#endif /* XK_MISCELLANY */
#include <xcb/xcb.h>
#include "ecore_private.h"
#include "Ecore_X.h"
-extern int _ecore_x11xcb_log_dom ;
+extern int _ecore_x11xcb_log_dom;
#ifdef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR
# undef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR
-#endif
+#endif /* ifdef ECORE_XLIB_XCB_DEFAULT_LOG_COLOR */
#define ECORE_XLIB_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
#ifdef ERR
# undef ERR
-#endif
+#endif /* ifdef ERR */
#define ERR(...) EINA_LOG_DOM_ERR(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef DBG
# undef DBG
-#endif
+#endif /* ifdef DBG */
#define DBG(...) EINA_LOG_DOM_DBG(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef INF
# undef INF
-#endif
+#endif /* ifdef INF */
#define INF(...) EINA_LOG_DOM_INFO(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef WRN
# undef WRN
-#endif
+#endif /* ifdef WRN */
#define WRN(...) EINA_LOG_DOM_WARN(_ecore_x11xcb_log_dom, __VA_ARGS__)
#ifdef CRIT
# undef CRIT
-#endif
+#endif /* ifdef CRIT */
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_x11xcb_log_dom, __VA_ARGS__)
-typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
+typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
struct _Ecore_X_Selection_Intern
{
- Ecore_X_Window win;
- Ecore_X_Atom selection;
- unsigned char *data;
- int length;
- Ecore_X_Time time;
+ Ecore_X_Window win;
+ Ecore_X_Atom selection;
+ unsigned char *data;
+ int length;
+ Ecore_X_Time time;
};
-typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
+typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
struct _Ecore_X_Selection_Converter
{
- Ecore_X_Atom target;
- int (*convert)(char *target, void *data, int size,
- void **data_ret, int *size_ret,
- Ecore_X_Atom *type, int *typeseize);
+ Ecore_X_Atom target;
+ int (*convert)(char *target, void *data, int size,
+ void **data_ret, int *size_ret,
+ Ecore_X_Atom *type, int *typeseize);
Ecore_X_Selection_Converter *next;
};
-typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
+typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
struct _Ecore_X_Selection_Parser
{
- char *target;
- void *(*parse)(const char *target, void *data, int size, int format);
+ char *target;
+ void *(*parse)(const char *target, void *data, int size, int format);
Ecore_X_Selection_Parser *next;
};
typedef struct _Ecore_X_DND_Source
{
- int version;
+ int version;
Ecore_X_Window win, dest;
enum {
ECORE_X_DND_SOURCE_CONVERTING
} state;
- struct {
- short x, y;
+ struct
+ {
+ short x, y;
unsigned short width, height;
} rectangle;
- struct {
+ struct
+ {
Ecore_X_Window window;
- int x, y;
+ int x, y;
} prev;
-
+
Ecore_X_Time time;
Ecore_X_Atom action, accepted_action;
- int will_accept;
- int suppress;
+ int will_accept;
+ int suppress;
- int await_status;
+ int await_status;
} Ecore_X_DND_Source;
typedef struct _Ecore_X_DND_Target
{
- int version;
+ int version;
Ecore_X_Window win, source;
enum {
ECORE_X_DND_TARGET_ENTERED
} state;
- struct {
+ struct
+ {
int x, y;
} pos;
Ecore_X_Atom action, accepted_action;
- int will_accept;
+ int will_accept;
} Ecore_X_DND_Target;
extern int ECORE_X_MODIFIER_SHIFT;
-extern int ECORE_X_MODIFIER_CTRL;
-extern int ECORE_X_MODIFIER_ALT;
-extern int ECORE_X_MODIFIER_WIN;
-
-extern int ECORE_X_LOCK_SCROLL;
-extern int ECORE_X_LOCK_NUM;
-extern int ECORE_X_LOCK_CAPS;
+extern int ECORE_X_MODIFIER_CTRL;
+extern int ECORE_X_MODIFIER_ALT;
+extern int ECORE_X_MODIFIER_WIN;
+
+extern int ECORE_X_LOCK_SCROLL;
+extern int ECORE_X_LOCK_NUM;
+extern int ECORE_X_LOCK_CAPS;
extern Ecore_X_Connection *_ecore_xcb_conn;
-extern Ecore_X_Screen *_ecore_xcb_screen;
-extern double _ecore_xcb_double_click_time;
-extern Ecore_X_Time _ecore_xcb_event_last_time;
-extern Ecore_X_Window _ecore_xcb_event_last_window;
-extern int16_t _ecore_xcb_event_last_root_x;
-extern int16_t _ecore_xcb_event_last_root_y;
-extern int _ecore_xcb_xcursor;
-
-extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
-
-extern int _ecore_window_grabs_num;
-extern Ecore_X_Window *_ecore_window_grabs;
-extern int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
-extern void *_ecore_window_grab_replay_data;
-
-extern Ecore_X_Window _ecore_xcb_private_window;
-
-
-void _ecore_x_error_handler_init(void);
-
-void _ecore_x_event_handle_any_event (xcb_generic_event_t *event);
-void _ecore_x_event_handle_key_press (xcb_generic_event_t *event);
-void _ecore_x_event_handle_key_release (xcb_generic_event_t *event);
-void _ecore_x_event_handle_button_press (xcb_generic_event_t *event);
-void _ecore_x_event_handle_button_release (xcb_generic_event_t *event);
-void _ecore_x_event_handle_motion_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_enter_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_leave_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_focus_in (xcb_generic_event_t *event);
-void _ecore_x_event_handle_focus_out (xcb_generic_event_t *event);
-void _ecore_x_event_handle_keymap_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_expose (xcb_generic_event_t *event);
-void _ecore_x_event_handle_graphics_expose (xcb_generic_event_t *event);
-void _ecore_x_event_handle_visibility_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_create_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_destroy_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_unmap_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_map_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_map_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_reparent_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_configure_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_configure_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_gravity_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_resize_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_circulate_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_circulate_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_property_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_selection_clear (xcb_generic_event_t *event);
-void _ecore_x_event_handle_selection_request (xcb_generic_event_t *event);
-void _ecore_x_event_handle_selection_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_colormap_notify (xcb_generic_event_t *event);
-void _ecore_x_event_handle_client_message (xcb_generic_event_t *event);
-void _ecore_x_event_handle_mapping_notify (xcb_generic_event_t *event);
+extern Ecore_X_Screen *_ecore_xcb_screen;
+extern double _ecore_xcb_double_click_time;
+extern Ecore_X_Time _ecore_xcb_event_last_time;
+extern Ecore_X_Window _ecore_xcb_event_last_window;
+extern int16_t _ecore_xcb_event_last_root_x;
+extern int16_t _ecore_xcb_event_last_root_y;
+extern int _ecore_xcb_xcursor;
+
+extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
+
+extern int _ecore_window_grabs_num;
+extern Ecore_X_Window *_ecore_window_grabs;
+extern int (*_ecore_window_grab_replay_func)(void *data, int event_type, void *event);
+extern void *_ecore_window_grab_replay_data;
+
+extern Ecore_X_Window _ecore_xcb_private_window;
+
+void _ecore_x_error_handler_init(void);
+
+void _ecore_x_event_handle_any_event (xcb_generic_event_t *event);
+void _ecore_x_event_handle_key_press (xcb_generic_event_t *event);
+void _ecore_x_event_handle_key_release (xcb_generic_event_t *event);
+void _ecore_x_event_handle_button_press (xcb_generic_event_t *event);
+void _ecore_x_event_handle_button_release (xcb_generic_event_t *event);
+void _ecore_x_event_handle_motion_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_enter_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_leave_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_focus_in (xcb_generic_event_t *event);
+void _ecore_x_event_handle_focus_out (xcb_generic_event_t *event);
+void _ecore_x_event_handle_keymap_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_expose (xcb_generic_event_t *event);
+void _ecore_x_event_handle_graphics_expose (xcb_generic_event_t *event);
+void _ecore_x_event_handle_visibility_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_create_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_destroy_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_unmap_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_map_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_map_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_reparent_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_configure_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_configure_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_gravity_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_resize_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_circulate_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_circulate_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_property_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_selection_clear (xcb_generic_event_t *event);
+void _ecore_x_event_handle_selection_request (xcb_generic_event_t *event);
+void _ecore_x_event_handle_selection_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_colormap_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_client_message (xcb_generic_event_t *event);
+void _ecore_x_event_handle_mapping_notify (xcb_generic_event_t *event);
#ifdef ECORE_XCB_DAMAGE
-void _ecore_x_event_handle_damage_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_damage_notify (xcb_generic_event_t *event);
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_RANDR
-void _ecore_x_event_handle_randr_change (xcb_generic_event_t *event);
+void _ecore_x_event_handle_randr_change (xcb_generic_event_t *event);
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_SCREENSAVER
-void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
+void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
-void _ecore_x_event_handle_shape_change (xcb_generic_event_t *event);
+void _ecore_x_event_handle_shape_change (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
-void _ecore_x_event_handle_sync_counter (xcb_generic_event_t *event);
-void _ecore_x_event_handle_sync_alarm (xcb_generic_event_t *event);
+void _ecore_x_event_handle_sync_counter (xcb_generic_event_t *event);
+void _ecore_x_event_handle_sync_alarm (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
-void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
+void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
#endif /* ECORE_XCB_FIXES */
-
/* requests / replies */
-int _ecore_x_reply_init ();
-void _ecore_x_reply_shutdown ();
-void _ecore_xcb_cookie_cache (unsigned int cookie);
-unsigned int _ecore_xcb_cookie_get (void);
-void _ecore_xcb_reply_cache (void *reply);
-void *_ecore_xcb_reply_get (void);
-
+int _ecore_x_reply_init ();
+void _ecore_x_reply_shutdown ();
+void _ecore_xcb_cookie_cache (unsigned int cookie);
+unsigned int _ecore_xcb_cookie_get (void);
+void _ecore_xcb_reply_cache (void *reply);
+void * _ecore_xcb_reply_get (void);
/* atoms */
extern Ecore_X_Atom ECORE_X_ATOM_ATOM;
#define ECORE_X_ATOMS_COUNT 117
-void _ecore_x_atom_init (xcb_intern_atom_cookie_t *);
-void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
-
+void _ecore_x_atom_init (xcb_intern_atom_cookie_t *);
+void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
/* damage */
-void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_damage_init_finalize (void);
+void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_damage_init_finalize (void);
/* composite */
-void _ecore_x_composite_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_composite_init_finalize (void);
+void _ecore_x_composite_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_composite_init_finalize (void);
/* from dnd */
-void _ecore_x_dnd_init (void);
-void _ecore_x_dnd_shutdown (void);
-Ecore_X_DND_Source *_ecore_x_dnd_source_get (void);
-Ecore_X_DND_Target *_ecore_x_dnd_target_get (void);
-void _ecore_x_dnd_drag (Ecore_X_Window root,
- int x,
- int y);
-
+void _ecore_x_dnd_init (void);
+void _ecore_x_dnd_shutdown (void);
+Ecore_X_DND_Source * _ecore_x_dnd_source_get (void);
+Ecore_X_DND_Target * _ecore_x_dnd_target_get (void);
+void _ecore_x_dnd_drag (Ecore_X_Window root,
+ int x,
+ int y);
/* dpms */
-void _ecore_x_dpms_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_dpms_init_finalize (void);
-
+void _ecore_x_dpms_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_dpms_init_finalize (void);
/* netwm */
-Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
-int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, char *data);
-int _ecore_x_netwm_startup_info(Ecore_X_Window win, char *data);
-
+Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
+int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, char *data);
+int _ecore_x_netwm_startup_info(Ecore_X_Window win, char *data);
/* randr */
-void _ecore_x_randr_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_randr_init_finalize (void);
-
+void _ecore_x_randr_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_randr_init_finalize (void);
/* selection */
-void _ecore_x_selection_init(void);
-void _ecore_x_selection_shutdown(void);
-Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target);
-char *_ecore_x_selection_target_get(Ecore_X_Atom target);
-Ecore_X_Selection_Intern *_ecore_x_selection_get(Ecore_X_Atom selection);
-int _ecore_x_selection_set(Ecore_X_Window w, const void *data, int len, Ecore_X_Atom selection);
-int _ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret);
-void *_ecore_x_selection_parse(const char *target, void *data, int size, int format);
-
+void _ecore_x_selection_init(void);
+void _ecore_x_selection_shutdown(void);
+Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target);
+char * _ecore_x_selection_target_get(Ecore_X_Atom target);
+Ecore_X_Selection_Intern * _ecore_x_selection_get(Ecore_X_Atom selection);
+int _ecore_x_selection_set(Ecore_X_Window w, const void *data, int len, Ecore_X_Atom selection);
+int _ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret);
+void * _ecore_x_selection_parse(const char *target, void *data, int size, int format);
/* screensaver */
-void _ecore_x_screensaver_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_screensaver_init_finalize (void);
-
+void _ecore_x_screensaver_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_screensaver_init_finalize (void);
/* shape */
-void _ecore_x_shape_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_shape_init_finalize (void);
-
+void _ecore_x_shape_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_shape_init_finalize (void);
/* sync */
-void _ecore_x_sync_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_sync_init_finalize (void);
-
+void _ecore_x_sync_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_sync_init_finalize (void);
/* xfixes */
-void _ecore_x_xfixes_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_xfixes_init_finalize (void);
-
+void _ecore_x_xfixes_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_xfixes_init_finalize (void);
/* xinerama */
-void _ecore_x_xinerama_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_xinerama_init_finalize (void);
-
+void _ecore_x_xinerama_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_xinerama_init_finalize (void);
/* xprint */
-void _ecore_x_xprint_init (const xcb_query_extension_reply_t *reply);
-void _ecore_x_xprint_init_finalize (void);
+void _ecore_x_xprint_init (const xcb_query_extension_reply_t *reply);
+void _ecore_x_xprint_init_finalize (void);
/* to categorize */
-void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin);
-void _ecore_x_window_grab_remove(Ecore_X_Window win);
-void _ecore_x_key_grab_remove(Ecore_X_Window win);
-
+void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin);
+void _ecore_x_window_grab_remove(Ecore_X_Window win);
+void _ecore_x_key_grab_remove(Ecore_X_Window win);
#endif /* __ECORE_XCB_PRIVATE_H__*/
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_RandR_Group X RandR Extension Functions
*
* Functions related to the X RandR extension.
*/
-
#ifdef ECORE_XCB_RANDR
static int _randr_available = 0;
static xcb_randr_query_version_cookie_t _ecore_xcb_randr_init_cookie;
#endif /* ECORE_XCB_RANDR */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_randr_init and
_ecore_xcb_randr_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_RANDR
if (reply && (reply->present))
_ecore_xcb_randr_init_cookie = xcb_randr_query_version_unchecked(_ecore_xcb_conn, 1, 2);
+
#endif /* ECORE_XCB_RANDR */
-}
+} /* _ecore_x_randr_init */
void
_ecore_x_randr_init_finalize(void)
{
if ((reply->major_version >= 1) &&
(reply->minor_version >= 1))
- _randr_available = 1;
+ _randr_available = 1;
+
free(reply);
}
+
#endif /* ECORE_XCB_RANDR */
-}
+} /* _ecore_x_randr_init_finalize */
/**
* Return whether the X server supports the RandR Extension.
{
#ifdef ECORE_XCB_RANDR
return _randr_available;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
-
+} /* ecore_x_randr_query */
static Ecore_X_Window
_xcb_randr_root_to_screen(Ecore_X_Window root)
for (; iter.rem; xcb_screen_next(&iter))
{
if (iter.data->root == root)
- return iter.data->root;
+ return iter.data->root;
}
return XCB_NONE;
-}
+} /* _xcb_randr_root_to_screen */
/**
* Select if the ScreenChangeNotify events will be sent.
int on)
{
#ifdef ECORE_XCB_RANDR
- xcb_randr_select_input(_ecore_xcb_conn, window,
- on ? XCB_RANDR_SCREEN_CHANGE_NOTIFY : 0);
- return 1;
-#else
+ xcb_randr_select_input(_ecore_xcb_conn, window,
+ on ? XCB_RANDR_SCREEN_CHANGE_NOTIFY : 0);
+ return 1;
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_events_select */
/**
* Sends the GetScreenInfo request.
_xcb_randr_root_to_screen(window));
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_RANDR */
-}
-
+} /* ecore_x_randr_get_screen_info_prefetch */
/**
* Gets the reply of the GetScreenInfo request sent by ecore_x_randr_get_screen_info_prefetch().
reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_get_screen_info_fetch */
/**
* Get the set of rotations and reflections.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->rotations;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_rotations_get */
/**
* Get the rotation.
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
return reply->rotation;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_rotation_get */
/**
* Get the frame buffer sizes.
*/
EAPI Ecore_X_Screen_Size *
ecore_x_randr_screen_sizes_get(Ecore_X_Window root __UNUSED__,
- int *num)
+ int *num)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_t *sizes;
- Ecore_X_Screen_Size *ret;
- int n;
- int i;
+ xcb_randr_screen_size_t *sizes;
+ Ecore_X_Screen_Size *ret;
+ int n;
+ int i;
- if (num) *num = 0;
+ if (num)
+ *num = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return NULL;
+ return NULL;
n = xcb_randr_get_screen_info_sizes_length(reply);
ret = calloc(n, sizeof(Ecore_X_Screen_Size));
- if (!ret) return NULL;
+ if (!ret)
+ return NULL;
+
+ if (num)
+ *num = n;
- if (num) *num = n;
sizes = xcb_randr_get_screen_info_sizes(reply);
for (i = 0; i < n; i++)
{
}
return ret;
-#else
- if (num) *num = 0;
+#else /* ifdef ECORE_XCB_RANDR */
+ if (num)
+ *num = 0;
+
return NULL;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_sizes_get */
/**
* Get the current frame buffer size.
Ecore_X_Screen_Size ret = { -1, -1 };
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_t *sizes;
- uint16_t size_index;
+ xcb_randr_screen_size_t *sizes;
+ uint16_t size_index;
reply = _ecore_xcb_reply_get();
if (!reply)
- return ret;
+ return ret;
size_index = reply->sizeID;
sizes = xcb_randr_get_screen_info_sizes(reply);
ret.width = sizes[size_index].mwidth;
ret.height = sizes[size_index].mheight;
}
+
#endif /* ECORE_XCB_RANDR */
return ret;
-}
+} /* ecore_x_randr_current_screen_size_get */
/**
* Get the current refresh rate.
EAPI Ecore_X_Screen_Refresh_Rate
ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root __UNUSED__)
{
- Ecore_X_Screen_Refresh_Rate ret = { -1 };
+ Ecore_X_Screen_Refresh_Rate ret = { -1 };
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
- return ret;
+ return ret;
ret.rate = reply->rate;
#endif /* ECORE_XCB_RANDR */
return ret;
-}
+} /* ecore_x_randr_current_screen_refresh_rate_get */
/**
* Get the refresh rates.
*/
EAPI Ecore_X_Screen_Refresh_Rate *
ecore_x_randr_screen_refresh_rates_get(Ecore_X_Window root __UNUSED__,
- int size_id __UNUSED__,
- int *num)
+ int size_id __UNUSED__,
+ int *num)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
- Ecore_X_Screen_Refresh_Rate *ret;
- Ecore_X_Screen_Refresh_Rate *tmp;
+ Ecore_X_Screen_Refresh_Rate *ret;
+ Ecore_X_Screen_Refresh_Rate *tmp;
xcb_randr_refresh_rates_iterator_t iter;
- uint16_t n;
+ uint16_t n;
- if (num) *num = 0;
+ if (num)
+ *num = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return NULL;
+ return NULL;
n = reply->nSizes;
ret = calloc(n, sizeof(Ecore_X_Screen_Refresh_Rate));
if (!ret)
- return NULL;
+ return NULL;
- if (num) *num = n;
+ if (num)
+ *num = n;
/* FIXME: maybe there's a missing function in xcb randr implementation */
iter = xcb_randr_get_screen_info_rates_iterator(reply);
tmp = ret;
for (; iter.rem; xcb_randr_refresh_rates_next(&iter), tmp++)
{
- tmp->rate = iter.data->nRates;;
+ tmp->rate = iter.data->nRates;
}
return ret;
-#else
- if (num) *num = 0;
+#else /* ifdef ECORE_XCB_RANDR */
+ if (num)
+ *num = 0;
+
return NULL;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_refresh_rates_get */
/* FIXME: round trip. Should we remove it ? */
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
- xcb_randr_get_screen_info_reply_t *reply;
+ xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
- return;
+ return;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
0);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (reply_config)
- free(reply_config);
+ free(reply_config);
+
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_rotation_set */
/* FIXME: round trip. Should we remove it ? */
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
- xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_iterator_t iter;
- int size_index = -1;
- int i;
+ xcb_randr_get_screen_info_reply_t *reply;
+ xcb_randr_screen_size_iterator_t iter;
+ int size_index = -1;
+ int i;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
(iter.data->mwidth = size.width) &&
(iter.data->mheight = size.height))
{
- size_index = i;
- break;
+ size_index = i;
+ break;
}
}
- if (size_index == -1) return 0;
+ if (size_index == -1)
+ return 0;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
0);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply_config)
- return 0;
+ return 0;
free(reply_config);
return 1;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_size_set */
/* FIXME: round trip. Should we remove it ? */
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
- xcb_randr_get_screen_info_reply_t *reply;
- xcb_randr_screen_size_iterator_t iter;
- int size_index = -1;
- int i;
+ xcb_randr_get_screen_info_reply_t *reply;
+ xcb_randr_screen_size_iterator_t iter;
+ int size_index = -1;
+ int i;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
(iter.data->mwidth = size.width) &&
(iter.data->mheight = size.height))
{
- size_index = i;
- break;
+ size_index = i;
+ break;
}
}
- if (size_index == -1) return 0;
+ if (size_index == -1)
+ return 0;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
rate.rate);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply_config)
- return 0;
+ return 0;
free(reply_config);
return 1;
-#else
+#else /* ifdef ECORE_XCB_RANDR */
return 0;
#endif /* ECORE_XCB_RANDR */
-}
+} /* ecore_x_randr_screen_refresh_rate_set */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <pixman.h>
#include "ecore_xcb_private.h"
-
/*
* [x] XCreateRegion
* [ ] XPolygonRegion
{
pixman_region16_t *region;
- region = (pixman_region16_t *)malloc (sizeof (pixman_region16_t));
+ region = (pixman_region16_t *)malloc (sizeof (pixman_region16_t));
if (!region)
- return NULL;
+ return NULL;
pixman_region_init(region);
return (Ecore_X_XRegion *)region;
-}
+} /* ecore_x_xregion_new */
EAPI void
ecore_x_xregion_free(Ecore_X_XRegion *region)
{
if (!region)
- return;
+ return;
pixman_region_fini(region);
free(region);
-}
+} /* ecore_x_xregion_free */
EAPI int
ecore_x_xregion_set(Ecore_X_XRegion *region, Ecore_X_GC gc)
{
xcb_rectangle_t *rects;
- pixman_box16_t *boxes;
- int num;
- int i;
+ pixman_box16_t *boxes;
+ int num;
+ int i;
if (!region)
- return 0;
+ return 0;
boxes = pixman_region_rectangles ((pixman_region16_t *)region, &num);
if (!boxes || (num == 0))
- return 0;
+ return 0;
rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num);
if (!rects)
- return 0;
+ return 0;
for (i = 0; i < num; i++)
{
num,
rects);
return 1;
-}
+} /* ecore_x_xregion_set */
EAPI void
ecore_x_xregion_translate(Ecore_X_XRegion *region, int x, int y)
{
if (!region)
- return;
+ return;
pixman_region_translate((pixman_region16_t *)region, x, y);
-}
+} /* ecore_x_xregion_translate */
EAPI int
ecore_x_xregion_intersect(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
{
return pixman_region_intersect((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
-}
+} /* ecore_x_xregion_intersect */
EAPI int
ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
{
return pixman_region_union((pixman_region16_t *)dst, (pixman_region16_t *)r1, (pixman_region16_t *)r2);
-}
+} /* ecore_x_xregion_union */
EAPI int
ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, Ecore_X_XRegion *src, Ecore_X_Rectangle *rect)
{
return pixman_region_union_rect((pixman_region16_t *)dst, (pixman_region16_t *)src,
rect->x, rect->y, rect->width, rect->height);
-}
+} /* ecore_x_xregion_union_rect */
EAPI int
ecore_x_xregion_subtract(Ecore_X_XRegion *dst, Ecore_X_XRegion *rm, Ecore_X_XRegion *rs)
{
return pixman_region_subtract((pixman_region16_t *)dst, (pixman_region16_t *)rm, (pixman_region16_t *)rs);
-}
+} /* ecore_x_xregion_subtract */
EAPI int
ecore_x_xregion_is_empty(Ecore_X_XRegion *region)
{
if (!region)
- return 1;
+ return 1;
return !pixman_region_not_empty((pixman_region16_t *)region);
-}
+} /* ecore_x_xregion_is_empty */
EAPI int
ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, Ecore_X_XRegion *r2)
{
if (!r1 || !r2)
- return 0;
+ return 0;
return pixman_region_equal((pixman_region16_t *)r1, (pixman_region16_t *)r2);
-}
+} /* ecore_x_xregion_is_equal */
EAPI int
ecore_x_xregion_point_contain(Ecore_X_XRegion *region, int x, int y)
{
if (!region)
- return 0;
+ return 0;
return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL);
-}
+} /* ecore_x_xregion_point_contain */
EAPI int
ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, Ecore_X_Rectangle *rect)
pixman_box16_t box;
if (!region || !rect)
- return 0;
+ return 0;
box.x1 = rect->x;
box.y1 = rect->y;
box.y2 = rect->y + rect->height - 1;
return pixman_region_contains_rectangle((pixman_region16_t *)region, &box);
-}
+} /* ecore_x_xregion_rect_contain */
+
#include <Eina.h>
-
-/*
+/*
* FIXME:
* - in ecore_xcb_cookie_cache, should provide better error management
* when memory allocation fails
* but its code is commented.
*/
-static Eina_List *_ecore_xcb_cookies = NULL;
-static void *_ecore_xcb_reply = NULL;
+static Eina_List *_ecore_xcb_cookies = NULL;
+static void *_ecore_xcb_reply = NULL;
-typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
+typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
struct _Ecore_Xcb_Data
{
- unsigned int cookie;
+ unsigned int cookie;
};
-
int
_ecore_x_reply_init ()
{
return 1;
-}
+} /* _ecore_x_reply_init */
void
_ecore_x_reply_shutdown ()
{
- Ecore_Xcb_Data *data;
+ Ecore_Xcb_Data *data;
- if (_ecore_xcb_reply)
- free(_ecore_xcb_reply);
+ if (_ecore_xcb_reply)
+ free(_ecore_xcb_reply);
if (!_ecore_xcb_cookies)
- return;
+ return;
EINA_LIST_FREE(_ecore_xcb_cookies, data)
- free(data);
-}
+ free(data);
+} /* _ecore_x_reply_shutdown */
void
_ecore_xcb_cookie_cache (unsigned int cookie)
Ecore_Xcb_Data *data;
if (!_ecore_xcb_cookies)
- return;
+ return;
data = (Ecore_Xcb_Data *)malloc(sizeof(Ecore_Xcb_Data));
if (!data)
- return;
+ return;
data->cookie = cookie;
free(data);
return;
}
-}
+} /* _ecore_xcb_cookie_cache */
unsigned int
_ecore_xcb_cookie_get (void)
{
Ecore_Xcb_Data *data;
- unsigned int cookie;
+ unsigned int cookie;
if (!_ecore_xcb_cookies)
- return 0;
+ return 0;
data = eina_list_data_get(_ecore_xcb_cookies);
- if (!data) return 0;
+ if (!data)
+ return 0;
_ecore_xcb_cookies = eina_list_remove_list(_ecore_xcb_cookies, _ecore_xcb_cookies);
- cookie = data->cookie;
- free(data);
+ cookie = data->cookie;
+ free(data);
- return cookie;
-}
+ return cookie;
+} /* _ecore_xcb_cookie_get */
void
_ecore_xcb_reply_cache (void *reply)
{
if (_ecore_xcb_reply)
- free(_ecore_xcb_reply);
+ free(_ecore_xcb_reply);
+
_ecore_xcb_reply = reply;
-}
+} /* _ecore_xcb_reply_cache */
void *
_ecore_xcb_reply_get (void)
{
return _ecore_xcb_reply;
-}
+} /* _ecore_xcb_reply_get */
EAPI void
ecore_xcb_reply_free()
/* free(_ecore_xcb_reply); */
/* _ecore_xcb_reply = NULL; */
/* } */
-}
+} /* ecore_xcb_reply_free */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_ScreenSaver_Group X ScreenSaver extension
*
* These functions use the ScreenSaver extension of the X server
- */
-
+ */
#ifdef ECORE_XCB_SCREENSAVER
static int _screensaver_available = 0;
static xcb_screensaver_query_version_cookie_t _ecore_xcb_screensaver_init_cookie;
#endif /* ECORE_XCB_SCREENSAVER */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_screensaver_init and
_ecore_xcb_screensaver_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_SCREENSAVER
if (reply && (reply->present))
_ecore_xcb_screensaver_init_cookie = xcb_screensaver_query_version_unchecked(_ecore_xcb_conn, 1, 1);
+
#endif /* ECORE_XCB_SCREENSAVER */
-}
+} /* _ecore_x_screensaver_init */
void
_ecore_x_screensaver_init_finalize(void)
{
if ((reply->server_major_version >= 1) &&
(reply->server_minor_version >= 1))
- _screensaver_available = 1;
+ _screensaver_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_SCREENSAVER */
-}
+#endif /* ECORE_XCB_SCREENSAVER */
+} /* _ecore_x_screensaver_init_finalize */
/**
* Return whether the X server supports the ScreenSaver Extension.
ecore_x_screensaver_event_available_get(void)
{
return 1;
-}
-
+} /* ecore_x_screensaver_event_available_get */
/**
* Sends the QueryInfo request.
cookie = xcb_screensaver_query_info_unchecked(_ecore_xcb_conn, ((xcb_screen_t *)_ecore_xcb_screen)->root);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_SCREENSAVER */
-}
-
+} /* ecore_x_screensaver_idle_time_prefetch */
/**
* Gets the reply of the QueryInfo request sent by ecore_x_get_screensaver_prefetch().
reply = xcb_screensaver_query_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_SCREENSAVER */
-}
-
+} /* ecore_x_screensaver_idle_time_fetch */
/**
* Get the number of seconds since the last input was received.
EAPI int
ecore_x_screensaver_idle_time_get(void)
{
- int idle = 0;
+ int idle = 0;
#ifdef ECORE_XCB_SCREENSAVER
xcb_screensaver_query_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
/* FIXME: check if it is ms_since_user_input or ms_until_server */
idle = reply->ms_since_user_input / 1000;
#endif /* ECORE_XCB_SCREENSAVER */
return idle;
-}
-
+} /* ecore_x_screensaver_idle_time_get */
/**
* Set the parameters of the screen saver.
(int16_t)interval,
(uint8_t)blank,
(uint8_t)expose);
-}
-
+} /* ecore_x_screensaver_set */
/**
* Sends the GetScreenSaver request.
cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_get_screensaver_prefetch */
/**
* Gets the reply of the GetScreenSaver request sent by ecore_x_get_screensaver_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_get_screensaver_fetch */
/**
* Set the timeout of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
(int16_t)timeout,
reply->interval,
reply->prefer_blanking,
reply->allow_exposures);
-}
-
+} /* ecore_x_screensaver_timeout_set */
/**
* Get the timeout of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->timeout;
-}
-
+} /* ecore_x_screensaver_timeout_get */
/**
* Set the interval of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
(int16_t)interval,
reply->prefer_blanking,
reply->allow_exposures);
-}
-
+} /* ecore_x_screensaver_interval_set */
/**
* Get the interval of the screen saver.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->interval;
-}
-
+} /* ecore_x_screensaver_interval_get */
/**
* Set the screen blanking.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
reply->interval,
(uint8_t)blank,
reply->allow_exposures);
-}
-
+} /* ecore_x_screensaver_blank_set */
/**
* Get the screen blanking.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->prefer_blanking;
-}
-
+} /* ecore_x_screensaver_blank_get */
/**
* Set the screen save control values.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return;
+ if (!reply)
+ return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
reply->interval,
reply->prefer_blanking,
(uint8_t)expose);
-}
-
+} /* ecore_x_screensaver_expose_set */
/**
* Get the screen save control values.
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0.0;
+ if (!reply)
+ return 0.0;
return (int)reply->allow_exposures;
-}
-
+} /* ecore_x_screensaver_expose_get */
/**
* Specifies if the Screen Saver NotifyMask event should be generated.
((xcb_screen_t *)_ecore_xcb_screen)->root,
on ? XCB_SCREENSAVER_EVENT_NOTIFY_MASK : 0);
#endif /* ECORE_XCB_SCREENSAVER */
-}
+} /* ecore_x_screensaver_event_listen_set */
+
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-static Ecore_X_Selection_Intern selections[4];
+static Ecore_X_Selection_Intern selections[4];
static Ecore_X_Selection_Converter *converters = NULL;
-static Ecore_X_Selection_Parser *parsers = NULL;
+static Ecore_X_Selection_Parser *parsers = NULL;
-static int _ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *tprop, int *);
-static int _ecore_x_selection_data_default_free(void *data);
-static void *_ecore_x_selection_parser_files(const char *target, void *data, int size, int format);
-static int _ecore_x_selection_data_files_free(void *data);
-static void *_ecore_x_selection_parser_text(const char *target, void *data, int size, int format);
-static int _ecore_x_selection_data_text_free(void *data);
-static void *_ecore_x_selection_parser_targets(const char *target, void *data, int size, int format);
-static int _ecore_x_selection_data_targets_free(void *data);
+static int _ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *tprop, int *);
+static int _ecore_x_selection_data_default_free(void *data);
+static void * _ecore_x_selection_parser_files(const char *target, void *data, int size, int format);
+static int _ecore_x_selection_data_files_free(void *data);
+static void * _ecore_x_selection_parser_text(const char *target, void *data, int size, int format);
+static int _ecore_x_selection_data_text_free(void *data);
+static void * _ecore_x_selection_parser_targets(const char *target, void *data, int size, int format);
+static int _ecore_x_selection_data_targets_free(void *data);
#define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
/* Initialize converters */
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
- _ecore_x_selection_converter_text);
+ _ecore_x_selection_converter_text);
#ifdef X_HAVE_UTF8_STRING
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
- _ecore_x_selection_converter_text);
-#endif
+ _ecore_x_selection_converter_text);
+#endif /* ifdef X_HAVE_UTF8_STRING */
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
- _ecore_x_selection_converter_text);
+ _ecore_x_selection_converter_text);
ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
- _ecore_x_selection_converter_text);
+ _ecore_x_selection_converter_text);
/* Initialize parsers */
ecore_x_selection_parser_add("text/plain",
- _ecore_x_selection_parser_text);
+ _ecore_x_selection_parser_text);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
- _ecore_x_selection_parser_text);
+ _ecore_x_selection_parser_text);
ecore_x_selection_parser_add("text/uri-list",
- _ecore_x_selection_parser_files);
+ _ecore_x_selection_parser_files);
ecore_x_selection_parser_add("_NETSCAPE_URL",
- _ecore_x_selection_parser_files);
+ _ecore_x_selection_parser_files);
ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
- _ecore_x_selection_parser_targets);
-}
+ _ecore_x_selection_parser_targets);
+} /* _ecore_x_selection_init */
void
_ecore_x_selection_shutdown(void)
cnv = converters;
while (cnv)
{
- Ecore_X_Selection_Converter *tmp;
+ Ecore_X_Selection_Converter *tmp;
- tmp = cnv->next;
- free(cnv);
- cnv = tmp;
+ tmp = cnv->next;
+ free(cnv);
+ cnv = tmp;
}
converters = NULL;
prs = parsers;
while (prs)
{
- Ecore_X_Selection_Parser *tmp;
+ Ecore_X_Selection_Parser *tmp;
- tmp = prs;
- prs = prs->next;
- free(tmp->target);
- free(tmp);
+ tmp = prs;
+ prs = prs->next;
+ free(tmp->target);
+ free(tmp);
}
parsers = NULL;
-}
+} /* _ecore_x_selection_shutdown */
Ecore_X_Selection_Intern *
_ecore_x_selection_get(Ecore_X_Atom selection)
{
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- return &selections[0];
+ return &selections[0];
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- return &selections[1];
+ return &selections[1];
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- return &selections[2];
+ return &selections[2];
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- return &selections[3];
+ return &selections[3];
else
- return NULL;
-}
-
+ return NULL;
+} /* _ecore_x_selection_get */
/*
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, selection);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* _ecore_xcb_get_selection_owner_prefetch */
/*
* Gets the reply of the GetSelectionOwner request sent by _ecore_xcb_get_selection_owner_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* _ecore_xcb_get_selection_owner_fetch */
/*
* To use this function, you must call before, and in order,
Ecore_X_Atom selection)
{
xcb_get_selection_owner_reply_t *reply;
- unsigned char *buf = NULL;
- int in;
+ unsigned char *buf = NULL;
+ int in;
xcb_set_selection_owner(_ecore_xcb_conn, window, selection, _ecore_xcb_event_last_time);
reply = _ecore_xcb_reply_get();
- if (!reply || (reply->owner != window)) return 0;
+ if (!reply || (reply->owner != window))
+ return 0;
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- in = 0;
+ in = 0;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- in = 1;
+ in = 1;
else if (selection == ECORE_X_ATOM_SELECTION_XDND)
- in = 2;
+ in = 2;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- in = 3;
+ in = 3;
else
- return 0;
+ return 0;
if (data)
{
- selections[in].win = window;
- selections[in].selection = selection;
- selections[in].length = size;
- selections[in].time = _ecore_xcb_event_last_time;
-
- buf = malloc(size);
- memcpy(buf, data, size);
- selections[in].data = buf;
+ selections[in].win = window;
+ selections[in].selection = selection;
+ selections[in].length = size;
+ selections[in].time = _ecore_xcb_event_last_time;
+
+ buf = malloc(size);
+ memcpy(buf, data, size);
+ selections[in].data = buf;
}
else
{
- if (selections[in].data)
- {
- free(selections[in].data);
- memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data));
- }
+ if (selections[in].data)
+ {
+ free(selections[in].data);
+ memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data));
+ }
}
return 1;
-}
-
+} /* _ecore_x_selection_set */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_PRIMARY);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_primary_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_primary_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_selection_primary_fetch */
/**
* Claim ownership of the PRIMARY selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_PRIMARY);
-}
+} /* ecore_x_selection_primary_set */
/**
* Release ownership of the primary selection
ecore_x_selection_primary_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY);
-}
-
+} /* ecore_x_selection_primary_clear */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_SECONDARY);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_secondary_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_secondary_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_selection_secondary_fetch */
/**
* Claim ownership of the SECONDARY selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_SECONDARY);
-}
+} /* ecore_x_selection_secondary_set */
/**
* Release ownership of the secondary selection
ecore_x_selection_secondary_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_SECONDARY);
-}
-
+} /* ecore_x_selection_secondary_clear */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_XDND);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_xdnd_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_xdnd_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_selection_xdnd_fetch */
/**
* Claim ownership of the XDND selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_XDND);
-}
+} /* ecore_x_selection_xdnd_set */
/**
* Release ownership of the XDND selection
ecore_x_selection_xdnd_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_XDND);
-}
-
+} /* ecore_x_selection_xdnd_clear */
/**
* Sends the GetSelectionOwner request.
cookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, ECORE_X_ATOM_SELECTION_CLIPBOARD);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_selection_clipboard_prefetch */
/**
* Gets the reply of the GetSelectionOwner request sent by ecore_x_selection_clipboard_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_selection_clipboard_fetch */
/**
* Claim ownership of the CLIPBOARD selection and set its data.
int size)
{
return _ecore_x_selection_set(window, data, size, ECORE_X_ATOM_SELECTION_CLIPBOARD);
-}
+} /* ecore_x_selection_clipboard_set */
/**
* Release ownership of the clipboard selection
ecore_x_selection_clipboard_clear(void)
{
return _ecore_x_selection_set(XCB_NONE, NULL, 0, ECORE_X_ATOM_SELECTION_CLIPBOARD);
-}
-
+} /* ecore_x_selection_clipboard_clear */
/* FIXME: roundtrip if target is not handled in the tests */
Ecore_X_Atom
Ecore_X_Atom x_target = XCB_NONE;
if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
- x_target = ECORE_X_ATOM_TEXT;
+ x_target = ECORE_X_ATOM_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
- x_target = ECORE_X_ATOM_COMPOUND_TEXT;
+ x_target = ECORE_X_ATOM_COMPOUND_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
- x_target = ECORE_X_ATOM_STRING;
+ x_target = ECORE_X_ATOM_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
- x_target = ECORE_X_ATOM_UTF8_STRING;
+ x_target = ECORE_X_ATOM_UTF8_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
- x_target = ECORE_X_ATOM_FILE_NAME;
+ x_target = ECORE_X_ATOM_FILE_NAME;
else
{
xcb_intern_atom_cookie_t cookie;
strlen(target), target);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
- return XCB_NONE;
- x_target = reply->atom;
+ return XCB_NONE;
+
+ x_target = reply->atom;
free(reply);
}
return x_target;
-}
-
+} /* _ecore_x_selection_target_atom_get */
/* FIXME: roundtrip if target is not handled in the tests */
char *
_ecore_x_selection_target_get(Ecore_X_Atom target)
{
if (target == ECORE_X_ATOM_FILE_NAME)
- return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
+ return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
else if (target == ECORE_X_ATOM_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_STRING);
+ return strdup(ECORE_X_SELECTION_TARGET_STRING);
else if (target == ECORE_X_ATOM_UTF8_STRING)
- return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
+ return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
else if (target == ECORE_X_ATOM_TEXT)
- return strdup(ECORE_X_SELECTION_TARGET_TEXT);
+ return strdup(ECORE_X_SELECTION_TARGET_TEXT);
else
{
xcb_get_atom_name_cookie_t cookie;
xcb_get_atom_name_reply_t *reply;
- char *name;
+ char *name;
cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, target);
reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
- return NULL;
+ return NULL;
+
name = (char *)malloc(sizeof(char) * (reply->length + 1));
if (!name)
{
free(reply);
return NULL;
}
+
memcpy(name, xcb_get_atom_name_name(reply), reply->length);
name[reply->length] = '\0';
free(reply);
return name;
}
-}
+} /* _ecore_x_selection_target_get */
static void
_ecore_x_selection_request(Ecore_X_Window window,
target = _ecore_x_selection_target_atom_get(target_str);
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
- prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
+ prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
- prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
+ prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
- prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
+ prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
else
- return;
+ return;
xcb_convert_selection(_ecore_xcb_conn, window,
selection, target, prop,
XCB_CURRENT_TIME);
-}
+} /* _ecore_x_selection_request */
EAPI void
ecore_x_selection_primary_request(Ecore_X_Window window,
const char *target)
{
_ecore_x_selection_request(window, ECORE_X_ATOM_SELECTION_PRIMARY, target);
-}
+} /* ecore_x_selection_primary_request */
EAPI void
ecore_x_selection_secondary_request(Ecore_X_Window window,
const char *target)
{
_ecore_x_selection_request(window, ECORE_X_ATOM_SELECTION_SECONDARY, target);
-}
+} /* ecore_x_selection_secondary_request */
EAPI void
ecore_x_selection_xdnd_request(Ecore_X_Window window,
const char *target)
{
- Ecore_X_Atom atom;
+ Ecore_X_Atom atom;
Ecore_X_DND_Target *_target;
_target = _ecore_x_dnd_target_get();
ECORE_X_ATOM_SELECTION_XDND, atom,
ECORE_X_ATOM_SELECTION_PROP_XDND,
_target->time);
-}
+} /* ecore_x_selection_xdnd_request */
EAPI void
ecore_x_selection_clipboard_request(Ecore_X_Window window, const char *target)
{
_ecore_x_selection_request(window, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
-}
+} /* ecore_x_selection_clipboard_request */
EAPI void
-ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
- int (*func)(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
- Ecore_X_Atom *ttype,
- int *tsize))
+ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
+ int (*func)(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *ttype,
+ int *tsize))
{
Ecore_X_Selection_Converter *cnv;
cnv = converters;
if (converters)
{
- while (1)
- {
- if (cnv->target == target)
- {
- cnv->convert = func;
- return;
- }
- if (cnv->next)
- cnv = cnv->next;
- else
- break;
- }
-
- cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
- cnv = cnv->next;
+ while (1)
+ {
+ if (cnv->target == target)
+ {
+ cnv->convert = func;
+ return;
+ }
+
+ if (cnv->next)
+ cnv = cnv->next;
+ else
+ break;
+ }
+
+ cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
+ cnv = cnv->next;
}
else
{
- converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
- cnv = converters;
+ converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
+ cnv = converters;
}
+
cnv->target = target;
cnv->convert = func;
-}
+} /* ecore_x_selection_converter_atom_add */
EAPI void
-ecore_x_selection_converter_add(char *target,
- int (*func)(char *target,
- void *data,
- int size,
- void **data_ret,
- int *size_ret,
- Ecore_X_Atom *,
- int *))
+ecore_x_selection_converter_add(char *target,
+ int (*func)(char *target,
+ void *data,
+ int size,
+ void **data_ret,
+ int *size_ret,
+ Ecore_X_Atom *,
+ int *))
{
Ecore_X_Atom x_target;
if (!func || !target)
- return;
+ return;
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_add(x_target, func);
-}
+} /* ecore_x_selection_converter_add */
EAPI void
ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
while (cnv)
{
- if (cnv->target == target)
- {
- if (prev_cnv)
- prev_cnv->next = cnv->next;
- else
- converters = cnv->next; /* This was the first converter */
- free(cnv);
-
- return;
- }
- prev_cnv = cnv;
- cnv = cnv->next;
+ if (cnv->target == target)
+ {
+ if (prev_cnv)
+ prev_cnv->next = cnv->next;
+ else
+ converters = cnv->next; /* This was the first converter */
+
+ free(cnv);
+
+ return;
+ }
+
+ prev_cnv = cnv;
+ cnv = cnv->next;
}
-}
+} /* ecore_x_selection_converter_atom_del */
EAPI void
ecore_x_selection_converter_del(char *target)
Ecore_X_Atom x_target;
if (!target)
- return;
+ return;
x_target = _ecore_x_selection_target_atom_get(target);
ecore_x_selection_converter_atom_del(x_target);
-}
+} /* ecore_x_selection_converter_del */
EAPI int
ecore_x_selection_notify_send(Ecore_X_Window requestor,
xcb_send_event(_ecore_xcb_conn, 0,
requestor, 0, (const char *)&ev);
return 1;
-}
+} /* ecore_x_selection_notify_send */
/* Locate and run conversion callback for specified selection target */
EAPI int
Ecore_X_Atom *targtype,
int *typesize)
{
- Ecore_X_Selection_Intern *sel;
+ Ecore_X_Selection_Intern *sel;
Ecore_X_Selection_Converter *cnv;
- void *data;
- char *tgt_str;
+ void *data;
+ char *tgt_str;
sel = _ecore_x_selection_get(selection);
tgt_str = _ecore_x_selection_target_get(target);
for (cnv = converters; cnv; cnv = cnv->next)
{
- if (cnv->target == target)
- {
- int r;
- r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, targtype, typesize);
- free(tgt_str);
- if (r)
- {
- *data_ret = data;
- return r;
- }
- else
- return 0;
- }
+ if (cnv->target == target)
+ {
+ int r;
+ r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, targtype, typesize);
+ free(tgt_str);
+ if (r)
+ {
+ *data_ret = data;
+ return r;
+ }
+ else
+ return 0;
+ }
}
/* Default, just return the data */
memcpy(*data_ret, sel->data, sel->length);
free(tgt_str);
return 1;
-}
+} /* ecore_x_selection_convert */
/* TODO: We need to work out a mechanism for automatic conversion to any requested
* locale using Ecore_Txt functions */
static int
_ecore_x_selection_converter_text(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *targprop, int *s)
{
-
- /* FIXME: to do... */
+ /* FIXME: to do... */
/* XTextProperty text_prop; */
/* char *mystr; */
/* #ifdef X_HAVE_UTF8_STRING */
/* if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style, &text_prop) == Success) */
/* { */
-/* int bufsize = strlen((char *)text_prop.value) + 1; */
-/* *data_ret = malloc(bufsize); */
-/* memcpy(*data_ret, text_prop.value, bufsize); */
-/* *size_ret = bufsize; */
-/* XFree(text_prop.value); */
-/* free(mystr); */
-/* return 1; */
+/* int bufsize = strlen((char *)text_prop.value) + 1; */
+/* *data_ret = malloc(bufsize); */
+/* memcpy(*data_ret, text_prop.value, bufsize); */
+/* *size_ret = bufsize; */
+/* XFree(text_prop.value); */
+/* free(mystr); */
+/* return 1; */
/* } */
/* #else */
/* if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, &text_prop) == Success) */
/* { */
-/* int bufsize = strlen(text_prop.value) + 1; */
-/* *data_ret = malloc(bufsize); */
-/* memcpy(*data_ret, text_prop.value, bufsize); */
-/* *size_ret = bufsize; */
-/* XFree(text_prop.value); */
-/* free(mystr); */
-/* return 1; */
+/* int bufsize = strlen(text_prop.value) + 1; */
+/* *data_ret = malloc(bufsize); */
+/* memcpy(*data_ret, text_prop.value, bufsize); */
+/* *size_ret = bufsize; */
+/* XFree(text_prop.value); */
+/* free(mystr); */
+/* return 1; */
/* } */
/* #endif */
/* else */
/* { */
-/* free(mystr); */
-/* return 0; */
+/* free(mystr); */
+/* return 0; */
/* } */
- return 0;
-}
+ return 0;
+} /* _ecore_x_selection_converter_text */
EAPI void
ecore_x_selection_parser_add(const char *target,
- void *(*func)(const char *target,
- void *data,
- int size,
- int format))
+ void *(*func)(const char *target,
+ void *data,
+ int size,
+ int format))
{
Ecore_X_Selection_Parser *prs;
if (!target)
- return;
+ return;
prs = parsers;
if (parsers)
{
- while (prs->next)
- {
- if (!strcmp(prs->target, target))
- {
- prs->parse = func;
- return;
- }
- prs = prs->next;
- }
-
- prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
- prs = prs->next;
+ while (prs->next)
+ {
+ if (!strcmp(prs->target, target))
+ {
+ prs->parse = func;
+ return;
+ }
+
+ prs = prs->next;
+ }
+
+ prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
+ prs = prs->next;
}
else
{
- parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
- prs = parsers;
+ parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
+ prs = parsers;
}
+
prs->target = strdup(target);
prs->parse = func;
-}
+} /* ecore_x_selection_parser_add */
EAPI void
ecore_x_selection_parser_del(const char *target)
Ecore_X_Selection_Parser *prs, *prev_prs;
if (!target)
- return;
+ return;
prev_prs = NULL;
prs = parsers;
while (prs)
{
- if (!strcmp(prs->target, target))
- {
- if (prev_prs)
- prev_prs->next = prs->next;
- else
- parsers = prs->next; /* This was the first parser */
- free(prs->target);
- free(prs);
-
- return;
- }
- prev_prs = prs;
- prs = prs->next;
+ if (!strcmp(prs->target, target))
+ {
+ if (prev_prs)
+ prev_prs->next = prs->next;
+ else
+ parsers = prs->next; /* This was the first parser */
+
+ free(prs->target);
+ free(prs);
+
+ return;
+ }
+
+ prev_prs = prs;
+ prs = prs->next;
}
-}
+} /* ecore_x_selection_parser_del */
/* Locate and run conversion callback for specified selection target */
void *
for (prs = parsers; prs; prs = prs->next)
{
- if (!strcmp(prs->target, target))
- {
- sel = prs->parse(target, data, size, format);
- return sel;
- }
+ if (!strcmp(prs->target, target))
+ {
+ sel = prs->parse(target, data, size, format);
+ return sel;
+ }
}
/* Default, just return the data */
sel->format = format;
sel->data = data;
return sel;
-}
+} /* _ecore_x_selection_parse */
static int
_ecore_x_selection_data_default_free(void *data)
free(sel->data);
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_default_free */
static void *
_ecore_x_selection_parser_files(const char *target, void *_data, int size, int format __UNUSED__)
if (strcmp(target, "text/uri-list") &&
strcmp(target, "_NETSCAPE_URL"))
- return NULL;
+ return NULL;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free;
if (data[size - 1])
{
- /* Isn't nul terminated */
- size++;
- data = realloc(data, size);
- data[size - 1] = 0;
+ /* Isn't nul terminated */
+ size++;
+ data = realloc(data, size);
+ data[size - 1] = 0;
}
tmp = malloc(size);
is = 0;
while ((is < size) && (data[is]))
{
- if ((i == 0) && (data[is] == '#'))
- {
- for (; ((data[is]) && (data[is] != '\n')); is++);
- }
- else
- {
- if ((data[is] != '\r') &&
- (data[is] != '\n'))
- {
- tmp[i++] = data[is++];
- }
- else
- {
- while ((data[is] == '\r') || (data[is] == '\n')) is++;
- tmp[i] = 0;
- sel->num_files++;
- sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
- sel->files[sel->num_files - 1] = strdup(tmp);
- tmp[0] = 0;
- i = 0;
- }
- }
+ if ((i == 0) && (data[is] == '#'))
+ {
+ for (; ((data[is]) && (data[is] != '\n')); is++) ;
+ }
+ else
+ {
+ if ((data[is] != '\r') &&
+ (data[is] != '\n'))
+ {
+ tmp[i++] = data[is++];
+ }
+ else
+ {
+ while ((data[is] == '\r') || (data[is] == '\n')) is++;
+ tmp[i] = 0;
+ sel->num_files++;
+ sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
+ sel->files[sel->num_files - 1] = strdup(tmp);
+ tmp[0] = 0;
+ i = 0;
+ }
+ }
}
if (i > 0)
{
- tmp[i] = 0;
- sel->num_files++;
- sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
- sel->files[sel->num_files - 1] = strdup(tmp);
+ tmp[i] = 0;
+ sel->num_files++;
+ sel->files = realloc(sel->files, sel->num_files * sizeof(char *));
+ sel->files[sel->num_files - 1] = strdup(tmp);
}
+
free(tmp);
free(data);
ECORE_X_SELECTION_DATA(sel)->length = sel->num_files;
return ECORE_X_SELECTION_DATA(sel);
-}
+} /* _ecore_x_selection_parser_files */
static int
_ecore_x_selection_data_files_free(void *data)
sel = data;
if (sel->files)
{
- for (i = 0; i < sel->num_files; i++)
- free(sel->files[i]);
- free(sel->files);
+ for (i = 0; i < sel->num_files; i++)
+ free(sel->files[i]);
+ free(sel->files);
}
+
free(sel);
return 0;
-}
+} /* _ecore_x_selection_data_files_free */
static void *
_ecore_x_selection_parser_text(const char *target __UNUSED__,
- void *_data,
- int size,
- int format __UNUSED__)
+ void *_data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Text *sel;
- char *data = _data;
+ char *data = _data;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
if (data[size - 1])
{
- /* Isn't nul terminated */
- size++;
- data = realloc(data, size);
- data[size - 1] = 0;
+ /* Isn't nul terminated */
+ size++;
+ data = realloc(data, size);
+ data[size - 1] = 0;
}
sel->text = (char *)data;
ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free;
return sel;
-}
+} /* _ecore_x_selection_parser_text */
static int
_ecore_x_selection_data_text_free(void *data)
free(sel->text);
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_text_free */
static void *
_ecore_x_selection_parser_targets(const char *target __UNUSED__,
- void *data,
- int size,
- int format __UNUSED__)
+ void *data,
+ int size,
+ int format __UNUSED__)
{
Ecore_X_Selection_Data_Targets *sel;
- uint32_t *targets;
- xcb_get_atom_name_cookie_t *cookies;
- int i;
+ uint32_t *targets;
+ xcb_get_atom_name_cookie_t *cookies;
+ int i;
sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
targets = (uint32_t *)data;
sel->targets = malloc((size - 2) * sizeof(char *));
cookies = (xcb_get_atom_name_cookie_t *)malloc ((size - 2) * sizeof (xcb_get_atom_name_cookie_t));
for (i = 0; i < size - 2; i++)
- cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i + 2]);
+ cookies[i] = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i + 2]);
/* FIXME: do we let the declaration of reply inside the loop ? */
for (i = 0; i < size - 2; i++)
{
- xcb_get_atom_name_reply_t *reply;
- char *name;
- int length;
-
- reply =xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
- length = xcb_get_atom_name_name_length(reply);
- name = (char *)malloc (length + 1);
- memcpy(name, xcb_get_atom_name_name(reply), length);
- name[length] = '\0';
- sel->targets[i - 2] = name;
+ xcb_get_atom_name_reply_t *reply;
+ char *name;
+ int length;
+
+ reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookies[i], NULL);
+ length = xcb_get_atom_name_name_length(reply);
+ name = (char *)malloc (length + 1);
+ memcpy(name, xcb_get_atom_name_name(reply), length);
+ name[length] = '\0';
+ sel->targets[i - 2] = name;
}
free(cookies);
free(data);
ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
ECORE_X_SELECTION_DATA(sel)->length = size;
return sel;
-}
+} /* _ecore_x_selection_parser_targets */
static int
_ecore_x_selection_data_targets_free(void *data)
if (sel->targets)
{
- for (i = 0; i < sel->num_targets; i++)
- free(sel->targets[i]);
- free(sel->targets);
+ for (i = 0; i < sel->num_targets; i++)
+ free(sel->targets[i]);
+ free(sel->targets);
}
+
free(sel);
return 1;
-}
+} /* _ecore_x_selection_data_targets_free */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Shape_Group X Shape extension
*
* Functions that use the shape extension of the X server to change shape of given windows.
*/
-
#ifdef ECORE_XCB_SHAPE
static int _shape_available = 0;
static xcb_shape_query_version_cookie_t _ecore_xcb_shape_init_cookie;
#endif /* ECORE_XCB_SHAPE */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_shape_init and
_ecore_xcb_shape_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_SHAPE
if (reply && (reply->present))
_ecore_xcb_shape_init_cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn);
+
#endif /* ECORE_XCB_SHAPE */
-}
+} /* _ecore_x_shape_init */
void
_ecore_x_shape_init_finalize(void)
_shape_available = 1;
free(reply);
}
-#endif /* ECORE_XCB_SHAPE */
-}
+#endif /* ECORE_XCB_SHAPE */
+} /* _ecore_x_shape_init_finalize */
/**
* Sets the shape of the given window to the given pixmap.
#ifdef ECORE_XCB_SHAPE
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, source_mask);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_mask_set */
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_window_set */
EAPI void
ecore_x_window_shape_window_set_xy(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
-
+} /* ecore_x_window_shape_window_set_xy */
/**
* Sets the shape of the given window to a rectangle.
rect.height = height;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangle_set */
EAPI void
ecore_x_window_shape_rectangles_set(Ecore_X_Window dest_win,
{
#ifdef ECORE_XCB_SHAPE
if (num > 0)
- xcb_shape_rectangles(_ecore_xcb_conn,
- XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
- 0, dest_win, 0, 0, num, (xcb_rectangle_t *)rects);
+ xcb_shape_rectangles(_ecore_xcb_conn,
+ XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
+ 0, dest_win, 0, 0, num, (xcb_rectangle_t *)rects);
else
- xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
+ xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
+
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangles_set */
EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_window_add */
EAPI void
ecore_x_window_shape_window_add_xy(Ecore_X_Window dest_win,
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_window_add_xy */
EAPI void
ecore_x_window_shape_rectangle_add(Ecore_X_Window dest_win,
rect.height = height;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangle_add */
EAPI void
ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win,
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
-
+
rect.x = x;
rect.y = y;
rect.width = width;
XCB_SHAPE_SO_INTERSECT, XCB_SHAPE_SK_BOUNDING,
0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_rectangle_clip */
EAPI void
ecore_x_window_shape_rectangles_add(Ecore_X_Window dest_win,
{
#ifdef ECORE_XCB_SHAPE
if (num > 0)
- xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, num, (const xcb_rectangle_t *)rects);
+ xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, num, (const xcb_rectangle_t *)rects);
else
- xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
-#endif /* ECORE_XCB_SHAPE */
-}
+ xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
+#endif /* ECORE_XCB_SHAPE */
+} /* ecore_x_window_shape_rectangles_add */
/**
* Sends the ShapeGetRectangles request.
cookie = xcb_shape_get_rectangles_unchecked(_ecore_xcb_conn, window, XCB_SHAPE_SK_BOUNDING);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_SHAPE */
-}
-
+} /* ecore_x_window_shape_rectangles_get_prefetch */
/**
* Gets the reply of the ShapeGetRectangles request sent by ecore_x_window_shape_rectangles_get_prefetch().
reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_SHAPE */
-}
-
+} /* ecore_x_window_shape_rectangles_get_fetch */
/**
* To document.
*/
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_rectangles_get(Ecore_X_Window window __UNUSED__,
- int *num_ret)
+ int *num_ret)
{
Ecore_X_Rectangle *rects = NULL;
- uint32_t num = 0;
+ uint32_t num = 0;
#ifdef ECORE_XCB_SHAPE
xcb_shape_get_rectangles_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (num_ret) *num_ret = 0;
- return NULL;
+ if (num_ret)
+ *num_ret = 0;
+
+ return NULL;
}
num = reply->rectangles_len;
rects = malloc(sizeof(Ecore_X_Rectangle) * num);
if (rects)
- memcpy (rects,
- xcb_shape_get_rectangles_rectangles(reply),
- num * sizeof (Ecore_X_Rectangle));
+ memcpy (rects,
+ xcb_shape_get_rectangles_rectangles(reply),
+ num * sizeof (Ecore_X_Rectangle));
else
- num = 0;
+ num = 0;
+
#endif /* ECORE_XCB_SHAPE */
- if (num_ret) *num_ret = num;
+ if (num_ret)
+ *num_ret = num;
return rects;
-}
+} /* ecore_x_window_shape_rectangles_get */
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window dest_win,
int on)
{
#ifdef ECORE_XCB_SHAPE
- xcb_shape_select_input(_ecore_xcb_conn, dest_win, on ? 1 : 0);
+ xcb_shape_select_input(_ecore_xcb_conn, dest_win, on ? 1 : 0);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_shape_events_select */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Sync_Group X Sync Extension Functions
*
* Functions related to the X Sync extension.
*/
-
#ifdef ECORE_XCB_SYNC
static int _sync_available = 0;
static xcb_sync_initialize_cookie_t _ecore_xcb_sync_init_cookie;
#endif /* ECORE_XCB_SYNC */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_sync_init and
_ecore_xcb_sync_init_finalize. The first one gets the cookies and
{
#ifdef ECORE_XCB_SYNC
if (reply && (reply->present))
- _ecore_xcb_sync_init_cookie = xcb_sync_initialize_unchecked(_ecore_xcb_conn,
- XCB_SYNC_MAJOR_VERSION,
- XCB_SYNC_MINOR_VERSION);
+ _ecore_xcb_sync_init_cookie = xcb_sync_initialize_unchecked(_ecore_xcb_conn,
+ XCB_SYNC_MAJOR_VERSION,
+ XCB_SYNC_MINOR_VERSION);
+
#endif /* ECORE_XCB_SYNC */
-}
+} /* _ecore_x_sync_init */
void
_ecore_x_sync_init_finalize(void)
if (reply)
{
- if (reply->major_version >= 3)
- _sync_available = 1;
+ if (reply->major_version >= 3)
+ _sync_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_SYNC */
-}
+#endif /* ECORE_XCB_SYNC */
+} /* _ecore_x_sync_init_finalize */
/**
* Return whether the X server supports the Sync Extension.
{
#ifdef ECORE_XCB_SYNC
return _sync_available;
-#else
+#else /* ifdef ECORE_XCB_SYNC */
return 0;
#endif /* ECORE_XCB_SYNC */
-}
-
+} /* ecore_x_sync_query */
/**
* Create a new alarm.
ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
{
#ifdef ECORE_XCB_SYNC
- uint32_t value_list[6];
- xcb_sync_int64_t init;
+ uint32_t value_list[6];
+ xcb_sync_int64_t init;
Ecore_X_Sync_Alarm alarm;
- uint32_t value_mask;
+ uint32_t value_mask;
init.lo = 0;
init.hi = 0;
xcb_sync_set_counter(_ecore_xcb_conn, counter, init);
value_mask =
- XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
- XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
- XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS;
+ XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
+ XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
+ XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS;
value_list[0] = counter;
value_list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE;
value_list[2] = 1;
ecore_x_sync();
return alarm;
-#else
+#else /* ifdef ECORE_XCB_SYNC */
return 0;
#endif /* ECORE_XCB_SYNC */
-}
-
+} /* ecore_x_sync_alarm_new */
/**
* Delete an alarm.
#ifdef ECORE_XCB_SYNC
xcb_sync_destroy_alarm(_ecore_xcb_conn, alarm);
return 1;
-#else
+#else /* ifdef ECORE_XCB_SYNC */
return 0;
#endif /* ECORE_XCB_SYNC */
-}
+} /* ecore_x_sync_alarm_free */
/* FIXME: round trip */
ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val)
{
#ifdef ECORE_XCB_SYNC
- xcb_sync_query_counter_cookie_t cookie;
- xcb_sync_query_counter_reply_t *reply;
-
- cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
- reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
- if (reply)
- {
- *val = (unsigned int)reply->counter_value.lo;
- free(reply);
- return 1;
- }
+ xcb_sync_query_counter_cookie_t cookie;
+ xcb_sync_query_counter_reply_t *reply;
+
+ cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter);
+ reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL);
+ if (reply)
+ {
+ *val = (unsigned int)reply->counter_value.lo;
+ free(reply);
+ return 1;
+ }
+
#endif /* ECORE_XCB_SYNC */
- return 0;
-}
+ return 0;
+} /* ecore_x_sync_counter_query */
EAPI Ecore_X_Sync_Counter
ecore_x_sync_counter_new(int val)
#else /* ! ECORE_XCB_SYNC */
return 0;
#endif /* ! ECORE_XCB_SYNC */
-}
+} /* ecore_x_sync_counter_new */
EAPI void
ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter)
#ifdef ECORE_XCB_SYNC
xcb_sync_destroy_counter(_ecore_xcb_conn, counter);
#endif /* ECORE_XCB_SYNC */
-}
+} /* ecore_x_sync_counter_free */
EAPI void
ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, int by)
v.lo = by;
xcb_sync_change_counter(_ecore_xcb_conn, counter, v);
#endif /* ECORE_XCB_SYNC */
-}
+} /* ecore_x_sync_counter_inc */
EAPI void
ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, int val)
xcb_sync_await(_ecore_xcb_conn, 1, (const xcb_sync_waitcondition_t *)&cond);
#endif /* ECORE_XCB_SYNC */
-}
+} /* ecore_x_sync_counter_val_wait */
+
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
-static int ignore_num = 0;
+static int ignore_num = 0;
static Ecore_X_Window *ignore_list = NULL;
-static Ecore_X_Window _ecore_x_window_at_xy_get(Ecore_X_Window base,
- int16_t base_x,
- int16_t base_y,
- int16_t x,
- int16_t y,
- Ecore_X_Window *skip,
- int skip_num);
+static Ecore_X_Window _ecore_x_window_at_xy_get(Ecore_X_Window base,
+ int16_t base_x,
+ int16_t base_y,
+ int16_t x,
+ int16_t y,
+ Ecore_X_Window *skip,
+ int skip_num);
#ifdef ECORE_XCB_RENDER
-static Ecore_X_Window _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
- int16_t x,
- int16_t y,
- uint16_t w,
- uint16_t h,
- uint8_t override_redirect,
- uint8_t save_under);
+static Ecore_X_Window _ecore_x_window_argb_internal_new(Ecore_X_Window parent,
+ int16_t x,
+ int16_t y,
+ uint16_t w,
+ uint16_t h,
+ uint8_t override_redirect,
+ uint8_t save_under);
#endif /* ECORE_XCB_RENDER */
-
/**
* @defgroup Ecore_X_Window_Create_Group X Window Creation Functions
*
int width,
int height)
{
- uint32_t value_list[9];
+ uint32_t value_list[9];
Ecore_X_Window window;
xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
- uint32_t value_mask;
+ uint32_t value_mask;
- if (parent == 0) parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (parent == 0)
+ parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
value_mask =
- XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
- XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
- XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
-
- value_list[0] = XCB_NONE;
- value_list[1] = 0;
- value_list[2] = XCB_GRAVITY_NORTH_WEST;
- value_list[3] = XCB_GRAVITY_NORTH_WEST;
- value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
- value_list[5] = 0;
- value_list[6] = 0;
- value_list[7] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[8] = XCB_EVENT_MASK_NO_EVENT;
+ XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
+ XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
+ XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
+
+ value_list[0] = XCB_NONE;
+ value_list[1] = 0;
+ value_list[2] = XCB_GRAVITY_NORTH_WEST;
+ value_list[3] = XCB_GRAVITY_NORTH_WEST;
+ value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
+ value_list[5] = 0;
+ value_list[6] = 0;
+ value_list[7] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[8] = XCB_EVENT_MASK_NO_EVENT;
window = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
- XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- window, parent, x, y, width, height, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT,
- vis,
- value_mask,
- value_list);
-
- if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root) ecore_x_window_defaults_set(window);
+ XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+ window, parent, x, y, width, height, 0,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ vis,
+ value_mask,
+ value_list);
+
+ if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
+ ecore_x_window_defaults_set(window);
+
return window;
-}
+} /* ecore_x_window_new */
/**
* Creates a window with the override redirect attribute set to @c True.
int width,
int height)
{
- uint32_t value_list[9];
+ uint32_t value_list[9];
Ecore_X_Window window;
- xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
- uint32_t value_mask;
+ xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
+ uint32_t value_mask;
- if (parent == 0) parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (parent == 0)
+ parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
value_mask =
- XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
- XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
- XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
-
- value_list[0] = XCB_NONE;
- value_list[1] = 0;
- value_list[2] = XCB_GRAVITY_NORTH_WEST;
- value_list[3] = XCB_GRAVITY_NORTH_WEST;
- value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
- value_list[5] = 1;
- value_list[6] = 0;
- value_list[7] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[8] = XCB_EVENT_MASK_NO_EVENT;
+ XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
+ XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
+ XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
+
+ value_list[0] = XCB_NONE;
+ value_list[1] = 0;
+ value_list[2] = XCB_GRAVITY_NORTH_WEST;
+ value_list[3] = XCB_GRAVITY_NORTH_WEST;
+ value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
+ value_list[5] = 1;
+ value_list[6] = 0;
+ value_list[7] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[8] = XCB_EVENT_MASK_NO_EVENT;
window = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
- XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- window, parent, x, y, width, height, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT,
- vis,
- value_mask,
- value_list);
+ XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+ window, parent, x, y, width, height, 0,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ vis,
+ value_mask,
+ value_list);
return window;
-}
+} /* ecore_x_window_override_new */
/**
* Creates a new input window.
int width,
int height)
{
- uint32_t value_list[3];
+ uint32_t value_list[3];
Ecore_X_Window window;
- xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
- uint32_t value_mask;
+ xcb_visualid_t vis = { XCB_WINDOW_CLASS_COPY_FROM_PARENT };
+ uint32_t value_mask;
- if (parent == 0) parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (parent == 0)
+ parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
value_mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
- value_list[0] = 1;
- value_list[1] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[2] = XCB_EVENT_MASK_NO_EVENT;
+ value_list[0] = 1;
+ value_list[1] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[2] = XCB_EVENT_MASK_NO_EVENT;
window = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
- XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- window, parent, x, y, width, height, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT,
- vis,
- value_mask,
- value_list);
+ XCB_WINDOW_CLASS_COPY_FROM_PARENT,
+ window, parent, x, y, width, height, 0,
+ XCB_WINDOW_CLASS_INPUT_OUTPUT,
+ vis,
+ value_mask,
+ value_list);
if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
{
}
return window;
-}
+} /* ecore_x_window_input_new */
/**
* Creates a new window.
#endif /* ECORE_XCB_RENDER */
return window;
-}
+} /* ecore_x_window_manager_argb_new */
/**
* Creates a new window.
#endif /* ECORE_XCB_RENDER */
return window;
-}
+} /* ecore_x_window_argb_new */
/**
* Creates a window with the override redirect attribute set to @c True.
#endif /* ECORE_XCB_RENDER */
return window;
-}
+} /* ecore_x_window_override_argb_new */
/**
* @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions
*/
if (window)
xcb_destroy_window(_ecore_xcb_conn, window);
-}
+} /* ecore_x_window_free */
/**
* Sends a delete request to the given window.
xcb_send_event(_ecore_xcb_conn, 0, window,
XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
-}
+} /* ecore_x_window_delete_request_send */
/**
* @defgroup Ecore_X_Window_Configure_Group X Window Configure Functions
* Functions to configure X windows.
*/
-
/**
* Configures the given window with the given mask.
* @param window The given window.
int stack_mode)
{
uint32_t *value_list;
- uint32_t value_mask;
- int length = 0;
+ uint32_t value_mask;
+ int length = 0;
if (!window)
return;
value_mask = mask;
- for ( ; value_mask; value_mask >>= 1)
- if (value_mask & 1)
- length++;
+ for (; value_mask; value_mask >>= 1)
+ if (value_mask & 1)
+ length++;
+
value_list = (uint32_t *)malloc(sizeof(uint32_t) * length);
if (!value_list)
return;
value_mask = mask;
- for ( ; value_mask; value_mask >>= 1, value_list++)
+ for (; value_mask; value_mask >>= 1, value_list++)
if (value_mask & 1)
{
- switch (value_mask) {
- case XCB_CONFIG_WINDOW_X:
- *value_list = x;
- break;
- case XCB_CONFIG_WINDOW_Y:
- *value_list = y;
- break;
- case XCB_CONFIG_WINDOW_WIDTH:
- *value_list = width;
- break;
- case XCB_CONFIG_WINDOW_HEIGHT:
- *value_list = height;
- break;
- case XCB_CONFIG_WINDOW_BORDER_WIDTH:
- *value_list = border_width;
- break;
- case XCB_CONFIG_WINDOW_SIBLING:
- *value_list = sibling;
- break;
- case XCB_CONFIG_WINDOW_STACK_MODE:
- *value_list = stack_mode;
- break;
- }
+ switch (value_mask) {
+ case XCB_CONFIG_WINDOW_X:
+ *value_list = x;
+ break;
+
+ case XCB_CONFIG_WINDOW_Y:
+ *value_list = y;
+ break;
+
+ case XCB_CONFIG_WINDOW_WIDTH:
+ *value_list = width;
+ break;
+
+ case XCB_CONFIG_WINDOW_HEIGHT:
+ *value_list = height;
+ break;
+
+ case XCB_CONFIG_WINDOW_BORDER_WIDTH:
+ *value_list = border_width;
+ break;
+
+ case XCB_CONFIG_WINDOW_SIBLING:
+ *value_list = sibling;
+ break;
+
+ case XCB_CONFIG_WINDOW_STACK_MODE:
+ *value_list = stack_mode;
+ break;
+ } /* switch */
}
xcb_configure_window(_ecore_xcb_conn, window, mask, value_list);
free(value_list);
-}
+} /* ecore_x_window_configure */
/**
* Moves a window to the position @p x, @p y.
value_list[1] = y;
xcb_configure_window(_ecore_xcb_conn, window, value_mask, value_list);
-}
+} /* ecore_x_window_move */
/**
* Resizes a window.
if (!window)
return;
- if (width < 1) width = 1;
- if (height < 1) height = 1;
+ if (width < 1)
+ width = 1;
+
+ if (height < 1)
+ height = 1;
value_mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
value_list[1] = height;
xcb_configure_window(_ecore_xcb_conn, window, value_mask, value_list);
-}
+} /* ecore_x_window_resize */
/**
* Moves and resizes a window.
if (!window)
return;
- if (width < 1) width = 1;
- if (height < 1) height = 1;
+ if (width < 1)
+ width = 1;
+
+ if (height < 1)
+ height = 1;
value_mask =
- XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
- XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
+ XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
+ XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
value_list[0] = x;
value_list[1] = y;
value_list[3] = height;
xcb_configure_window(_ecore_xcb_conn, window, value_mask, value_list);
-}
+} /* ecore_x_window_move_resize */
/**
* Sets the width of the border of the given window.
value_list = border_width;
xcb_configure_window(_ecore_xcb_conn, window, XCB_CONFIG_WINDOW_BORDER_WIDTH, &value_list);
-}
+} /* ecore_x_window_border_width_set */
/**
* Raises the given window.
value_list = XCB_STACK_MODE_ABOVE;
xcb_configure_window(_ecore_xcb_conn, window, XCB_CONFIG_WINDOW_STACK_MODE, &value_list);
-}
+} /* ecore_x_window_raise */
/**
* Lowers the given window.
value_list = XCB_STACK_MODE_BELOW;
xcb_configure_window(_ecore_xcb_conn, window, XCB_CONFIG_WINDOW_STACK_MODE, &value_list);
-}
+} /* ecore_x_window_lower */
/**
* @defgroup Ecore_X_Window_Change_Properties_Group X Window Change Property Functions
EAPI void
ecore_x_window_defaults_set(Ecore_X_Window window)
{
- char buf[MAXHOSTNAMELEN];
- pid_t pid;
- int argc;
+ char buf[MAXHOSTNAMELEN];
+ pid_t pid;
+ int argc;
char **argv;
/*
/* The ecore function uses UTF8 which Xlib may not like (especially
* with older clients) */
/* ecore_xcb_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE,
- (char *)buf); */
+ (char *)buf); */
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_WM_CLIENT_MACHINE,
ECORE_X_ATOM_STRING,
ecore_app_args_get(&argc, &argv);
ecore_x_icccm_command_set(window, argc, argv);
-}
+} /* ecore_x_window_defaults_set */
/**
* @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions
ecore_x_window_show(Ecore_X_Window window)
{
xcb_map_window(_ecore_xcb_conn, window);
-}
+} /* ecore_x_window_show */
/**
* Hides a window.
ecore_x_window_hide(Ecore_X_Window window)
{
xcb_unmap_notify_event_t ev;
- Ecore_X_Window root;
+ Ecore_X_Window root;
/* ICCCM: SEND unmap event... */
root = window;
/* FIXME: is it correct ? */
if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1)
- root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
else
{
- xcb_get_geometry_cookie_t cookie;
- xcb_get_geometry_reply_t *rep;
- Ecore_X_Drawable draw;
+ xcb_get_geometry_cookie_t cookie;
+ xcb_get_geometry_reply_t *rep;
+ Ecore_X_Drawable draw;
/* FIXME: can we avoid round trips, here ? */
draw = window;
rep = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
if (!rep)
return;
+
root = rep->root;
free(rep);
}
+
ev.response_type = XCB_UNMAP_NOTIFY;
ev.pad0 = 0;
ev.sequence = 0;
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char *)&ev);
xcb_unmap_window(_ecore_xcb_conn, window);
-}
+} /* ecore_x_window_hide */
/**
* @defgroup Ecore_X_Window_Input_Focus_Group X Window Input Focus Functions
{
Ecore_X_Time time = XCB_CURRENT_TIME;
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
/* xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_NONE, win, time); */
xcb_set_input_focus(_ecore_xcb_conn,
XCB_INPUT_FOCUS_POINTER_ROOT, window, time);
-}
+} /* ecore_x_window_focus */
/**
* Sets the focus to the given window at a specific time.
ecore_x_window_focus_at_time(Ecore_X_Window window,
Ecore_X_Time time)
{
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
/* xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_NONE, win, time); */
xcb_set_input_focus(_ecore_xcb_conn,
XCB_INPUT_FOCUS_POINTER_ROOT, window, time);
-}
+} /* ecore_x_window_focus_at_time */
/**
* @defgroup Ecore_X_Window_Reparent_Group X Window Reparent Functions
int x,
int y)
{
- if (new_parent == 0) new_parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (new_parent == 0)
+ new_parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
xcb_reparent_window(_ecore_xcb_conn, window, new_parent, x, y);
-}
-
+} /* ecore_x_window_reparent */
/**
* @defgroup Ecore_X_Window_Change_Attributes_Group X Window Change Attributes Functions
value_list = pixmap;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_BACK_PIXMAP, &value_list);
-}
+} /* ecore_x_window_pixmap_set */
/**
* Sets the background color of the given window.
{
xcb_alloc_color_cookie_t cookie;
xcb_alloc_color_reply_t *rep;
- uint32_t value_list;
+ uint32_t value_list;
/* FIXME: should I provide a reply, and not the color components, here ? */
/* (because of roundtrips) */
red, green, blue);
rep = xcb_alloc_color_reply(_ecore_xcb_conn, cookie, NULL);
if (!rep)
- return;
+ return;
value_list = rep->pixel;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_BACK_PIXEL, &value_list);
free(rep);
-}
+} /* ecore_x_window_background_color_set */
/**
* Sets the bit gravity of the given window.
value_list = gravity;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_BIT_GRAVITY, &value_list);
-}
+} /* ecore_x_window_pixel_gravity_set */
/**
* Sets the gravity of the given window.
value_list = gravity;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_WIN_GRAVITY, &value_list);
-}
+} /* ecore_x_window_gravity_set */
/**
* Sets the override attribute of the given window.
value_list = override_redirect;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_OVERRIDE_REDIRECT, &value_list);
-}
+} /* ecore_x_window_override_set */
/**
* Shows the cursor of the given window.
ecore_x_window_cursor_show(Ecore_X_Window window,
int show)
{
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
if (!show)
{
- Ecore_X_Cursor cursor;
+ Ecore_X_Cursor cursor;
Ecore_X_Drawable draw;
- Ecore_X_Pixmap pixmap;
- Ecore_X_Pixmap mask;
- Ecore_X_GC gc;
- xcb_point_t point;
- uint32_t value_list;
+ Ecore_X_Pixmap pixmap;
+ Ecore_X_Pixmap mask;
+ Ecore_X_GC gc;
+ xcb_point_t point;
+ uint32_t value_list;
draw = window;
pixmap = xcb_generate_id(_ecore_xcb_conn);
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_CURSOR, &value_list);
}
-}
+} /* ecore_x_window_cursor_show */
/**
* Sets the cursor of the given window.
value_list = cursor;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_CURSOR, &value_list);
-}
+} /* ecore_x_window_cursor_set */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
- XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT;
+ XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
-
-}
+} /* ecore_x_window_container_manage */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_VISIBILITY_CHANGE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE |
/* XCB_EVENT_MASK_RESIZE_REDIRECT | */
- XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE |
- XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE |
+ XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
#ifdef ECORE_XCB_SHAPE
xcb_shape_select_input(_ecore_xcb_conn, window, 1);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_client_manage */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
- XCB_EVENT_MASK_PROPERTY_CHANGE;
+ XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_PROPERTY_CHANGE;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
-}
+} /* ecore_x_window_sniff */
/**
* Todo
uint32_t value_list;
value_list =
- XCB_EVENT_MASK_VISIBILITY_CHANGE |
- XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE |
- XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ XCB_EVENT_MASK_VISIBILITY_CHANGE |
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE |
+ XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
xcb_change_window_attributes(_ecore_xcb_conn, window,
XCB_CW_EVENT_MASK, &value_list);
#ifdef ECORE_XCB_SHAPE
xcb_shape_select_input(_ecore_xcb_conn, window, 1);
#endif /* ECORE_XCB_SHAPE */
-}
+} /* ecore_x_window_client_sniff */
/**
* Clears an area of the given window.
int height)
{
xcb_clear_area(_ecore_xcb_conn, 0, window, x, y, width, height);
-}
+} /* ecore_x_window_area_clear */
/**
* Exposes an area of the given window.
int height)
{
xcb_clear_area(_ecore_xcb_conn, 1, window, x, y, width, height);
-}
-
+} /* ecore_x_window_area_expose */
/**
* @defgroup Ecore_X_Window_Save_Set_Group X Window Change Save Set Functions
ecore_x_window_save_set_add(Ecore_X_Window window)
{
xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_INSERT, window);
-}
+} /* ecore_x_window_save_set_add */
/**
* Deletes the window from the client's save-set.
ecore_x_window_save_set_del(Ecore_X_Window window)
{
xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_DELETE, window);
-}
+} /* ecore_x_window_save_set_del */
/******************************
- *
- * Request that have a reply
- *
- ******************************/
-
+*
+* Request that have a reply
+*
+******************************/
/**
* Sends the GetInputFocus request.
cookie = xcb_get_input_focus_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_get_input_focus_prefetch */
/**
* Gets the reply of the GetInputFocus request sent by ecore_x_get_input_focus_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_get_input_focus_fetch */
/**
* Gets the window that has focus.
ecore_x_window_focus_get(void)
{
xcb_get_input_focus_reply_t *reply;
- Ecore_X_Window window = 0;
+ Ecore_X_Window window = 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return window;
+ if (!reply)
+ return window;
return reply->focus;
-}
-
+} /* ecore_x_window_focus_get */
/**
* @defgroup Ecore_X_Window_Get_Attributes_Group X Window Get Attributes Functions
* Functions that get the attributes of a window.
*/
-
/**
* Sends the GetWindowAttributes request.
* @ingroup Ecore_X_Window_Get_Attributes_Group
cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_get_window_attributes_prefetch */
/**
* Gets the reply of the GetWindowAttributes request sent by ecore_x_get_window_attributes_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_get_window_attributes_fetch */
/**
* Retrieves the attributes of a window.
* @ingroup Ecore_X_Window_Get_Attributes_Group
*/
EAPI int
-ecore_x_window_attributes_get(Ecore_X_Window window __UNUSED__,
+ecore_x_window_attributes_get(Ecore_X_Window window __UNUSED__,
Ecore_X_Window_Attributes *att_ret)
{
xcb_get_window_attributes_reply_t *reply;
- if (!att_ret) return 0;
+ if (!att_ret)
+ return 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes));
- if (reply->map_state != XCB_MAP_STATE_UNMAPPED) att_ret->visible = 1;
- if (reply->map_state == XCB_MAP_STATE_VIEWABLE) att_ret->viewable = 1;
- if (reply->override_redirect) att_ret->override = 1;
- if (reply->_class == XCB_WINDOW_CLASS_INPUT_ONLY) att_ret->input_only = 1;
- if (reply->save_under) att_ret->save_under = 1;
+ if (reply->map_state != XCB_MAP_STATE_UNMAPPED)
+ att_ret->visible = 1;
+
+ if (reply->map_state == XCB_MAP_STATE_VIEWABLE)
+ att_ret->viewable = 1;
+
+ if (reply->override_redirect)
+ att_ret->override = 1;
+
+ if (reply->_class == XCB_WINDOW_CLASS_INPUT_ONLY)
+ att_ret->input_only = 1;
+
+ if (reply->save_under)
+ att_ret->save_under = 1;
- att_ret->event_mask.mine = reply->your_event_mask;
- att_ret->event_mask.all = reply->all_event_masks;
+ att_ret->event_mask.mine = reply->your_event_mask;
+ att_ret->event_mask.all = reply->all_event_masks;
att_ret->event_mask.no_propagate = reply->do_not_propagate_mask;
- att_ret->window_gravity = reply->win_gravity;
- att_ret->pixel_gravity = reply->bit_gravity;
- att_ret->colormap = reply->colormap;
- att_ret->visual = reply->visual;
+ att_ret->window_gravity = reply->win_gravity;
+ att_ret->pixel_gravity = reply->bit_gravity;
+ att_ret->colormap = reply->colormap;
+ att_ret->visual = reply->visual;
return 1;
-}
+} /* ecore_x_window_attributes_get */
/**
* Finds out whether the given window is currently visible.
xcb_get_window_attributes_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
return (reply->map_state == XCB_MAP_STATE_VIEWABLE) ? 1 : 0;
-}
-
+} /* ecore_x_window_visible_get */
/**
* Sends the QueryPointer request.
cookie = xcb_query_pointer_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_pointer_xy_get_prefetch */
/**
* Gets the reply of the QueryPointer request sent by ecore_x_query_pointer_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_query_pointer_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_pointer_xy_get_fetch */
/**
* Retrieves the coordinates of the pointer.
*/
EAPI void
ecore_x_pointer_xy_get(Ecore_X_Window window __UNUSED__,
- int *x,
- int *y)
+ int *x,
+ int *y)
{
xcb_query_pointer_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (x) *x = 0;
- if (y) *y = 0;
+ if (x)
+ *x = 0;
+
+ if (y)
+ *y = 0;
- return;
+ return;
}
- if (x) *x = reply->win_x;
- if (y) *y = reply->win_y;
-}
+ if (x)
+ *x = reply->win_x;
+ if (y)
+ *y = reply->win_y;
+} /* ecore_x_pointer_xy_get */
/**
* Sends the QueryTree request.
cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
+} /* ecore_x_query_tree_prefetch */
/**
* Gets the reply of the QueryTree request sent by ecore_x_query_tree_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_query_tree_fetch */
/**
* Retrieves the parent window of the given window.
xcb_query_tree_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
return reply->parent;
-}
-
+} /* ecore_x_window_parent_get */
/**
* Retrieves the children windows of the given window.
*/
EAPI Ecore_X_Window *
ecore_x_window_children_get(Ecore_X_Window window __UNUSED__,
- int *num)
+ int *num)
{
xcb_query_tree_reply_t *reply;
- Ecore_X_Window *windows = NULL;
+ Ecore_X_Window *windows = NULL;
+
+ if (num)
+ *num = 0;
- if (num) *num = 0;
reply = _ecore_xcb_reply_get();
- if (!reply) return NULL;
+ if (!reply)
+ return NULL;
windows = malloc(sizeof(Ecore_X_Window) * reply->children_len);
if (!windows)
- return NULL;
+ return NULL;
+
+ if (num)
+ *num = reply->children_len;
- if (num) *num = reply->children_len;
memcpy(windows,
xcb_query_tree_children(reply),
sizeof(Ecore_X_Window) * reply->children_len);
return windows;
-}
+} /* ecore_x_window_children_get */
/* FIXME: I've tried to remove the round trips. 3 cookies are */
/* created at the beginning of the function. Because of */
int skip_num)
{
xcb_get_window_attributes_cookie_t cookie_get_window_attributes;
- xcb_get_geometry_cookie_t cookie_get_geometry;
- xcb_query_tree_cookie_t cookie_query_tree;
+ xcb_get_geometry_cookie_t cookie_get_geometry;
+ xcb_query_tree_cookie_t cookie_query_tree;
xcb_get_window_attributes_reply_t *reply_get_window_attributes;
- xcb_get_geometry_reply_t *reply_get_geometry;
- xcb_query_tree_reply_t *reply_query_tree;
- Ecore_X_Window window = 0;
- Ecore_X_Window child = 0;
- int16_t win_x;
- int16_t win_y;
- uint16_t win_width;
- uint16_t win_height;
- xcb_window_t *wins = NULL;
- int tree_c_len;
- int i;
+ xcb_get_geometry_reply_t *reply_get_geometry;
+ xcb_query_tree_reply_t *reply_query_tree;
+ Ecore_X_Window window = 0;
+ Ecore_X_Window child = 0;
+ int16_t win_x;
+ int16_t win_y;
+ uint16_t win_width;
+ uint16_t win_height;
+ xcb_window_t *wins = NULL;
+ int tree_c_len;
+ int i;
cookie_get_window_attributes = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, base);
cookie_get_geometry = xcb_get_geometry_unchecked(_ecore_xcb_conn, base);
reply_get_window_attributes = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie_get_window_attributes, NULL);
if (!reply_get_window_attributes)
{
- reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
- if (reply_get_geometry) free(reply_get_geometry);
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
+ if (reply_get_geometry)
+ free(reply_get_geometry);
+
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
if (reply_get_window_attributes->map_state != XCB_MAP_STATE_VIEWABLE)
{
- free(reply_get_window_attributes);
- reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
- if (reply_get_geometry) free(reply_get_geometry);
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ free(reply_get_window_attributes);
+ reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
+ if (reply_get_geometry)
+ free(reply_get_geometry);
+
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
free(reply_get_window_attributes);
reply_get_geometry = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_get_geometry, NULL);
if (!reply_get_geometry)
{
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
win_x = reply_get_geometry->x;
(x < (int16_t)(win_x + win_width)) &&
(y < (int16_t)(win_y + win_height))))
{
- reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
- if (reply_query_tree) free(reply_query_tree);
- return window;
+ reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
+ if (reply_query_tree)
+ free(reply_query_tree);
+
+ return window;
}
reply_query_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_query_tree, NULL);
if (!reply_query_tree)
{
if (skip)
- {
+ {
int i;
- for (i = 0; i < skip_num; i++)
- if (base == skip[i])
- return window;
- }
- return base;
+ for (i = 0; i < skip_num; i++)
+ if (base == skip[i])
+ return window;
+
+ }
+
+ return base;
}
wins = xcb_query_tree_children(reply_query_tree);
int j;
for (j = 0; j < skip_num; j++)
- if (wins[i] == skip[j])
- continue;
+ if (wins[i] == skip[j])
+ continue;
+
}
+
child = _ecore_x_window_at_xy_get(wins[i], win_x, win_y, x, y, skip, skip_num);
if (child)
{
{
int i;
- for (i = 0; i < skip_num; i++)
- if (base == skip[i])
- {
- /* We return 0. child has an xid equal to 0 */
- free(reply_query_tree);
- return child;
- }
+ for (i = 0; i < skip_num; i++)
+ if (base == skip[i])
+ {
+ /* We return 0. child has an xid equal to 0 */
+ free(reply_query_tree);
+ return child;
+ }
+
}
free(reply_query_tree);
return base;
-}
+} /* _ecore_x_window_at_xy_get */
/**
* @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions
*/
EAPI Ecore_X_Window
ecore_x_window_at_xy_get(int x,
- int y)
+ int y)
{
Ecore_X_Window window;
Ecore_X_Window root;
ecore_x_ungrab();
return window ? window : root;
-}
+} /* ecore_x_window_at_xy_get */
/**
* Retrieves the top, visible window at the given location,
*/
EAPI Ecore_X_Window
ecore_x_window_at_xy_with_skip_get(int x,
- int y,
- Ecore_X_Window *skip,
- int skip_num)
+ int y,
+ Ecore_X_Window *skip,
+ int skip_num)
{
Ecore_X_Window window;
Ecore_X_Window root;
ecore_x_ungrab();
return window ? window : root;
-}
+} /* ecore_x_window_at_xy_with_skip_get */
/**
* Retrieves the top, visible window at the given location,
ecore_x_ungrab();
return window ? window : begin;
-}
-
-
+} /* ecore_x_window_at_xy_begin_get */
/* FIXME: Should I provide the replies (or the cookies), instead of
creating them in the function ? */
uint8_t override_redirect,
uint8_t save_under)
{
- uint32_t value_list[10];
- xcb_depth_iterator_t iter_depth;
- xcb_visualtype_iterator_t iter_visualtype;
+ uint32_t value_list[10];
+ xcb_depth_iterator_t iter_depth;
+ xcb_visualtype_iterator_t iter_visualtype;
xcb_render_query_pict_formats_cookie_t cookie_pict_format;
xcb_render_query_pict_formats_reply_t *rep_pict_format;
- Ecore_X_Screen *screen = NULL;
- Ecore_X_Window win = { 0 };
- xcb_visualid_t vis = { 0 };
- Ecore_X_Colormap colormap;
- uint32_t value_mask;
+ Ecore_X_Screen *screen = NULL;
+ Ecore_X_Window win = { 0 };
+ xcb_visualid_t vis = { 0 };
+ Ecore_X_Colormap colormap;
+ uint32_t value_mask;
cookie_pict_format = xcb_render_query_pict_formats_unchecked(_ecore_xcb_conn);
if (parent == 0)
{
parent = ((xcb_screen_t *)_ecore_xcb_screen)->root;
- screen = ((xcb_screen_t *)_ecore_xcb_screen);
+ screen = ((xcb_screen_t *)_ecore_xcb_screen);
}
else
{
- xcb_screen_iterator_t iter_screen;
+ xcb_screen_iterator_t iter_screen;
xcb_get_geometry_reply_t *rep;
- Ecore_X_Drawable draw;
- Ecore_X_Window root;
+ Ecore_X_Drawable draw;
+ Ecore_X_Window root;
draw = parent;
rep = xcb_get_geometry_reply(_ecore_xcb_conn,
draw),
NULL);
if (!rep)
- return win;
+ return win;
root = rep->root;
{
if (iter_screen.data->root == root)
{
- screen = iter_screen.data;
+ screen = iter_screen.data;
}
}
}
+
if (!screen)
- return win;
+ return win;
/* we get the X visual types */
iter_depth = xcb_screen_allowed_depths_iterator(screen);
for (; iter_depth.rem; xcb_depth_next(&iter_depth)) {
- if (iter_depth.data->depth == 32) {
- iter_visualtype = xcb_depth_visuals_iterator(iter_depth.data);
- break;
- }
- }
+ if (iter_depth.data->depth == 32)
+ {
+ iter_visualtype = xcb_depth_visuals_iterator(iter_depth.data);
+ break;
+ }
+ }
/* we get the X render visual id */
rep_pict_format = xcb_render_query_pict_formats_reply(_ecore_xcb_conn,
cookie_pict_format,
NULL);
if (!rep_pict_format)
- return win;
+ return win;
for (; iter_visualtype.rem; xcb_visualtype_next(&iter_visualtype)) {
- if (iter_visualtype.data->_class == XCB_VISUAL_CLASS_TRUE_COLOR) {
- xcb_render_pictforminfo_iterator_t iter_forminfo;
- xcb_render_pictscreen_iterator_t iter_pictscreen;
- xcb_render_pictformat_t pict_format = { 0 };
-
- iter_forminfo = xcb_render_query_pict_formats_formats_iterator(rep_pict_format);
- for (; iter_forminfo.rem; xcb_render_pictforminfo_next(&iter_forminfo)) {
- if (iter_forminfo.data->type == XCB_RENDER_PICT_TYPE_DIRECT &&
- iter_forminfo.data->direct.alpha_mask && iter_forminfo.data->depth == 32) {
- pict_format = iter_forminfo.data->id;
- break;
- }
- }
- if (pict_format == 0) {
- free(rep_pict_format);
- return win;
- }
- iter_pictscreen = xcb_render_query_pict_formats_screens_iterator(rep_pict_format);
- for (; iter_pictscreen.rem; xcb_render_pictscreen_next(&iter_pictscreen)) {
- xcb_render_pictdepth_iterator_t iter_depth;
-
- iter_depth = xcb_render_pictscreen_depths_iterator(iter_pictscreen.data);
- for (; iter_depth.rem; xcb_render_pictdepth_next(&iter_depth)) {
- xcb_render_pictvisual_iterator_t iter_visual;
-
- iter_visual = xcb_render_pictdepth_visuals_iterator(iter_depth.data);
- for (; iter_visual.rem; xcb_render_pictvisual_next(&iter_visual)) {
- if ((iter_visual.data->visual == iter_visualtype.data->visual_id) &&
- (pict_format == iter_visual.data->format)) {
- vis = iter_visual.data->visual;
- break;
- }
+ if (iter_visualtype.data->_class == XCB_VISUAL_CLASS_TRUE_COLOR)
+ {
+ xcb_render_pictforminfo_iterator_t iter_forminfo;
+ xcb_render_pictscreen_iterator_t iter_pictscreen;
+ xcb_render_pictformat_t pict_format = { 0 };
+
+ iter_forminfo = xcb_render_query_pict_formats_formats_iterator(rep_pict_format);
+ for (; iter_forminfo.rem; xcb_render_pictforminfo_next(&iter_forminfo)) {
+ if (iter_forminfo.data->type == XCB_RENDER_PICT_TYPE_DIRECT &&
+ iter_forminfo.data->direct.alpha_mask && iter_forminfo.data->depth == 32)
+ {
+ pict_format = iter_forminfo.data->id;
+ break;
+ }
+ }
+ if (pict_format == 0)
+ {
+ free(rep_pict_format);
+ return win;
+ }
+
+ iter_pictscreen = xcb_render_query_pict_formats_screens_iterator(rep_pict_format);
+ for (; iter_pictscreen.rem; xcb_render_pictscreen_next(&iter_pictscreen)) {
+ xcb_render_pictdepth_iterator_t iter_depth;
+
+ iter_depth = xcb_render_pictscreen_depths_iterator(iter_pictscreen.data);
+ for (; iter_depth.rem; xcb_render_pictdepth_next(&iter_depth)) {
+ xcb_render_pictvisual_iterator_t iter_visual;
+
+ iter_visual = xcb_render_pictdepth_visuals_iterator(iter_depth.data);
+ for (; iter_visual.rem; xcb_render_pictvisual_next(&iter_visual)) {
+ if ((iter_visual.data->visual == iter_visualtype.data->visual_id) &&
+ (pict_format == iter_visual.data->format))
+ {
+ vis = iter_visual.data->visual;
+ break;
+ }
+ }
+ }
}
- }
- }
- }
- }
+ }
+ }
free(rep_pict_format);
if (vis == 0)
- return win;
+ return win;
colormap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_colormap(_ecore_xcb_conn, XCB_COLORMAP_ALLOC_NONE, colormap, parent, vis);
value_mask =
- XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
- XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
- XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE |
- XCB_CW_COLORMAP;
-
- value_list[0] = XCB_NONE;
- value_list[1] = 0;
- value_list[2] = XCB_GRAVITY_NORTH_WEST;
- value_list[3] = XCB_GRAVITY_NORTH_WEST;
- value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
- value_list[5] = override_redirect;
- value_list[6] = save_under;
- value_list[7] =
- XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
- XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
- XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
- XCB_EVENT_MASK_COLOR_MAP_CHANGE;
- value_list[8] = XCB_EVENT_MASK_NO_EVENT;
- value_list[9] = colormap;
+ XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY |
+ XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | XCB_CW_OVERRIDE_REDIRECT |
+ XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE |
+ XCB_CW_COLORMAP;
+
+ value_list[0] = XCB_NONE;
+ value_list[1] = 0;
+ value_list[2] = XCB_GRAVITY_NORTH_WEST;
+ value_list[3] = XCB_GRAVITY_NORTH_WEST;
+ value_list[4] = XCB_BACKING_STORE_NOT_USEFUL;
+ value_list[5] = override_redirect;
+ value_list[6] = save_under;
+ value_list[7] =
+ XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
+ XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
+ XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW |
+ XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE |
+ XCB_EVENT_MASK_VISIBILITY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE |
+ XCB_EVENT_MASK_COLOR_MAP_CHANGE;
+ value_list[8] = XCB_EVENT_MASK_NO_EVENT;
+ value_list[9] = colormap;
win = xcb_generate_id(_ecore_xcb_conn);
xcb_create_window(_ecore_xcb_conn,
xcb_free_colormap(_ecore_xcb_conn, colormap);
if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root)
- ecore_x_window_defaults_set(win);
+ ecore_x_window_defaults_set(win);
return win;
-}
-#endif /* ECORE_XCB_RENDER */
-
+} /* _ecore_x_window_argb_internal_new */
+#endif /* ECORE_XCB_RENDER */
/* FIXME: round trip */
EAPI int
ecore_x_window_argb_get(Ecore_X_Window win)
{
- uint8_t ret = 0;
+ uint8_t ret = 0;
#ifdef ECORE_XCB_RENDER
- xcb_render_pictforminfo_iterator_t iter_forminfo;
- xcb_render_pictscreen_iterator_t iter_pictscreen;
- xcb_render_pictformat_t pict_format = { 0 };
+ xcb_render_pictforminfo_iterator_t iter_forminfo;
+ xcb_render_pictscreen_iterator_t iter_pictscreen;
+ xcb_render_pictformat_t pict_format = { 0 };
xcb_render_query_pict_formats_reply_t *rep_pictformat;
- xcb_get_window_attributes_reply_t *rep;
- xcb_visualid_t visual;
+ xcb_get_window_attributes_reply_t *rep;
+ xcb_visualid_t visual;
rep = xcb_get_window_attributes_reply(_ecore_xcb_conn,
xcb_get_window_attributes_unchecked(_ecore_xcb_conn,
win),
NULL);
if (!rep)
- return ret;
+ return ret;
visual = rep->visual;
xcb_render_query_pict_formats_unchecked(_ecore_xcb_conn),
NULL);
if (!rep_pictformat)
- return ret;
+ return ret;
iter_forminfo = xcb_render_query_pict_formats_formats_iterator(rep_pictformat);
for (; iter_forminfo.rem; xcb_render_pictforminfo_next(&iter_forminfo))
#endif /* ECORE_XCB_RENDER */
return ret;
-}
-
-
-
+} /* ecore_x_window_argb_get */
/**
* Set if a window should be ignored.
if (ignore)
{
- if (ignore_list)
- {
- for (i = 0; i < ignore_num; i++)
- {
- if (window == ignore_list[i])
- return;
- }
- ignore_list = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
- if (!ignore_list) return;
- ignore_list[ignore_num++] = window;
- }
- else
- {
- ignore_num = 0;
- ignore_list = malloc(sizeof(Ecore_X_Window));
- ignore_list[ignore_num++] = window;
- }
+ if (ignore_list)
+ {
+ for (i = 0; i < ignore_num; i++)
+ {
+ if (window == ignore_list[i])
+ return;
+ }
+ ignore_list = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
+ if (!ignore_list)
+ return;
+
+ ignore_list[ignore_num++] = window;
+ }
+ else
+ {
+ ignore_num = 0;
+ ignore_list = malloc(sizeof(Ecore_X_Window));
+ ignore_list[ignore_num++] = window;
+ }
}
else
{
- if (!ignore_list) return;
- for (i = 0, j = 0; i < ignore_num; i++)
- {
- if (window != ignore_list[i])
- ignore_list[i] = ignore_list[j++];
- else
- ignore_num--;
- }
- ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
+ if (!ignore_list)
+ return;
+
+ for (i = 0, j = 0; i < ignore_num; i++)
+ {
+ if (window != ignore_list[i])
+ ignore_list[i] = ignore_list[j++];
+ else
+ ignore_num--;
+ }
+ ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
}
-}
+} /* ecore_x_window_ignore_set */
/**
* Get the ignore list
EAPI Ecore_X_Window *
ecore_x_window_ignore_list(int *num)
{
- if (num) *num = ignore_num;
+ if (num)
+ *num = ignore_num;
+
return ignore_list;
-}
+} /* ecore_x_window_ignore_list */
/**
* Retrieves the size of the given window.
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ecore_x_drawable_geometry_get(window, NULL, NULL, width, height);
-}
+} /* ecore_x_window_size_get */
/**
* Retrieves the geometry of the given window.
window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
ecore_x_drawable_geometry_get(window, x, y, width, height);
-}
+} /* ecore_x_window_geometry_get */
/**
* Retrieves the width of the border of the given window.
return 0;
return ecore_x_drawable_border_width_get(win);
-}
+} /* ecore_x_window_border_width_get */
/**
* Retrieves the depth of the given window.
ecore_x_window_depth_get(Ecore_X_Window win)
{
return ecore_x_drawable_depth_get(win);
-}
+} /* ecore_x_window_depth_get */
+
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
-
/*
* Set CARD32 (array) property
*/
EAPI void
ecore_x_window_prop_card32_set(Ecore_X_Window win,
Ecore_X_Atom atom,
- unsigned int *val,
+ unsigned int *val,
unsigned int num)
{
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
atom, ECORE_X_ATOM_CARDINAL, 32, num, (const void *)val);
-}
+} /* ecore_x_window_prop_card32_set */
/**
* Sends the GetProperty request.
*/
EAPI void
ecore_x_window_prop_card32_get_prefetch(Ecore_X_Window window,
- Ecore_X_Atom atom)
+ Ecore_X_Atom atom)
{
xcb_get_property_cookie_t cookie;
ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_card32_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_card32_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_card32_get_fetch */
/*
* Get CARD32 (array) property
*/
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- unsigned int *val,
- unsigned int len)
+ Ecore_X_Atom atom __UNUSED__,
+ unsigned int *val,
+ unsigned int len)
{
xcb_get_property_reply_t *reply;
return -1;
if (reply->value_len < len)
- len = xcb_get_property_value_length(reply);
+ len = xcb_get_property_value_length(reply);
if (val)
memcpy(val, xcb_get_property_value(reply), len);
return (int)len;
-}
+} /* ecore_x_window_prop_card32_get */
/*
* Get CARD32 (array) property of any length
*/
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- unsigned int **plist)
+ Ecore_X_Atom atom __UNUSED__,
+ unsigned int **plist)
{
xcb_get_property_reply_t *reply;
- int num = -1;
+ int num = -1;
if (plist)
*plist = NULL;
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
(reply->format == 32))
{
- uint32_t *val;
-
- num = xcb_get_property_value_length(reply);
- if (plist)
- {
- val = (uint32_t *)malloc (num);
- if (!val)
- goto error;
-
- memcpy(val, xcb_get_property_value(reply), num);
- *plist = val;
- }
+ uint32_t *val;
+
+ num = xcb_get_property_value_length(reply);
+ if (plist)
+ {
+ val = (uint32_t *)malloc (num);
+ if (!val)
+ goto error;
+
+ memcpy(val, xcb_get_property_value(reply), num);
+ *plist = val;
+ }
}
- error:
+error:
return num;
-}
+} /* ecore_x_window_prop_card32_list_get */
/*
* Set X ID (array) property
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win,
Ecore_X_Atom atom,
- Ecore_X_Atom type,
+ Ecore_X_Atom type,
Ecore_X_ID *xids,
- unsigned int num)
+ unsigned int num)
{
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
atom, type, 32, num, xids);
-}
+} /* ecore_x_window_prop_xid_set */
/**
* Sends the GetProperty request.
type,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_xid_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_xid_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_xid_get_fetch */
/*
* Get X ID (array) property
*/
EAPI int
ecore_x_window_prop_xid_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- Ecore_X_Atom type __UNUSED__,
- Ecore_X_ID *xids,
- unsigned int len)
+ Ecore_X_Atom atom __UNUSED__,
+ Ecore_X_Atom type __UNUSED__,
+ Ecore_X_ID *xids,
+ unsigned int len)
{
xcb_get_property_reply_t *reply;
- int num = len;
+ int num = len;
reply = _ecore_xcb_reply_get();
if (!reply)
else if (reply->format == 32)
{
if (reply->value_len < len)
- num = xcb_get_property_value_length(reply);
+ num = xcb_get_property_value_length(reply);
if (xids)
memcpy(xids, xcb_get_property_value(reply), num);
}
return num;
-}
+} /* ecore_x_window_prop_xid_get */
/*
* Get X ID (array) property
*/
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win __UNUSED__,
- Ecore_X_Atom atom __UNUSED__,
- Ecore_X_Atom type __UNUSED__,
- Ecore_X_ID **pxids)
+ Ecore_X_Atom atom __UNUSED__,
+ Ecore_X_Atom type __UNUSED__,
+ Ecore_X_ID **pxids)
{
xcb_get_property_reply_t *reply;
- int num = -1;
+ int num = -1;
if (pxids)
*pxids = NULL;
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
(reply->format == 32))
{
- uint32_t *val;
-
- num = xcb_get_property_value_length(reply);
- if (pxids)
- {
- val = (uint32_t *)malloc (num);
- if (!val)
- return -1;
-
- memcpy(val, xcb_get_property_value(reply), num);
- *pxids = val;
- }
+ uint32_t *val;
+
+ num = xcb_get_property_value_length(reply);
+ if (pxids)
+ {
+ val = (uint32_t *)malloc (num);
+ if (!val)
+ return -1;
+
+ memcpy(val, xcb_get_property_value(reply), num);
+ *pxids = val;
+ }
}
return num;
-}
+} /* ecore_x_window_prop_xid_list_get */
/*
* Remove/add/toggle X ID list item.
int op)
{
Ecore_X_ID *lst;
- int i;
- int num;
+ int i;
+ int num;
num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
if (num < 0)
- return; /* Error - assuming invalid window */
+ return; /* Error - assuming invalid window */
/* Is it there? */
for (i = 0; i < num; i++)
{
- if (lst[i] == item)
- break;
+ if (lst[i] == item)
+ break;
}
if (i < num)
{
- /* Was in list */
- if (op == ECORE_X_PROP_LIST_ADD)
- goto done;
- /* Remove it */
- num--;
- for (; i < num; i++)
- lst[i] = lst[i + 1];
+ /* Was in list */
+ if (op == ECORE_X_PROP_LIST_ADD)
+ goto done;
+
+ /* Remove it */
+ num--;
+ for (; i < num; i++)
+ lst[i] = lst[i + 1];
}
else
{
- /* Was not in list */
- if (op == ECORE_X_PROP_LIST_REMOVE)
- goto done;
- /* Add it */
- num++;
- lst = realloc(lst, num * sizeof(Ecore_X_ID));
- lst[i] = item;
+ /* Was not in list */
+ if (op == ECORE_X_PROP_LIST_REMOVE)
+ goto done;
+
+ /* Add it */
+ num++;
+ lst = realloc(lst, num * sizeof(Ecore_X_ID));
+ lst[i] = item;
}
ecore_x_window_prop_xid_set(win, atom, type, lst, num);
- done:
+done:
if (lst)
free(lst);
-}
+} /* ecore_x_window_prop_xid_list_change */
/*
* Set Atom (array) property
unsigned int num)
{
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num);
-}
+} /* ecore_x_window_prop_atom_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_atom_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_atom_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_atom_get_fetch */
/*
* Get Atom (array) property
ecore_x_window_prop_atom_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *list,
- unsigned int len)
+ unsigned int len)
{
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len);
-}
+} /* ecore_x_window_prop_atom_get */
/*
* Get Atom (array) property
Ecore_X_Atom **plist)
{
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, plist);
-}
+} /* ecore_x_window_prop_atom_list_get */
/*
* Remove/add/toggle atom list item.
int op)
{
ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op);
-}
+} /* ecore_x_window_prop_atom_list_change */
/*
* Set Window (array) property
unsigned int num)
{
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num);
-}
+} /* ecore_x_window_prop_window_set */
/**
* Sends the GetProperty request.
ECORE_X_ATOM_WINDOW,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_window_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_window_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_window_get_fetch */
/*
* Get Window (array) property
unsigned int len)
{
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len);
-}
+} /* ecore_x_window_prop_window_get */
/*
* Get Window (array) property
Ecore_X_Window **plist)
{
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plist);
-}
+} /* ecore_x_window_prop_window_list_get */
/**
* To be documented.
ecore_x_window_prop_any_type(void)
{
return XCB_GET_PROPERTY_TYPE_ANY;
-}
+} /* ecore_x_window_prop_any_type */
/**
* To be documented.
void *data,
int number)
{
- if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (window == 0)
+ window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
property, type,
size, number, data);
-}
+} /* ecore_x_window_prop_property_set */
/**
* Sends the GetProperty request.
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
property, type, 0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_property_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_property_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_property_get_fetch */
/**
* To be documented.
* FIXME: To be fixed.
*/
EAPI int
-ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_Atom property __UNUSED__,
- Ecore_X_Atom type __UNUSED__,
- int size __UNUSED__,
- unsigned char **data,
- int *num)
+ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
+ Ecore_X_Atom property __UNUSED__,
+ Ecore_X_Atom type __UNUSED__,
+ int size __UNUSED__,
+ unsigned char **data,
+ int *num)
{
xcb_get_property_reply_t *reply;
/* make sure these are initialized */
- if (num) *num = 0L;
+ if (num)
+ *num = 0L;
if (data)
- *data = NULL;
+ *data = NULL;
else /* we can't store the retrieved data, so just return */
- return 0;
+ return 0;
reply = _ecore_xcb_reply_get();
if (!reply)
- return 0;
+ return 0;
if ((reply->format != size) ||
(reply->value_len == 0))
if (!*data)
return 0;
- memcpy(*data, xcb_get_property_value(reply),
+ memcpy(*data, xcb_get_property_value(reply),
xcb_get_property_value_length(reply));
if (num)
*num = reply->value_len;
return reply->format;
-}
+} /* ecore_x_window_prop_property_get */
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window window,
Ecore_X_Atom property)
{
xcb_delete_property(_ecore_xcb_conn, window, property);
-}
+} /* ecore_x_window_prop_property_del */
/**
* Sends the ListProperties request.
cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_list_prefetch */
/**
* Gets the reply of the ListProperties request sent by ecore_x_window_prop_list_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
-
+} /* ecore_x_window_prop_list_fetch */
/**
* To be documented.
*/
EAPI Ecore_X_Atom *
ecore_x_window_prop_list(Ecore_X_Window window __UNUSED__,
- int *num_ret)
+ int *num_ret)
{
xcb_list_properties_reply_t *reply;
- Ecore_X_Atom *atoms;
+ Ecore_X_Atom *atoms;
- if (num_ret) *num_ret = 0;
+ if (num_ret)
+ *num_ret = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom));
if (!atoms)
return NULL;
+
memcpy(atoms,
xcb_list_properties_atoms(reply),
reply->atoms_len * sizeof(Ecore_X_Atom));
if(num_ret)
- *num_ret = reply->atoms_len;
+ *num_ret = reply->atoms_len;
return atoms;
-}
+} /* ecore_x_window_prop_list */
/**
* Set a window string property.
Ecore_X_Atom type,
const char *str)
{
- if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+ if (win == 0)
+ win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
+
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
- type, ECORE_X_ATOM_UTF8_STRING,
- 8, strlen(str), str);
-}
+ type, ECORE_X_ATOM_UTF8_STRING,
+ 8, strlen(str), str);
+} /* ecore_x_window_prop_string_set */
/**
* Sends the GetProperty request.
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
type, XCB_GET_PROPERTY_TYPE_ANY, 0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
-}
-
+} /* ecore_x_window_prop_string_get_prefetch */
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_string_get_prefetch().
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
-}
+} /* ecore_x_window_prop_string_get_fetch */
/**
* Get a window string property.
*/
EAPI char *
ecore_x_window_prop_string_get(Ecore_X_Window window __UNUSED__,
- Ecore_X_Atom type __UNUSED__)
+ Ecore_X_Atom type __UNUSED__)
{
xcb_get_property_reply_t *reply;
- char *str = NULL;
+ char *str = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
- return NULL;
+ return NULL;
if (reply->type == ECORE_X_ATOM_UTF8_STRING)
{
}
else
{
- /* FIXME: to be done... */
+ /* FIXME: to be done... */
/* #ifdef X_HAVE_UTF8_STRING */
/* s = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xtp, */
}
return str;
-}
+} /* ecore_x_window_prop_string_get */
/* FIXME : round trips because of GetWMProtocols */
/* should we rewrite its code ? */
ecore_x_window_prop_protocol_isset(Ecore_X_Window window,
Ecore_X_WM_Protocol protocol)
{
- xcb_get_property_cookie_t cookie;
+ xcb_get_property_cookie_t cookie;
xcb_get_wm_protocols_reply_t protocols;
- Ecore_X_Atom proto;
- uint32_t i;
- uint8_t ret = 0;
+ Ecore_X_Atom proto;
+ uint32_t i;
+ uint8_t ret = 0;
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
- return ret;
+ return ret;
proto = _ecore_xcb_atoms_wm_protocols[protocol];
cookie = xcb_get_wm_protocols(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_PROTOCOLS);
if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protocols, NULL))
- return ret;
+ return ret;
for (i = 0; i < protocols.atoms_len; i++)
- if (protocols.atoms[i] == proto)
- {
- ret = 1;
- break;
- }
+ if (protocols.atoms[i] == proto)
+ {
+ ret = 1;
+ break;
+ }
xcb_get_wm_protocols_reply_wipe(&protocols);
return ret;
-}
+} /* ecore_x_window_prop_protocol_isset */
/**
* To be documented.
ecore_x_window_prop_protocol_list_get(Ecore_X_Window window,
int *num_ret)
{
- xcb_get_property_cookie_t cookie;
+ xcb_get_property_cookie_t cookie;
xcb_get_wm_protocols_reply_t protocols;
- Ecore_X_WM_Protocol *prot_ret = NULL;
- uint32_t protos_count;
- uint32_t i;
+ Ecore_X_WM_Protocol *prot_ret = NULL;
+ uint32_t protos_count;
+ uint32_t i;
cookie = xcb_get_wm_protocols(_ecore_xcb_conn, window, ECORE_X_ATOM_WM_PROTOCOLS);
if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protocols, NULL))
return NULL;
- if ((protocols.atoms_len <= 0)) return NULL;
+ if ((protocols.atoms_len <= 0))
+ return NULL;
prot_ret = calloc(1, protocols.atoms_len * sizeof(Ecore_X_WM_Protocol));
if (!prot_ret)
{
- xcb_get_wm_protocols_reply_wipe(&protocols);
- return NULL;
+ xcb_get_wm_protocols_reply_wipe(&protocols);
+ return NULL;
}
+
for (i = 0; i < protocols.atoms_len; i++)
{
- Ecore_X_WM_Protocol j;
-
- prot_ret[i] = -1;
- for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
- {
- if (_ecore_xcb_atoms_wm_protocols[j] == protocols.atoms[i])
- prot_ret[i] = j;
- }
+ Ecore_X_WM_Protocol j;
+
+ prot_ret[i] = -1;
+ for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
+ {
+ if (_ecore_xcb_atoms_wm_protocols[j] == protocols.atoms[i])
+ prot_ret[i] = j;
+ }
}
xcb_get_wm_protocols_reply_wipe(&protocols);
*num_ret = protos_count;
return prot_ret;
-}
+} /* ecore_x_window_prop_protocol_list_get */
+
#include "ecore_xcb_private.h"
#include "Ecore_X.h"
-
-typedef struct _Shadow Shadow;
+typedef struct _Shadow Shadow;
struct _Shadow
{
- Shadow *parent;
- Shadow **children;
- Ecore_X_Window win;
- int children_num;
- short x, y;
- unsigned short w, h;
+ Shadow *parent;
+ Shadow **children;
+ Ecore_X_Window win;
+ int children_num;
+ short x, y;
+ unsigned short w, h;
};
static int shadow_count = 0;
static Shadow **shadow_base = NULL;
static int shadow_num = 0;
-
/* FIXME: round trips */
static Shadow *
_ecore_x_window_tree_walk(Ecore_X_Window window)
{
- Shadow *s;
- Shadow **sl;
+ Shadow *s;
+ Shadow **sl;
xcb_get_window_attributes_reply_t *reply_attr;
- xcb_get_geometry_reply_t *reply_geom;
- xcb_query_tree_reply_t *reply_tree;
+ xcb_get_geometry_reply_t *reply_geom;
+ xcb_query_tree_reply_t *reply_tree;
xcb_get_window_attributes_cookie_t cookie_attr;
- xcb_get_geometry_cookie_t cookie_geom;
- xcb_query_tree_cookie_t cookie_tree;
- int i;
- int j;
+ xcb_get_geometry_cookie_t cookie_geom;
+ xcb_query_tree_cookie_t cookie_tree;
+ int i;
+ int j;
cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window);
cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window);
if (!reply_attr)
{
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (reply_geom) free(reply_geom);
+ if (reply_geom)
+ free(reply_geom);
+
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
return NULL;
}
if (reply_attr->map_state != XCB_MAP_STATE_VIEWABLE)
{
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
- if (reply_geom) free(reply_geom);
+ if (reply_geom)
+ free(reply_geom);
+
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
return NULL;
}
free(reply_attr);
s = calloc(1, sizeof(Shadow));
- if (!s) return NULL;
+ if (!s)
+ return NULL;
reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL);
if (!reply_geom)
{
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
- if (reply_tree) free(reply_tree);
+ if (reply_tree)
+ free(reply_tree);
+
return NULL;
}
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
if (reply_tree)
-/* if (XQueryTree(_ecore_xcb_conn, s->win, &root_win, &parent_win, */
-/* &list, &num)) */
{
+/* if (XQueryTree(_ecore_xcb_conn, s->win, &root_win, &parent_win, */
+/* &list, &num)) */
xcb_window_t *list;
- int num;
+ int num;
num = xcb_query_tree_children_length(reply_tree);
list = xcb_query_tree_children(reply_tree);
- s->children = calloc(1, sizeof(Shadow *) * num);
- if (s->children)
- {
- s->children_num = num;
- for (i = 0; i < num; i++)
- {
- s->children[i] = _ecore_x_window_tree_walk(list[i]);
- if (s->children[i]) s->children[i]->parent = s;
- }
- /* compress list down */
- j = 0;
- for (i = 0; i < num; i++)
- {
- if (s->children[i])
- {
- s->children[j] = s->children[i];
- j++;
- }
- }
- if (j == 0)
- {
- free(s->children);
- s->children = NULL;
- s->children_num = 0;
- }
- else
- {
- s->children_num = j;
- sl = realloc(s->children, sizeof(Shadow *) * j);
- if (sl) s->children = sl;
- }
- }
+ s->children = calloc(1, sizeof(Shadow *) * num);
+ if (s->children)
+ {
+ s->children_num = num;
+ for (i = 0; i < num; i++)
+ {
+ s->children[i] = _ecore_x_window_tree_walk(list[i]);
+ if (s->children[i])
+ s->children[i]->parent = s;
+ }
+ /* compress list down */
+ j = 0;
+ for (i = 0; i < num; i++)
+ {
+ if (s->children[i])
+ {
+ s->children[j] = s->children[i];
+ j++;
+ }
+ }
+ if (j == 0)
+ {
+ free(s->children);
+ s->children = NULL;
+ s->children_num = 0;
+ }
+ else
+ {
+ s->children_num = j;
+ sl = realloc(s->children, sizeof(Shadow *) * j);
+ if (sl)
+ s->children = sl;
+ }
+ }
+
free(reply_tree);
}
+
return s;
-}
+} /* _ecore_x_window_tree_walk */
static void
_ecore_x_window_tree_shadow_free1(Shadow *s)
{
int i;
- if (!s) return;
+ if (!s)
+ return;
+
if (s->children)
{
- for (i = 0; i < s->children_num; i++)
- {
- if (s->children[i])
- _ecore_x_window_tree_shadow_free1(s->children[i]);
- }
- free(s->children);
+ for (i = 0; i < s->children_num; i++)
+ {
+ if (s->children[i])
+ _ecore_x_window_tree_shadow_free1(s->children[i]);
+ }
+ free(s->children);
}
+
free(s);
-}
+} /* _ecore_x_window_tree_shadow_free1 */
static void
_ecore_x_window_tree_shadow_free(void)
{
int i;
- if (!shadow_base) return;
+ if (!shadow_base)
+ return;
+
for (i = 0; i < shadow_num; i++)
{
- if (!shadow_base[i]) continue;
- _ecore_x_window_tree_shadow_free1(shadow_base[i]);
+ if (!shadow_base[i])
+ continue;
+
+ _ecore_x_window_tree_shadow_free1(shadow_base[i]);
}
free(shadow_base);
shadow_base = NULL;
shadow_num = 0;
-}
+} /* _ecore_x_window_tree_shadow_free */
static void
_ecore_x_window_tree_shadow_populate(void)
{
- Ecore_X_Window *roots;
- int i, num;
+ Ecore_X_Window *roots;
+ int i, num;
roots = ecore_x_window_root_list(&num);
if (roots)
{
- shadow_base = calloc(1, sizeof(Shadow *) * num);
- if (shadow_base)
- {
- shadow_num = num;
- for (i = 0; i < num; i++)
- shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
- }
- free(roots);
+ shadow_base = calloc(1, sizeof(Shadow *) * num);
+ if (shadow_base)
+ {
+ shadow_num = num;
+ for (i = 0; i < num; i++)
+ shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
+ }
+
+ free(roots);
}
-}
+} /* _ecore_x_window_tree_shadow_populate */
static void
_ecore_x_window_tree_shadow_start(void)
{
shadow_count++;
- if (shadow_count > 1) return;
+ if (shadow_count > 1)
+ return;
+
_ecore_x_window_tree_shadow_populate();
-}
+} /* _ecore_x_window_tree_shadow_start */
static void
_ecore_x_window_tree_shadow_stop(void)
{
shadow_count--;
- if (shadow_count != 0) return;
+ if (shadow_count != 0)
+ return;
+
_ecore_x_window_tree_shadow_free();
-}
+} /* _ecore_x_window_tree_shadow_stop */
Shadow *
_ecore_x_window_shadow_tree_find_shadow(Shadow *s, Ecore_X_Window win)
Shadow *ss;
int i;
- if (s->win == win) return s;
+ if (s->win == win)
+ return s;
+
if (s->children)
{
- for (i = 0; i < s->children_num; i++)
- {
- if (!s->children[i]) continue;
- if ((ss = _ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
- return ss;
- }
+ for (i = 0; i < s->children_num; i++)
+ {
+ if (!s->children[i])
+ continue;
+
+ if ((ss = _ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
+ return ss;
+ }
}
+
return NULL;
-}
+} /* _ecore_x_window_shadow_tree_find_shadow */
Shadow *
_ecore_x_window_shadow_tree_find(Ecore_X_Window base)
for (i = 0; i < shadow_num; i++)
{
- if (!shadow_base[i]) continue;
- if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
- return s;
+ if (!shadow_base[i])
+ continue;
+
+ if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
+ return s;
}
return NULL;
-}
+} /* _ecore_x_window_shadow_tree_find */
static Ecore_X_Window
_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, int by, int x, int y,
- Ecore_X_Window *skip, int skip_num)
+ Ecore_X_Window *skip, int skip_num)
{
Ecore_X_Window child;
int i, j;
wx = s->x + bx;
wy = s->y + by;
if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h))))
- return 0;
+ return 0;
+
if (s->children)
{
- int skipit = 0;
-
- for (i = s->children_num - 1; i >= 0; --i)
- {
- if (!s->children[i]) continue;
- skipit = 0;
- if (skip)
- {
- for (j = 0; j < skip_num; j++)
- {
- if (s->children[i]->win == skip[j])
- {
- skipit = 1;
- goto onward;
- }
- }
- }
- onward:
- if (!skipit)
- {
- if ((child = _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
- {
- return child;
- }
- }
- }
+ int skipit = 0;
+
+ for (i = s->children_num - 1; i >= 0; --i)
+ {
+ if (!s->children[i])
+ continue;
+
+ skipit = 0;
+ if (skip)
+ {
+ for (j = 0; j < skip_num; j++)
+ {
+ if (s->children[i]->win == skip[j])
+ {
+ skipit = 1;
+ goto onward;
+ }
+ }
+ }
+
+onward:
+ if (!skipit)
+ {
+ if ((child = _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
+ {
+ return child;
+ }
+ }
+ }
}
+
return s->win;
-}
+} /* _ecore_x_window_shadow_tree_at_xy_get_shadow */
static Ecore_X_Window
_ecore_x_window_shadow_tree_at_xy_get(Ecore_X_Window base, int bx, int by, int x, int y,
- Ecore_X_Window *skip, int skip_num)
+ Ecore_X_Window *skip, int skip_num)
{
Shadow *s;
if (!shadow_base)
{
- _ecore_x_window_tree_shadow_populate();
- if (!shadow_base) return 0;
+ _ecore_x_window_tree_shadow_populate();
+ if (!shadow_base)
+ return 0;
}
+
s = _ecore_x_window_shadow_tree_find(base);
- if (!s) return 0;
+ if (!s)
+ return 0;
+
return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num);
-}
+} /* _ecore_x_window_shadow_tree_at_xy_get */
/**
* Retrieves the top, visible window at the given location,
ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y, Ecore_X_Window *skip, int skip_num)
{
return _ecore_x_window_shadow_tree_at_xy_get(base, 0, 0, x, y, skip, skip_num);
-}
+} /* ecore_x_window_shadow_tree_at_xy_with_skip_get */
/**
* Retrieves the parent window a given window has. This uses the shadow window
ecore_x_window_shadow_parent_get(Ecore_X_Window root, Ecore_X_Window win)
{
Shadow *s;
- int i;
+ int i;
if (!shadow_base)
{
- _ecore_x_window_tree_shadow_populate();
- if (!shadow_base) return 0;
+ _ecore_x_window_tree_shadow_populate();
+ if (!shadow_base)
+ return 0;
}
+
for (i = 0; i < shadow_num; i++)
{
- if (!shadow_base[i]) continue;
- s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win);
- if (s)
- {
- if (!s->parent) return 0;
- return s->parent->win;
- }
+ if (!shadow_base[i])
+ continue;
+
+ s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win);
+ if (s)
+ {
+ if (!s->parent)
+ return 0;
+
+ return s->parent->win;
+ }
}
return 0;
-}
+} /* ecore_x_window_shadow_parent_get */
/**
* Flushes the window shadow tree so nothing is stored.
ecore_x_window_shadow_tree_flush(void)
{
_ecore_x_window_tree_shadow_free();
-}
+} /* ecore_x_window_shadow_tree_flush */
+
#include "ecore_xcb_private.h"
-
/**
* @defgroup Ecore_X_Xinerama_Group X Xinerama Extension Functions
*
* Functions related to the X Xinerama extension.
*/
-
#ifdef ECORE_XCB_XINERAMA
static int _xinerama_available = 0;
static xcb_xinerama_query_version_cookie_t _ecore_xcb_xinerama_init_cookie;
#endif /* ECORE_XCB_XINERAMA */
-
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_xinerama_init and
_ecore_xcb_xinerama_init_finalize. The first one gets the cookies and
#ifdef ECORE_XCB_XINERAMA
if (reply && (reply->present))
_ecore_xcb_xinerama_init_cookie = xcb_xinerama_query_version_unchecked(_ecore_xcb_conn, 1, 2);
+
#endif /* ECORE_XCB_XINERAMA */
-}
+} /* _ecore_x_xinerama_init */
void
_ecore_x_xinerama_init_finalize(void)
xcb_xinerama_query_version_reply_t *reply;
reply = xcb_xinerama_query_version_reply(_ecore_xcb_conn,
- _ecore_xcb_xinerama_init_cookie, NULL);
+ _ecore_xcb_xinerama_init_cookie, NULL);
if (reply)
{
if ((reply->major >= 1) &&
(reply->minor >= 1))
- _xinerama_available = 1;
+ _xinerama_available = 1;
+
free(reply);
}
-#endif /* ECORE_XCB_XINERAMA */
-}
+#endif /* ECORE_XCB_XINERAMA */
+} /* _ecore_x_xinerama_init_finalize */
/**
* Return whether the X server supports the Xinerama Extension.
{
#ifdef ECORE_XCB_XINERAMA
return _xinerama_available;
-#else
+#else /* ifdef ECORE_XCB_XINERAMA */
return 0;
#endif /* ECORE_XCB_XINERAMA */
-}
-
+} /* ecore_x_xinerama_query */
/**
* Sends the XineramaQueryScreens request.
cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_XINERAMA */
-}
-
+} /* ecore_x_xinerama_query_screens_prefetch */
/**
* Gets the reply of the XineramaQueryScreens request sent by ecore_x_xinerama_query_screens_prefetch().
reply = xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_XINERAMA */
-}
-
+} /* ecore_x_xinerama_query_screens_fetch */
/**
* Return the number of screens.
EAPI int
ecore_x_xinerama_screen_count_get(void)
{
- int screen_count = 0;
+ int screen_count = 0;
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_screen_info_iterator_t iter;
xcb_xinerama_query_screens_reply_t *reply;
reply = _ecore_xcb_reply_get();
- if (!reply) return 0;
+ if (!reply)
+ return 0;
iter = xcb_xinerama_query_screens_screen_info_iterator(reply);
screen_count = iter.rem;
#endif /* ECORE_XCB_XINERAMA */
return screen_count;
-}
-
+} /* ecore_x_xinerama_screen_count_get */
/**
* Get the geometry of the screen.
reply = _ecore_xcb_reply_get();
if (!reply)
{
- if (x) *x = 0;
- if (y) *y = 0;
- if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
- if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
+ if (x)
+ *x = 0;
+
+ if (y)
+ *y = 0;
+
+ if (width)
+ *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
+
+ if (height)
+ *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
return 0;
}
{
if (screen == 0)
{
- if (x) *x = iter.data->x_org;
- if (y) *y = iter.data->y_org;
- if (width) *width = iter.data->width;
- if (height) *height = iter.data->height;
+ if (x)
+ *x = iter.data->x_org;
+
+ if (y)
+ *y = iter.data->y_org;
+
+ if (width)
+ *width = iter.data->width;
+
+ if (height)
+ *height = iter.data->height;
+
return 1;
}
}
#endif /* ECORE_XCB_XINERAMA */
- if (x) *x = 0;
- if (y) *y = 0;
- if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
- if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
+ if (x)
+ *x = 0;
+
+ if (y)
+ *y = 0;
+
+ if (width)
+ *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
+
+ if (height)
+ *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
return 0;
-}
+} /* ecore_x_xinerama_screen_geometry_get */
+