• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 DENSO CORPORATION
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 _ivi_layout_PRIVATE_H_
27 #define _ivi_layout_PRIVATE_H_
28 
29 #include <stdint.h>
30 
31 #include <libweston/libweston.h>
32 #include "ivi-layout-export.h"
33 #include <libweston-desktop/libweston-desktop.h>
34 
35 struct ivi_layout_view {
36 	struct wl_list link;	/* ivi_layout::view_list */
37 	struct wl_list surf_link;	/*ivi_layout_surface::view_list */
38 	struct wl_list pending_link;	/* ivi_layout_layer::pending.view_list */
39 	struct wl_list order_link;	/* ivi_layout_layer::order.view_list */
40 
41 	struct weston_view *view;
42 	struct weston_transform transform;
43 
44 	struct ivi_layout_surface *ivisurf;
45 	struct ivi_layout_layer *on_layer;
46 };
47 
48 struct ivi_layout_surface {
49 	struct wl_list link;	/* ivi_layout::surface_list */
50 	struct wl_signal property_changed;
51 	int32_t update_count;
52 	uint32_t id_surface;
53 
54 	struct ivi_layout *layout;
55 	struct weston_surface *surface;
56 	struct weston_desktop_surface *weston_desktop_surface;
57 
58 	struct ivi_layout_surface_properties prop;
59 
60 	struct {
61 		struct ivi_layout_surface_properties prop;
62 	} pending;
63 
64 	struct wl_list view_list;	/* ivi_layout_view::surf_link */
65 };
66 
67 struct ivi_layout_layer {
68 	struct wl_list link;	/* ivi_layout::layer_list */
69 	struct wl_signal property_changed;
70 	uint32_t id_layer;
71 
72 	struct ivi_layout *layout;
73 	struct ivi_layout_screen *on_screen;
74 
75 	struct ivi_layout_layer_properties prop;
76 
77 	struct {
78 		struct ivi_layout_layer_properties prop;
79 		struct wl_list view_list;	/* ivi_layout_view::pending_link */
80 		struct wl_list link;	/* ivi_layout_screen::pending.layer_list */
81 	} pending;
82 
83 	struct {
84 		int dirty;
85 		struct wl_list view_list;	/* ivi_layout_view::order_link */
86 		struct wl_list link;	/* ivi_layout_screen::order.layer_list */
87 	} order;
88 
89 	int32_t ref_count;
90 };
91 
92 struct ivi_layout {
93 	struct weston_compositor *compositor;
94 
95 	struct wl_list surface_list;	/* ivi_layout_surface::link */
96 	struct wl_list layer_list;	/* ivi_layout_layer::link */
97 	struct wl_list screen_list;	/* ivi_layout_screen::link */
98 	struct wl_list view_list;	/* ivi_layout_view::link */
99 
100 	struct {
101 		struct wl_signal created;
102 		struct wl_signal removed;
103 	} layer_notification;
104 
105 	struct {
106 		struct wl_signal created;
107 		struct wl_signal removed;
108 		struct wl_signal configure_changed;
109 		struct wl_signal configure_desktop_changed;
110 	} surface_notification;
111 
112 	struct weston_layer layout_layer;
113 
114 	struct ivi_layout_transition_set *transitions;
115 	struct wl_list pending_transition_list;	/* transition_node::link */
116 
117 	struct {
118 		struct wl_listener created;
119 		struct wl_listener destroyed;
120 	} output_listener;
121 };
122 
123 struct ivi_layout *get_instance(void);
124 
125 struct ivi_layout_transition;
126 
127 struct ivi_layout_transition_set {
128 	struct wl_event_source  *event_source;
129 	struct wl_list          transition_list;
130 };
131 
132 typedef void (*ivi_layout_transition_destroy_user_func)(void *user_data);
133 
134 struct ivi_layout_transition_set *
135 ivi_layout_transition_set_create(struct weston_compositor *ec);
136 
137 void
138 ivi_layout_transition_move_resize_view(struct ivi_layout_surface *surface,
139 				       int32_t dest_x, int32_t dest_y,
140 				       int32_t dest_width, int32_t dest_height,
141 				       uint32_t duration);
142 
143 void
144 ivi_layout_transition_visibility_on(struct ivi_layout_surface *surface,
145 				    uint32_t duration);
146 
147 void
148 ivi_layout_transition_visibility_off(struct ivi_layout_surface *surface,
149 				     uint32_t duration);
150 
151 
152 void
153 ivi_layout_transition_move_layer(struct ivi_layout_layer *layer,
154 				 int32_t dest_x, int32_t dest_y,
155 				 uint32_t duration);
156 
157 void
158 ivi_layout_transition_fade_layer(struct ivi_layout_layer *layer,
159 				 uint32_t is_fade_in,
160 				 double start_alpha, double end_alpha,
161 				 void *user_data,
162 				 ivi_layout_transition_destroy_user_func destroy_func,
163 				 uint32_t duration);
164 
165 int32_t
166 is_surface_transition(struct ivi_layout_surface *surface);
167 
168 void
169 ivi_layout_remove_all_surface_transitions(struct ivi_layout_surface *surface);
170 
171 /**
172  * methods of interaction between transition animation with ivi-layout
173  */
174 int32_t
175 ivi_layout_commit_changes(void);
176 uint32_t
177 ivi_layout_get_id_of_surface(struct ivi_layout_surface *ivisurf);
178 int32_t
179 ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
180 					     int32_t x, int32_t y,
181 					     int32_t width, int32_t height);
182 int32_t
183 ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
184 			       wl_fixed_t opacity);
185 int32_t
186 ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
187 				  bool newVisibility);
188 void
189 ivi_layout_surface_set_size(struct ivi_layout_surface *ivisurf,
190 			    int32_t width, int32_t height);
191 struct ivi_layout_surface *
192 ivi_layout_get_surface_from_id(uint32_t id_surface);
193 int32_t
194 ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
195 			     wl_fixed_t opacity);
196 int32_t
197 ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
198 				bool newVisibility);
199 int32_t
200 ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
201 					   int32_t x, int32_t y,
202 					   int32_t width, int32_t height);
203 int32_t
204 ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
205 				  struct ivi_layout_surface **pSurface,
206 				  int32_t number);
207 void
208 ivi_layout_transition_move_layer_cancel(struct ivi_layout_layer *layer);
209 
210 #endif
211