summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-04-10 14:45:12 -0300
committerRafael Antognolli <rafael.antognolli@intel.com>2013-04-10 14:53:14 -0300
commit2d62ea88e51c36a3116e5160710bfe0b6b3c0bee (patch)
treec015c5934ba70c964a44174beed8b0da94f457f6
parent7d17130db6659244e0c601a4573aadf845eeaba5 (diff)
ecore/wayland: Add support for double and triple click.
It's implemented exactly the same way as on the X11 backend. It does handle multiple devices, though may need some adjustments when multi-touch is added, since there's no support for multi-touch on EFL-wayland yet.
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c2
-rw-r--r--src/lib/ecore_wayland/ecore_wl_input.c177
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h3
5 files changed, 164 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 779bf02487..61514bea81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-04-10 Rafael Antognolli
2
3 * Ecore: Add support for double and triple click on Wayland.
4
12013-04-10 Tom Hacohen (Tasn) Yakov Goldberg 52013-04-10 Tom Hacohen (Tasn) Yakov Goldberg
2 * Evas textblock : Added split cursor for BiDi text 6 * Evas textblock : Added split cursor for BiDi text
3 7
diff --git a/NEWS b/NEWS
index 3735e3891a..2c50a8d142 100644
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,7 @@ Additions:
52 - ecore_wl_registry_get() 52 - ecore_wl_registry_get()
53 - Add #ifdef __cplusplus to Ecore_Wayland.h so C++ programs can link to 53 - Add #ifdef __cplusplus to Ecore_Wayland.h so C++ programs can link to
54 and use the API. 54 and use the API.
55 - Add support for double and triple click.
55 * ecore_evas: 56 * ecore_evas:
56 - ecore_evas_window_profile_supported_get() 57 - ecore_evas_window_profile_supported_get()
57 - ecore_evas_window_profile_set() 58 - ecore_evas_window_profile_set()
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index dd6829dcbe..184e531120 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -158,6 +158,7 @@ ecore_wl_init(const char *name)
158 } 158 }
159 159
160 _ecore_wl_window_init(); 160 _ecore_wl_window_init();
161 _ecore_wl_events_init();
161 162
162 return _ecore_wl_init_count; 163 return _ecore_wl_init_count;
163} 164}
@@ -293,6 +294,7 @@ _ecore_wl_shutdown(Eina_Bool close)
293 if (--_ecore_wl_init_count != 0) return _ecore_wl_init_count; 294 if (--_ecore_wl_init_count != 0) return _ecore_wl_init_count;
294 if (!_ecore_wl_disp) return _ecore_wl_init_count; 295 if (!_ecore_wl_disp) return _ecore_wl_init_count;
295 296
297 _ecore_wl_events_shutdown();
296 _ecore_wl_window_shutdown(); 298 _ecore_wl_window_shutdown();
297 299
298 if (_ecore_wl_disp->fd_hdl) 300 if (_ecore_wl_disp->fd_hdl)
diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c
index 93c9914f0c..114172e907 100644
--- a/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/src/lib/ecore_wayland/ecore_wl_input.c
@@ -35,15 +35,33 @@
35# define BTN_BACK 0x116 35# define BTN_BACK 0x116
36#endif 36#endif
37 37
38typedef struct _Ecore_Wl_Mouse_Down_Info
39{
40 EINA_INLIST;
41 void *dev;
42 int last_win;
43 int last_last_win;
44 int last_event_win;
45 int last_last_event_win;
46 unsigned int last_time;
47 unsigned int last_last_time;
48 Eina_Bool did_double : 1;
49 Eina_Bool did_triple : 1;
50} Ecore_Wl_Mouse_Down_Info;
51
38Ecore_Wl_Dnd *glb_dnd = NULL; 52Ecore_Wl_Dnd *glb_dnd = NULL;
39 53
54/* FIXME: This should be a global setting, used by wayland and X */
55static double _ecore_wl_double_click_time = 0.25;
56static Eina_Inlist *_ecore_wl_mouse_down_info_list = NULL;
57
40/* local function prototypes */ 58/* local function prototypes */
41static void _ecore_wl_input_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps); 59static void _ecore_wl_input_seat_handle_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability caps);
42 60
43static void _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy); 61static void _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy);
44static void _ecore_wl_input_cb_pointer_leave(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int serial, struct wl_surface *surface); 62static void _ecore_wl_input_cb_pointer_leave(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int serial, struct wl_surface *surface);
45static void _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int timestamp, wl_fixed_t sx, wl_fixed_t sy); 63static void _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int timestamp, wl_fixed_t sx, wl_fixed_t sy);
46static void _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state); 64static void _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state);
47static void _ecore_wl_input_cb_pointer_axis(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int timestamp, unsigned int axis, wl_fixed_t value); 65static void _ecore_wl_input_cb_pointer_axis(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int timestamp, unsigned int axis, wl_fixed_t value);
48static void _ecore_wl_input_cb_pointer_frame(void *data, struct wl_callback *callback, unsigned int timestamp EINA_UNUSED); 66static void _ecore_wl_input_cb_pointer_frame(void *data, struct wl_callback *callback, unsigned int timestamp EINA_UNUSED);
49static void _ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int format, int fd, unsigned int size); 67static void _ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int format, int fd, unsigned int size);
@@ -52,8 +70,8 @@ static void _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_keyboard *ke
52static void _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, unsigned int timestamp, unsigned int key, unsigned int state); 70static void _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial, unsigned int timestamp, unsigned int key, unsigned int state);
53static void _ecore_wl_input_cb_keyboard_modifiers(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial EINA_UNUSED, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group); 71static void _ecore_wl_input_cb_keyboard_modifiers(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int serial EINA_UNUSED, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group);
54static Eina_Bool _ecore_wl_input_cb_keyboard_repeat(void *data, Ecore_Fd_Handler *handler EINA_UNUSED); 72static Eina_Bool _ecore_wl_input_cb_keyboard_repeat(void *data, Ecore_Fd_Handler *handler EINA_UNUSED);
55static void _ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial, unsigned int timestamp, struct wl_surface *surface EINA_UNUSED, int id EINA_UNUSED, wl_fixed_t x, wl_fixed_t y); 73static void _ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch, unsigned int serial, unsigned int timestamp, struct wl_surface *surface EINA_UNUSED, int id EINA_UNUSED, wl_fixed_t x, wl_fixed_t y);
56static void _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial, unsigned int timestamp, int id EINA_UNUSED); 74static void _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch, unsigned int serial, unsigned int timestamp, int id EINA_UNUSED);
57static void _ecore_wl_input_cb_touch_motion(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int timestamp, int id EINA_UNUSED, wl_fixed_t x, wl_fixed_t y); 75static void _ecore_wl_input_cb_touch_motion(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int timestamp, int id EINA_UNUSED, wl_fixed_t x, wl_fixed_t y);
58static void _ecore_wl_input_cb_touch_frame(void *data EINA_UNUSED, struct wl_touch *touch EINA_UNUSED); 76static void _ecore_wl_input_cb_touch_frame(void *data EINA_UNUSED, struct wl_touch *touch EINA_UNUSED);
59static void _ecore_wl_input_cb_touch_cancel(void *data EINA_UNUSED, struct wl_touch *touch EINA_UNUSED); 77static void _ecore_wl_input_cb_touch_cancel(void *data EINA_UNUSED, struct wl_touch *touch EINA_UNUSED);
@@ -69,9 +87,10 @@ static void _ecore_wl_input_mouse_in_send(Ecore_Wl_Input *input, Ecore_Wl_Window
69static void _ecore_wl_input_mouse_out_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int timestamp); 87static void _ecore_wl_input_mouse_out_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int timestamp);
70static void _ecore_wl_input_focus_in_send(Ecore_Wl_Input *input EINA_UNUSED, Ecore_Wl_Window *win, unsigned int timestamp); 88static void _ecore_wl_input_focus_in_send(Ecore_Wl_Input *input EINA_UNUSED, Ecore_Wl_Window *win, unsigned int timestamp);
71static void _ecore_wl_input_focus_out_send(Ecore_Wl_Input *input EINA_UNUSED, Ecore_Wl_Window *win, unsigned int timestamp); 89static void _ecore_wl_input_focus_out_send(Ecore_Wl_Input *input EINA_UNUSED, Ecore_Wl_Window *win, unsigned int timestamp);
72static void _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int button, unsigned int timestamp); 90static void _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, void *device, unsigned int button, unsigned int timestamp);
73static void _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int button, unsigned int timestamp); 91static void _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, void *device, unsigned int button, unsigned int timestamp);
74static void _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int value, unsigned int timestamp); 92static void _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int value, unsigned int timestamp);
93static Ecore_Wl_Mouse_Down_Info *_ecore_wl_mouse_down_info_get(void *dev);
75 94
76/* static int _ecore_wl_input_keysym_to_string(unsigned int symbol, char *buffer, int len); */ 95/* static int _ecore_wl_input_keysym_to_string(unsigned int symbol, char *buffer, int len); */
77 96
@@ -382,7 +401,7 @@ _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer EINA_UN
382} 401}
383 402
384static void 403static void
385_ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state) 404_ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state)
386{ 405{
387 Ecore_Wl_Input *input; 406 Ecore_Wl_Input *input;
388 407
@@ -400,13 +419,13 @@ _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer EINA_UN
400 if ((input->pointer_focus) && (!input->grab) && (state)) 419 if ((input->pointer_focus) && (!input->grab) && (state))
401 ecore_wl_input_grab(input, input->pointer_focus, button); 420 ecore_wl_input_grab(input, input->pointer_focus, button);
402 421
403 _ecore_wl_input_mouse_down_send(input, input->pointer_focus, 422 _ecore_wl_input_mouse_down_send(input, input->pointer_focus,
404 button, timestamp); 423 pointer, button, timestamp);
405 } 424 }
406 else 425 else
407 { 426 {
408 _ecore_wl_input_mouse_up_send(input, input->pointer_focus, 427 _ecore_wl_input_mouse_up_send(input, input->pointer_focus,
409 button, timestamp); 428 pointer, button, timestamp);
410 if ((input->grab) && (input->grab_button == button) && (!state)) 429 if ((input->grab) && (input->grab_button == button) && (!state))
411 ecore_wl_input_ungrab(input); 430 ecore_wl_input_ungrab(input);
412 } 431 }
@@ -665,7 +684,7 @@ _ecore_wl_input_cb_keyboard_repeat(void *data, Ecore_Fd_Handler *handler EINA_UN
665} 684}
666 685
667static void 686static void
668_ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned int serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy) 687_ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer, unsigned int serial, struct wl_surface *surface, wl_fixed_t sx, wl_fixed_t sy)
669{ 688{
670 Ecore_Wl_Input *input; 689 Ecore_Wl_Input *input;
671 Ecore_Wl_Window *win = NULL; 690 Ecore_Wl_Window *win = NULL;
@@ -711,8 +730,8 @@ _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer EINA_UNU
711 { 730 {
712 /* NB: 'Fake' a mouse_up for move finished */ 731 /* NB: 'Fake' a mouse_up for move finished */
713 win->moving = EINA_FALSE; 732 win->moving = EINA_FALSE;
714 _ecore_wl_input_mouse_up_send(input, win, BTN_LEFT, 733 _ecore_wl_input_mouse_up_send(input, win, pointer,
715 input->timestamp); 734 BTN_LEFT, input->timestamp);
716 735
717 if ((input->grab) && (input->grab_button == BTN_LEFT)) 736 if ((input->grab) && (input->grab_button == BTN_LEFT))
718 ecore_wl_input_ungrab(input); 737 ecore_wl_input_ungrab(input);
@@ -721,8 +740,8 @@ _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer EINA_UNU
721 { 740 {
722 /* NB: 'Fake' a mouse_up for resize finished */ 741 /* NB: 'Fake' a mouse_up for resize finished */
723 win->resizing = EINA_FALSE; 742 win->resizing = EINA_FALSE;
724 _ecore_wl_input_mouse_up_send(input, win, BTN_LEFT, 743 _ecore_wl_input_mouse_up_send(input, win, pointer,
725 input->timestamp); 744 BTN_LEFT, input->timestamp);
726 745
727 if ((input->grab) && (input->grab_button == BTN_LEFT)) 746 if ((input->grab) && (input->grab_button == BTN_LEFT))
728 ecore_wl_input_ungrab(input); 747 ecore_wl_input_ungrab(input);
@@ -833,7 +852,7 @@ _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_keyboard *keyboard EINA_
833} 852}
834 853
835static void 854static void
836_ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial, unsigned int timestamp, struct wl_surface *surface EINA_UNUSED, int id EINA_UNUSED, wl_fixed_t x, wl_fixed_t y) 855_ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch, unsigned int serial, unsigned int timestamp, struct wl_surface *surface EINA_UNUSED, int id EINA_UNUSED, wl_fixed_t x, wl_fixed_t y)
837{ 856{
838 Ecore_Wl_Input *input; 857 Ecore_Wl_Input *input;
839 858
@@ -849,11 +868,12 @@ _ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch EINA_UNUSED, un
849 input->sx = wl_fixed_to_int(x); 868 input->sx = wl_fixed_to_int(x);
850 input->sy = wl_fixed_to_int(y); 869 input->sy = wl_fixed_to_int(y);
851 _ecore_wl_input_cb_pointer_enter(data, NULL, serial, surface, x, y); 870 _ecore_wl_input_cb_pointer_enter(data, NULL, serial, surface, x, y);
852 _ecore_wl_input_mouse_down_send(input, input->pointer_focus, BTN_LEFT, timestamp); 871 _ecore_wl_input_mouse_down_send(input, input->pointer_focus,
872 touch, BTN_LEFT, timestamp);
853} 873}
854 874
855static void 875static void
856_ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial, unsigned int timestamp, int id EINA_UNUSED) 876_ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch, unsigned int serial, unsigned int timestamp, int id EINA_UNUSED)
857{ 877{
858 Ecore_Wl_Input *input; 878 Ecore_Wl_Input *input;
859 879
@@ -865,7 +885,8 @@ _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch EINA_UNUSED, unsi
865 * This needs to be tested with an actual touch device */ 885 * This needs to be tested with an actual touch device */
866 /* input->timestamp = timestamp; */ 886 /* input->timestamp = timestamp; */
867 input->display->serial = serial; 887 input->display->serial = serial;
868 _ecore_wl_input_mouse_up_send(input, input->pointer_focus, BTN_LEFT, timestamp); 888 _ecore_wl_input_mouse_up_send(input, input->pointer_focus,
889 touch, BTN_LEFT, timestamp);
869} 890}
870 891
871static void 892static void
@@ -1058,7 +1079,7 @@ _ecore_wl_input_focus_out_send(Ecore_Wl_Input *input EINA_UNUSED, Ecore_Wl_Windo
1058} 1079}
1059 1080
1060static void 1081static void
1061_ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int button, unsigned int timestamp) 1082_ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, void *device, unsigned int button, unsigned int timestamp)
1062{ 1083{
1063 Ecore_Event_Mouse_Button *ev; 1084 Ecore_Event_Mouse_Button *ev;
1064 1085
@@ -1082,10 +1103,57 @@ _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, uns
1082 /* ev->root.y = input->sy; */ 1103 /* ev->root.y = input->sy; */
1083 ev->modifiers = input->modifiers; 1104 ev->modifiers = input->modifiers;
1084 1105
1085 /* FIXME: Need to get these from wayland somehow */
1086 ev->double_click = 0; 1106 ev->double_click = 0;
1087 ev->triple_click = 0; 1107 ev->triple_click = 0;
1088 1108
1109 /* handling double and triple click, taking into account multiple input
1110 * devices */
1111 Ecore_Wl_Mouse_Down_Info *down_info = _ecore_wl_mouse_down_info_get(device);
1112
1113 if (down_info)
1114 {
1115 if (down_info->did_triple)
1116 {
1117 down_info->last_win = 0;
1118 down_info->last_last_win = 0;
1119 down_info->last_event_win = 0;
1120 down_info->last_last_event_win = 0;
1121 down_info->last_time = 0;
1122 down_info->last_last_time = 0;
1123 }
1124 //Check Double Clicked
1125 if (((int)(timestamp - down_info->last_time) <=
1126 (int)(1000 * _ecore_wl_double_click_time)) &&
1127 (win->id == down_info->last_win) &&
1128 (win->id == down_info->last_event_win))
1129 {
1130 ev->double_click = 1;
1131 down_info->did_double = EINA_TRUE;
1132 }
1133 else
1134 {
1135 down_info->did_double = EINA_FALSE;
1136 down_info->did_triple = EINA_FALSE;
1137 }
1138
1139 //Check Triple Clicked
1140 if (((int)(timestamp - down_info->last_last_time) <=
1141 (int)(2 * 1000 * _ecore_wl_double_click_time)) &&
1142 (win->id == down_info->last_win) &&
1143 (win->id == down_info->last_last_win) &&
1144 (win->id == down_info->last_event_win) &&
1145 (win->id == down_info->last_last_event_win)
1146 )
1147 {
1148 ev->triple_click = 1;
1149 down_info->did_triple = EINA_TRUE;
1150 }
1151 else
1152 {
1153 down_info->did_triple = EINA_FALSE;
1154 }
1155 }
1156
1089 ev->multi.device = 0; 1157 ev->multi.device = 0;
1090 ev->multi.radius = 1; 1158 ev->multi.radius = 1;
1091 ev->multi.radius_x = 1; 1159 ev->multi.radius_x = 1;
@@ -1102,10 +1170,21 @@ _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, uns
1102 } 1170 }
1103 1171
1104 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); 1172 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
1173
1174 if ((down_info) &&
1175 (!down_info->did_triple))
1176 {
1177 down_info->last_last_win = down_info->last_win;
1178 down_info->last_win = win->id;
1179 down_info->last_last_event_win = down_info->last_event_win;
1180 down_info->last_event_win = win->id;
1181 down_info->last_last_time = down_info->last_time;
1182 down_info->last_time = timestamp;
1183 }
1105} 1184}
1106 1185
1107static void 1186static void
1108_ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int button, unsigned int timestamp) 1187_ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, void *device, unsigned int button, unsigned int timestamp)
1109{ 1188{
1110 Ecore_Event_Mouse_Button *ev; 1189 Ecore_Event_Mouse_Button *ev;
1111 1190
@@ -1129,10 +1208,18 @@ _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsig
1129 /* ev->root.y = input->sy; */ 1208 /* ev->root.y = input->sy; */
1130 ev->modifiers = input->modifiers; 1209 ev->modifiers = input->modifiers;
1131 1210
1132 /* FIXME: Need to get these from wayland somehow */
1133 ev->double_click = 0; 1211 ev->double_click = 0;
1134 ev->triple_click = 0; 1212 ev->triple_click = 0;
1135 1213
1214 Ecore_Wl_Mouse_Down_Info *down_info = _ecore_wl_mouse_down_info_get(device);
1215 if (down_info)
1216 {
1217 if (down_info->did_double)
1218 ev->double_click = 1;
1219 if (down_info->did_triple)
1220 ev->triple_click = 1;
1221 }
1222
1136 ev->multi.device = 0; 1223 ev->multi.device = 0;
1137 ev->multi.radius = 1; 1224 ev->multi.radius = 1;
1138 ev->multi.radius_x = 1; 1225 ev->multi.radius_x = 1;
@@ -1198,3 +1285,47 @@ _ecore_wl_input_set_selection(Ecore_Wl_Input *input, struct wl_data_source *sour
1198 wl_data_device_set_selection(input->data_device, source, input->display->serial); 1285 wl_data_device_set_selection(input->data_device, source, input->display->serial);
1199} 1286}
1200 1287
1288static void
1289_ecore_wl_mouse_down_info_clear(void)
1290{
1291 Eina_Inlist *l = _ecore_wl_mouse_down_info_list;
1292 Ecore_Wl_Mouse_Down_Info *info = NULL;
1293 while (l)
1294 {
1295 info = EINA_INLIST_CONTAINER_GET(l, Ecore_Wl_Mouse_Down_Info);
1296 l = eina_inlist_remove(l, l);
1297 free(info);
1298 }
1299 _ecore_wl_mouse_down_info_list = NULL;
1300}
1301
1302static Ecore_Wl_Mouse_Down_Info *
1303_ecore_wl_mouse_down_info_get(void *dev)
1304{
1305 Eina_Inlist *l = _ecore_wl_mouse_down_info_list;
1306 Ecore_Wl_Mouse_Down_Info *info = NULL;
1307
1308 //Return the exist info
1309 EINA_INLIST_FOREACH(l, info)
1310 if (info->dev == dev) return info;
1311
1312 //New Device. Add it.
1313 info = calloc(1, sizeof(Ecore_Wl_Mouse_Down_Info));
1314 if (!info) return NULL;
1315
1316 info->dev = dev;
1317 l = eina_inlist_append(l, (Eina_Inlist *)info);
1318 _ecore_wl_mouse_down_info_list = l;
1319 return info;
1320}
1321
1322void
1323_ecore_wl_events_init(void)
1324{
1325}
1326
1327void
1328_ecore_wl_events_shutdown(void)
1329{
1330 _ecore_wl_mouse_down_info_clear();
1331}
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index ecd7a110b3..f07c0478ed 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -99,5 +99,8 @@ void _ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device);
99void _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer); 99void _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer);
100void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source); 100void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source);
101 101
102void _ecore_wl_events_init(void);
103void _ecore_wl_events_shutdown(void);
104
102struct wl_data_source *_ecore_wl_create_data_source(Ecore_Wl_Display *ewd); 105struct wl_data_source *_ecore_wl_create_data_source(Ecore_Wl_Display *ewd);
103#endif 106#endif