blob: 8287e93fdb049d0bc4ef1d709de26757b9d682db [file] [log] [blame]
Nobuhiko Tanibata6f9df652014-11-27 13:22:00 +09001/*
2 * Copyright (C) 2014 DENSO CORPORATION
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the copyright holders not be used in
9 * advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. The copyright holders make
11 * no representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 */
22
23#ifndef _ivi_layout_PRIVATE_H_
24#define _ivi_layout_PRIVATE_H_
25
26#include "compositor.h"
27#include "ivi-layout-export.h"
28
29struct ivi_layout_surface {
30 struct wl_list link;
31 struct wl_signal property_changed;
32 struct wl_list layer_list;
33 int32_t update_count;
34 uint32_t id_surface;
35
36 struct ivi_layout *layout;
37 struct weston_surface *surface;
38
39 struct wl_listener surface_destroy_listener;
40 struct weston_transform surface_rotation;
41 struct weston_transform layer_rotation;
42 struct weston_transform surface_pos;
43 struct weston_transform layer_pos;
44 struct weston_transform scaling;
45
46 struct ivi_layout_surface_properties prop;
47 uint32_t event_mask;
48
49 struct {
50 struct ivi_layout_surface_properties prop;
51 struct wl_list link;
52 } pending;
53
54 struct {
55 struct wl_list link;
56 struct wl_list layer_list;
57 } order;
58
59 struct {
60 ivi_controller_surface_content_callback callback;
61 void *userdata;
62 } content_observer;
63
64 struct wl_signal configured;
65};
66
67struct ivi_layout_layer {
68 struct wl_list link;
69 struct wl_signal property_changed;
70 struct wl_list screen_list;
71 struct wl_list link_to_surface;
72 uint32_t id_layer;
73
74 struct ivi_layout *layout;
75
76 struct ivi_layout_layer_properties prop;
77 uint32_t event_mask;
78
79 struct {
80 struct ivi_layout_layer_properties prop;
81 struct wl_list surface_list;
82 struct wl_list link;
83 } pending;
84
85 struct {
86 struct wl_list surface_list;
87 struct wl_list link;
88 } order;
89};
90
91struct ivi_layout {
92 struct weston_compositor *compositor;
93
94 struct wl_list surface_list;
95 struct wl_list layer_list;
96 struct wl_list screen_list;
97
98 struct {
99 struct wl_signal created;
100 struct wl_signal removed;
101 } layer_notification;
102
103 struct {
104 struct wl_signal created;
105 struct wl_signal removed;
106 struct wl_signal configure_changed;
107 } surface_notification;
108
109 struct weston_layer layout_layer;
110 struct wl_signal warning_signal;
111
112 struct ivi_layout_transition_set *transitions;
113 struct wl_list pending_transition_list;
114};
115
116struct ivi_layout *get_instance(void);
117
118struct ivi_layout_transition;
119
120struct ivi_layout_transition_set {
121 struct wl_event_source *event_source;
122 struct wl_list transition_list;
123};
124
125typedef void (*ivi_layout_transition_destroy_user_func)(void *user_data);
126
127struct ivi_layout_transition_set *
128ivi_layout_transition_set_create(struct weston_compositor *ec);
129
130void
131ivi_layout_transition_move_resize_view(struct ivi_layout_surface *surface,
132 int32_t dest_x, int32_t dest_y,
133 int32_t dest_width, int32_t dest_height,
134 uint32_t duration);
135
136void
137ivi_layout_transition_visibility_on(struct ivi_layout_surface *surface,
138 uint32_t duration);
139
140void
141ivi_layout_transition_visibility_off(struct ivi_layout_surface *surface,
142 uint32_t duration);
143
144
145void
146ivi_layout_transition_move_layer(struct ivi_layout_layer *layer,
147 int32_t dest_x, int32_t dest_y,
148 uint32_t duration);
149
150void
151ivi_layout_transition_fade_layer(struct ivi_layout_layer *layer,
152 uint32_t is_fade_in,
153 double start_alpha, double end_alpha,
154 void *user_data,
155 ivi_layout_transition_destroy_user_func destroy_func,
156 uint32_t duration);
157
158int32_t
159is_surface_transition(struct ivi_layout_surface *surface);
160
161/**
162 * \brief get ivi_layout_layer from id of layer
163 *
164 * \return (struct ivi_layout_layer *)
165 * if the method call was successful
166 * \return NULL if the method call was failed
167 */
168struct ivi_layout_layer *
169ivi_layout_get_layer_from_id(uint32_t id_layer);
170
171/**
172 * \brief Remove a surface
173 */
174void
175ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf);
176
177/**
178 * \brief Get all Layers of the given screen
179 *
180 * \return IVI_SUCCEEDED if the method call was successful
181 * \return IVI_FAILED if the method call was failed
182 */
183int32_t
184ivi_layout_get_layers_on_screen(struct ivi_layout_screen *iviscrn,
185 int32_t *pLength,
186 struct ivi_layout_layer ***ppArray);
187
188/**
189 * \brief Get all Surfaces which are currently registered to a given
190 * layer and are managed by the services
191 *
192 * \return IVI_SUCCEEDED if the method call was successful
193 * \return IVI_FAILED if the method call was failed
194 */
195int32_t
196ivi_layout_get_surfaces_on_layer(struct ivi_layout_layer *ivilayer,
197 int32_t *pLength,
198 struct ivi_layout_surface ***ppArray);
199
200/**
201 * \brief Get the visibility of a layer. If a layer is not visible,
202 * the layer and its surfaces will not be rendered.
203 *
204 * \return true if layer is visible
205 * \return false if layer is invisible or the method call was failed
206 */
207bool
208ivi_layout_layer_get_visibility(struct ivi_layout_layer *ivilayer);
209
210/**
211 * \brief Get the horizontal and vertical dimension of the layer.
212 *
213 * \return IVI_SUCCEEDED if the method call was successful
214 * \return IVI_FAILED if the method call was failed
215 */
216int32_t
217ivi_layout_layer_get_dimension(struct ivi_layout_layer *ivilayer,
218 int32_t *dest_width, int32_t *dest_height);
219
220/**
221 * \brief Set the horizontal and vertical dimension of the layer.
222 *
223 * \return IVI_SUCCEEDED if the method call was successful
224 * \return IVI_FAILED if the method call was failed
225 */
226int32_t
227ivi_layout_layer_set_dimension(struct ivi_layout_layer *ivilayer,
228 int32_t dest_width, int32_t dest_height);
229
230/**
231 * \brief Gets the orientation of a layer.
232 *
233 * \return (enum wl_output_transform)
234 * if the method call was successful
235 * \return WL_OUTPUT_TRANSFORM_NORMAL if the method call was failed
236 */
237enum wl_output_transform
238ivi_layout_layer_get_orientation(struct ivi_layout_layer *ivilayer);
239
240/**
241 * \brief Set the horizontal and vertical dimension of the surface.
242 *
243 * \return IVI_SUCCEEDED if the method call was successful
244 * \return IVI_FAILED if the method call was failed
245 */
246int32_t
247ivi_layout_surface_set_dimension(struct ivi_layout_surface *ivisurf,
248 int32_t dest_width, int32_t dest_height);
249
250/**
251 * \brief Get the horizontal and vertical dimension of the surface.
252 *
253 * \return IVI_SUCCEEDED if the method call was successful
254 * \return IVI_FAILED if the method call was failed
255 */
256int32_t
257ivi_layout_surface_get_dimension(struct ivi_layout_surface *ivisurf,
258 int32_t *dest_width, int32_t *dest_height);
259
260/**
261 * \brief Sets the horizontal and vertical position of the surface.
262 *
263 * \return IVI_SUCCEEDED if the method call was successful
264 * \return IVI_FAILED if the method call was failed
265 */
266int32_t
267ivi_layout_surface_set_position(struct ivi_layout_surface *ivisurf,
268 int32_t dest_x, int32_t dest_y);
269
270/**
271 * \brief Get the horizontal and vertical position of the surface.
272 *
273 * \return IVI_SUCCEEDED if the method call was successful
274 * \return IVI_FAILED if the method call was failed
275 */
276int32_t
277ivi_layout_surface_get_position(struct ivi_layout_surface *ivisurf,
278 int32_t *dest_x, int32_t *dest_y);
279
280/**
281 * \brief Gets the orientation of a surface.
282 *
283 * \return (enum wl_output_transform)
284 * if the method call was successful
285 * \return WL_OUTPUT_TRANSFORM_NORMAL if the method call was failed
286 */
287enum wl_output_transform
288ivi_layout_surface_get_orientation(struct ivi_layout_surface *ivisurf);
289
290int32_t
291ivi_layout_surface_set_transition_duration(
292 struct ivi_layout_surface *ivisurf,
293 uint32_t duration);
294
295struct ivi_layout_interface {
296 struct weston_view *(*get_weston_view)(
297 struct ivi_layout_surface *surface);
298
299 void (*surface_configure)(struct ivi_layout_surface *ivisurf,
300 int32_t width,
301 int32_t height);
302
303 struct ivi_layout_surface *(*surface_create)(
304 struct weston_surface *wl_surface,
305 uint32_t id_surface);
306
307 void (*init_with_compositor)(struct weston_compositor *ec);
308
309 int32_t (*get_surface_dimension)(
310 struct ivi_layout_surface *ivisurf,
311 int32_t *dest_width,
312 int32_t *dest_height);
313
314 void (*add_surface_configured_listener)(
315 struct ivi_layout_surface *ivisurf,
316 struct wl_listener* listener);
317};
318
319#endif