1 From fb20221f0c0068a4a75fe62f2873d9d3c5566e73 Mon Sep 17 00:00:00 2001
2 From: Manuel Bachmann <manuel.bachmann@iot.bzh>
3 Date: Wed, 13 Jan 2016 18:42:26 +0100
4 Subject: [PATCH] [PATCH] Backport IVI-Shell from Weston 1.9.0 to 1.8.0
6 IVI-Shell is the alternative Weston shell implementing the
7 eponymous protocol, and supported in client toolkits such
10 We backport only what is necessary, without modifying core
13 Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
15 ivi-shell/hmi-controller.c | 140 +++---
16 ivi-shell/input-panel-ivi.c | 41 +-
17 ivi-shell/ivi-layout-export.h | 58 ++-
18 ivi-shell/ivi-layout-private.h | 47 +-
19 ivi-shell/ivi-layout-transition.c | 39 +-
20 ivi-shell/ivi-layout.c | 983 +++++++++++++++++++-------------------
21 ivi-shell/ivi-shell.c | 91 ++--
22 ivi-shell/ivi-shell.h | 37 +-
23 8 files changed, 758 insertions(+), 678 deletions(-)
25 diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
26 index 88e9333..2f18217 100644
27 --- a/ivi-shell/hmi-controller.c
28 +++ b/ivi-shell/hmi-controller.c
31 * Copyright (C) 2014 DENSO CORPORATION
33 - * Permission to use, copy, modify, distribute, and sell this software and
34 - * its documentation for any purpose is hereby granted without fee, provided
35 - * that the above copyright notice appear in all copies and that both that
36 - * copyright notice and this permission notice appear in supporting
37 - * documentation, and that the name of the copyright holders not be used in
38 - * advertising or publicity pertaining to distribution of the software
39 - * without specific, written prior permission. The copyright holders make
40 - * no representations about the suitability of this software for any
41 - * purpose. It is provided "as is" without express or implied warranty.
42 + * Permission is hereby granted, free of charge, to any person obtaining
43 + * a copy of this software and associated documentation files (the
44 + * "Software"), to deal in the Software without restriction, including
45 + * without limitation the rights to use, copy, modify, merge, publish,
46 + * distribute, sublicense, and/or sell copies of the Software, and to
47 + * permit persons to whom the Software is furnished to do so, subject to
48 + * the following conditions:
50 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
51 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
52 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
53 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
54 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
55 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
56 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
57 + * The above copyright notice and this permission notice (including the
58 + * next paragraph) shall be included in all copies or substantial
59 + * portions of the Software.
61 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
62 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
63 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
64 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
65 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
66 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
67 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
72 @@ -721,27 +724,9 @@ hmi_controller_create(struct weston_compositor *ec)
73 ivi_controller_interface->layer_set_visibility(
74 hmi_ctrl->workspace_background_layer.ivilayer, false);
76 - /* init workspace ivi_layer */
77 - hmi_ctrl->workspace_layer.x = hmi_ctrl->workspace_background_layer.x;
78 - hmi_ctrl->workspace_layer.y = hmi_ctrl->workspace_background_layer.y;
79 - hmi_ctrl->workspace_layer.width =
80 - hmi_ctrl->workspace_background_layer.width;
81 - hmi_ctrl->workspace_layer.height =
82 - hmi_ctrl->workspace_background_layer.height;
83 - hmi_ctrl->workspace_layer.id_layer =
84 - hmi_ctrl->hmi_setting->workspace_layer_id;
86 - create_layer(iviscrn, &hmi_ctrl->workspace_layer);
87 - ivi_controller_interface->layer_set_opacity(hmi_ctrl->workspace_layer.ivilayer, 0);
88 - ivi_controller_interface->layer_set_visibility(hmi_ctrl->workspace_layer.ivilayer,
91 wl_list_init(&hmi_ctrl->workspace_fade.layer_list);
92 tmp_link_layer = MEM_ALLOC(sizeof(*tmp_link_layer));
93 - tmp_link_layer->layout_layer = hmi_ctrl->workspace_layer.ivilayer;
94 - wl_list_insert(&hmi_ctrl->workspace_fade.layer_list,
95 - &tmp_link_layer->link);
96 - tmp_link_layer = MEM_ALLOC(sizeof(*tmp_link_layer));
97 tmp_link_layer->layout_layer =
98 hmi_ctrl->workspace_background_layer.ivilayer;
99 wl_list_insert(&hmi_ctrl->workspace_fade.layer_list,
100 @@ -976,12 +961,11 @@ static void
101 ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
104 - struct ivi_layout_layer *layer = hmi_ctrl->workspace_layer.ivilayer;
105 int32_t minspace_x = 10;
106 int32_t minspace_y = minspace_x;
108 - int32_t width = hmi_ctrl->workspace_layer.width;
109 - int32_t height = hmi_ctrl->workspace_layer.height;
110 + int32_t width = hmi_ctrl->workspace_background_layer.width;
111 + int32_t height = hmi_ctrl->workspace_background_layer.height;
113 int32_t x_count = (width - minspace_x) / (minspace_x + icon_size);
114 int32_t space_x = (int32_t)((width - x_count * icon_size) / (1.0 + x_count));
115 @@ -1011,6 +995,11 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
116 struct ivi_layout_surface* layout_surface = NULL;
117 uint32_t *add_surface_id = NULL;
119 + struct ivi_layout_screen *iviscrn = NULL;
120 + struct link_layer *tmp_link_layer = NULL;
121 + struct ivi_layout_screen **pp_screen = NULL;
122 + int32_t screen_length = 0;
127 @@ -1087,16 +1076,10 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
128 ivi_controller_interface->get_surface_from_id(data->surface_id);
129 assert(layout_surface);
131 - ret = ivi_controller_interface->layer_add_surface(layer, layout_surface);
134 ret = ivi_controller_interface->surface_set_destination_rectangle(
135 layout_surface, x, y, icon_size, icon_size);
138 - ret = ivi_controller_interface->surface_set_visibility(layout_surface, true);
144 @@ -1105,6 +1088,43 @@ ivi_hmi_controller_add_launchers(struct hmi_controller *hmi_ctrl,
148 + /* init workspace ivi_layer */
149 + hmi_ctrl->workspace_layer.x = hmi_ctrl->workspace_background_layer.x;
150 + hmi_ctrl->workspace_layer.y = hmi_ctrl->workspace_background_layer.y;
151 + hmi_ctrl->workspace_layer.width =
152 + hmi_ctrl->workspace_background_layer.width * hmi_ctrl->workspace_count;
153 + hmi_ctrl->workspace_layer.height =
154 + hmi_ctrl->workspace_background_layer.height;
155 + hmi_ctrl->workspace_layer.id_layer =
156 + hmi_ctrl->hmi_setting->workspace_layer_id;
158 + ivi_controller_interface->get_screens(&screen_length, &pp_screen);
159 + iviscrn = pp_screen[0];
161 + create_layer(iviscrn, &hmi_ctrl->workspace_layer);
162 + ivi_controller_interface->layer_set_opacity(hmi_ctrl->workspace_layer.ivilayer, 0);
163 + ivi_controller_interface->layer_set_visibility(hmi_ctrl->workspace_layer.ivilayer,
166 + tmp_link_layer = MEM_ALLOC(sizeof(*tmp_link_layer));
167 + tmp_link_layer->layout_layer = hmi_ctrl->workspace_layer.ivilayer;
168 + wl_list_insert(&hmi_ctrl->workspace_fade.layer_list,
169 + &tmp_link_layer->link);
171 + /* Add surface to layer */
172 + wl_array_for_each(data, &launchers) {
174 + ivi_controller_interface->get_surface_from_id(data->surface_id);
175 + assert(layout_surface);
177 + ret = ivi_controller_interface->layer_add_surface(hmi_ctrl->workspace_layer.ivilayer,
181 + ret = ivi_controller_interface->surface_set_visibility(layout_surface, true);
185 wl_array_release(&launchers);
186 ivi_controller_interface->commit_changes();
188 @@ -1266,8 +1286,8 @@ move_workspace_grab_end(struct move_grab *move, struct wl_resource* resource,
190 ivi_controller_interface->layer_set_destination_rectangle(layer,
192 - hmi_ctrl->workspace_background_layer.width,
193 - hmi_ctrl->workspace_background_layer.height);
194 + hmi_ctrl->workspace_layer.width,
195 + hmi_ctrl->workspace_layer.height);
196 ivi_controller_interface->commit_changes();
199 @@ -1465,15 +1485,18 @@ enum HMI_GRAB_DEVICE {
200 static enum HMI_GRAB_DEVICE
201 get_hmi_grab_device(struct weston_seat *seat, uint32_t serial)
203 - if (seat->pointer &&
204 - seat->pointer->focus &&
205 - seat->pointer->button_count &&
206 - seat->pointer->grab_serial == serial)
207 + struct weston_pointer *pointer = seat->pointer;
208 + struct weston_touch *touch = seat->touch;
212 + pointer->button_count &&
213 + pointer->grab_serial == serial)
214 return HMI_GRAB_DEVICE_POINTER;
217 - seat->touch->focus &&
218 - seat->touch->grab_serial == serial)
221 + touch->grab_serial == serial)
222 return HMI_GRAB_DEVICE_TOUCH;
224 return HMI_GRAB_DEVICE_NONE;
225 @@ -1564,6 +1587,9 @@ ivi_hmi_controller_workspace_control(struct wl_client *client,
226 struct pointer_move_grab *pnt_move_grab = NULL;
227 struct touch_move_grab *tch_move_grab = NULL;
228 struct weston_seat *seat = NULL;
229 + struct weston_pointer *pointer;
230 + struct weston_touch *touch;
232 enum HMI_GRAB_DEVICE device;
234 if (hmi_ctrl->workspace_count < 2)
235 @@ -1582,21 +1608,23 @@ ivi_hmi_controller_workspace_control(struct wl_client *client,
238 case HMI_GRAB_DEVICE_POINTER:
239 - pnt_move_grab = create_workspace_pointer_move(seat->pointer,
240 + pointer = seat->pointer;
241 + pnt_move_grab = create_workspace_pointer_move(pointer,
244 pointer_grab_start(&pnt_move_grab->base, layer,
245 &pointer_move_grab_workspace_interface,
250 case HMI_GRAB_DEVICE_TOUCH:
251 - tch_move_grab = create_workspace_touch_move(seat->touch,
252 + touch = seat->touch;
253 + tch_move_grab = create_workspace_touch_move(touch,
256 touch_grab_start(&tch_move_grab->base, layer,
257 &touch_move_grab_workspace_interface,
263 diff --git a/ivi-shell/input-panel-ivi.c b/ivi-shell/input-panel-ivi.c
264 index 6b89177..3eefb68 100644
265 --- a/ivi-shell/input-panel-ivi.c
266 +++ b/ivi-shell/input-panel-ivi.c
268 * Copyright © 2011-2012 Collabora, Ltd.
269 * Copyright © 2013 Raspberry Pi Foundation
271 - * Permission to use, copy, modify, distribute, and sell this software and
272 - * its documentation for any purpose is hereby granted without fee, provided
273 - * that the above copyright notice appear in all copies and that both that
274 - * copyright notice and this permission notice appear in supporting
275 - * documentation, and that the name of the copyright holders not be used in
276 - * advertising or publicity pertaining to distribution of the software
277 - * without specific, written prior permission. The copyright holders make
278 - * no representations about the suitability of this software for any
279 - * purpose. It is provided "as is" without express or implied warranty.
280 + * Permission is hereby granted, free of charge, to any person obtaining
281 + * a copy of this software and associated documentation files (the
282 + * "Software"), to deal in the Software without restriction, including
283 + * without limitation the rights to use, copy, modify, merge, publish,
284 + * distribute, sublicense, and/or sell copies of the Software, and to
285 + * permit persons to whom the Software is furnished to do so, subject to
286 + * the following conditions:
288 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
289 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
290 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
291 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
292 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
293 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
294 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
295 + * The above copyright notice and this permission notice (including the
296 + * next paragraph) shall be included in all copies or substantial
297 + * portions of the Software.
299 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
300 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
301 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
302 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
303 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
304 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
305 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
310 @@ -66,9 +69,11 @@ show_input_panel_surface(struct input_panel_surface *ipsurf)
313 wl_list_for_each(seat, &shell->compositor->seat_list, link) {
314 - if (!seat->keyboard || !seat->keyboard->focus)
315 + struct weston_keyboard *keyboard = seat->keyboard;
317 + if (!keyboard || !keyboard->focus)
319 - focus = weston_surface_get_main_surface(seat->keyboard->focus);
320 + focus = weston_surface_get_main_surface(keyboard->focus);
321 ipsurf->output = focus->output;
322 x = ipsurf->output->x + (ipsurf->output->width - ipsurf->surface->width) / 2;
323 y = ipsurf->output->y + ipsurf->output->height - ipsurf->surface->height;
324 diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
325 index 4b4328c..8a92009 100644
326 --- a/ivi-shell/ivi-layout-export.h
327 +++ b/ivi-shell/ivi-layout-export.h
330 * Copyright (C) 2013 DENSO CORPORATION
332 - * Permission to use, copy, modify, distribute, and sell this software and
333 - * its documentation for any purpose is hereby granted without fee, provided
334 - * that the above copyright notice appear in all copies and that both that
335 - * copyright notice and this permission notice appear in supporting
336 - * documentation, and that the name of the copyright holders not be used in
337 - * advertising or publicity pertaining to distribution of the software
338 - * without specific, written prior permission. The copyright holders make
339 - * no representations about the suitability of this software for any
340 - * purpose. It is provided "as is" without express or implied warranty.
341 + * Permission is hereby granted, free of charge, to any person obtaining
342 + * a copy of this software and associated documentation files (the
343 + * "Software"), to deal in the Software without restriction, including
344 + * without limitation the rights to use, copy, modify, merge, publish,
345 + * distribute, sublicense, and/or sell copies of the Software, and to
346 + * permit persons to whom the Software is furnished to do so, subject to
347 + * the following conditions:
349 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
350 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
351 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
352 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
353 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
354 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
355 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
356 + * The above copyright notice and this permission notice (including the
357 + * next paragraph) shall be included in all copies or substantial
358 + * portions of the Software.
360 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
361 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
362 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
363 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
364 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
365 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
366 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
371 @@ -467,7 +470,7 @@ struct ivi_controller_interface {
373 * \brief Removes a ivi_layer which is currently managed by the service
375 - void (*layer_remove)(struct ivi_layout_layer *ivilayer);
376 + void (*layer_destroy)(struct ivi_layout_layer *ivilayer);
379 * \brief Get all ivi_layers which are currently registered and managed
380 @@ -780,6 +783,27 @@ struct ivi_controller_interface {
381 int32_t x, int32_t y,
382 int32_t width, int32_t height);
385 + * remove notification by callback on property changes of ivi_surface
387 + void (*surface_remove_notification_by_callback)(struct ivi_layout_surface *ivisurf,
388 + surface_property_notification_func callback,
392 + * \brief remove notification by callback on property changes of ivi_layer
394 + void (*layer_remove_notification_by_callback)(struct ivi_layout_layer *ivilayer,
395 + layer_property_notification_func callback,
399 + * \brief get id of ivi_screen from ivi_layout_screen
402 + * \return id of ivi_screen
404 + uint32_t (*get_id_of_screen)(struct ivi_layout_screen *iviscrn);
408 diff --git a/ivi-shell/ivi-layout-private.h b/ivi-shell/ivi-layout-private.h
409 index 4531748..074d598 100644
410 --- a/ivi-shell/ivi-layout-private.h
411 +++ b/ivi-shell/ivi-layout-private.h
414 * Copyright (C) 2014 DENSO CORPORATION
416 - * Permission to use, copy, modify, distribute, and sell this software and
417 - * its documentation for any purpose is hereby granted without fee, provided
418 - * that the above copyright notice appear in all copies and that both that
419 - * copyright notice and this permission notice appear in supporting
420 - * documentation, and that the name of the copyright holders not be used in
421 - * advertising or publicity pertaining to distribution of the software
422 - * without specific, written prior permission. The copyright holders make
423 - * no representations about the suitability of this software for any
424 - * purpose. It is provided "as is" without express or implied warranty.
425 + * Permission is hereby granted, free of charge, to any person obtaining
426 + * a copy of this software and associated documentation files (the
427 + * "Software"), to deal in the Software without restriction, including
428 + * without limitation the rights to use, copy, modify, merge, publish,
429 + * distribute, sublicense, and/or sell copies of the Software, and to
430 + * permit persons to whom the Software is furnished to do so, subject to
431 + * the following conditions:
433 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
434 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
435 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
436 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
437 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
438 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
439 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
440 + * The above copyright notice and this permission notice (including the
441 + * next paragraph) shall be included in all copies or substantial
442 + * portions of the Software.
444 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
445 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
446 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
447 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
448 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
449 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
450 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
454 #ifndef _ivi_layout_PRIVATE_H_
455 @@ -36,12 +39,7 @@ struct ivi_layout_surface {
456 struct ivi_layout *layout;
457 struct weston_surface *surface;
459 - struct wl_listener surface_destroy_listener;
460 - struct weston_transform surface_rotation;
461 - struct weston_transform layer_rotation;
462 - struct weston_transform surface_pos;
463 - struct weston_transform layer_pos;
464 - struct weston_transform scaling;
465 + struct weston_transform transform;
467 struct ivi_layout_surface_properties prop;
469 @@ -83,9 +81,12 @@ struct ivi_layout_layer {
474 struct wl_list surface_list;
482 @@ -223,4 +224,6 @@ ivi_layout_transition_move_layer_cancel(struct ivi_layout_layer *layer);
484 load_controller_modules(struct weston_compositor *compositor, const char *modules,
485 int *argc, char *argv[]);
487 +ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf);
489 diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c
490 index f691d35..d12a8f4 100644
491 --- a/ivi-shell/ivi-layout-transition.c
492 +++ b/ivi-shell/ivi-layout-transition.c
495 * Copyright (C) 2014 DENSO CORPORATION
497 - * Permission to use, copy, modify, distribute, and sell this software and
498 - * its documentation for any purpose is hereby granted without fee, provided
499 - * that the above copyright notice appear in all copies and that both that
500 - * copyright notice and this permission notice appear in supporting
501 - * documentation, and that the name of the copyright holders not be used in
502 - * advertising or publicity pertaining to distribution of the software
503 - * without specific, written prior permission. The copyright holders make
504 - * no representations about the suitability of this software for any
505 - * purpose. It is provided "as is" without express or implied warranty.
506 + * Permission is hereby granted, free of charge, to any person obtaining
507 + * a copy of this software and associated documentation files (the
508 + * "Software"), to deal in the Software without restriction, including
509 + * without limitation the rights to use, copy, modify, merge, publish,
510 + * distribute, sublicense, and/or sell copies of the Software, and to
511 + * permit persons to whom the Software is furnished to do so, subject to
512 + * the following conditions:
514 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
515 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
516 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
517 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
518 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
519 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
520 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
521 + * The above copyright notice and this permission notice (including the
522 + * next paragraph) shall be included in all copies or substantial
523 + * portions of the Software.
525 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
526 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
527 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
528 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
529 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
530 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
531 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
536 @@ -226,7 +229,7 @@ layout_transition_destroy(struct ivi_layout_transition *transition)
537 struct ivi_layout *layout = get_instance();
539 remove_transition(layout, transition);
540 - if(transition->destroy_func)
541 + if (transition->destroy_func)
542 transition->destroy_func(transition);
545 @@ -660,7 +663,7 @@ transition_move_layer_destroy(struct ivi_layout_transition *transition)
547 struct move_layer_data *data = transition->private_data;
549 - if(data->destroy_func)
550 + if (data->destroy_func)
551 data->destroy_func(transition->user_data);
554 diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
555 index abfba70..c153884 100644
556 --- a/ivi-shell/ivi-layout.c
557 +++ b/ivi-shell/ivi-layout.c
560 * Copyright (C) 2013 DENSO CORPORATION
562 - * Permission to use, copy, modify, distribute, and sell this software and
563 - * its documentation for any purpose is hereby granted without fee, provided
564 - * that the above copyright notice appear in all copies and that both that
565 - * copyright notice and this permission notice appear in supporting
566 - * documentation, and that the name of the copyright holders not be used in
567 - * advertising or publicity pertaining to distribution of the software
568 - * without specific, written prior permission. The copyright holders make
569 - * no representations about the suitability of this software for any
570 - * purpose. It is provided "as is" without express or implied warranty.
571 + * Permission is hereby granted, free of charge, to any person obtaining
572 + * a copy of this software and associated documentation files (the
573 + * "Software"), to deal in the Software without restriction, including
574 + * without limitation the rights to use, copy, modify, merge, publish,
575 + * distribute, sublicense, and/or sell copies of the Software, and to
576 + * permit persons to whom the Software is furnished to do so, subject to
577 + * the following conditions:
579 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
580 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
581 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
582 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
583 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
584 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
585 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
586 + * The above copyright notice and this permission notice (including the
587 + * next paragraph) shall be included in all copies or substantial
588 + * portions of the Software.
590 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
591 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
592 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
593 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
594 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
595 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
596 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
607 #include "compositor.h"
608 #include "ivi-layout-export.h"
609 #include "ivi-layout-private.h"
611 -#include "../shared/os-compatibility.h"
612 +#include "shared/os-compatibility.h"
614 +#define max(a, b) ((a) > (b) ? (a) : (b))
617 struct ivi_layout_layer *ivilayer;
618 @@ -89,14 +95,13 @@ struct ivi_layout_screen {
619 struct ivi_layout *layout;
620 struct weston_output *output;
622 - uint32_t event_mask;
625 struct wl_list layer_list;
631 struct wl_list layer_list;
634 @@ -107,6 +112,17 @@ struct ivi_layout_notification_callback {
638 +struct ivi_rectangle
647 +remove_notification(struct wl_list *listener_list, void *callback, void *userdata);
649 static struct ivi_layout ivilayout = {0};
652 @@ -139,12 +155,8 @@ remove_link_to_surface(struct ivi_layout_layer *ivilayer)
653 struct link_layer *next = NULL;
655 wl_list_for_each_safe(link, next, &ivilayer->link_to_surface, link_to_layer) {
656 - if (!wl_list_empty(&link->link_to_layer)) {
657 - wl_list_remove(&link->link_to_layer);
659 - if (!wl_list_empty(&link->link)) {
660 - wl_list_remove(&link->link);
662 + wl_list_remove(&link->link_to_layer);
663 + wl_list_remove(&link->link);
667 @@ -158,7 +170,6 @@ static void
668 add_link_to_layer(struct ivi_layout_screen *iviscrn,
669 struct link_screen *link_screen)
671 - wl_list_init(&link_screen->link_to_screen);
672 wl_list_insert(&iviscrn->link_to_layer, &link_screen->link_to_screen);
675 @@ -178,7 +189,6 @@ add_ordersurface_to_layer(struct ivi_layout_surface *ivisurf,
678 link_layer->ivilayer = ivilayer;
679 - wl_list_init(&link_layer->link);
680 wl_list_insert(&ivisurf->layer_list, &link_layer->link);
681 add_link_to_surface(ivilayer, link_layer);
683 @@ -190,12 +200,8 @@ remove_ordersurface_from_layer(struct ivi_layout_surface *ivisurf)
684 struct link_layer *next = NULL;
686 wl_list_for_each_safe(link_layer, next, &ivisurf->layer_list, link) {
687 - if (!wl_list_empty(&link_layer->link)) {
688 - wl_list_remove(&link_layer->link);
690 - if (!wl_list_empty(&link_layer->link_to_layer)) {
691 - wl_list_remove(&link_layer->link_to_layer);
693 + wl_list_remove(&link_layer->link);
694 + wl_list_remove(&link_layer->link_to_layer);
697 wl_list_init(&ivisurf->layer_list);
698 @@ -217,7 +223,6 @@ add_orderlayer_to_screen(struct ivi_layout_layer *ivilayer,
701 link_scrn->iviscrn = iviscrn;
702 - wl_list_init(&link_scrn->link);
703 wl_list_insert(&ivilayer->screen_list, &link_scrn->link);
704 add_link_to_layer(iviscrn, link_scrn);
706 @@ -229,12 +234,8 @@ remove_orderlayer_from_screen(struct ivi_layout_layer *ivilayer)
707 struct link_screen *next = NULL;
709 wl_list_for_each_safe(link_scrn, next, &ivilayer->screen_list, link) {
710 - if (!wl_list_empty(&link_scrn->link)) {
711 - wl_list_remove(&link_scrn->link);
713 - if (!wl_list_empty(&link_scrn->link_to_screen)) {
714 - wl_list_remove(&link_scrn->link_to_screen);
716 + wl_list_remove(&link_scrn->link);
717 + wl_list_remove(&link_scrn->link_to_screen);
720 wl_list_init(&ivilayer->screen_list);
721 @@ -290,9 +291,7 @@ remove_all_notification(struct wl_list *listener_list)
723 wl_list_for_each_safe(listener, next, listener_list, link) {
724 struct listener_layout_notification *notification = NULL;
725 - if (!wl_list_empty(&listener->link)) {
726 - wl_list_remove(&listener->link);
728 + wl_list_remove(&listener->link);
731 container_of(listener,
732 @@ -315,29 +314,36 @@ ivi_layout_surface_remove_notification(struct ivi_layout_surface *ivisurf)
733 remove_all_notification(&ivisurf->property_changed.listener_list);
737 +ivi_layout_surface_remove_notification_by_callback(struct ivi_layout_surface *ivisurf,
738 + surface_property_notification_func callback,
741 + if (ivisurf == NULL) {
742 + weston_log("ivi_layout_surface_remove_notification_by_callback: invalid argument\n");
746 + remove_notification(&ivisurf->property_changed.listener_list, callback, userdata);
750 - * this shall not be called from controller because this is triggered by ivi_surface.destroy
751 - * This means that this is called from westonsurface_destroy_from_ivisurface.
752 + * Called at destruction of wl_surface/ivi_surface
755 -ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf)
757 +ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf)
759 struct ivi_layout *layout = get_instance();
761 if (ivisurf == NULL) {
762 - weston_log("ivi_layout_surface_remove: invalid argument\n");
763 + weston_log("%s: invalid argument\n", __func__);
767 - if (!wl_list_empty(&ivisurf->pending.link)) {
768 - wl_list_remove(&ivisurf->pending.link);
770 - if (!wl_list_empty(&ivisurf->order.link)) {
771 - wl_list_remove(&ivisurf->order.link);
773 - if (!wl_list_empty(&ivisurf->link)) {
774 - wl_list_remove(&ivisurf->link);
776 + wl_list_remove(&ivisurf->transform.link);
777 + wl_list_remove(&ivisurf->pending.link);
778 + wl_list_remove(&ivisurf->order.link);
779 + wl_list_remove(&ivisurf->link);
780 remove_ordersurface_from_layer(ivisurf);
782 wl_signal_emit(&layout->surface_notification.removed, ivisurf);
783 @@ -350,27 +356,6 @@ ivi_layout_surface_remove(struct ivi_layout_surface *ivisurf)
787 - * Called at destruction of ivi_surface
790 -westonsurface_destroy_from_ivisurface(struct wl_listener *listener, void *data)
792 - struct ivi_layout_surface *ivisurf = NULL;
794 - ivisurf = container_of(listener, struct ivi_layout_surface,
795 - surface_destroy_listener);
797 - wl_list_remove(&ivisurf->surface_rotation.link);
798 - wl_list_remove(&ivisurf->layer_rotation.link);
799 - wl_list_remove(&ivisurf->surface_pos.link);
800 - wl_list_remove(&ivisurf->layer_pos.link);
801 - wl_list_remove(&ivisurf->scaling.link);
803 - ivisurf->surface = NULL;
804 - ivi_layout_surface_remove(ivisurf);
808 * Internal API to check ivi_layer/ivi_surface already added in ivi_layer/ivi_screen.
809 * Called by ivi_layout_layer_add_surface/ivi_layout_screenAddLayer
811 @@ -423,14 +408,12 @@ create_screen(struct weston_compositor *ec)
815 - wl_list_init(&iviscrn->link);
816 iviscrn->layout = layout;
818 iviscrn->id_screen = count;
821 iviscrn->output = output;
822 - iviscrn->event_mask = 0;
824 wl_list_init(&iviscrn->pending.layer_list);
825 wl_list_init(&iviscrn->pending.link);
826 @@ -494,293 +477,319 @@ update_opacity(struct ivi_layout_layer *ivilayer,
830 -update_surface_orientation(struct ivi_layout_layer *ivilayer,
831 - struct ivi_layout_surface *ivisurf)
833 - struct weston_view *view;
834 - struct weston_matrix *matrix = &ivisurf->surface_rotation.matrix;
835 - float width = 0.0f;
836 - float height = 0.0f;
837 - float v_sin = 0.0f;
838 - float v_cos = 0.0f;
844 - wl_list_for_each(view, &ivisurf->surface->views, surface_link) {
845 - if (view != NULL) {
850 - if (view == NULL) {
854 - if ((ivilayer->prop.dest_width == 0) ||
855 - (ivilayer->prop.dest_height == 0)) {
858 - width = (float)ivilayer->prop.dest_width;
859 - height = (float)ivilayer->prop.dest_height;
861 - switch (ivisurf->prop.orientation) {
862 - case WL_OUTPUT_TRANSFORM_NORMAL:
866 +get_rotate_values(enum wl_output_transform orientation,
870 + switch (orientation) {
871 case WL_OUTPUT_TRANSFORM_90:
874 - sx = width / height;
875 - sy = height / width;
879 case WL_OUTPUT_TRANSFORM_180:
885 case WL_OUTPUT_TRANSFORM_270:
889 + case WL_OUTPUT_TRANSFORM_NORMAL:
893 - sx = width / height;
894 - sy = height / width;
899 - wl_list_remove(&ivisurf->surface_rotation.link);
900 - weston_view_geometry_dirty(view);
902 - weston_matrix_init(matrix);
904 - cy = 0.5f * height;
905 - weston_matrix_translate(matrix, -cx, -cy, 0.0f);
906 - weston_matrix_rotate_xy(matrix, v_cos, v_sin);
907 - weston_matrix_scale(matrix, sx, sy, 1.0);
908 - weston_matrix_translate(matrix, cx, cy, 0.0f);
909 - wl_list_insert(&view->geometry.transformation_list,
910 - &ivisurf->surface_rotation.link);
912 - weston_view_set_transform_parent(view, NULL);
913 - weston_view_update_transform(view);
917 -update_layer_orientation(struct ivi_layout_layer *ivilayer,
918 - struct ivi_layout_surface *ivisurf)
920 - struct weston_surface *es = ivisurf->surface;
921 - struct weston_view *view;
922 - struct weston_matrix *matrix = &ivisurf->layer_rotation.matrix;
923 - struct weston_output *output = NULL;
924 - float width = 0.0f;
925 - float height = 0.0f;
926 - float v_sin = 0.0f;
927 - float v_cos = 0.0f;
933 - wl_list_for_each(view, &ivisurf->surface->views, surface_link) {
934 - if (view != NULL) {
939 - if (es == NULL || view == NULL) {
943 - output = es->output;
944 - if (output == NULL) {
947 - if ((output->width == 0) || (output->height == 0)) {
950 - width = (float)output->width;
951 - height = (float)output->height;
953 - switch (ivilayer->prop.orientation) {
954 - case WL_OUTPUT_TRANSFORM_NORMAL:
958 +get_scale(enum wl_output_transform orientation,
961 + float source_width,
962 + float source_height,
966 + switch (orientation) {
967 case WL_OUTPUT_TRANSFORM_90:
970 - sx = width / height;
971 - sy = height / width;
972 + *scale_x = dest_width / source_height;
973 + *scale_y = dest_height / source_width;
975 case WL_OUTPUT_TRANSFORM_180:
978 + *scale_x = dest_width / source_width;
979 + *scale_y = dest_height / source_height;
981 case WL_OUTPUT_TRANSFORM_270:
982 + *scale_x = dest_width / source_height;
983 + *scale_y = dest_height / source_width;
985 + case WL_OUTPUT_TRANSFORM_NORMAL:
989 - sx = width / height;
990 - sy = height / width;
991 + *scale_x = dest_width / source_width;
992 + *scale_y = dest_height / source_height;
995 - wl_list_remove(&ivisurf->layer_rotation.link);
996 - weston_view_geometry_dirty(view);
998 - weston_matrix_init(matrix);
1000 - cy = 0.5f * height;
1001 - weston_matrix_translate(matrix, -cx, -cy, 0.0f);
1002 - weston_matrix_rotate_xy(matrix, v_cos, v_sin);
1003 - weston_matrix_scale(matrix, sx, sy, 1.0);
1004 - weston_matrix_translate(matrix, cx, cy, 0.0f);
1005 - wl_list_insert(&view->geometry.transformation_list,
1006 - &ivisurf->layer_rotation.link);
1009 - weston_view_set_transform_parent(view, NULL);
1010 - weston_view_update_transform(view);
1012 +calc_transformation_matrix(struct ivi_rectangle *source_rect,
1013 + struct ivi_rectangle *dest_rect,
1014 + enum wl_output_transform orientation,
1015 + struct weston_matrix *m)
1017 + float source_center_x;
1018 + float source_center_y;
1023 + float translate_x;
1024 + float translate_y;
1026 + source_center_x = source_rect->x + source_rect->width * 0.5f;
1027 + source_center_y = source_rect->y + source_rect->height * 0.5f;
1028 + weston_matrix_translate(m, -source_center_x, -source_center_y, 0.0f);
1030 + get_rotate_values(orientation, &vsin, &vcos);
1031 + weston_matrix_rotate_xy(m, vcos, vsin);
1033 + get_scale(orientation,
1035 + dest_rect->height,
1036 + source_rect->width,
1037 + source_rect->height,
1040 + weston_matrix_scale(m, scale_x, scale_y, 1.0f);
1042 + translate_x = dest_rect->width * 0.5f + dest_rect->x;
1043 + translate_y = dest_rect->height * 0.5f + dest_rect->y;
1044 + weston_matrix_translate(m, translate_x, translate_y, 0.0f);
1048 + * This computes intersected rect_output from two ivi_rectangles
1051 -update_surface_position(struct ivi_layout_surface *ivisurf)
1052 +ivi_rectangle_intersect(const struct ivi_rectangle *rect1,
1053 + const struct ivi_rectangle *rect2,
1054 + struct ivi_rectangle *rect_output)
1056 - struct weston_view *view;
1057 - float tx = (float)ivisurf->prop.dest_x;
1058 - float ty = (float)ivisurf->prop.dest_y;
1059 - struct weston_matrix *matrix = &ivisurf->surface_pos.matrix;
1060 + int32_t rect1_right = rect1->x + rect1->width;
1061 + int32_t rect1_bottom = rect1->y + rect1->height;
1062 + int32_t rect2_right = rect2->x + rect2->width;
1063 + int32_t rect2_bottom = rect2->y + rect2->height;
1065 - wl_list_for_each(view, &ivisurf->surface->views, surface_link) {
1066 - if (view != NULL) {
1070 + rect_output->x = max(rect1->x, rect2->x);
1071 + rect_output->y = max(rect1->y, rect2->y);
1072 + rect_output->width = rect1_right < rect2_right ?
1073 + rect1_right - rect_output->x :
1074 + rect2_right - rect_output->x;
1075 + rect_output->height = rect1_bottom < rect2_bottom ?
1076 + rect1_bottom - rect_output->y :
1077 + rect2_bottom - rect_output->y;
1079 - if (view == NULL) {
1081 + if (rect_output->width < 0 || rect_output->height < 0) {
1082 + rect_output->width = 0;
1083 + rect_output->height = 0;
1086 - wl_list_remove(&ivisurf->surface_pos.link);
1088 - weston_matrix_init(matrix);
1089 - weston_matrix_translate(matrix, tx, ty, 0.0f);
1090 - wl_list_insert(&view->geometry.transformation_list,
1091 - &ivisurf->surface_pos.link);
1093 - weston_view_set_transform_parent(view, NULL);
1094 - weston_view_update_transform(view);
1098 + * Transform rect_input by the inverse of matrix, intersect with boundingbox,
1099 + * and store the result in rect_output.
1100 + * The boundingbox must be given in the same coordinate space as rect_output.
1101 + * Additionally, there are the following restrictions on the matrix:
1102 + * - no projective transformations
1104 + * - only multiples of 90-degree rotations supported
1106 + * In failure case of weston_matrix_invert, rect_output is set to boundingbox
1107 + * as a fail-safe with log.
1110 -update_layer_position(struct ivi_layout_layer *ivilayer,
1111 - struct ivi_layout_surface *ivisurf)
1112 +calc_inverse_matrix_transform(const struct weston_matrix *matrix,
1113 + const struct ivi_rectangle *rect_input,
1114 + const struct ivi_rectangle *boundingbox,
1115 + struct ivi_rectangle *rect_output)
1117 - struct weston_view *view;
1118 - struct weston_matrix *matrix = &ivisurf->layer_pos.matrix;
1119 - float tx = (float)ivilayer->prop.dest_x;
1120 - float ty = (float)ivilayer->prop.dest_y;
1121 + struct weston_matrix m;
1122 + struct weston_vector top_left;
1123 + struct weston_vector bottom_right;
1125 - wl_list_for_each(view, &ivisurf->surface->views, surface_link) {
1126 - if (view != NULL) {
1130 + assert(boundingbox != rect_output);
1132 - if (view == NULL) {
1134 + if (weston_matrix_invert(&m, matrix) < 0) {
1135 + weston_log("ivi-shell: calc_inverse_matrix_transform fails to invert a matrix.\n");
1136 + weston_log("ivi-shell: boundingbox is set to the rect_output.\n");
1137 + rect_output->x = boundingbox->x;
1138 + rect_output->y = boundingbox->y;
1139 + rect_output->width = boundingbox->width;
1140 + rect_output->height = boundingbox->height;
1143 - wl_list_remove(&ivisurf->layer_pos.link);
1144 + /* The vectors and matrices involved will always produce f[3] == 1.0. */
1145 + top_left.f[0] = rect_input->x;
1146 + top_left.f[1] = rect_input->y;
1147 + top_left.f[2] = 0.0f;
1148 + top_left.f[3] = 1.0f;
1150 - weston_matrix_init(matrix);
1151 - weston_matrix_translate(matrix, tx, ty, 0.0f);
1152 - wl_list_insert(&view->geometry.transformation_list,
1153 - &ivisurf->layer_pos.link);
1154 + bottom_right.f[0] = rect_input->x + rect_input->width;
1155 + bottom_right.f[1] = rect_input->y + rect_input->height;
1156 + bottom_right.f[2] = 0.0f;
1157 + bottom_right.f[3] = 1.0f;
1159 - weston_view_set_transform_parent(view, NULL);
1160 - weston_view_update_transform(view);
1162 + weston_matrix_transform(&m, &top_left);
1163 + weston_matrix_transform(&m, &bottom_right);
1166 -update_scale(struct ivi_layout_layer *ivilayer,
1167 - struct ivi_layout_surface *ivisurf)
1169 - struct weston_view *view;
1170 - struct weston_matrix *matrix = &ivisurf->scaling.matrix;
1178 - wl_list_for_each(view, &ivisurf->surface->views, surface_link) {
1179 - if (view != NULL) {
1182 + if (top_left.f[0] < bottom_right.f[0]) {
1183 + rect_output->x = top_left.f[0];
1184 + rect_output->width = bottom_right.f[0] - rect_output->x;
1186 + rect_output->x = bottom_right.f[0];
1187 + rect_output->width = top_left.f[0] - rect_output->x;
1190 - if (view == NULL) {
1192 + if (top_left.f[1] < bottom_right.f[1]) {
1193 + rect_output->y = top_left.f[1];
1194 + rect_output->height = bottom_right.f[1] - rect_output->y;
1196 + rect_output->y = bottom_right.f[1];
1197 + rect_output->height = top_left.f[1] - rect_output->y;
1200 - if (ivisurf->prop.source_width == 0 || ivisurf->prop.source_height == 0) {
1201 - weston_log("ivi-shell: source rectangle is not yet set by ivi_layout_surface_set_source_rectangle\n");
1204 + ivi_rectangle_intersect(rect_output, boundingbox, rect_output);
1207 - if (ivisurf->prop.dest_width == 0 || ivisurf->prop.dest_height == 0) {
1208 - weston_log("ivi-shell: destination rectangle is not yet set by ivi_layout_surface_set_destination_rectangle\n");
1212 + * This computes the whole transformation matrix:m from surface-local
1213 + * coordinates to global coordinates. It is assumed that
1214 + * weston_view::geometry.{x,y} are zero.
1216 + * Additionally, this computes the mask on surface-local coordinates as a
1217 + * ivi_rectangle. This can be set to weston_view_set_mask.
1219 + * The mask is computed by following steps
1220 + * - destination rectangle of layer is inversed to surface-local cooodinates
1221 + * by inversed matrix:m.
1222 + * - the area is intersected by intersected area between weston_surface and
1223 + * source rectangle of ivi_surface.
1226 +calc_surface_to_global_matrix_and_mask_to_weston_surface(
1227 + struct ivi_layout_layer *ivilayer,
1228 + struct ivi_layout_surface *ivisurf,
1229 + struct weston_matrix *m,
1230 + struct ivi_rectangle *result)
1232 + const struct ivi_layout_surface_properties *sp = &ivisurf->prop;
1233 + const struct ivi_layout_layer_properties *lp = &ivilayer->prop;
1234 + struct ivi_rectangle weston_surface_rect = { 0,
1236 + ivisurf->surface->width,
1237 + ivisurf->surface->height };
1238 + struct ivi_rectangle surface_source_rect = { sp->source_x,
1241 + sp->source_height };
1242 + struct ivi_rectangle surface_dest_rect = { sp->dest_x,
1245 + sp->dest_height };
1246 + struct ivi_rectangle layer_source_rect = { lp->source_x,
1249 + lp->source_height };
1250 + struct ivi_rectangle layer_dest_rect = { lp->dest_x,
1253 + lp->dest_height };
1254 + struct ivi_rectangle surface_result;
1256 - lw = ((float)ivilayer->prop.dest_width / (float)ivilayer->prop.source_width );
1257 - sw = ((float)ivisurf->prop.dest_width / (float)ivisurf->prop.source_width );
1258 - lh = ((float)ivilayer->prop.dest_height / (float)ivilayer->prop.source_height);
1259 - sh = ((float)ivisurf->prop.dest_height / (float)ivisurf->prop.source_height );
1263 + * the whole transformation matrix:m from surface-local
1264 + * coordinates to global coordinates, which is computed by
1266 + * - surface-local coordinates to layer-local coordinates
1267 + * - layer-local coordinates to global coordinates
1269 + calc_transformation_matrix(&surface_source_rect,
1270 + &surface_dest_rect,
1271 + sp->orientation, m);
1273 - wl_list_remove(&ivisurf->scaling.link);
1274 - weston_matrix_init(matrix);
1275 - weston_matrix_scale(matrix, sx, sy, 1.0f);
1276 + calc_transformation_matrix(&layer_source_rect,
1278 + lp->orientation, m);
1280 - wl_list_insert(&view->geometry.transformation_list,
1281 - &ivisurf->scaling.link);
1282 + /* this intersected ivi_rectangle would be used for masking
1285 + ivi_rectangle_intersect(&surface_source_rect, &weston_surface_rect,
1288 - weston_view_set_transform_parent(view, NULL);
1289 - weston_view_update_transform(view);
1290 + /* calc masking area of weston_surface from m */
1291 + calc_inverse_matrix_transform(m,
1298 update_prop(struct ivi_layout_layer *ivilayer,
1299 struct ivi_layout_surface *ivisurf)
1301 - if (ivilayer->event_mask | ivisurf->event_mask) {
1302 - struct weston_view *tmpview;
1303 - update_opacity(ivilayer, ivisurf);
1304 - update_layer_orientation(ivilayer, ivisurf);
1305 - update_layer_position(ivilayer, ivisurf);
1306 - update_surface_position(ivisurf);
1307 - update_surface_orientation(ivilayer, ivisurf);
1308 - update_scale(ivilayer, ivisurf);
1309 + struct weston_view *tmpview;
1310 + struct ivi_rectangle r;
1311 + bool can_calc = true;
1313 - ivisurf->update_count++;
1314 + if (!ivilayer->event_mask && !ivisurf->event_mask) {
1318 - wl_list_for_each(tmpview, &ivisurf->surface->views, surface_link) {
1319 - if (tmpview != NULL) {
1323 + update_opacity(ivilayer, ivisurf);
1325 + wl_list_for_each(tmpview, &ivisurf->surface->views, surface_link) {
1326 if (tmpview != NULL) {
1327 - weston_view_geometry_dirty(tmpview);
1332 - if (ivisurf->surface != NULL) {
1333 - weston_surface_damage(ivisurf->surface);
1334 + if (ivisurf->prop.source_width == 0 || ivisurf->prop.source_height == 0) {
1335 + weston_log("ivi-shell: source rectangle is not yet set by ivi_layout_surface_set_source_rectangle\n");
1339 + if (ivisurf->prop.dest_width == 0 || ivisurf->prop.dest_height == 0) {
1340 + weston_log("ivi-shell: destination rectangle is not yet set by ivi_layout_surface_set_destination_rectangle\n");
1345 + wl_list_remove(&ivisurf->transform.link);
1346 + weston_matrix_init(&ivisurf->transform.matrix);
1348 + calc_surface_to_global_matrix_and_mask_to_weston_surface(
1349 + ivilayer, ivisurf, &ivisurf->transform.matrix, &r);
1351 + if (tmpview != NULL) {
1352 + weston_view_set_mask(tmpview, r.x, r.y, r.width, r.height);
1353 + wl_list_insert(&tmpview->geometry.transformation_list,
1354 + &ivisurf->transform.link);
1356 + weston_view_set_transform_parent(tmpview, NULL);
1360 + ivisurf->update_count++;
1362 + if (tmpview != NULL) {
1363 + weston_view_geometry_dirty(tmpview);
1366 + if (ivisurf->surface != NULL) {
1367 + weston_surface_damage(ivisurf->surface);
1372 @@ -810,7 +819,7 @@ commit_surface_list(struct ivi_layout *layout)
1373 int32_t configured = 0;
1375 wl_list_for_each(ivisurf, &layout->surface_list, link) {
1376 - if(ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_DEFAULT) {
1377 + if (ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_DEFAULT) {
1378 dest_x = ivisurf->prop.dest_x;
1379 dest_y = ivisurf->prop.dest_y;
1380 dest_width = ivisurf->prop.dest_width;
1381 @@ -823,7 +832,7 @@ commit_surface_list(struct ivi_layout *layout)
1382 ivisurf->pending.prop.dest_height,
1383 ivisurf->pending.prop.transition_duration);
1385 - if(ivisurf->pending.prop.visibility) {
1386 + if (ivisurf->pending.prop.visibility) {
1387 ivi_layout_transition_visibility_on(ivisurf, ivisurf->pending.prop.transition_duration);
1389 ivi_layout_transition_visibility_off(ivisurf, ivisurf->pending.prop.transition_duration);
1390 @@ -837,7 +846,7 @@ commit_surface_list(struct ivi_layout *layout)
1391 ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
1392 ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
1394 - } else if(ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_DEST_RECT_ONLY){
1395 + } else if (ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_DEST_RECT_ONLY) {
1396 dest_x = ivisurf->prop.dest_x;
1397 dest_y = ivisurf->prop.dest_y;
1398 dest_width = ivisurf->prop.dest_width;
1399 @@ -859,9 +868,9 @@ commit_surface_list(struct ivi_layout *layout)
1400 ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
1401 ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
1403 - } else if(ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY){
1404 + } else if (ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_FADE_ONLY) {
1406 - if(ivisurf->pending.prop.visibility) {
1407 + if (ivisurf->pending.prop.visibility) {
1408 ivi_layout_transition_visibility_on(ivisurf, ivisurf->pending.prop.transition_duration);
1410 ivi_layout_transition_visibility_off(ivisurf, ivisurf->pending.prop.transition_duration);
1411 @@ -903,9 +912,9 @@ commit_layer_list(struct ivi_layout *layout)
1412 struct ivi_layout_surface *next = NULL;
1414 wl_list_for_each(ivilayer, &layout->layer_list, link) {
1415 - if(ivilayer->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_LAYER_MOVE) {
1416 + if (ivilayer->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_LAYER_MOVE) {
1417 ivi_layout_transition_move_layer(ivilayer, ivilayer->pending.prop.dest_x, ivilayer->pending.prop.dest_y, ivilayer->pending.prop.transition_duration);
1418 - } else if(ivilayer->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_LAYER_FADE) {
1419 + } else if (ivilayer->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_LAYER_FADE) {
1420 ivi_layout_transition_fade_layer(ivilayer,ivilayer->pending.prop.is_fade_in,
1421 ivilayer->pending.prop.start_alpha,ivilayer->pending.prop.end_alpha,
1423 @@ -915,53 +924,30 @@ commit_layer_list(struct ivi_layout *layout)
1425 ivilayer->prop = ivilayer->pending.prop;
1427 - if (!(ivilayer->event_mask &
1428 - (IVI_NOTIFICATION_ADD | IVI_NOTIFICATION_REMOVE)) ) {
1429 + if (!ivilayer->order.dirty) {
1433 - if (ivilayer->event_mask & IVI_NOTIFICATION_REMOVE) {
1434 - wl_list_for_each_safe(ivisurf, next,
1435 - &ivilayer->order.surface_list, order.link) {
1436 - remove_ordersurface_from_layer(ivisurf);
1438 - if (!wl_list_empty(&ivisurf->order.link)) {
1439 - wl_list_remove(&ivisurf->order.link);
1442 - wl_list_init(&ivisurf->order.link);
1443 - ivisurf->event_mask |= IVI_NOTIFICATION_REMOVE;
1446 - wl_list_init(&ivilayer->order.surface_list);
1447 + wl_list_for_each_safe(ivisurf, next, &ivilayer->order.surface_list,
1449 + remove_ordersurface_from_layer(ivisurf);
1450 + wl_list_remove(&ivisurf->order.link);
1451 + wl_list_init(&ivisurf->order.link);
1452 + ivisurf->event_mask |= IVI_NOTIFICATION_REMOVE;
1455 - if (ivilayer->event_mask & IVI_NOTIFICATION_ADD) {
1456 - wl_list_for_each_safe(ivisurf, next,
1457 - &ivilayer->order.surface_list, order.link) {
1458 - remove_ordersurface_from_layer(ivisurf);
1460 - if (!wl_list_empty(&ivisurf->order.link)) {
1461 - wl_list_remove(&ivisurf->order.link);
1464 - wl_list_init(&ivisurf->order.link);
1466 + assert(wl_list_empty(&ivilayer->order.surface_list));
1468 - wl_list_init(&ivilayer->order.surface_list);
1469 - wl_list_for_each(ivisurf, &ivilayer->pending.surface_list,
1470 + wl_list_for_each(ivisurf, &ivilayer->pending.surface_list,
1472 - if(!wl_list_empty(&ivisurf->order.link)){
1473 - wl_list_remove(&ivisurf->order.link);
1474 - wl_list_init(&ivisurf->order.link);
1477 - wl_list_insert(&ivilayer->order.surface_list,
1478 - &ivisurf->order.link);
1479 - add_ordersurface_to_layer(ivisurf, ivilayer);
1480 - ivisurf->event_mask |= IVI_NOTIFICATION_ADD;
1482 + wl_list_remove(&ivisurf->order.link);
1483 + wl_list_insert(&ivilayer->order.surface_list,
1484 + &ivisurf->order.link);
1485 + add_ordersurface_to_layer(ivisurf, ivilayer);
1486 + ivisurf->event_mask |= IVI_NOTIFICATION_ADD;
1489 + ivilayer->order.dirty = 0;
1493 @@ -974,33 +960,17 @@ commit_screen_list(struct ivi_layout *layout)
1494 struct ivi_layout_surface *ivisurf = NULL;
1496 wl_list_for_each(iviscrn, &layout->screen_list, link) {
1497 - if (iviscrn->event_mask & IVI_NOTIFICATION_REMOVE) {
1498 + if (iviscrn->order.dirty) {
1499 wl_list_for_each_safe(ivilayer, next,
1500 &iviscrn->order.layer_list, order.link) {
1501 remove_orderlayer_from_screen(ivilayer);
1503 - if (!wl_list_empty(&ivilayer->order.link)) {
1504 - wl_list_remove(&ivilayer->order.link);
1507 + wl_list_remove(&ivilayer->order.link);
1508 wl_list_init(&ivilayer->order.link);
1509 ivilayer->event_mask |= IVI_NOTIFICATION_REMOVE;
1513 - if (iviscrn->event_mask & IVI_NOTIFICATION_ADD) {
1514 - wl_list_for_each_safe(ivilayer, next,
1515 - &iviscrn->order.layer_list, order.link) {
1516 - remove_orderlayer_from_screen(ivilayer);
1517 + assert(wl_list_empty(&iviscrn->order.layer_list));
1519 - if (!wl_list_empty(&ivilayer->order.link)) {
1520 - wl_list_remove(&ivilayer->order.link);
1523 - wl_list_init(&ivilayer->order.link);
1526 - wl_list_init(&iviscrn->order.layer_list);
1527 wl_list_for_each(ivilayer, &iviscrn->pending.layer_list,
1529 wl_list_insert(&iviscrn->order.layer_list,
1530 @@ -1008,9 +978,9 @@ commit_screen_list(struct ivi_layout *layout)
1531 add_orderlayer_to_screen(ivilayer, iviscrn);
1532 ivilayer->event_mask |= IVI_NOTIFICATION_ADD;
1536 - iviscrn->event_mask = 0;
1537 + iviscrn->order.dirty = 0;
1540 /* Clear view list of layout ivi_layer */
1541 wl_list_init(&layout->layout_layer.view_list.link);
1542 @@ -1046,7 +1016,7 @@ commit_screen_list(struct ivi_layout *layout)
1544 commit_transition(struct ivi_layout* layout)
1546 - if(wl_list_empty(&layout->pending_transition_list)){
1547 + if (wl_list_empty(&layout->pending_transition_list)) {
1551 @@ -1079,11 +1049,13 @@ send_prop(struct ivi_layout *layout)
1552 struct ivi_layout_surface *ivisurf = NULL;
1554 wl_list_for_each_reverse(ivilayer, &layout->layer_list, link) {
1555 - send_layer_prop(ivilayer);
1556 + if (ivilayer->event_mask)
1557 + send_layer_prop(ivilayer);
1560 wl_list_for_each_reverse(ivisurf, &layout->surface_list, link) {
1561 - send_surface_prop(ivisurf);
1562 + if (ivisurf->event_mask)
1563 + send_surface_prop(ivisurf);
1567 @@ -1095,14 +1067,9 @@ clear_surface_pending_list(struct ivi_layout_layer *ivilayer)
1569 wl_list_for_each_safe(surface_link, surface_next,
1570 &ivilayer->pending.surface_list, pending.link) {
1571 - if (!wl_list_empty(&surface_link->pending.link)) {
1572 - wl_list_remove(&surface_link->pending.link);
1575 + wl_list_remove(&surface_link->pending.link);
1576 wl_list_init(&surface_link->pending.link);
1579 - ivilayer->event_mask |= IVI_NOTIFICATION_REMOVE;
1583 @@ -1113,14 +1080,9 @@ clear_surface_order_list(struct ivi_layout_layer *ivilayer)
1585 wl_list_for_each_safe(surface_link, surface_next,
1586 &ivilayer->order.surface_list, order.link) {
1587 - if (!wl_list_empty(&surface_link->order.link)) {
1588 - wl_list_remove(&surface_link->order.link);
1591 + wl_list_remove(&surface_link->order.link);
1592 wl_list_init(&surface_link->order.link);
1595 - ivilayer->event_mask |= IVI_NOTIFICATION_REMOVE;
1599 @@ -1287,9 +1249,7 @@ remove_notification(struct wl_list *listener_list, void *callback, void *userdat
1603 - if (!wl_list_empty(&listener->link)) {
1604 - wl_list_remove(&listener->link);
1606 + wl_list_remove(&listener->link);
1608 free(notification->userdata);
1610 @@ -1480,6 +1440,12 @@ ivi_layout_get_id_of_layer(struct ivi_layout_layer *ivilayer)
1611 return ivilayer->id_layer;
1615 +ivi_layout_get_id_of_screen(struct ivi_layout_screen *iviscrn)
1617 + return iviscrn->id_screen;
1620 static struct ivi_layout_layer *
1621 ivi_layout_get_layer_from_id(uint32_t id_layer)
1623 @@ -1531,7 +1497,7 @@ ivi_layout_get_screen_resolution(struct ivi_layout_screen *iviscrn,
1625 struct weston_output *output = NULL;
1627 - if (pWidth == NULL || pHeight == NULL) {
1628 + if (iviscrn == NULL || pWidth == NULL || pHeight == NULL) {
1629 weston_log("ivi_layout_get_screen_resolution: invalid argument\n");
1632 @@ -1605,7 +1571,7 @@ ivi_layout_get_screens(int32_t *pLength, struct ivi_layout_screen ***ppArray)
1634 length = wl_list_length(&layout->screen_list);
1637 + if (length != 0) {
1638 /* the Array must be free by module which called this function */
1639 *ppArray = calloc(length, sizeof(struct ivi_layout_screen *));
1640 if (*ppArray == NULL) {
1641 @@ -1639,7 +1605,7 @@ ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
1643 length = wl_list_length(&ivilayer->screen_list);
1646 + if (length != 0) {
1647 /* the Array must be free by module which called this function */
1648 *ppArray = calloc(length, sizeof(struct ivi_layout_screen *));
1649 if (*ppArray == NULL) {
1650 @@ -1672,7 +1638,7 @@ ivi_layout_get_layers(int32_t *pLength, struct ivi_layout_layer ***ppArray)
1652 length = wl_list_length(&layout->layer_list);
1655 + if (length != 0) {
1656 /* the Array must be free by module which called this function */
1657 *ppArray = calloc(length, sizeof(struct ivi_layout_layer *));
1658 if (*ppArray == NULL) {
1659 @@ -1706,7 +1672,7 @@ ivi_layout_get_layers_on_screen(struct ivi_layout_screen *iviscrn,
1661 length = wl_list_length(&iviscrn->order.layer_list);
1664 + if (length != 0) {
1665 /* the Array must be free by module which called this function */
1666 *ppArray = calloc(length, sizeof(struct ivi_layout_layer *));
1667 if (*ppArray == NULL) {
1668 @@ -1714,7 +1680,7 @@ ivi_layout_get_layers_on_screen(struct ivi_layout_screen *iviscrn,
1672 - wl_list_for_each(ivilayer, &iviscrn->order.layer_list, link) {
1673 + wl_list_for_each(ivilayer, &iviscrn->order.layer_list, order.link) {
1674 (*ppArray)[n++] = ivilayer;
1677 @@ -1740,7 +1706,7 @@ ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf,
1679 length = wl_list_length(&ivisurf->layer_list);
1682 + if (length != 0) {
1683 /* the Array must be free by module which called this function */
1684 *ppArray = calloc(length, sizeof(struct ivi_layout_layer *));
1685 if (*ppArray == NULL) {
1686 @@ -1774,7 +1740,7 @@ ivi_layout_get_surfaces(int32_t *pLength, struct ivi_layout_surface ***ppArray)
1688 length = wl_list_length(&layout->surface_list);
1691 + if (length != 0) {
1692 /* the Array must be free by module which called this function */
1693 *ppArray = calloc(length, sizeof(struct ivi_layout_surface *));
1694 if (*ppArray == NULL) {
1695 @@ -1836,6 +1802,7 @@ ivi_layout_layer_create_with_dimension(uint32_t id_layer,
1696 ivilayer = get_layer(&layout->layer_list, id_layer);
1697 if (ivilayer != NULL) {
1698 weston_log("id_layer is already created\n");
1699 + ++ivilayer->ref_count;
1703 @@ -1845,7 +1812,7 @@ ivi_layout_layer_create_with_dimension(uint32_t id_layer,
1707 - wl_list_init(&ivilayer->link);
1708 + ivilayer->ref_count = 1;
1709 wl_signal_init(&ivilayer->property_changed);
1710 wl_list_init(&ivilayer->screen_list);
1711 wl_list_init(&ivilayer->link_to_surface);
1712 @@ -1881,7 +1848,20 @@ ivi_layout_layer_remove_notification(struct ivi_layout_layer *ivilayer)
1716 -ivi_layout_layer_remove(struct ivi_layout_layer *ivilayer)
1717 +ivi_layout_layer_remove_notification_by_callback(struct ivi_layout_layer *ivilayer,
1718 + layer_property_notification_func callback,
1721 + if (ivilayer == NULL) {
1722 + weston_log("ivi_layout_layer_remove_notification_by_callback: invalid argument\n");
1726 + remove_notification(&ivilayer->property_changed.listener_list, callback, userdata);
1730 +ivi_layout_layer_destroy(struct ivi_layout_layer *ivilayer)
1732 struct ivi_layout *layout = get_instance();
1734 @@ -1890,20 +1870,18 @@ ivi_layout_layer_remove(struct ivi_layout_layer *ivilayer)
1738 + if (--ivilayer->ref_count > 0)
1741 wl_signal_emit(&layout->layer_notification.removed, ivilayer);
1743 clear_surface_pending_list(ivilayer);
1744 clear_surface_order_list(ivilayer);
1746 - if (!wl_list_empty(&ivilayer->pending.link)) {
1747 - wl_list_remove(&ivilayer->pending.link);
1749 - if (!wl_list_empty(&ivilayer->order.link)) {
1750 - wl_list_remove(&ivilayer->order.link);
1752 - if (!wl_list_empty(&ivilayer->link)) {
1753 - wl_list_remove(&ivilayer->link);
1755 + wl_list_remove(&ivilayer->pending.link);
1756 + wl_list_remove(&ivilayer->order.link);
1757 + wl_list_remove(&ivilayer->link);
1759 remove_orderlayer_from_screen(ivilayer);
1760 remove_link_to_surface(ivilayer);
1761 ivi_layout_layer_remove_notification(ivilayer);
1762 @@ -1925,7 +1903,10 @@ ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
1763 prop = &ivilayer->pending.prop;
1764 prop->visibility = newVisibility;
1766 - ivilayer->event_mask |= IVI_NOTIFICATION_VISIBILITY;
1767 + if (ivilayer->prop.visibility != newVisibility)
1768 + ivilayer->event_mask |= IVI_NOTIFICATION_VISIBILITY;
1770 + ivilayer->event_mask &= ~IVI_NOTIFICATION_VISIBILITY;
1772 return IVI_SUCCEEDED;
1774 @@ -1947,7 +1928,9 @@ ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
1776 struct ivi_layout_layer_properties *prop = NULL;
1778 - if (ivilayer == NULL) {
1779 + if (ivilayer == NULL ||
1780 + opacity < wl_fixed_from_double(0.0) ||
1781 + wl_fixed_from_double(1.0) < opacity) {
1782 weston_log("ivi_layout_layer_set_opacity: invalid argument\n");
1785 @@ -1955,7 +1938,10 @@ ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
1786 prop = &ivilayer->pending.prop;
1787 prop->opacity = opacity;
1789 - ivilayer->event_mask |= IVI_NOTIFICATION_OPACITY;
1790 + if (ivilayer->prop.opacity != opacity)
1791 + ivilayer->event_mask |= IVI_NOTIFICATION_OPACITY;
1793 + ivilayer->event_mask &= ~IVI_NOTIFICATION_OPACITY;
1795 return IVI_SUCCEEDED;
1797 @@ -1989,7 +1975,12 @@ ivi_layout_layer_set_source_rectangle(struct ivi_layout_layer *ivilayer,
1798 prop->source_width = width;
1799 prop->source_height = height;
1801 - ivilayer->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
1802 + if (ivilayer->prop.source_x != x || ivilayer->prop.source_y != y ||
1803 + ivilayer->prop.source_width != width ||
1804 + ivilayer->prop.source_height != height)
1805 + ivilayer->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
1807 + ivilayer->event_mask &= ~IVI_NOTIFICATION_SOURCE_RECT;
1809 return IVI_SUCCEEDED;
1811 @@ -2012,7 +2003,12 @@ ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
1812 prop->dest_width = width;
1813 prop->dest_height = height;
1815 - ivilayer->event_mask |= IVI_NOTIFICATION_DEST_RECT;
1816 + if (ivilayer->prop.dest_x != x || ivilayer->prop.dest_y != y ||
1817 + ivilayer->prop.dest_width != width ||
1818 + ivilayer->prop.dest_height != height)
1819 + ivilayer->event_mask |= IVI_NOTIFICATION_DEST_RECT;
1821 + ivilayer->event_mask &= ~IVI_NOTIFICATION_DEST_RECT;
1823 return IVI_SUCCEEDED;
1825 @@ -2048,7 +2044,11 @@ ivi_layout_layer_set_dimension(struct ivi_layout_layer *ivilayer,
1826 prop->dest_width = dest_width;
1827 prop->dest_height = dest_height;
1829 - ivilayer->event_mask |= IVI_NOTIFICATION_DIMENSION;
1830 + if (ivilayer->prop.dest_width != dest_width ||
1831 + ivilayer->prop.dest_height != dest_height)
1832 + ivilayer->event_mask |= IVI_NOTIFICATION_DIMENSION;
1834 + ivilayer->event_mask &= ~IVI_NOTIFICATION_DIMENSION;
1836 return IVI_SUCCEEDED;
1838 @@ -2083,7 +2083,10 @@ ivi_layout_layer_set_position(struct ivi_layout_layer *ivilayer,
1839 prop->dest_x = dest_x;
1840 prop->dest_y = dest_y;
1842 - ivilayer->event_mask |= IVI_NOTIFICATION_POSITION;
1843 + if (ivilayer->prop.dest_x != dest_x || ivilayer->prop.dest_y != dest_y)
1844 + ivilayer->event_mask |= IVI_NOTIFICATION_POSITION;
1846 + ivilayer->event_mask &= ~IVI_NOTIFICATION_POSITION;
1848 return IVI_SUCCEEDED;
1850 @@ -2102,7 +2105,10 @@ ivi_layout_layer_set_orientation(struct ivi_layout_layer *ivilayer,
1851 prop = &ivilayer->pending.prop;
1852 prop->orientation = orientation;
1854 - ivilayer->event_mask |= IVI_NOTIFICATION_ORIENTATION;
1855 + if (ivilayer->prop.orientation != orientation)
1856 + ivilayer->event_mask |= IVI_NOTIFICATION_ORIENTATION;
1858 + ivilayer->event_mask &= ~IVI_NOTIFICATION_ORIENTATION;
1860 return IVI_SUCCEEDED;
1862 @@ -2134,17 +2140,7 @@ ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
1866 - if (pSurface == NULL) {
1867 - wl_list_for_each_safe(ivisurf, next, &ivilayer->pending.surface_list, pending.link) {
1868 - if (!wl_list_empty(&ivisurf->pending.link)) {
1869 - wl_list_remove(&ivisurf->pending.link);
1872 - wl_list_init(&ivisurf->pending.link);
1874 - ivilayer->event_mask |= IVI_NOTIFICATION_REMOVE;
1875 - return IVI_SUCCEEDED;
1877 + clear_surface_pending_list(ivilayer);
1879 for (i = 0; i < number; i++) {
1880 id_surface = &pSurface[i]->id_surface;
1881 @@ -2154,17 +2150,14 @@ ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
1885 - if (!wl_list_empty(&ivisurf->pending.link)) {
1886 - wl_list_remove(&ivisurf->pending.link);
1888 - wl_list_init(&ivisurf->pending.link);
1889 + wl_list_remove(&ivisurf->pending.link);
1890 wl_list_insert(&ivilayer->pending.surface_list,
1891 &ivisurf->pending.link);
1896 - ivilayer->event_mask |= IVI_NOTIFICATION_ADD;
1897 + ivilayer->order.dirty = 1;
1899 return IVI_SUCCEEDED;
1901 @@ -2183,7 +2176,10 @@ ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
1902 prop = &ivisurf->pending.prop;
1903 prop->visibility = newVisibility;
1905 - ivisurf->event_mask |= IVI_NOTIFICATION_VISIBILITY;
1906 + if (ivisurf->prop.visibility != newVisibility)
1907 + ivisurf->event_mask |= IVI_NOTIFICATION_VISIBILITY;
1909 + ivisurf->event_mask &= ~IVI_NOTIFICATION_VISIBILITY;
1911 return IVI_SUCCEEDED;
1913 @@ -2205,7 +2201,9 @@ ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
1915 struct ivi_layout_surface_properties *prop = NULL;
1917 - if (ivisurf == NULL) {
1918 + if (ivisurf == NULL ||
1919 + opacity < wl_fixed_from_double(0.0) ||
1920 + wl_fixed_from_double(1.0) < opacity) {
1921 weston_log("ivi_layout_surface_set_opacity: invalid argument\n");
1924 @@ -2213,7 +2211,10 @@ ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
1925 prop = &ivisurf->pending.prop;
1926 prop->opacity = opacity;
1928 - ivisurf->event_mask |= IVI_NOTIFICATION_OPACITY;
1929 + if (ivisurf->prop.opacity != opacity)
1930 + ivisurf->event_mask |= IVI_NOTIFICATION_OPACITY;
1932 + ivisurf->event_mask &= ~IVI_NOTIFICATION_OPACITY;
1934 return IVI_SUCCEEDED;
1936 @@ -2251,7 +2252,12 @@ ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
1937 prop->dest_width = width;
1938 prop->dest_height = height;
1940 - ivisurf->event_mask |= IVI_NOTIFICATION_DEST_RECT;
1941 + if (ivisurf->prop.dest_x != x || ivisurf->prop.dest_y != y ||
1942 + ivisurf->prop.dest_width != width ||
1943 + ivisurf->prop.dest_height != height)
1944 + ivisurf->event_mask |= IVI_NOTIFICATION_DEST_RECT;
1946 + ivisurf->event_mask &= ~IVI_NOTIFICATION_DEST_RECT;
1948 return IVI_SUCCEEDED;
1950 @@ -2271,7 +2277,11 @@ ivi_layout_surface_set_dimension(struct ivi_layout_surface *ivisurf,
1951 prop->dest_width = dest_width;
1952 prop->dest_height = dest_height;
1954 - ivisurf->event_mask |= IVI_NOTIFICATION_DIMENSION;
1955 + if (ivisurf->prop.dest_width != dest_width ||
1956 + ivisurf->prop.dest_height != dest_height)
1957 + ivisurf->event_mask |= IVI_NOTIFICATION_DIMENSION;
1959 + ivisurf->event_mask &= ~IVI_NOTIFICATION_DIMENSION;
1961 return IVI_SUCCEEDED;
1963 @@ -2306,7 +2316,10 @@ ivi_layout_surface_set_position(struct ivi_layout_surface *ivisurf,
1964 prop->dest_x = dest_x;
1965 prop->dest_y = dest_y;
1967 - ivisurf->event_mask |= IVI_NOTIFICATION_POSITION;
1968 + if (ivisurf->prop.dest_x != dest_x || ivisurf->prop.dest_y != dest_y)
1969 + ivisurf->event_mask |= IVI_NOTIFICATION_POSITION;
1971 + ivisurf->event_mask &= ~IVI_NOTIFICATION_POSITION;
1973 return IVI_SUCCEEDED;
1975 @@ -2340,7 +2353,10 @@ ivi_layout_surface_set_orientation(struct ivi_layout_surface *ivisurf,
1976 prop = &ivisurf->pending.prop;
1977 prop->orientation = orientation;
1979 - ivisurf->event_mask |= IVI_NOTIFICATION_ORIENTATION;
1980 + if (ivisurf->prop.orientation != orientation)
1981 + ivisurf->event_mask |= IVI_NOTIFICATION_ORIENTATION;
1983 + ivisurf->event_mask &= ~IVI_NOTIFICATION_ORIENTATION;
1985 return IVI_SUCCEEDED;
1987 @@ -2378,17 +2394,14 @@ ivi_layout_screen_add_layer(struct ivi_layout_screen *iviscrn,
1989 wl_list_for_each_safe(ivilayer, next, &layout->layer_list, link) {
1990 if (ivilayer->id_layer == addlayer->id_layer) {
1991 - if (!wl_list_empty(&ivilayer->pending.link)) {
1992 - wl_list_remove(&ivilayer->pending.link);
1994 - wl_list_init(&ivilayer->pending.link);
1995 + wl_list_remove(&ivilayer->pending.link);
1996 wl_list_insert(&iviscrn->pending.layer_list,
1997 &ivilayer->pending.link);
2002 - iviscrn->event_mask |= IVI_NOTIFICATION_ADD;
2003 + iviscrn->order.dirty = 1;
2005 return IVI_SUCCEEDED;
2007 @@ -2411,23 +2424,11 @@ ivi_layout_screen_set_render_order(struct ivi_layout_screen *iviscrn,
2009 wl_list_for_each_safe(ivilayer, next,
2010 &iviscrn->pending.layer_list, pending.link) {
2011 + wl_list_remove(&ivilayer->pending.link);
2012 wl_list_init(&ivilayer->pending.link);
2015 - wl_list_init(&iviscrn->pending.layer_list);
2017 - if (pLayer == NULL) {
2018 - wl_list_for_each_safe(ivilayer, next, &iviscrn->pending.layer_list, pending.link) {
2019 - if (!wl_list_empty(&ivilayer->pending.link)) {
2020 - wl_list_remove(&ivilayer->pending.link);
2023 - wl_list_init(&ivilayer->pending.link);
2026 - iviscrn->event_mask |= IVI_NOTIFICATION_REMOVE;
2027 - return IVI_SUCCEEDED;
2029 + assert(wl_list_empty(&iviscrn->pending.layer_list));
2031 for (i = 0; i < number; i++) {
2032 id_layer = &pLayer[i]->id_layer;
2033 @@ -2436,17 +2437,14 @@ ivi_layout_screen_set_render_order(struct ivi_layout_screen *iviscrn,
2037 - if (!wl_list_empty(&ivilayer->pending.link)) {
2038 - wl_list_remove(&ivilayer->pending.link);
2040 - wl_list_init(&ivilayer->pending.link);
2041 + wl_list_remove(&ivilayer->pending.link);
2042 wl_list_insert(&iviscrn->pending.layer_list,
2043 &ivilayer->pending.link);
2048 - iviscrn->event_mask |= IVI_NOTIFICATION_ADD;
2049 + iviscrn->order.dirty = 1;
2051 return IVI_SUCCEEDED;
2053 @@ -2555,17 +2553,14 @@ ivi_layout_layer_add_surface(struct ivi_layout_layer *ivilayer,
2055 wl_list_for_each_safe(ivisurf, next, &layout->surface_list, link) {
2056 if (ivisurf->id_surface == addsurf->id_surface) {
2057 - if (!wl_list_empty(&ivisurf->pending.link)) {
2058 - wl_list_remove(&ivisurf->pending.link);
2060 - wl_list_init(&ivisurf->pending.link);
2061 + wl_list_remove(&ivisurf->pending.link);
2062 wl_list_insert(&ivilayer->pending.surface_list,
2063 &ivisurf->pending.link);
2068 - ivilayer->event_mask |= IVI_NOTIFICATION_ADD;
2069 + ivilayer->order.dirty = 1;
2071 return IVI_SUCCEEDED;
2073 @@ -2585,15 +2580,13 @@ ivi_layout_layer_remove_surface(struct ivi_layout_layer *ivilayer,
2074 wl_list_for_each_safe(ivisurf, next,
2075 &ivilayer->pending.surface_list, pending.link) {
2076 if (ivisurf->id_surface == remsurf->id_surface) {
2077 - if (!wl_list_empty(&ivisurf->pending.link)) {
2078 - wl_list_remove(&ivisurf->pending.link);
2080 + wl_list_remove(&ivisurf->pending.link);
2081 wl_list_init(&ivisurf->pending.link);
2086 - remsurf->event_mask |= IVI_NOTIFICATION_REMOVE;
2087 + ivilayer->order.dirty = 1;
2091 @@ -2614,7 +2607,12 @@ ivi_layout_surface_set_source_rectangle(struct ivi_layout_surface *ivisurf,
2092 prop->source_width = width;
2093 prop->source_height = height;
2095 - ivisurf->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
2096 + if (ivisurf->prop.source_x != x || ivisurf->prop.source_y != y ||
2097 + ivisurf->prop.source_width != width ||
2098 + ivisurf->prop.source_height != height)
2099 + ivisurf->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
2101 + ivisurf->event_mask &= ~IVI_NOTIFICATION_SOURCE_RECT;
2103 return IVI_SUCCEEDED;
2105 @@ -2731,7 +2729,7 @@ ivi_layout_get_weston_view(struct ivi_layout_surface *surface)
2107 struct weston_view *tmpview = NULL;
2109 - if(surface == NULL)
2110 + if (surface == NULL)
2113 wl_list_for_each(tmpview, &surface->surface->views, surface_link)
2114 @@ -2796,7 +2794,6 @@ ivi_layout_surface_create(struct weston_surface *wl_surface,
2118 - wl_list_init(&ivisurf->link);
2119 wl_signal_init(&ivisurf->property_changed);
2120 wl_signal_init(&ivisurf->configured);
2121 wl_list_init(&ivisurf->layer_list);
2122 @@ -2804,10 +2801,6 @@ ivi_layout_surface_create(struct weston_surface *wl_surface,
2123 ivisurf->layout = layout;
2125 ivisurf->surface = wl_surface;
2126 - ivisurf->surface_destroy_listener.notify =
2127 - westonsurface_destroy_from_ivisurface;
2128 - wl_resource_add_destroy_listener(wl_surface->resource,
2129 - &ivisurf->surface_destroy_listener);
2131 tmpview = weston_view_create(wl_surface);
2132 if (tmpview == NULL) {
2133 @@ -2817,17 +2810,8 @@ ivi_layout_surface_create(struct weston_surface *wl_surface,
2134 ivisurf->surface->width_from_buffer = 0;
2135 ivisurf->surface->height_from_buffer = 0;
2137 - weston_matrix_init(&ivisurf->surface_rotation.matrix);
2138 - weston_matrix_init(&ivisurf->layer_rotation.matrix);
2139 - weston_matrix_init(&ivisurf->surface_pos.matrix);
2140 - weston_matrix_init(&ivisurf->layer_pos.matrix);
2141 - weston_matrix_init(&ivisurf->scaling.matrix);
2143 - wl_list_init(&ivisurf->surface_rotation.link);
2144 - wl_list_init(&ivisurf->layer_rotation.link);
2145 - wl_list_init(&ivisurf->surface_pos.link);
2146 - wl_list_init(&ivisurf->layer_pos.link);
2147 - wl_list_init(&ivisurf->scaling.link);
2148 + weston_matrix_init(&ivisurf->transform.matrix);
2149 + wl_list_init(&ivisurf->transform.link);
2151 init_surface_properties(&ivisurf->prop);
2152 ivisurf->event_mask = 0;
2153 @@ -2927,7 +2911,7 @@ static struct ivi_controller_interface ivi_controller_interface = {
2154 .add_notification_remove_layer = ivi_layout_add_notification_remove_layer,
2155 .remove_notification_remove_layer = ivi_layout_remove_notification_remove_layer,
2156 .layer_create_with_dimension = ivi_layout_layer_create_with_dimension,
2157 - .layer_remove = ivi_layout_layer_remove,
2158 + .layer_destroy = ivi_layout_layer_destroy,
2159 .get_layers = ivi_layout_get_layers,
2160 .get_id_of_layer = ivi_layout_get_id_of_layer,
2161 .get_layer_from_id = ivi_layout_get_layer_from_id,
2162 @@ -2954,7 +2938,7 @@ static struct ivi_controller_interface ivi_controller_interface = {
2163 .layer_set_transition = ivi_layout_layer_set_transition,
2166 - * screen controller interfaces
2167 + * screen controller interfaces part1
2169 .get_screen_from_id = ivi_layout_get_screen_from_id,
2170 .get_screen_resolution = ivi_layout_get_screen_resolution,
2171 @@ -2975,6 +2959,17 @@ static struct ivi_controller_interface ivi_controller_interface = {
2173 .surface_get_size = ivi_layout_surface_get_size,
2174 .surface_dump = ivi_layout_surface_dump,
2177 + * remove notification by callback on property changes of ivi_surface/layer
2179 + .surface_remove_notification_by_callback = ivi_layout_surface_remove_notification_by_callback,
2180 + .layer_remove_notification_by_callback = ivi_layout_layer_remove_notification_by_callback,
2183 + * screen controller interfaces part2
2185 + .get_id_of_screen = ivi_layout_get_id_of_screen
2189 diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
2190 index 4a688cc..4c63410 100644
2191 --- a/ivi-shell/ivi-shell.c
2192 +++ b/ivi-shell/ivi-shell.c
2195 * Copyright (C) 2013 DENSO CORPORATION
2197 - * Permission to use, copy, modify, distribute, and sell this software and
2198 - * its documentation for any purpose is hereby granted without fee, provided
2199 - * that the above copyright notice appear in all copies and that both that
2200 - * copyright notice and this permission notice appear in supporting
2201 - * documentation, and that the name of the copyright holders not be used in
2202 - * advertising or publicity pertaining to distribution of the software
2203 - * without specific, written prior permission. The copyright holders make
2204 - * no representations about the suitability of this software for any
2205 - * purpose. It is provided "as is" without express or implied warranty.
2206 + * Permission is hereby granted, free of charge, to any person obtaining
2207 + * a copy of this software and associated documentation files (the
2208 + * "Software"), to deal in the Software without restriction, including
2209 + * without limitation the rights to use, copy, modify, merge, publish,
2210 + * distribute, sublicense, and/or sell copies of the Software, and to
2211 + * permit persons to whom the Software is furnished to do so, subject to
2212 + * the following conditions:
2214 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
2215 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
2216 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
2217 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
2218 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
2219 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
2220 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2221 + * The above copyright notice and this permission notice (including the
2222 + * next paragraph) shall be included in all copies or substantial
2223 + * portions of the Software.
2225 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2226 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2227 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2228 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2229 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2230 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2231 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2236 @@ -126,6 +129,22 @@ ivi_shell_surface_configure(struct weston_surface *surface,
2241 +layout_surface_cleanup(struct ivi_shell_surface *ivisurf)
2243 + assert(ivisurf->layout_surface != NULL);
2245 + ivi_layout_surface_destroy(ivisurf->layout_surface);
2246 + ivisurf->layout_surface = NULL;
2248 + ivisurf->surface->configure = NULL;
2249 + ivisurf->surface->configure_private = NULL;
2250 + ivisurf->surface = NULL;
2252 + // destroy weston_surface destroy signal.
2253 + wl_list_remove(&ivisurf->surface_destroy_listener.link);
2257 * The ivi_surface wl_resource destructor.
2259 @@ -135,9 +154,18 @@ static void
2260 shell_destroy_shell_surface(struct wl_resource *resource)
2262 struct ivi_shell_surface *ivisurf = wl_resource_get_user_data(resource);
2263 - if (ivisurf != NULL) {
2264 - ivisurf->resource = NULL;
2267 + if (ivisurf == NULL)
2270 + assert(ivisurf->resource == resource);
2272 + if (ivisurf->layout_surface != NULL)
2273 + layout_surface_cleanup(ivisurf);
2275 + wl_list_remove(&ivisurf->link);
2280 /* Gets called through the weston_surface destroy signal. */
2281 @@ -150,21 +178,8 @@ shell_handle_surface_destroy(struct wl_listener *listener, void *data)
2283 assert(ivisurf != NULL);
2285 - if (ivisurf->surface!=NULL) {
2286 - ivisurf->surface->configure = NULL;
2287 - ivisurf->surface->configure_private = NULL;
2288 - ivisurf->surface = NULL;
2291 - wl_list_remove(&ivisurf->surface_destroy_listener.link);
2292 - wl_list_remove(&ivisurf->link);
2294 - if (ivisurf->resource != NULL) {
2295 - wl_resource_set_user_data(ivisurf->resource, NULL);
2296 - ivisurf->resource = NULL;
2300 + if (ivisurf->layout_surface != NULL)
2301 + layout_surface_cleanup(ivisurf);
2304 /* Gets called, when a client sends ivi_surface.destroy request. */
2305 @@ -219,7 +234,7 @@ application_surface_create(struct wl_client *client,
2306 layout_surface = ivi_layout_surface_create(weston_surface, id_surface);
2308 /* check if id_ivi is already used for wl_surface*/
2309 - if (layout_surface == NULL){
2310 + if (layout_surface == NULL) {
2311 wl_resource_post_error(resource,
2312 IVI_APPLICATION_ERROR_IVI_ID,
2313 "surface_id is already assigned "
2314 @@ -338,8 +353,8 @@ shell_destroy(struct wl_listener *listener, void *data)
2318 -terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
2320 +terminate_binding(struct weston_seat *seat, uint32_t time,
2321 + uint32_t key, void *data)
2323 struct weston_compositor *compositor = data;
2325 @@ -423,6 +438,8 @@ module_init(struct weston_compositor *compositor,
2326 if (input_panel_setup(shell) < 0)
2329 + text_backend_init(compositor);
2331 if (wl_global_create(compositor->wl_display,
2332 &ivi_application_interface, 1,
2333 shell, bind_ivi_application) == NULL)
2334 diff --git a/ivi-shell/ivi-shell.h b/ivi-shell/ivi-shell.h
2335 index 2f42173..9a05eb2 100644
2336 --- a/ivi-shell/ivi-shell.h
2337 +++ b/ivi-shell/ivi-shell.h
2340 * Copyright (C) 2013 DENSO CORPORATION
2342 - * Permission to use, copy, modify, distribute, and sell this software and
2343 - * its documentation for any purpose is hereby granted without fee, provided
2344 - * that the above copyright notice appear in all copies and that both that
2345 - * copyright notice and this permission notice appear in supporting
2346 - * documentation, and that the name of the copyright holders not be used in
2347 - * advertising or publicity pertaining to distribution of the software
2348 - * without specific, written prior permission. The copyright holders make
2349 - * no representations about the suitability of this software for any
2350 - * purpose. It is provided "as is" without express or implied warranty.
2351 + * Permission is hereby granted, free of charge, to any person obtaining
2352 + * a copy of this software and associated documentation files (the
2353 + * "Software"), to deal in the Software without restriction, including
2354 + * without limitation the rights to use, copy, modify, merge, publish,
2355 + * distribute, sublicense, and/or sell copies of the Software, and to
2356 + * permit persons to whom the Software is furnished to do so, subject to
2357 + * the following conditions:
2359 - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
2360 - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
2361 - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
2362 - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
2363 - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
2364 - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
2365 - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2366 + * The above copyright notice and this permission notice (including the
2367 + * next paragraph) shall be included in all copies or substantial
2368 + * portions of the Software.
2370 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2371 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2372 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2373 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2374 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2375 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2376 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2380 #include <stdbool.h>
2381 @@ -32,6 +35,8 @@ struct ivi_shell
2383 struct wl_list ivi_surface_list; /* struct ivi_shell_surface::link */
2385 + struct text_backend *text_backend;
2387 struct wl_listener show_input_panel_listener;
2388 struct wl_listener hide_input_panel_listener;
2389 struct wl_listener update_input_panel_listener;