ecore-wl2: do not send double mouse up events during input ungrab
authorMike Blumenkrantz <zmike@osg.samsung.com>
Wed, 17 Feb 2016 18:14:38 +0000 (13:14 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Wed, 17 Feb 2016 18:16:04 +0000 (13:16 -0500)
if the ungrab is triggered from a mouse up event, this ensures that a
mouse up will be sent from the ungrab function. continuing to send a
mouse up event in addition to this will guarantee multiple mouse events
are emitted

@fix

src/lib/ecore_wl2/ecore_wl2_input.c

index 9d0301a..f362325 100644 (file)
@@ -573,12 +573,11 @@ _pointer_cb_button(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned
      }
    else
      {
-        if (input->focus.pointer)
-          _ecore_wl2_input_mouse_up_send(input, input->focus.pointer,
-                                         0, button, timestamp);
-
         if ((input->grab.window) && (input->grab.button == button))
           _ecore_wl2_input_ungrab(input);
+        else if (input->focus.pointer)
+          _ecore_wl2_input_mouse_up_send(input, input->focus.pointer,
+                                         0, button, timestamp);
      }
 }
 
@@ -953,11 +952,11 @@ _touch_cb_up(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial
    input->timestamp = timestamp;
    input->display->serial = serial;
 
-   _ecore_wl2_input_mouse_up_send(input, input->focus.touch, id,
-                                  BTN_LEFT, timestamp);
-
    if ((input->grab.window) && (input->grab.button == BTN_LEFT))
      _ecore_wl2_input_ungrab(input);
+   else
+     _ecore_wl2_input_mouse_up_send(input, input->focus.touch, id,
+                                    BTN_LEFT, timestamp);
 }
 
 static void