From: Hosang Kim Date: Mon, 8 Feb 2021 06:36:46 +0000 (+0900) Subject: ecore_wl2_input: add touch id slots for distinguishing single touch and multi touch. X-Git-Tag: accepted/tizen/unified/20230113.091229~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F53%2F286653%2F2;p=platform%2Fupstream%2Fefl.git ecore_wl2_input: add touch id slots for distinguishing single touch and multi touch. Sometimes touch count is different between window manager and application. (For example, application window is removed) So add touch id slots for counting touch event. Change-Id: Iea15ac3e5d77ea7c108289cc896b8933ff386d8e (cherry picked from commit a35765c7113513d1bc9eda7775b655c68f3d5fb4) --- diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index 39cb1c0..e577ad0 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c @@ -1682,6 +1682,9 @@ _touch_cb_down(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int seri input->focus.touch = window; input->timestamp = timestamp; input->grab.touch_count++; + //TIZEN_ONLY(20210208): add touch id slots for distinguishing single touch and multi touch. + input->grab.touch_array[id] = EINA_TRUE; + // // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface _ecore_wl2_input_touch_axis_process(input, id); @@ -1742,7 +1745,10 @@ _touch_cb_up(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial BTN_LEFT, timestamp); if (input->grab.count) input->grab.count--; - if (input->grab.touch_count) input->grab.touch_count--; + //TIZEN_ONLY(20210208): add touch id slots for distinguishing single touch and multi touch. + if (input->grab.touch_array[id] && input->grab.touch_count) input->grab.touch_count--; + if (input->grab.touch_array[id]) input->grab.touch_array[id] = EINA_FALSE; + // if ((input->grab.window) && (input->grab.button == BTN_LEFT) && (!input->grab.count) && !input->grab.touch_count) _ecore_wl2_input_ungrab(input); @@ -1820,6 +1826,14 @@ _touch_cb_cancel(void *data, struct wl_touch *touch EINA_UNUSED) ERR("[cancel] time=%u window=0x%x", ev->timestamp, ev->window); // + //TIZEN_ONLY(20210208): add touch id slots for distinguishing single touch and multi touch. + for (int i = 0; i < ECORE_WL2_TOUCH_MAX; i++) + input->grab.touch_array[i] = EINA_FALSE; + input->focus.touch = NULL; + input->grab.count = 0; + _ecore_wl2_input_ungrab(input); + // + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_CANCEL, ev, NULL, _input_event_mouse_button_cb_free); // } @@ -2499,6 +2513,17 @@ _ecore_wl2_input_window_remove(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window) if ((input->focus.keyboard) && (input->focus.keyboard == window)) input->focus.keyboard = NULL; + //TIZEN_ONLY(20210208): add touch id slots for distinguishing single touch and multi touch. + if ((input->focus.touch) && + (input->focus.touch == window)) + { + for (int i = 0; i < ECORE_WL2_TOUCH_MAX; i++) + input->grab.touch_array[i] = EINA_FALSE; + input->focus.touch = NULL; + input->grab.count = 0; + _ecore_wl2_input_ungrab(input); + } + // if ((input->repeat_win) && (input->repeat_win == window)) { diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index 7b08980..5b26537 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -706,6 +706,9 @@ struct _Ecore_Wl2_Input unsigned int button, count, timestamp; Ecore_Wl2_Window *window; unsigned int touch_count; + //TIZEN_ONLY(20210208): add touch id slots for distinguishing single touch and multi touch. + Eina_Bool touch_array[ECORE_WL2_TOUCH_MAX]; + // } grab; struct