aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_wl2/ecore_wl2_input.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-09-23 11:22:00 -0400
committerChris Michael <cp.michael@samsung.com>2015-12-03 12:02:40 -0500
commitc0e03359e59ef47efbb0529059b9456d9c24e1aa (patch)
treefa8ad7f8b3f7c8c661a17f544b09c17bde062ecb /src/lib/ecore_wl2/ecore_wl2_input.c
parentecore-wl2: Issue input grab/ungrab during pointer button events (diff)
downloadefl-c0e03359e59ef47efbb0529059b9456d9c24e1aa.tar.gz
ecore-wl2: Add code to send mouse wheel events
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_input.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index 6488d1b858..cf37855934 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -85,6 +85,44 @@ _ecore_wl2_input_mouse_move_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *windo
}
static void
+_ecore_wl2_input_mouse_wheel_send(Ecore_Wl2_Input *input, unsigned int axis, int value, unsigned int timestamp)
+{
+ Ecore_Event_Mouse_Wheel *ev;
+
+ ev = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
+ if (!ev) return;
+
+ ev->timestamp = timestamp;
+ ev->modifiers = input->keyboard.modifiers;
+ ev->x = input->pointer.sx;
+ ev->y = input->pointer.sy;
+
+ if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
+ {
+ ev->direction = 0;
+ ev->z = value;
+ }
+ else if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
+ {
+ ev->direction = 1;
+ ev->z = value;
+ }
+
+ if (input->grab.window)
+ {
+ ev->window = input->grab.window->id;
+ ev->event_window = input->grab.window->id;
+ }
+ else if (input->focus.pointer)
+ {
+ ev->window = input->focus.pointer->id;
+ ev->event_window = input->focus.pointer->id;
+ }
+
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
+}
+
+static void
_ecore_wl2_input_grab(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, unsigned int button)
{
input->grab.window = window;
@@ -225,7 +263,8 @@ _pointer_cb_axis(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned in
input = data;
if (!input) return;
- /* TODO: send mouse wheel event */
+ _ecore_wl2_input_mouse_wheel_send(input, axis, wl_fixed_to_int(value),
+ timestamp);
}
static const struct wl_pointer_listener _pointer_listener =