PUI: add manual render set/get APIs and move ani get/set/update APIs to PUI from...
[platform/core/uifw/libpui.git] / src / PUI_internal.h
1 /*
2  * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial
14  * portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25
26 #ifndef _LIBPUI_INTERNAL_H_
27 #define _LIBPUI_INTERNAL_H_
28
29 #define EFL_BETA_API_SUPPORT
30
31 #include <stdint.h>
32 #include <Ecore_Wl2.h>
33 #include <Eina.h>
34 #include <wayland-tbm-client.h>
35 #include <tbm_surface_internal.h>
36 #include "PUI_common.h"
37
38 #ifndef PATH_MAX
39 #define PATH_MAX 4096
40 #endif
41
42 struct _pui_ani
43 {
44         pui_h pui_handle;
45         pui_ani_t *ani;
46
47         Eina_Array *ecore_event_hdls;
48         Ecore_Wl2_Frame_Cb_Handle *frame_done_cb;
49
50         pui_id id;
51 };
52
53 struct _pui_ani_t
54 {
55         pui_ani_h ani_h;
56
57         pui_id id;
58         pui_ani_cmd cmd;
59         int repeat;
60         pui_ani_status status;
61
62         int serial;
63         pui_ani_control_buffer *buffer;
64
65         Eina_Bool (*frame_cb)(void *data);
66         pui_bool (*backend_frame_cb)(void *data, int serial);
67         void *frame_cb_data;
68         double frame_interval;
69         Ecore_Timer *frame_cb_timer;
70
71         pui_backend_ani_data *ani_data;
72 };
73
74 struct _pui
75 {
76         Ecore_Wl2_Window *win;
77         Ecore_Wl2_Display *ewd;
78         int visibility;
79
80         struct wayland_tbm_client *wl_tbm_client;
81         tbm_surface_queue_h tbm_queue;
82
83         pui_ani_h current_ani_h;
84         tbm_surface_info_s current_sinfo;
85         tbm_surface_h current_surface;
86         int is_buffer_set;
87         pui_bool manual_render;
88
89         Eina_List *ani_handles;
90
91         pui_backend_module_data *backend_module_data;
92 };
93
94 struct _pui_module_data
95 {
96         void *module_info;
97         pui_backend_module *backend_module_info;
98         pui_backend_module_data *backend_module_data;
99 };
100
101 #ifdef __cplusplus
102 extern "C" {
103 #endif
104
105 pui_ani_control_buffer *
106 pui_ani_get_buffer(pui_ani_h ani_h);
107
108 pui_int_error
109 pui_ani_set_buffer(pui_ani_h ani_h, pui_ani_control_buffer *buffer);
110
111 pui_int_error
112 pui_ani_update(pui_ani_h ani_h);
113
114 pui_bool
115 pui_ani_add_frame_cb(pui_ani_t *ani, pui_bool (*frame_cb)(void *data, int serial), double frame_interval);
116
117 void
118 pui_ani_remove_frame_cb(pui_ani_t *ani);
119
120 void
121 pui_ani_status_update(pui_ani_t *ani, pui_ani_status status);
122
123 pui_ani_status
124 pui_ani_status_get(pui_ani_t *ani);
125
126 pui_backend_ani_data *
127 pui_ani_get_ani_data(pui_ani_t *ani);
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif//_LIBPUI_INTERNAL_H_