forked from enlightenment/efl
Ecore_X(cb): Port Hermits xlib code to support double/triple click for
multi-touch devices to xcb. Remove dead code. Add missing flush calls after change_window_attributes. Quiet down the event code by commenting out some LOGFN's. Make selection event code more like Xlib. Add missing flush calls after send_event. SVN revision: 63009
This commit is contained in:
parent
0c3a54457d
commit
96a210d07c
|
@ -23,6 +23,20 @@
|
|||
# define CODESET "INVALID"
|
||||
#endif
|
||||
|
||||
typedef struct _Ecore_X_Mouse_Down_Info
|
||||
{
|
||||
EINA_INLIST;
|
||||
int dev;
|
||||
Ecore_X_Time last_time;
|
||||
Ecore_X_Time last_last_time;
|
||||
Ecore_X_Window last_win;
|
||||
Ecore_X_Window last_last_win;
|
||||
Ecore_X_Window last_event_win;
|
||||
Ecore_X_Window last_last_event_win;
|
||||
Eina_Bool did_double : 1;
|
||||
Eina_Bool did_triple : 1;
|
||||
} Ecore_X_Mouse_Down_Info;
|
||||
|
||||
/* local function prototypes */
|
||||
static void _ecore_xcb_event_handle_any_event(xcb_generic_event_t *event);
|
||||
static void _ecore_xcb_event_handle_key_press(xcb_generic_event_t *event);
|
||||
|
@ -76,28 +90,21 @@ static void _ecore_xcb_event_handle_input_event(xcb_generic_event_t *event);
|
|||
|
||||
static void _ecore_xcb_event_key_press(xcb_generic_event_t *event);
|
||||
static void _ecore_xcb_event_key_release(xcb_generic_event_t *event);
|
||||
//static void _ecore_xcb_event_mouse_move(uint16_t timestamp, uint16_t modifiers, int16_t x, int16_t y, int16_t root_x, int16_t root_y, xcb_window_t event_win, xcb_window_t win, xcb_window_t root_win, uint8_t same_screen, int dev, double radx, double rady, double pressure, double angle, int16_t mx, int16_t my, int16_t mrx, int16_t mry);
|
||||
static void _ecore_xcb_event_mouse_move_free(void *data __UNUSED__, void *event);
|
||||
//static Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event, uint16_t timestamp, uint16_t modifiers, xcb_button_t buttons, int16_t x, int16_t y, int16_t root_x, int16_t root_y, xcb_window_t event_win, xcb_window_t win, xcb_window_t root_win, uint8_t same_screen, int dev, double radx, double rady, double pressure, double angle, int16_t mx, int16_t my, int16_t mrx, int16_t mry);
|
||||
static Ecore_X_Event_Mode _ecore_xcb_event_mode_get(uint8_t mode);
|
||||
static Ecore_X_Event_Detail _ecore_xcb_event_detail_get(uint8_t detail);
|
||||
static void _ecore_xcb_event_xdnd_enter_free(void *data __UNUSED__, void *event);
|
||||
static void _ecore_xcb_event_selection_notify_free(void *data __UNUSED__, void *event);
|
||||
static void _ecore_xcb_event_generic_event_free(void *data, void *event);
|
||||
static void _ecore_xcb_event_mouse_down_info_clear(void);
|
||||
static Ecore_X_Mouse_Down_Info *_ecore_xcb_event_mouse_down_info_get(int dev);
|
||||
|
||||
/* local variables */
|
||||
static Ecore_X_Time _ecore_xcb_event_last_time;
|
||||
static Eina_Bool _ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
static Ecore_Event *_ecore_xcb_event_last_mouse_move_event = NULL;
|
||||
static Eina_Inlist *_ecore_xcb_mouse_down_info_list = NULL;
|
||||
static Ecore_X_Time _ecore_xcb_event_last_time;
|
||||
static Ecore_X_Window _ecore_xcb_event_last_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 Ecore_X_Window _ecore_xcb_mouse_down_last_win = 0;
|
||||
static Ecore_X_Window _ecore_xcb_mouse_down_last_last_win = 0;
|
||||
static Ecore_X_Window _ecore_xcb_mouse_down_last_event_win = 0;
|
||||
static Ecore_X_Window _ecore_xcb_mouse_down_last_last_event_win = 0;
|
||||
static Eina_Bool _ecore_xcb_mouse_down_did_double = EINA_FALSE;
|
||||
static Eina_Bool _ecore_xcb_mouse_down_did_triple = EINA_FALSE;
|
||||
|
||||
/* public variables */
|
||||
int16_t _ecore_xcb_event_last_root_x = 0;
|
||||
|
@ -215,6 +222,8 @@ _ecore_xcb_events_shutdown(void)
|
|||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_mouse_down_info_clear();
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
if (_ecore_xcb_event_last_mouse_move_event)
|
||||
{
|
||||
|
@ -228,7 +237,7 @@ _ecore_xcb_events_handle(xcb_generic_event_t *ev)
|
|||
{
|
||||
uint8_t response = 0;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
/* strip highest bit (set if event is generated) */
|
||||
response = (ev->response_type & ~0x80);
|
||||
|
@ -437,6 +446,7 @@ ecore_x_event_mask_set(Ecore_X_Window win, Ecore_X_Event_Mask mask)
|
|||
free(reply);
|
||||
xcb_change_window_attributes(_ecore_xcb_conn, win,
|
||||
XCB_CW_EVENT_MASK, &list);
|
||||
ecore_x_flush();
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -457,6 +467,7 @@ ecore_x_event_mask_unset(Ecore_X_Window win, Ecore_X_Event_Mask mask)
|
|||
free(reply);
|
||||
xcb_change_window_attributes(_ecore_xcb_conn, win,
|
||||
XCB_CW_EVENT_MASK, &list);
|
||||
ecore_x_flush();
|
||||
}
|
||||
|
||||
unsigned int
|
||||
|
@ -492,7 +503,7 @@ _ecore_xcb_event_handle_any_event(xcb_generic_event_t *event)
|
|||
{
|
||||
xcb_generic_event_t *ev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
ev = malloc(sizeof(xcb_generic_event_t));
|
||||
if (!ev) return;
|
||||
|
@ -518,8 +529,6 @@ _ecore_xcb_event_handle_button_press(xcb_generic_event_t *event)
|
|||
{
|
||||
xcb_button_press_event_t *ev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
|
||||
ev = (xcb_button_press_event_t *)event;
|
||||
|
@ -594,16 +603,6 @@ _ecore_xcb_event_handle_button_press(xcb_generic_event_t *event)
|
|||
ev->event_x, ev->event_y,
|
||||
ev->root_x, ev->root_y);
|
||||
|
||||
if (_ecore_xcb_mouse_down_did_triple)
|
||||
{
|
||||
_ecore_xcb_mouse_down_last_time = 0;
|
||||
_ecore_xcb_mouse_down_last_win = 0;
|
||||
_ecore_xcb_mouse_down_last_last_win = 0;
|
||||
_ecore_xcb_mouse_down_last_event_win = 0;
|
||||
_ecore_xcb_mouse_down_last_last_event_win = 0;
|
||||
_ecore_xcb_mouse_down_last_last_time = 0;
|
||||
}
|
||||
|
||||
e = _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||
ev->time,
|
||||
ev->state, ev->detail,
|
||||
|
@ -618,26 +617,6 @@ _ecore_xcb_event_handle_button_press(xcb_generic_event_t *event)
|
|||
_ecore_xcb_window_grab_allow_events(ev->event, ev->child,
|
||||
ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||
e, ev->time);
|
||||
|
||||
if (child_win == ev->event)
|
||||
{
|
||||
if (!_ecore_xcb_mouse_down_did_triple)
|
||||
{
|
||||
_ecore_xcb_mouse_down_last_last_win =
|
||||
_ecore_xcb_mouse_down_last_win;
|
||||
if (ev->child)
|
||||
_ecore_xcb_mouse_down_last_win = ev->child;
|
||||
else
|
||||
_ecore_xcb_mouse_down_last_win = ev->event;
|
||||
|
||||
_ecore_xcb_mouse_down_last_last_event_win =
|
||||
_ecore_xcb_mouse_down_last_event_win;
|
||||
_ecore_xcb_mouse_down_last_event_win = ev->event;
|
||||
_ecore_xcb_mouse_down_last_last_time =
|
||||
_ecore_xcb_mouse_down_last_time;
|
||||
_ecore_xcb_mouse_down_last_time = ev->time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -646,8 +625,6 @@ _ecore_xcb_event_handle_button_release(xcb_generic_event_t *event)
|
|||
{
|
||||
xcb_button_release_event_t *ev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_button_release_event_t *)event;
|
||||
if ((ev->detail <= 3) || (ev->detail > 7))
|
||||
|
@ -679,8 +656,6 @@ _ecore_xcb_event_handle_motion_notify(xcb_generic_event_t *event)
|
|||
{
|
||||
xcb_motion_notify_event_t *ev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
ev = (xcb_motion_notify_event_t *)event;
|
||||
|
||||
/* if (_ecore_xcb_event_last_mouse_move_event) */
|
||||
|
@ -710,8 +685,6 @@ _ecore_xcb_event_handle_enter_notify(xcb_generic_event_t *event)
|
|||
xcb_enter_notify_event_t *ev;
|
||||
Ecore_X_Event_Mouse_In *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_enter_notify_event_t *)event;
|
||||
|
||||
|
@ -753,8 +726,6 @@ _ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event)
|
|||
xcb_leave_notify_event_t *ev;
|
||||
Ecore_X_Event_Mouse_Out *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_enter_notify_event_t *)event;
|
||||
|
||||
|
@ -797,7 +768,7 @@ _ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event)
|
|||
static void
|
||||
_ecore_xcb_event_handle_keymap_notify(xcb_generic_event_t *event __UNUSED__)
|
||||
{
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
// FIXME: handle this event type
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
|
@ -809,8 +780,6 @@ _ecore_xcb_event_handle_focus_in(xcb_generic_event_t *event)
|
|||
xcb_focus_in_event_t *ev;
|
||||
Ecore_X_Event_Window_Focus_In *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_focus_in_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In)))) return;
|
||||
|
@ -831,8 +800,6 @@ _ecore_xcb_event_handle_focus_out(xcb_generic_event_t *event)
|
|||
xcb_focus_out_event_t *ev;
|
||||
Ecore_X_Event_Window_Focus_Out *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_focus_out_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out)))) return;
|
||||
|
@ -853,8 +820,6 @@ _ecore_xcb_event_handle_expose(xcb_generic_event_t *event)
|
|||
xcb_expose_event_t *ev;
|
||||
Ecore_X_Event_Window_Damage *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_expose_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return;
|
||||
|
@ -876,8 +841,6 @@ _ecore_xcb_event_handle_graphics_exposure(xcb_generic_event_t *event)
|
|||
xcb_graphics_exposure_event_t *ev;
|
||||
Ecore_X_Event_Window_Damage *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_graphics_exposure_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return;
|
||||
|
@ -899,8 +862,6 @@ _ecore_xcb_event_handle_visibility_notify(xcb_generic_event_t *event)
|
|||
xcb_visibility_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Visibility_Change *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_visibility_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change))))
|
||||
|
@ -922,8 +883,6 @@ _ecore_xcb_event_handle_create_notify(xcb_generic_event_t *event)
|
|||
xcb_create_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Create *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_create_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Create)))) return;
|
||||
|
@ -950,8 +909,6 @@ _ecore_xcb_event_handle_destroy_notify(xcb_generic_event_t *event)
|
|||
xcb_destroy_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Destroy *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_destroy_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy)))) return;
|
||||
|
@ -971,8 +928,6 @@ _ecore_xcb_event_handle_map_notify(xcb_generic_event_t *event)
|
|||
xcb_map_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Show *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_map_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show)))) return;
|
||||
|
@ -990,8 +945,6 @@ _ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event)
|
|||
xcb_unmap_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Hide *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_unmap_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Hide)))) return;
|
||||
|
@ -1009,8 +962,6 @@ _ecore_xcb_event_handle_map_request(xcb_generic_event_t *event)
|
|||
xcb_map_request_event_t *ev;
|
||||
Ecore_X_Event_Window_Show_Request *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_map_request_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request)))) return;
|
||||
|
@ -1028,8 +979,6 @@ _ecore_xcb_event_handle_reparent_notify(xcb_generic_event_t *event)
|
|||
xcb_reparent_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Reparent *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_reparent_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent)))) return;
|
||||
|
@ -1048,8 +997,6 @@ _ecore_xcb_event_handle_configure_notify(xcb_generic_event_t *event)
|
|||
xcb_configure_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Configure *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_configure_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure)))) return;
|
||||
|
@ -1076,8 +1023,6 @@ _ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event)
|
|||
xcb_configure_request_event_t *ev;
|
||||
Ecore_X_Event_Window_Configure_Request *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_configure_request_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request))))
|
||||
|
@ -1116,13 +1061,12 @@ _ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event)
|
|||
}
|
||||
|
||||
static void
|
||||
_ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event)
|
||||
_ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event __UNUSED__)
|
||||
{
|
||||
/*
|
||||
xcb_gravity_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Gravity *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_gravity_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Gravity)))) return;
|
||||
|
@ -1132,6 +1076,7 @@ _ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event)
|
|||
e->time = _ecore_xcb_event_last_time;
|
||||
|
||||
ecore_event_add(ECORE_X_EVENT_WINDOW_GRAVITY, e, NULL, NULL);
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1140,8 +1085,6 @@ _ecore_xcb_event_handle_resize_request(xcb_generic_event_t *event)
|
|||
xcb_resize_request_event_t *ev;
|
||||
Ecore_X_Event_Window_Resize_Request *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_resize_request_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request)))) return;
|
||||
|
@ -1160,8 +1103,6 @@ _ecore_xcb_event_handle_circulate_notify(xcb_generic_event_t *event)
|
|||
xcb_circulate_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Stack *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_circulate_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack)))) return;
|
||||
|
@ -1183,8 +1124,6 @@ _ecore_xcb_event_handle_circulate_request(xcb_generic_event_t *event)
|
|||
xcb_circulate_request_event_t *ev;
|
||||
Ecore_X_Event_Window_Stack_Request *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_circulate_request_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request)))) return;
|
||||
|
@ -1206,8 +1145,6 @@ _ecore_xcb_event_handle_property_notify(xcb_generic_event_t *event)
|
|||
xcb_property_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Property *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_property_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Property)))) return;
|
||||
|
@ -1273,19 +1210,23 @@ _ecore_xcb_event_handle_selection_request(xcb_generic_event_t *event)
|
|||
if ((sd = _ecore_xcb_selection_get(ev->selection)) &&
|
||||
(sd->win == ev->owner))
|
||||
{
|
||||
if (sd->data)
|
||||
Ecore_X_Selection_Intern *si;
|
||||
|
||||
si = _ecore_xcb_selection_get(ev->selection);
|
||||
if (si->data)
|
||||
{
|
||||
Ecore_X_Atom property, type;
|
||||
void *data;
|
||||
Ecore_X_Atom property = XCB_NONE, type;
|
||||
void *data = NULL;
|
||||
int len = 0, typesize = 0;
|
||||
|
||||
type = ev->target;
|
||||
typesize = 8;
|
||||
len = sd->length;
|
||||
|
||||
if (!ecore_x_selection_convert(ev->selection, ev->target,
|
||||
&data, &len, &type, &typesize))
|
||||
property = XCB_NONE;
|
||||
else
|
||||
else if (data)
|
||||
{
|
||||
ecore_x_window_prop_property_set(ev->requestor, ev->property,
|
||||
type, typesize, data, len);
|
||||
|
@ -1316,7 +1257,7 @@ _ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event)
|
|||
{
|
||||
format =
|
||||
ecore_x_window_prop_property_get(ev->requestor, ev->property,
|
||||
ECORE_X_ATOM_ATOM, 32, &data, &num);
|
||||
XCB_ATOM_ATOM, 32, &data, &num);
|
||||
if (!format) return;
|
||||
}
|
||||
else
|
||||
|
@ -1358,8 +1299,6 @@ _ecore_xcb_event_handle_colormap_notify(xcb_generic_event_t *event)
|
|||
xcb_colormap_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Colormap *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_colormap_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap)))) return;
|
||||
|
@ -1380,8 +1319,6 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
|
|||
{
|
||||
xcb_client_message_event_t *ev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_client_message_event_t *)event;
|
||||
|
||||
|
@ -1442,7 +1379,7 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
|
|||
|
||||
if (!ecore_x_window_prop_property_get(target->source,
|
||||
ECORE_X_ATOM_XDND_TYPE_LIST,
|
||||
ECORE_X_ATOM_ATOM, 32,
|
||||
XCB_ATOM_ATOM, 32,
|
||||
&data, &num_ret))
|
||||
{
|
||||
WRN("DND: Could not fetch data type list from source window");
|
||||
|
@ -1489,12 +1426,12 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
|
|||
|
||||
target = _ecore_xcb_dnd_target_get();
|
||||
if ((target->source != (Ecore_X_Window)ev->data.data32[0]) ||
|
||||
(target->win != ev->window)) return;
|
||||
(target->win != ev->window)) return; // NB: Maybe ev->event ??
|
||||
target->pos.x = ev->data.data32[2] >> 16;
|
||||
target->pos.y = ev->data.data32[2] & 0xFFFFUL;
|
||||
target->action = ev->data.data32[4];
|
||||
target->time = (target->version >= 1) ?
|
||||
(Ecore_X_Time)ev->data.data32[3] : ecore_x_current_time_get();
|
||||
(Ecore_X_Time)ev->data.data32[3] : XCB_CURRENT_TIME;
|
||||
|
||||
e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position));
|
||||
if (!e) return;
|
||||
|
@ -1704,22 +1641,12 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
|
|||
|
||||
if (ev->window != root)
|
||||
{
|
||||
xcb_client_message_event_t cm;
|
||||
|
||||
cm.response_type = XCB_CLIENT_MESSAGE;
|
||||
cm.format = ev->format;
|
||||
cm.window = root;
|
||||
cm.type = ev->type;
|
||||
cm.data.data32[0] = ECORE_X_ATOM_NET_WM_PING;
|
||||
cm.data.data32[1] = ev->data.data32[1];
|
||||
cm.data.data32[2] = ev->window;//ev->data.data32[2];
|
||||
cm.data.data32[3] = 0;
|
||||
cm.data.data32[4] = 0;
|
||||
|
||||
ev->window = root;
|
||||
xcb_send_event(_ecore_xcb_conn, 0, root,
|
||||
(XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
|
||||
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY),
|
||||
(const char *)&cm);
|
||||
(const char *)&ev);
|
||||
ecore_x_flush();
|
||||
}
|
||||
}
|
||||
else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) &&
|
||||
|
@ -1729,10 +1656,10 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
|
|||
}
|
||||
else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO) && (ev->format == 8))
|
||||
{
|
||||
_ecore_xcb_netwm_startup_info_begin(ev->window, ev->data.data8[0]);
|
||||
_ecore_xcb_netwm_startup_info(ev->window, ev->data.data8[0]);
|
||||
}
|
||||
else if ((ev->type == 27777) && (ev->data.data32[0] == 0x7162534) &&
|
||||
(ev->format == 32))// && (ev->window = _private_window))
|
||||
(ev->format == 32)) // && (ev->window = _private_window))
|
||||
{
|
||||
if (ev->data.data32[1] == 0x10000001)
|
||||
_ecore_xcb_window_button_grab_remove(ev->data.data32[2]);
|
||||
|
@ -1748,7 +1675,7 @@ _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event)
|
|||
return;
|
||||
|
||||
e->win = ev->window;
|
||||
e->message_type = ev->type;
|
||||
e->message_type = ev->response_type; //NB: Was ev->type;
|
||||
e->format = ev->format;
|
||||
for (i = 0; i < 5; i++)
|
||||
e->data.l[i] = ev->data.data32[i];
|
||||
|
@ -1762,8 +1689,6 @@ _ecore_xcb_event_handle_mapping_notify(xcb_generic_event_t *event)
|
|||
xcb_mapping_notify_event_t *ev;
|
||||
Ecore_X_Event_Mapping_Change *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
|
||||
ev = (xcb_mapping_notify_event_t *)event;
|
||||
|
@ -1830,8 +1755,6 @@ _ecore_xcb_event_handle_randr_change(xcb_generic_event_t *event)
|
|||
Ecore_X_Event_Screen_Change *e;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
ev = (xcb_randr_screen_change_notify_event_t *)event;
|
||||
|
@ -1859,8 +1782,6 @@ _ecore_xcb_event_handle_randr_notify(xcb_generic_event_t *event)
|
|||
xcb_randr_notify_event_t *ev;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
ev = (xcb_randr_notify_event_t *)event;
|
||||
|
@ -1889,8 +1810,6 @@ _ecore_xcb_event_handle_randr_crtc_change(xcb_generic_event_t *event)
|
|||
Ecore_X_Event_Randr_Crtc_Change *e;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
ev = (xcb_randr_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change))))
|
||||
|
@ -1917,8 +1836,6 @@ _ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event)
|
|||
Ecore_X_Event_Randr_Output_Change *e;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
ev = (xcb_randr_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change))))
|
||||
|
@ -1944,8 +1861,6 @@ _ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event)
|
|||
Ecore_X_Event_Randr_Output_Property_Notify *e;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
#ifdef ECORE_XCB_RANDR
|
||||
ev = (xcb_randr_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify))))
|
||||
|
@ -1972,8 +1887,6 @@ _ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event)
|
|||
Ecore_X_Event_Screensaver_Notify *e;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
#ifdef ECORE_XCB_SCREENSAVER
|
||||
ev = (xcb_screensaver_notify_event_t *)event;
|
||||
|
@ -1995,8 +1908,6 @@ _ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event)
|
|||
xcb_shape_notify_event_t *ev;
|
||||
Ecore_X_Event_Window_Shape *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
ev = (xcb_shape_notify_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Shape)))) return;
|
||||
|
@ -2035,8 +1946,6 @@ _ecore_xcb_event_handle_sync_counter(xcb_generic_event_t *event)
|
|||
Ecore_X_Event_Sync_Counter *e;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
|
@ -2057,8 +1966,6 @@ _ecore_xcb_event_handle_sync_alarm(xcb_generic_event_t *event)
|
|||
Ecore_X_Event_Sync_Alarm *e;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
#ifdef ECORE_XCB_SYNC
|
||||
ev = (xcb_sync_alarm_notify_event_t *)event;
|
||||
|
@ -2080,8 +1987,6 @@ _ecore_xcb_event_handle_xfixes_selection_notify(xcb_generic_event_t *event)
|
|||
xcb_xfixes_selection_notify_event_t *ev;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
#ifdef ECORE_XCB_XFIXES
|
||||
ev = (xcb_xfixes_selection_notify_event_t *)event;
|
||||
|
@ -2120,8 +2025,6 @@ _ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event)
|
|||
xcb_ge_event_t *ev;
|
||||
Ecore_X_Event_Generic *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
ev = (xcb_ge_event_t *)event;
|
||||
if (!(e = calloc(1, sizeof(Ecore_X_Event_Generic))))
|
||||
return;
|
||||
|
@ -2165,8 +2068,6 @@ _ecore_xcb_event_key_press(xcb_generic_event_t *event)
|
|||
char compose_buffer[256];
|
||||
int val = 0;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
|
||||
xevent = (xcb_key_press_event_t *)event;
|
||||
|
@ -2218,6 +2119,7 @@ _ecore_xcb_event_key_press(xcb_generic_event_t *event)
|
|||
e->same_screen = xevent->same_screen;
|
||||
e->root_window = xevent->root;
|
||||
|
||||
DBG("Sending Key Down Event: %s", e->keyname);
|
||||
ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
|
||||
}
|
||||
_ecore_xcb_event_last_time = xevent->time;
|
||||
|
@ -2235,8 +2137,6 @@ _ecore_xcb_event_key_release(xcb_generic_event_t *event)
|
|||
char compose_buffer[256];
|
||||
int val = 0;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
_ecore_xcb_event_last_mouse_move = EINA_FALSE;
|
||||
|
||||
xevent = (xcb_key_release_event_t *)event;
|
||||
|
@ -2299,8 +2199,6 @@ _ecore_xcb_event_mouse_move(uint16_t timestamp, uint16_t modifiers, int16_t x, i
|
|||
Ecore_Event_Mouse_Move *e;
|
||||
Ecore_Event *event;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
if (!(e = malloc(sizeof(Ecore_Event_Mouse_Move)))) return;
|
||||
|
||||
e->window = win;
|
||||
|
@ -2339,8 +2237,6 @@ _ecore_xcb_event_mouse_move_free(void *data __UNUSED__, void *event)
|
|||
{
|
||||
Ecore_Event_Mouse_Move *ev;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
|
||||
ev = event;
|
||||
if (_ecore_xcb_event_last_mouse_move_event)
|
||||
{
|
||||
|
@ -2354,8 +2250,7 @@ Ecore_Event_Mouse_Button *
|
|||
_ecore_xcb_event_mouse_button(int event, uint16_t timestamp, uint16_t modifiers, xcb_button_t buttons, int16_t x, int16_t y, int16_t root_x, int16_t root_y, xcb_window_t event_win, xcb_window_t win, xcb_window_t root_win, uint8_t same_screen, int dev, double radx, double rady, double pressure, double angle, int16_t mx, int16_t my, int16_t mrx, int16_t mry)
|
||||
{
|
||||
Ecore_Event_Mouse_Button *e;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
Ecore_X_Mouse_Down_Info *info = NULL;
|
||||
|
||||
if (!(e = malloc(sizeof(Ecore_Event_Mouse_Button)))) return NULL;
|
||||
|
||||
|
@ -2373,42 +2268,52 @@ _ecore_xcb_event_mouse_button(int event, uint16_t timestamp, uint16_t modifiers,
|
|||
e->root.x = root_x;
|
||||
e->root.y = root_y;
|
||||
|
||||
if (event_win == win)
|
||||
if ((info = _ecore_xcb_event_mouse_down_info_get(dev)))
|
||||
{
|
||||
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
|
||||
if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
|
||||
(info->did_triple))
|
||||
{
|
||||
if (((int)(timestamp - _ecore_xcb_mouse_down_last_time) <=
|
||||
(int)(1000 * _ecore_xcb_double_click_time)) &&
|
||||
(win == _ecore_xcb_mouse_down_last_win) &&
|
||||
(event_win == _ecore_xcb_mouse_down_last_event_win))
|
||||
{
|
||||
e->double_click = 1;
|
||||
_ecore_xcb_mouse_down_did_double = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ecore_xcb_mouse_down_did_double = EINA_FALSE;
|
||||
_ecore_xcb_mouse_down_did_triple = EINA_FALSE;
|
||||
}
|
||||
if (((int)(timestamp - _ecore_xcb_mouse_down_last_last_time) <=
|
||||
(int)(2 * 1000 * _ecore_xcb_double_click_time)) &&
|
||||
(win == _ecore_xcb_mouse_down_last_win) &&
|
||||
(win == _ecore_xcb_mouse_down_last_last_win) &&
|
||||
(event_win == _ecore_xcb_mouse_down_last_event_win) &&
|
||||
(event_win == _ecore_xcb_mouse_down_last_last_event_win))
|
||||
{
|
||||
e->triple_click = 1;
|
||||
_ecore_xcb_mouse_down_did_triple = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
_ecore_xcb_mouse_down_did_triple = EINA_FALSE;
|
||||
info->last_win = 0;
|
||||
info->last_last_win = 0;
|
||||
info->last_event_win = 0;
|
||||
info->last_time = 0;
|
||||
info->last_last_time = 0;
|
||||
}
|
||||
else
|
||||
if (event_win == win)
|
||||
{
|
||||
if (_ecore_xcb_mouse_down_did_double)
|
||||
e->double_click = 1;
|
||||
if (_ecore_xcb_mouse_down_did_triple)
|
||||
e->triple_click = 1;
|
||||
if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
|
||||
{
|
||||
if (((int)(timestamp - info->last_time) <=
|
||||
(int)(1000 * _ecore_xcb_double_click_time)) &&
|
||||
(win == info->last_win) &&
|
||||
(event_win == info->last_event_win))
|
||||
{
|
||||
e->double_click = 1;
|
||||
info->did_double = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->did_double = EINA_FALSE;
|
||||
info->did_triple = EINA_FALSE;
|
||||
}
|
||||
if (((int)(timestamp - info->last_last_time) <=
|
||||
(int)(2 * 1000 * _ecore_xcb_double_click_time)) &&
|
||||
(win == info->last_win) &&
|
||||
(win == info->last_last_win) &&
|
||||
(event_win == info->last_event_win) &&
|
||||
(event_win == info->last_last_event_win))
|
||||
{
|
||||
e->triple_click = 1;
|
||||
info->did_triple = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
info->did_triple = EINA_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info->did_double) e->double_click = 1;
|
||||
if (info->did_triple) e->triple_click = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2437,6 +2342,17 @@ _ecore_xcb_event_mouse_button(int event, uint16_t timestamp, uint16_t modifiers,
|
|||
|
||||
ecore_event_add(event, e, NULL, NULL);
|
||||
|
||||
if ((info) && (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) &&
|
||||
(win == event_win) && (!info->did_triple))
|
||||
{
|
||||
info->last_last_win = info->last_win;
|
||||
info->last_win = win;
|
||||
info->last_last_event_win = info->last_event_win;
|
||||
info->last_event_win = event_win;
|
||||
info->last_last_time = info->last_time;
|
||||
info->last_time = timestamp;
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
@ -2518,3 +2434,38 @@ _ecore_xcb_event_generic_event_free(void *data, void *event)
|
|||
if (e->data) free(data);
|
||||
free(e);
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_xcb_event_mouse_down_info_clear(void)
|
||||
{
|
||||
Eina_Inlist *l;
|
||||
Ecore_X_Mouse_Down_Info *info = NULL;
|
||||
|
||||
l = _ecore_xcb_mouse_down_info_list;
|
||||
while (l)
|
||||
{
|
||||
info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info);
|
||||
l = eina_inlist_remove(l, l);
|
||||
free(info);
|
||||
}
|
||||
_ecore_xcb_mouse_down_info_list = NULL;
|
||||
}
|
||||
|
||||
static Ecore_X_Mouse_Down_Info *
|
||||
_ecore_xcb_event_mouse_down_info_get(int dev)
|
||||
{
|
||||
Eina_Inlist *l;
|
||||
Ecore_X_Mouse_Down_Info *info = NULL;
|
||||
|
||||
l = _ecore_xcb_mouse_down_info_list;
|
||||
EINA_INLIST_FOREACH(l, info)
|
||||
if (info->dev == dev) return info;
|
||||
|
||||
if (!(info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info)))) return NULL;
|
||||
|
||||
info->dev = dev;
|
||||
l = eina_inlist_append(l, (Eina_Inlist *)info);
|
||||
_ecore_xcb_mouse_down_info_list = l;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue