ecore-wayland: Prevent duplicated mouse up events. 75/77275/2
authorJengHyun Kang <jhyuni.kang@samsung.com>
Wed, 29 Jun 2016 08:33:04 +0000 (17:33 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 30 Jun 2016 06:52:11 +0000 (23:52 -0700)
Change-Id: Ibb3d6ee20ee1f7413e8e1d7f34ccc8b29f913b44

src/lib/ecore_wayland/ecore_wl_input.c

index 7ae42d9..e667e8b 100644 (file)
@@ -202,12 +202,13 @@ ecore_wl_input_ungrab(Ecore_Wl_Input *input)
 
    if (!input) return;
 
-   if ((input->grab) && (input->grab_button))
+   if ((input->grab) && (input->grab_button) && (input->grab_count))
      _ecore_wl_input_mouse_up_send(input, input->grab, 0, input->grab_button,
                                    input->grab_timestamp);
 
    input->grab = NULL;
    input->grab_button = 0;
+   input->grab_count = 0;
 }
 
 /* NB: This function should be called just before shell move and shell resize
@@ -759,7 +760,7 @@ _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer EINA_UN
           _ecore_wl_input_mouse_up_send(input, input->pointer_focus,
                                         0, button, timestamp);
 
-        input->grab_count--;
+        if (input->grab_count) input->grab_count--;
         if ((input->grab) && (input->grab_button == button) &&
             (!state) && (!input->grab_count))
           ecore_wl_input_ungrab(input);
@@ -1466,7 +1467,7 @@ _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch EINA_UNUSED, unsi
    input->display->serial = serial;
 
    _ecore_wl_input_mouse_up_send(input, input->touch_focus, id, BTN_LEFT, timestamp);
-   input->grab_count--;
+   if (input->grab_count) input->grab_count--;
    if ((input->grab) && (input->grab_button == BTN_LEFT) &&
        (!input->grab_count))
      ecore_wl_input_ungrab(input);