export way to handle raw xlib/xcb events.
Patch by Kenneth Christiansen, xcb by me and untested. SVN revision: 40113
This commit is contained in:
parent
aaf395c68f
commit
babc8d254f
|
@ -755,6 +755,12 @@ struct _Ecore_X_Event_Desktop_Change
|
|||
int source;
|
||||
};
|
||||
|
||||
EAPI extern int ECORE_X_EVENT_ANY; /**< low level event dependent on
|
||||
backend in use, if Xlib will be XEvent,
|
||||
if XCB will be xcb_generic_event_t.
|
||||
|
||||
@warning avoid using it.
|
||||
*/
|
||||
EAPI extern int ECORE_X_EVENT_MOUSE_IN;
|
||||
EAPI extern int ECORE_X_EVENT_MOUSE_OUT;
|
||||
EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_IN;
|
||||
|
|
|
@ -18,6 +18,11 @@ 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;
|
||||
|
||||
static const int AnyXEvent = 0; /* 0 can be used as there are no event types
|
||||
* with index 0 and 1 as they are used for
|
||||
* errors
|
||||
*/
|
||||
|
||||
#ifdef ECORE_XCB_DAMAGE
|
||||
static int _ecore_xcb_event_damage_id = 0;
|
||||
#endif /* ECORE_XCB_DAMAGE */
|
||||
|
@ -60,6 +65,7 @@ Ecore_X_Window _ecore_xcb_private_window = 0;
|
|||
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;
|
||||
|
@ -400,6 +406,7 @@ ecore_x_init(const char *name)
|
|||
_ecore_xcb_xcursor = XcursorSupportsARGB(_ecore_xcb_conn);
|
||||
#endif /* ECORE_XCB_CURSOR */
|
||||
|
||||
_ecore_xcb_event_handlers[AnyXEvent] = _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;
|
||||
|
@ -462,8 +469,9 @@ ecore_x_init(const char *name)
|
|||
_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_MOUSE_IN)
|
||||
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();
|
||||
|
@ -826,6 +834,9 @@ handle_event(xcb_generic_event_t *ev)
|
|||
|
||||
if (response_type < _ecore_xcb_event_handlers_num)
|
||||
{
|
||||
if (_ecore_xcb_event_handlers[AnyXEvent])
|
||||
_ecore_xcb_event_handlers[AnyXEvent] (&ev);
|
||||
|
||||
if (_ecore_xcb_event_handlers[response_type])
|
||||
_ecore_xcb_event_handlers[response_type] (ev);
|
||||
}
|
||||
|
|
|
@ -192,6 +192,15 @@ _ecore_x_event_free_selection_notify(void *data __UNUSED__, void *ev)
|
|||
free(e);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_x_event_handle_any_event(xcb_generic_event_t *event)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* FIXME: handle this event */
|
||||
void
|
||||
_ecore_x_event_handle_key_press(xcb_generic_event_t *event)
|
||||
|
|
|
@ -165,6 +165,7 @@ 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);
|
||||
|
|
|
@ -22,6 +22,12 @@ static int _ecore_x_key_mask_get(KeySym sym);
|
|||
static int _ecore_x_event_modifier(unsigned int state);
|
||||
|
||||
static Ecore_Fd_Handler *_ecore_x_fd_handler_handle = NULL;
|
||||
|
||||
static const int AnyXEvent = 0; /* 0 can be used as there are no event types
|
||||
* with index 0 and 1 as they are used for
|
||||
* errors
|
||||
*/
|
||||
|
||||
static int _ecore_x_event_shape_id = 0;
|
||||
static int _ecore_x_event_screensaver_id = 0;
|
||||
static int _ecore_x_event_sync_id = 0;
|
||||
|
@ -54,6 +60,7 @@ Ecore_X_Window _ecore_x_private_win = 0;
|
|||
|
||||
Ecore_X_Atom _ecore_x_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;
|
||||
|
@ -224,6 +231,7 @@ ecore_x_init(const char *name)
|
|||
#ifdef ECORE_XCURSOR
|
||||
_ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp);
|
||||
#endif
|
||||
_ecore_x_event_handlers[AnyXEvent] = _ecore_x_event_handle_any_event;
|
||||
_ecore_x_event_handlers[KeyPress] = _ecore_x_event_handle_key_press;
|
||||
_ecore_x_event_handlers[KeyRelease] = _ecore_x_event_handle_key_release;
|
||||
_ecore_x_event_handlers[ButtonPress] = _ecore_x_event_handle_button_press;
|
||||
|
@ -292,8 +300,9 @@ ecore_x_init(const char *name)
|
|||
while (0);
|
||||
#endif
|
||||
|
||||
if (!ECORE_X_EVENT_MOUSE_IN)
|
||||
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();
|
||||
|
@ -699,6 +708,9 @@ _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
|
||||
if ((ev.type >= 0) && (ev.type < _ecore_x_event_handlers_num))
|
||||
{
|
||||
if (_ecore_x_event_handlers[AnyXEvent])
|
||||
_ecore_x_event_handlers[AnyXEvent] (&ev);
|
||||
|
||||
if (_ecore_x_event_handlers[ev.type])
|
||||
_ecore_x_event_handlers[ev.type] (&ev);
|
||||
}
|
||||
|
|
|
@ -412,6 +412,15 @@ _ecore_mouse_button(int event,
|
|||
return e;
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_x_event_handle_any_event(XEvent *xevent)
|
||||
{
|
||||
XEvent* ev = malloc(sizeof(XEvent));
|
||||
memcpy(ev, xevent, sizeof(XEvent));
|
||||
|
||||
ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_ecore_x_event_handle_key_press(XEvent *xevent)
|
||||
{
|
||||
|
|
|
@ -169,6 +169,7 @@ extern void *_ecore_window_grab_replay_data;
|
|||
extern Ecore_X_Window _ecore_x_private_win;
|
||||
|
||||
void _ecore_x_error_handler_init(void);
|
||||
void _ecore_x_event_handle_any_event(XEvent *xevent);
|
||||
void _ecore_x_event_handle_key_press(XEvent *xevent);
|
||||
void _ecore_x_event_handle_key_release(XEvent *xevent);
|
||||
void _ecore_x_event_handle_button_press(XEvent *xevent);
|
||||
|
|
Loading…
Reference in New Issue