aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_wl2/ecore_wl2_input.c
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-06-28 09:01:38 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-06-28 09:01:38 -0400
commitdf65a16620fd5415bf0d8315d08729e6da738432 (patch)
tree2a1e59ea9c97cdd43e179cb973a7bbfa8ac7f4d8 /src/lib/ecore_wl2/ecore_wl2_input.c
parentecore-wayland: Prevent duplicated mouse up events. (diff)
downloadefl-df65a16620fd5415bf0d8315d08729e6da738432.tar.gz
ecore-wl2: Prevent duplicated mouse up events
If you touch downs and ups about all of fingers, that is sufficient condition to call ecore_wl_input_ungrab(). And then one mouse up event is generated from that function. So if you set a callback about ECORE_EVENT_MOUSE_BUTTON_UP, you can watch two mouse up events are occurred. This is a port of the patch for Ecore_Wayland library (deprecated) to the newer Ecore_Wl2 library. ref https://phab.enlightenment.org/D4112 @fix Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_input.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index 7a5899f5b9..30573eafcc 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -476,12 +476,13 @@ _ecore_wl2_input_grab(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, unsigned
void
_ecore_wl2_input_ungrab(Ecore_Wl2_Input *input)
{
- if ((input->grab.window) && (input->grab.button))
+ if ((input->grab.window) && (input->grab.button) && (input->grab.count))
_ecore_wl2_input_mouse_up_send(input, input->grab.window, 0,
input->grab.button, input->grab.timestamp);
input->grab.window = NULL;
input->grab.button = 0;
+ input->grab.count = 0;
}
static void
@@ -590,7 +591,8 @@ _pointer_cb_button(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
{
- if ((input->focus.pointer) && (!input->grab.window))
+ if ((input->focus.pointer) &&
+ (!input->grab.window) && (!input->grab.count))
{
_ecore_wl2_input_grab(input, input->focus.pointer, button);
input->grab.timestamp = timestamp;
@@ -599,14 +601,19 @@ _pointer_cb_button(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned
if (input->focus.pointer)
_ecore_wl2_input_mouse_down_send(input, input->focus.pointer,
0, button, timestamp);
+
+ input->grab.count++;
}
else
{
- if ((input->grab.window) && (input->grab.button == button))
- _ecore_wl2_input_ungrab(input);
- else if (input->focus.pointer)
+ if (input->focus.pointer)
_ecore_wl2_input_mouse_up_send(input, input->focus.pointer,
0, button, timestamp);
+
+ if (input->grab.count) input->grab.count--;
+ if ((input->grab.window) && (input->grab.button == button) &&
+ (!input->grab.count))
+ _ecore_wl2_input_ungrab(input);
}
}
@@ -990,11 +997,13 @@ _touch_cb_up(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial
input->timestamp = timestamp;
input->display->serial = serial;
- if ((input->grab.window) && (input->grab.button == BTN_LEFT))
+ _ecore_wl2_input_mouse_up_send(input, input->focus.touch, id,
+ BTN_LEFT, timestamp);
+
+ if (input->grab.count) input->grab.count--;
+ if ((input->grab.window) && (input->grab.button == BTN_LEFT) &&
+ (!input->grab.count))
_ecore_wl2_input_ungrab(input);
- else
- _ecore_wl2_input_mouse_up_send(input, input->focus.touch, id,
- BTN_LEFT, timestamp);
}
static void