ecore_wl2_input: add touch id slots for distinguishing single touch and multi touch. 53/286653/2
authorHosang Kim <hosang12.kim@samsung.com>
Mon, 8 Feb 2021 06:36:46 +0000 (15:36 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Thu, 12 Jan 2023 09:09:06 +0000 (09:09 +0000)
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)

src/lib/ecore_wl2/ecore_wl2_input.c
src/lib/ecore_wl2/ecore_wl2_private.h

index 39cb1c0..e577ad0 100644 (file)
@@ -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))
      {
index 7b08980..5b26537 100644 (file)
@@ -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