summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorjhyuni.kang <jhyuni.kang@samsung.com>2015-05-12 08:57:03 -0400
committerChris Michael <cp.michael@samsung.com>2015-05-12 08:57:47 -0400
commitaee186b4f3fdc27b5fe6ac13238e517f4f02fe15 (patch)
tree47f2340ef440b95059be7f0db15611523d0b4b78 /src/lib/ecore_wayland
parent8a3441dfe9f2c59586498b41cc87fc26288b7d06 (diff)
ecore-wayland: Add a grab_count variable for synchronization wl_input_grab/ungrab with pointer and touch event
Summary: The touch screen device generates touch events. But in some special enviroments, a first finger will be matched to a pointer event(not touch event). And other fingers (second, third, ...) will be matched touch events. In that case ecore_wl_input_ungrab() is called abnormally. A first finger pressed, _ecore_wl_input_cb_pointer_button() call ecore_wl_input_grab(). A second finger pressed, _ecore_wl_input_cb_touch_down() is called but not grab. But when a second finger is released, _ecore_wl_input_cb_touch_up() call ecore_wl_input_ungrab() So ungrab function generate two mouse up events and a first finger is released. In other case, first finger pressed -> second finger pressed -> first finger release. That case when a first finger released a second finger release event is generated. So after that application doesn't get a release event about a second finger when a second finger is really released. I think in a multitouch case, ungrab function will be called when a all finger are released. So I add a grab_count variable for count currently touched fingers. And only called a ungrab funtion all fingers are released. Test Plan: In a touch screen supported multitouch, press two or more fingers and release. And watch events generation. Reviewers: raster, devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2481
Diffstat (limited to 'src/lib/ecore_wayland')
-rwxr-xr-xsrc/lib/ecore_wayland/ecore_wl_input.c28
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h1
2 files changed, 21 insertions, 8 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c
index b0297e9..294121f 100755
--- a/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/src/lib/ecore_wayland/ecore_wl_input.c
@@ -583,7 +583,7 @@ _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer EINA_UN
583 583
584 if (state) 584 if (state)
585 { 585 {
586 if ((input->pointer_focus) && (!input->grab)) 586 if ((input->pointer_focus) && (!input->grab) && (!input->grab_count))
587 { 587 {
588 ecore_wl_input_grab(input, input->pointer_focus, button); 588 ecore_wl_input_grab(input, input->pointer_focus, button);
589 input->grab_timestamp = timestamp; 589 input->grab_timestamp = timestamp;
@@ -592,6 +592,7 @@ _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer EINA_UN
592 if (input->pointer_focus) 592 if (input->pointer_focus)
593 _ecore_wl_input_mouse_down_send(input, input->pointer_focus, 593 _ecore_wl_input_mouse_down_send(input, input->pointer_focus,
594 0, button, timestamp); 594 0, button, timestamp);
595 input->grab_count++;
595 } 596 }
596 else 597 else
597 { 598 {
@@ -599,7 +600,10 @@ _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer EINA_UN
599 _ecore_wl_input_mouse_up_send(input, input->pointer_focus, 600 _ecore_wl_input_mouse_up_send(input, input->pointer_focus,
600 0, button, timestamp); 601 0, button, timestamp);
601 602
602 if ((input->grab) && (input->grab_button == button) && (!state)) 603 input->grab_count--;
604 if (input->grab_count < 0)
605 input->grab_count = 0;
606 if ((input->grab) && (input->grab_button == button) && (!state) && (!input->grab_count))
603 ecore_wl_input_ungrab(input); 607 ecore_wl_input_ungrab(input);
604 } 608 }
605 609
@@ -1074,16 +1078,21 @@ _ecore_wl_input_cb_touch_down(void *data, struct wl_touch *touch EINA_UNUSED, un
1074 input->sx = wl_fixed_to_int(x); 1078 input->sx = wl_fixed_to_int(x);
1075 input->sy = wl_fixed_to_int(y); 1079 input->sy = wl_fixed_to_int(y);
1076 1080
1077 _ecore_wl_input_mouse_move_send(input, input->touch_focus, timestamp, id); 1081 //_ecore_wl_input_mouse_move_send(input, input->touch_focus, timestamp, id);
1078 _ecore_wl_input_cb_pointer_enter(data, NULL, serial, surface, x, y); 1082 if (!input->grab_count)
1079 if ((input->touch_focus) && (!input->grab))
1080 { 1083 {
1081 ecore_wl_input_grab(input, input->touch_focus, BTN_LEFT); 1084 _ecore_wl_input_cb_pointer_enter(data, NULL, serial, surface, x, y);
1082 input->grab_timestamp = timestamp; 1085 if ((input->touch_focus) && (!input->grab))
1086 {
1087 ecore_wl_input_grab(input, input->touch_focus, BTN_LEFT);
1088 input->grab_timestamp = timestamp;
1089 }
1083 } 1090 }
1084 1091
1085 _ecore_wl_input_mouse_down_send(input, input->touch_focus, 1092 _ecore_wl_input_mouse_down_send(input, input->touch_focus,
1086 id, BTN_LEFT, timestamp); 1093 id, BTN_LEFT, timestamp);
1094
1095 input->grab_count++;
1087} 1096}
1088 1097
1089static void 1098static void
@@ -1100,7 +1109,10 @@ _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch EINA_UNUSED, unsi
1100 input->display->serial = serial; 1109 input->display->serial = serial;
1101 1110
1102 _ecore_wl_input_mouse_up_send(input, input->touch_focus, id, BTN_LEFT, timestamp); 1111 _ecore_wl_input_mouse_up_send(input, input->touch_focus, id, BTN_LEFT, timestamp);
1103 if ((input->grab) && (input->grab_button == BTN_LEFT)) 1112 input->grab_count--;
1113 if (input->grab_count < 0)
1114 input->grab_count = 0;
1115 if ((input->grab) && (input->grab_button == BTN_LEFT) && (!input->grab_count))
1104 ecore_wl_input_ungrab(input); 1116 ecore_wl_input_ungrab(input);
1105} 1117}
1106 1118
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index 77c12db..c54b157 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -209,6 +209,7 @@ struct _Ecore_Wl_Input
209 Ecore_Wl_Window *grab; 209 Ecore_Wl_Window *grab;
210 unsigned int grab_button; 210 unsigned int grab_button;
211 unsigned int grab_timestamp; 211 unsigned int grab_timestamp;
212 unsigned int grab_count;
212 213
213 Ecore_Wl_Dnd_Source *drag_source; 214 Ecore_Wl_Dnd_Source *drag_source;
214 Ecore_Wl_Dnd_Source *selection_source; 215 Ecore_Wl_Dnd_Source *selection_source;