1 /* This header is not to be installed and should only be used by EFL internals */
2 #ifndef _EVAS_INTERNAL_H
3 #define _EVAS_INTERNAL_H
4 
5 #ifdef EAPI
6 # undef EAPI
7 #endif
8 
9 #ifdef _WIN32
10 # ifdef EFL_BUILD
11 #  ifdef DLL_EXPORT
12 #   define EAPI __declspec(dllexport)
13 #  else
14 #   define EAPI
15 #  endif
16 # else
17 #  define EAPI __declspec(dllimport)
18 # endif
19 #else
20 # ifdef __GNUC__
21 #  if __GNUC__ >= 4
22 #   define EAPI __attribute__ ((visibility("default")))
23 #  else
24 #   define EAPI
25 #  endif
26 # else
27 #  define EAPI
28 # endif
29 #endif
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #ifndef EFL_INTERNAL_UNSTABLE
36 # error This file can not be included outside EFL
37 #endif
38 
39 #include <Efl.h>
40 
41 typedef struct _Evas_Object_Pointer_Data Evas_Object_Pointer_Data;
42 
43 EOAPI const Eina_List *efl_input_device_children_get(const Eo *obj);
44 
45 EOAPI void efl_input_device_evas_set(Eo *obj, Evas *e);
46 EOAPI Evas *efl_input_device_evas_get(const Eo *obj);
47 
48 EOAPI void efl_input_device_subclass_set(Eo *obj, Evas_Device_Subclass sub_clas);
49 EOAPI Evas_Device_Subclass efl_input_device_subclass_get(const Eo *obj);
50 
51 EOAPI void efl_input_device_grab_register(Eo *obj, Efl_Canvas_Object *grab, Evas_Object_Pointer_Data *pdata);
52 EOAPI void efl_input_device_grab_unregister(Eo *obj, Efl_Canvas_Object *grab, Evas_Object_Pointer_Data *pdata);
53 
54 typedef struct _Efl_Input_Pointer_Data  Efl_Input_Pointer_Data;
55 typedef struct _Efl_Input_Key_Data      Efl_Input_Key_Data;
56 typedef struct _Efl_Input_Hold_Data     Efl_Input_Hold_Data;
57 typedef struct _Efl_Input_Focus_Data    Efl_Input_Focus_Data;
58 
59 #ifndef _EVAS_TYPES_EOT_H_
60 typedef struct _Evas_Modifier Evas_Modifier;
61 typedef struct _Evas_Lock Evas_Lock;
62 #endif
63 
64 struct _Efl_Input_Pointer_Data
65 {
66    Eo             *eo;
67    unsigned int    timestamp; /* FIXME: store as double? */
68    int             button;
69    unsigned int    pressed_buttons;
70    int             touch_id; /* finger or tool ID */
71    double          radius, radius_x, radius_y;
72    double          pressure, distance, azimuth, tilt, twist;
73    double          angle;
74    /* current, previous positions in window coordinates.
75     * raw can be either un-smoothed, un-predicted x,y or a tablet's raw input.
76     * norm is the normalized value in [0..1] for tablet input.
77     */
78    Eina_Vector2    cur, prev, raw, norm;
79    struct {
80       int          z;
81       Eina_Bool    horizontal;
82    } wheel;
83    Efl_Gfx_Entity                    *source; /* could it be ecore? */
84    Efl_Input_Device           *device;
85    Efl_Pointer_Action          action;
86    Efl_Pointer_Flags           button_flags;
87    Efl_Input_Flags             event_flags;
88    void                       *data; /* evas data - whatever that is */
89    Eina_Bool                   window_pos; /* true if positions are window-relative
90                                               (see input vs. feed: this is "input") */
91    Evas_Modifier              *modifiers;
92    Evas_Lock                  *locks;
93    void                       *legacy; /* DO NOT TOUCH THIS */
94    uint32_t                    value_flags;
95    Eina_Bool                   has_norm : 1; /* not in value_flags */
96    Eina_Bool                   has_raw : 1; /* not in value_flags */
97    Eina_Bool                   evas_done : 1; /* set by evas */
98    Eina_Bool                   fake : 1;
99    Eina_Bool                   win_fed : 1;
100 };
101 
102 struct _Efl_Input_Key_Data
103 {
104    Eo                *eo;
105    unsigned int       timestamp; /* FIXME: store as double? */
106 
107    Eina_Bool          pressed; /* 1 = pressed/down, 0 = released/up */
108    Eina_Stringshare  *keyname;
109    Eina_Stringshare  *key;
110    Eina_Stringshare  *string;
111    Eina_Stringshare  *compose;
112    unsigned int       keycode;
113 
114    void              *data;
115    Evas_Modifier     *modifiers;
116    Evas_Lock         *locks;
117    Efl_Input_Flags    event_flags;
118    Efl_Input_Device  *device;
119    void              *legacy; /* DO NOT TOUCH THIS */
120    Eina_Bool          evas_done : 1; /* set by evas */
121    Eina_Bool          fake : 1;
122    Eina_Bool          win_fed : 1;
123    Eina_Bool          no_stringshare : 1;
124 };
125 
126 struct _Efl_Input_Hold_Data
127 {
128    Eo               *eo;
129    double            timestamp;
130    Efl_Input_Flags   event_flags;
131    Efl_Input_Device *device;
132    void             *data;
133    void             *legacy; /* DO NOT TOUCH THIS */
134    Eina_Bool         hold : 1;
135    Eina_Bool         evas_done : 1; /* set by evas */
136 };
137 
138 struct _Efl_Input_Focus_Data
139 {
140    Eo *eo;
141    Efl_Input_Device *device; //The seat
142    Eo *object_wref; // wref on the focused object - Efl.Canvas.Object or Efl.Canvas.
143    double timestamp;
144    Efl_Input_Flags   event_flags;
145 };
146 
147 /* Internal helpers */
148 
149 static inline const char *
_efl_input_modifier_to_string(Efl_Input_Modifier mod)150 _efl_input_modifier_to_string(Efl_Input_Modifier mod)
151 {
152    switch (mod)
153      {
154       default:
155       case EFL_INPUT_MODIFIER_NONE:    return NULL;
156       case EFL_INPUT_MODIFIER_ALT:     return "Alt";
157       case EFL_INPUT_MODIFIER_CONTROL: return "Control";
158       case EFL_INPUT_MODIFIER_SHIFT:   return "Shift";
159       case EFL_INPUT_MODIFIER_META:    return "Meta";
160       case EFL_INPUT_MODIFIER_ALTGR:   return "AltGr";
161       case EFL_INPUT_MODIFIER_HYPER:   return "Hyper";
162       case EFL_INPUT_MODIFIER_SUPER:   return "Super";
163      }
164 }
165 
166 static inline const char *
_efl_input_lock_to_string(Efl_Input_Lock lock)167 _efl_input_lock_to_string(Efl_Input_Lock lock)
168 {
169    switch (lock)
170      {
171       default:
172       case EFL_INPUT_LOCK_NONE:    return NULL;
173       case EFL_INPUT_LOCK_NUM:     return "Num";
174       case EFL_INPUT_LOCK_CAPS:    return "Caps";
175       case EFL_INPUT_LOCK_SCROLL:  return "Scroll";
176       case EFL_INPUT_LOCK_SHIFT:   return "Shift";
177      }
178 }
179 
180 static inline Eina_Bool
_efl_input_value_has(const Efl_Input_Pointer_Data * pd,Efl_Input_Value key)181 _efl_input_value_has(const Efl_Input_Pointer_Data *pd, Efl_Input_Value key)
182 {
183    return (pd->value_flags & (1u << (int) key)) != 0;
184 }
185 
186 static inline void
_efl_input_value_mark(Efl_Input_Pointer_Data * pd,Efl_Input_Value key)187 _efl_input_value_mark(Efl_Input_Pointer_Data *pd, Efl_Input_Value key)
188 {
189    pd->value_flags |= (1u << (int) key);
190 }
191 
192 #define _efl_input_value_mask(key) (1u << (int) key)
193 
194 typedef struct _Efl_Canvas_Output Efl_Canvas_Output;
195 
196 EAPI Efl_Canvas_Output *efl_canvas_output_add(Evas *canvas);
197 EAPI void efl_canvas_output_del(Efl_Canvas_Output *output);
198 EAPI void efl_canvas_output_view_set(Efl_Canvas_Output *output,
199                                      Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
200 EAPI void efl_canvas_output_view_get(Efl_Canvas_Output *output,
201                                      Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
202 EAPI Eina_Bool efl_canvas_output_engine_info_set(Efl_Canvas_Output *output,
203                                                  Evas_Engine_Info *info);
204 EAPI Evas_Engine_Info *efl_canvas_output_engine_info_get(Efl_Canvas_Output *output);
205 EAPI Eina_Bool efl_canvas_output_lock(Efl_Canvas_Output *output);
206 EAPI Eina_Bool efl_canvas_output_unlock(Efl_Canvas_Output *output);
207 
208 EAPI void evas_render_pending_objects_flush(Evas *eo_evas);
209 
210 EAPI void efl_input_pointer_finalize(Efl_Input_Pointer *obj);
211 
212 EAPI Eina_Iterator *efl_canvas_iterator_create(Eo *obj, Eina_Iterator *real_iterator, Eina_List *list);
213 
214 static inline void
evas_object_size_hint_combined_min_get(const Eo * obj,int * w,int * h)215 evas_object_size_hint_combined_min_get(const Eo *obj, int *w, int *h)
216 {
217    Eina_Size2D sz;
218    sz = efl_gfx_hint_size_combined_min_get(obj);
219    if (w) *w = sz.w;
220    if (h) *h = sz.h;
221 }
222 
223 static inline void
evas_object_size_hint_combined_max_get(const Eo * obj,int * w,int * h)224 evas_object_size_hint_combined_max_get(const Eo *obj, int *w, int *h)
225 {
226    Eina_Size2D sz;
227    sz = efl_gfx_hint_size_combined_max_get(obj);
228    if (w) *w = sz.w;
229    if (h) *h = sz.h;
230 }
231 
232 /* Internal EO APIs */
233 EAPI Eo *evas_find(const Eo *obj);
234 EOAPI void efl_canvas_object_legacy_ctor(Eo *obj);
235 EOAPI void efl_canvas_object_type_set(Eo *obj, const char *type);
236 EOAPI void efl_canvas_group_add(Eo *obj);
237 EOAPI void efl_canvas_group_del(Eo *obj);
238 EOAPI void efl_canvas_group_clipped_set(Eo *obj, Eina_Bool unclipped);
239 EOAPI void evas_canvas_touch_point_list_nth_xy_get(Eo *obj, unsigned int n, double *x, double *y);
240 EOAPI void evas_canvas_seat_focus_in(Eo *obj, Efl_Input_Device *seat);
241 EOAPI void evas_canvas_seat_focus_out(Eo *obj, Efl_Input_Device *seat);
242 EOAPI Eo* evas_canvas_seat_focus_get(const Eo *obj, Efl_Input_Device *seat);
243 
244 EOAPI void *efl_input_legacy_info_get(const Eo *obj);
245 
246 EOAPI Eo *efl_input_focus_instance_get(Efl_Object *owner, void **priv);
247 EOAPI Eo *efl_input_hold_instance_get(Efl_Object *owner, void **priv);
248 EOAPI Eo *efl_input_key_instance_get(Efl_Object *owner, void **priv);
249 EOAPI Eo *efl_input_pointer_instance_get(Efl_Object *owner, void **priv);
250 /**
251  * @brief If @c true the object belongs to the window border decorations.
252  *
253  * This will be @c false by default, and should be @c false for all objects
254  * created by the application, unless swallowed in some very specific parts of
255  * the window.
256  *
257  * It is very unlikely that an application needs to call this manually, as the
258  * window will handle this feature automatically.
259  *
260  * @param[in] obj The object.
261  * @param[in] is_frame @c true if the object is a frame, @c false otherwise
262  *
263  * @since 1.2
264  *
265  * @ingroup Efl_Canvas_Object
266  */
267 EOAPI void efl_canvas_object_is_frame_object_set(Eo *obj, Eina_Bool is_frame);
268 
269 /**
270  * @brief If @c true the object belongs to the window border decorations.
271  *
272  * This will be @c false by default, and should be @c false for all objects
273  * created by the application, unless swallowed in some very specific parts of
274  * the window.
275  *
276  * It is very unlikely that an application needs to call this manually, as the
277  * window will handle this feature automatically.
278  *
279  * @param[in] obj The object.
280  *
281  * @return @c true if the object is a frame, @c false otherwise
282  *
283  * @since 1.2
284  *
285  * @ingroup Efl_Canvas_Object
286  */
287 EOAPI Eina_Bool efl_canvas_object_is_frame_object_get(const Eo *obj);
288 
289 EWAPI extern const Efl_Event_Description _EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE;
290 #define EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE (&(_EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE))
291 
292 EWAPI extern const Efl_Event_Description _EVAS_CANVAS_EVENT_RENDER_FLUSH_POST;
293 #define EVAS_CANVAS_EVENT_RENDER_FLUSH_POST (&(_EVAS_CANVAS_EVENT_RENDER_FLUSH_POST))
294 
295 EWAPI extern const Efl_Event_Description _EVAS_CANVAS_EVENT_AXIS_UPDATE;
296 #define EVAS_CANVAS_EVENT_AXIS_UPDATE (&(_EVAS_CANVAS_EVENT_AXIS_UPDATE))
297 
298 EWAPI extern const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE;
299 #define EVAS_CANVAS_EVENT_VIEWPORT_RESIZE (&(_EVAS_CANVAS_EVENT_VIEWPORT_RESIZE))
300 
301 #define EFL_CANVAS_GROUP_DEL_OPS(kls) EFL_OBJECT_OP_FUNC(efl_canvas_group_del, _##kls##_efl_canvas_group_group_del)
302 #define EFL_CANVAS_GROUP_ADD_OPS(kls) EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _##kls##_efl_canvas_group_group_add)
303 #define EFL_CANVAS_GROUP_ADD_DEL_OPS(kls) EFL_CANVAS_GROUP_ADD_OPS(kls), EFL_CANVAS_GROUP_DEL_OPS(kls)
304 
305 /* Efl.Animation.Player */
306 EWAPI extern const Efl_Event_Description _EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED;
307 #define EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED (&(_EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED))
308 /* Efl.Animation.Player END */
309 
310 
311 
312 /*TextBlock Internal function*/
313 /**
314  * Check if cursor is at cluster with one glyph (replace codepoints with new codepoint).
315  *
316  * @param cur the cursor.
317  * @param forward if Eina_True check cluster after cusror position, else before cursor position.
318  */
319 EAPI Eina_Bool evas_textblock_cursor_at_cluster_as_single_glyph(Evas_Textblock_Cursor *cur,Eina_Bool forward);
320 
321 
322 
323 
324 /*Attribute Factory Internal function*/
325 EAPI const char * efl_text_formatter_attribute_get(Efl_Text_Attribute_Handle *annotation);
326 EAPI Eina_Iterator * efl_text_formatter_range_attributes_get(const Efl_Text_Cursor_Object *start, const Efl_Text_Cursor_Object *end);
327 EAPI void efl_text_formatter_attribute_cursors_get(const Efl_Text_Attribute_Handle *handle, Efl_Text_Cursor_Object *start, Efl_Text_Cursor_Object *end);
328 EAPI void efl_text_formatter_remove(Efl_Text_Attribute_Handle *annotation);
329 EAPI Eina_Bool efl_text_formatter_attribute_is_item(Efl_Text_Attribute_Handle *annotation);
330 EAPI Eina_Bool efl_text_formatter_item_geometry_get(const Efl_Text_Attribute_Handle *annotation, int *x, int *y, int *w, int *h);
331 
332 #ifdef __cplusplus
333 }
334 #endif
335 
336 #undef EAPI
337 #define EAPI
338 
339 #endif
340