summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_event_hold.c
blob: 700d486834f6d50283d4212a30e5cbd75b7c3c31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#define EFL_EVENT_PROTECTED

#include <Evas.h>

#define EFL_INTERNAL_UNSTABLE
#include "interfaces/efl_common_internal.h"

#define MY_CLASS EFL_EVENT_HOLD_CLASS

EOLIAN static void
_efl_event_hold_hold_set(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd, Eina_Bool val)
{
   pd->hold = !!val;
}

EOLIAN static Eina_Bool
_efl_event_hold_hold_get(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd)
{
   return pd->hold;
}

EOLIAN static void
_efl_event_hold_efl_event_input_device_set(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd, Efl_Input_Device *dev)
{
   pd->device = dev;
}

EOLIAN static Efl_Input_Device *
_efl_event_hold_efl_event_input_device_get(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd)
{
   return pd->device;
}

EOLIAN static double
_efl_event_hold_efl_event_timestamp_get(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd)
{
   return pd->timestamp;
}

EOLIAN static void
_efl_event_hold_efl_event_timestamp_set(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd, double ms)
{
   pd->timestamp = ms;
}

EOLIAN static void
_efl_event_hold_efl_event_input_event_flags_set(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd EINA_UNUSED, Efl_Event_Flags flags EINA_UNUSED)
{
   // ignore
}

EOLIAN static Efl_Event_Flags
_efl_event_hold_efl_event_input_event_flags_get(Eo *obj EINA_UNUSED, Efl_Event_Hold_Data *pd EINA_UNUSED)
{
   // ignore
   return 0;
}

EOLIAN static Eo *
_efl_event_hold_eo_base_constructor(Eo *obj, Efl_Event_Hold_Data *pd)
{
   obj = eo_constructor(eo_super(obj, MY_CLASS));
   pd->eo = obj;
   return obj;
}

EOLIAN static Efl_Event *
_efl_event_hold_efl_event_instance_get(Eo *klass EINA_UNUSED, void *_pd EINA_UNUSED,
                                       Eo_Base *owner, void **priv)
{
   // TODO: Implement a cache. Depends only on how many hold events we trigger.
   Efl_Event *evt = eo_add(MY_CLASS, owner);
   if (priv) *priv = eo_data_scope_get(evt, MY_CLASS);
   return evt;
}

EOLIAN static void
_efl_event_hold_efl_event_reset(Eo *obj, Efl_Event_Hold_Data *pd)
{
   memset(pd, 0, sizeof(*pd));
   pd->eo = obj;
}

EOLIAN static Efl_Event *
_efl_event_hold_efl_event_dup(Eo *obj, Efl_Event_Hold_Data *pd)
{
   Efl_Event_Hold_Data *ev;
   Efl_Event *evt = eo_add(EFL_EVENT_HOLD_CLASS, eo_parent_get(obj));
   ev = eo_data_scope_get(evt, MY_CLASS);
   if (ev)
     {
        memcpy(ev, pd, sizeof(*ev));
        ev->eo = evt;
     }
   return evt;
}

#include "efl_event_hold.eo.c"