c5d85bb17dc99d8ac33744a23c1116c5295dd675
[AGL/meta-agl.git] / meta-agl-profile-graphical / recipes-graphics / wayland / weston / 0012-hmi-controller-register-for-desktop_surface_configured.patch
1 index d5403e06..7b2f2707 100644
2 --- a/ivi-shell/hmi-controller.c
3 +++ b/ivi-shell/hmi-controller.c
4 @@ -129,9 +129,9 @@ struct hmi_controller {
5         struct weston_compositor           *compositor;
6         struct wl_listener                  destroy_listener;
7  
8 -       struct wl_listener                  surface_created;
9         struct wl_listener                  surface_removed;
10         struct wl_listener                  surface_configured;
11 +       struct wl_listener                  desktop_surface_configured;
12  
13         struct wl_client                   *user_interface;
14         struct ui_setting                   ui_setting;
15 @@ -581,28 +581,6 @@ create_layer(struct weston_output *output,
16  /**
17   * Internal set notification
18   */
19 -static void
20 -set_notification_create_surface(struct wl_listener *listener, void *data)
21 -{
22 -       struct hmi_controller *hmi_ctrl =
23 -                       wl_container_of(listener, hmi_ctrl,
24 -                                       surface_created);
25 -       struct ivi_layout_surface *ivisurf = data;
26 -       struct hmi_controller_layer *layer_link =
27 -                                       wl_container_of(hmi_ctrl->application_layer_list.prev,
28 -                                                       layer_link,
29 -                                                       link);
30 -       struct ivi_layout_layer *application_layer = layer_link->ivilayer;
31 -       int32_t ret = 0;
32 -
33 -       /* skip ui widgets */
34 -       if (is_surf_in_ui_widget(hmi_ctrl, ivisurf))
35 -               return;
36 -
37 -       ret = ivi_layout_interface->layer_add_surface(application_layer, ivisurf);
38 -       assert(!ret);
39 -}
40 -
41  static void
42  set_notification_remove_surface(struct wl_listener *listener, void *data)
43  {
44 @@ -670,6 +648,42 @@ set_notification_configure_surface(struct wl_listener *listener, void *data)
45         switch_mode(hmi_ctrl, hmi_ctrl->layout_mode);
46  }
47  
48 +static void
49 +set_notification_configure_desktop_surface(struct wl_listener *listener, void *data)
50 +{
51 +       struct hmi_controller *hmi_ctrl =
52 +                       wl_container_of(listener, hmi_ctrl,
53 +                                       desktop_surface_configured);
54 +       struct ivi_layout_surface *ivisurf = data;
55 +       struct hmi_controller_layer *layer_link =
56 +                                       wl_container_of(hmi_ctrl->application_layer_list.prev,
57 +                                                       layer_link,
58 +                                                       link);
59 +       struct ivi_layout_layer *application_layer = layer_link->ivilayer;
60 +       struct weston_surface *surface;
61 +       int32_t ret = 0;
62 +
63 +       /* skip ui widgets */
64 +       if (is_surf_in_ui_widget(hmi_ctrl, ivisurf))
65 +               return;
66 +
67 +       ret = ivi_layout_interface->layer_add_surface(application_layer, ivisurf);
68 +       assert(!ret);
69 +
70 +       /*
71 +        * if application changes size of wl_buffer. The source rectangle shall be
72 +        * fit to the size.
73 +        */
74 +       surface = ivi_layout_interface->surface_get_weston_surface(ivisurf);
75 +       if (surface) {
76 +               ivi_layout_interface->surface_set_source_rectangle(ivisurf, 0,
77 +                               0, surface->width, surface->height);
78 +       }
79 +
80 +       ivi_layout_interface->commit_changes();
81 +       switch_mode(hmi_ctrl, hmi_ctrl->layout_mode);
82 +}
83 +
84  /**
85   * A hmi_controller used 4 ivi_layers to manage ivi_surfaces. The IDs of
86   * corresponding ivi_layer are defined in weston.ini. Default scene graph
87 @@ -852,6 +866,9 @@ hmi_controller_create(struct weston_compositor *ec)
88         hmi_ctrl->surface_configured.notify = set_notification_configure_surface;
89         ivi_layout_interface->add_listener_configure_surface(&hmi_ctrl->surface_configured);
90  
91 +       hmi_ctrl->desktop_surface_configured.notify = set_notification_configure_desktop_surface;
92 +       ivi_layout_interface->add_listener_configure_desktop_surface(&hmi_ctrl->desktop_surface_configured);
93 +
94         hmi_ctrl->destroy_listener.notify = hmi_controller_destroy;
95         wl_signal_add(&hmi_ctrl->compositor->destroy_signal,
96                       &hmi_ctrl->destroy_listener);
97 @@ -1275,13 +1292,6 @@ ivi_hmi_controller_UI_ready(struct wl_client *client,
98         ivi_layout_interface->commit_changes();
99  
100         ivi_hmi_controller_add_launchers(hmi_ctrl, 256);
101 -
102 -       /* Add surface_created listener after the initialization of launchers.
103 -        * Otherwise, surfaces of the launchers will be added to application
104 -        * layer too.*/
105 -       hmi_ctrl->surface_created.notify = set_notification_create_surface;
106 -       ivi_layout_interface->add_listener_create_surface(&hmi_ctrl->surface_created);
107 -
108         hmi_ctrl->is_initialized = 1;
109  }
110  
111 diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
112 index 6b854503..22d63708 100644
113 --- a/ivi-shell/ivi-layout.c
114 +++ b/ivi-shell/ivi-layout.c
115 @@ -787,9 +787,15 @@ commit_surface_list(struct ivi_layout *layout)
116                         ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
117  
118                         if (configured && !is_surface_transition(ivisurf)) {
119 -                               shell_surface_send_configure(ivisurf->surface,
120 -                                                            ivisurf->prop.dest_width,
121 -                                                            ivisurf->prop.dest_height);
122 +                               if (ivisurf->weston_desktop_surface) {
123 +                                       weston_desktop_surface_set_size(ivisurf->weston_desktop_surface,
124 +                                                                       ivisurf->prop.dest_width,
125 +                                                                       ivisurf->prop.dest_height);
126 +                               } else {
127 +                                       shell_surface_send_configure(ivisurf->surface,
128 +                                                                    ivisurf->prop.dest_width,
129 +                                                                    ivisurf->prop.dest_height);
130 +                               }
131                         }
132                 } else {
133                         configured = 0;