keyrouter: Fix wrong return value
[platform/core/uifw/libds-tizen.git] / src / libds / touch.c
1 #include <stdlib.h>
2 #include <wayland-server.h>
3 #include "libds/interfaces/touch.h"
4
5 void
6 ds_touch_init(struct ds_touch *touch,
7         const struct ds_touch_interface *iface)
8 {
9     touch->iface = iface;
10
11     wl_signal_init(&touch->events.down);
12     wl_signal_init(&touch->events.up);
13     wl_signal_init(&touch->events.motion);
14     wl_signal_init(&touch->events.frame);
15 }
16
17 void
18 ds_touch_destroy(struct ds_touch *touch)
19 {
20     if (!touch)
21         return;
22
23     if (touch->iface && touch->iface->destroy)
24         touch->iface->destroy(touch);
25     else
26         free(touch);
27 }
28
29 WL_EXPORT void
30 ds_touch_add_down_listener(struct ds_touch *touch,
31         struct wl_listener *listener)
32 {
33     wl_signal_add(&touch->events.down, listener);
34 }
35
36 WL_EXPORT void
37 ds_touch_add_up_listener(struct ds_touch *touch,
38         struct wl_listener *listener)
39 {
40     wl_signal_add(&touch->events.up, listener);
41 }
42
43 WL_EXPORT void
44 ds_touch_add_motion_listener(struct ds_touch *touch,
45         struct wl_listener *listener)
46 {
47     wl_signal_add(&touch->events.motion, listener);
48 }
49
50 WL_EXPORT void
51 ds_touch_add_frame_listener(struct ds_touch *touch,
52         struct wl_listener *listener)
53 {
54     wl_signal_add(&touch->events.frame, listener);
55 }