Introduce meta-agl-profile-core and meta-agl-profile-graphics
[AGL/meta-agl.git] / meta-agl-profile-graphical / recipes-graphics / wayland / weston / 0004-layout-interface-added-interface-to-change-surface-id.patch
1 index e1e897ed..5b1f12f0 100644
2 --- a/ivi-shell/ivi-layout-export.h
3 +++ b/ivi-shell/ivi-layout-export.h
4 @@ -320,6 +320,12 @@ struct ivi_layout_interface {
5                                         struct ivi_layout_surface *ivisurf,
6                                         uint32_t duration);
7  
8 +       /**
9 +        * \brief set id of ivi_layout_surface
10 +        */
11 +       int32_t (*surface_set_id)(struct ivi_layout_surface *ivisurf,
12 +                                 uint32_t id_surface);
13 +
14         /**
15          * layer controller interface
16          */
17 diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
18 index 298e18ea..fa8e75f6 100644
19 --- a/ivi-shell/ivi-layout.c
20 +++ b/ivi-shell/ivi-layout.c
21 @@ -1901,6 +1901,44 @@ ivi_layout_surface_set_transition_duration(struct ivi_layout_surface *ivisurf,
22         return 0;
23  }
24  
25 +/*
26 + * This interface enables e.g. an id agent to set the id of an ivi-layout
27 + * surface, that has been created by a desktop application. This can only be
28 + * done once as long as the initial surface id equals IVI_INVALID_ID. Afterwards
29 + * two events are emitted, namely surface_created and surface_configured.
30 + */
31 +static int32_t
32 +ivi_layout_surface_set_id(struct ivi_layout_surface *ivisurf,
33 +                         uint32_t id_surface)
34 +{
35 +       struct ivi_layout *layout = get_instance();
36 +       struct ivi_layout_surface *search_ivisurf = NULL;
37 +
38 +       if (!ivisurf) {
39 +               weston_log("%s: invalid argument\n", __func__);
40 +               return IVI_FAILED;
41 +       }
42 +
43 +       if (ivisurf->id_surface != IVI_INVALID_ID) {
44 +               weston_log("surface id can only be set once\n");
45 +               return IVI_FAILED;
46 +       }
47 +
48 +       search_ivisurf = get_surface(&layout->surface_list, id_surface);
49 +       if (search_ivisurf) {
50 +               weston_log("id_surface(%d) is already created\n", id_surface);
51 +               return IVI_FAILED;
52 +       }
53 +
54 +       ivisurf->id_surface = id_surface;
55 +
56 +       wl_signal_emit(&layout->surface_notification.created, ivisurf);
57 +       wl_signal_emit(&layout->surface_notification.configure_changed,
58 +                      ivisurf);
59 +
60 +       return IVI_SUCCEEDED;
61 +}
62 +
63  static int32_t
64  ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
65                                   enum ivi_layout_transition_type type,
66 @@ -2058,6 +2096,7 @@ static struct ivi_layout_interface ivi_layout_interface = {
67         .surface_get_weston_surface             = ivi_layout_surface_get_weston_surface,
68         .surface_set_transition                 = ivi_layout_surface_set_transition,
69         .surface_set_transition_duration        = ivi_layout_surface_set_transition_duration,
70 +       .surface_set_id                         = ivi_layout_surface_set_id,
71  
72         /**
73          * layer controller interfaces