Introduce meta-agl-profile-core and meta-agl-profile-graphics
[AGL/meta-agl.git] / meta-agl-profile-graphical / recipes-graphics / wayland / weston / 0009-ivi-shell-added-libweston-desktop-api_implementation.patch
1 index 84db2c97..e797e4f9 100644
2 --- a/ivi-shell/ivi-shell.c
3 +++ b/ivi-shell/ivi-shell.c
4 @@ -489,6 +489,162 @@ shell_add_bindings(struct weston_compositor *compositor,
5                                             shell);
6  }
7  
8 +/*
9 + * libweston-desktop
10 + */
11 +
12 +static void
13 +desktop_surface_ping_timeout(struct weston_desktop_client *client,
14 +                            void *user_data)
15 +{
16 +       weston_log("ivi-shell: desktop_surface_ping_timeout is not supported\n");
17 +}
18 +
19 +static void
20 +desktop_surface_pong(struct weston_desktop_client *client,
21 +                    void *user_data)
22 +{
23 +       weston_log("ivi-shell: desktop_surface_pong is not supported\n");
24 +}
25 +
26 +static void
27 +desktop_surface_added(struct weston_desktop_surface *surface,
28 +                     void *user_data)
29 +{
30 +       struct ivi_shell *shell = (struct ivi_shell *) user_data;
31 +       struct ivi_layout_surface *layout_surface;
32 +       struct ivi_shell_surface *ivisurf;
33 +       struct weston_surface *weston_surf =
34 +                       weston_desktop_surface_get_surface(surface);
35 +
36 +       layout_surface = ivi_layout_desktop_surface_create(weston_surf,
37 +                                                      IVI_INVALID_ID);
38 +       if (!layout_surface) {
39 +               return;
40 +       }
41 +
42 +       layout_surface->weston_desktop_surface = surface;
43 +
44 +       ivisurf = zalloc(sizeof *ivisurf);
45 +       if (!ivisurf) {
46 +               return;
47 +       }
48 +
49 +       ivisurf->shell = shell;
50 +       ivisurf->id_surface = IVI_INVALID_ID;
51 +
52 +       ivisurf->width = 0;
53 +       ivisurf->height = 0;
54 +       ivisurf->layout_surface = layout_surface;
55 +       ivisurf->surface = weston_surf;
56 +
57 +       weston_desktop_surface_set_user_data(surface, ivisurf);
58 +}
59 +
60 +static void
61 +desktop_surface_removed(struct weston_desktop_surface *surface,
62 +                       void *user_data)
63 +{
64 +       struct ivi_shell_surface *ivisurf = (struct ivi_shell_surface *)
65 +                       weston_desktop_surface_get_user_data(surface);
66 +
67 +       assert(ivisurf != NULL);
68 +
69 +       if (ivisurf->layout_surface)
70 +               layout_surface_cleanup(ivisurf);
71 +}
72 +
73 +static void
74 +desktop_surface_committed(struct weston_desktop_surface *surface,
75 +                         int32_t sx, int32_t sy, void *user_data)
76 +{
77 +       struct ivi_shell_surface *ivisurf = (struct ivi_shell_surface *)
78 +                       weston_desktop_surface_get_user_data(surface);
79 +       struct weston_surface *weston_surf =
80 +                       weston_desktop_surface_get_surface(surface);
81 +
82 +       if(!ivisurf)
83 +               return;
84 +
85 +       if (weston_surf->width == 0 || weston_surf->height == 0)
86 +               return;
87 +
88 +       if (ivisurf->width != weston_surf->width ||
89 +           ivisurf->height != weston_surf->height) {
90 +               ivisurf->width  = weston_surf->width;
91 +               ivisurf->height = weston_surf->height;
92 +
93 +               ivi_layout_desktop_surface_configure(ivisurf->layout_surface,
94 +                                                weston_surf->width,
95 +                                                weston_surf->height);
96 +       }
97 +}
98 +
99 +static void
100 +desktop_surface_move(struct weston_desktop_surface *surface,
101 +                    struct weston_seat *seat, uint32_t serial, void *user_data)
102 +{
103 +       weston_log("ivi-shell: desktop_surface_move is not supported\n");
104 +}
105 +
106 +static void
107 +desktop_surface_resize(struct weston_desktop_surface *surface,
108 +                      struct weston_seat *seat, uint32_t serial,
109 +                      enum weston_desktop_surface_edge edges, void *user_data)
110 +{
111 +       weston_log("ivi-shell: desktop_surface_resize is not supported\n");
112 +}
113 +
114 +static void
115 +desktop_surface_fullscreen_requested(struct weston_desktop_surface *surface,
116 +                                    bool fullscreen,
117 +                                    struct weston_output *output,
118 +                                    void *user_data)
119 +{
120 +       weston_log("ivi-shell: desktop_surface_fullscreen_requested is not supported\n");
121 +}
122 +
123 +static void
124 +desktop_surface_maximized_requested(struct weston_desktop_surface *surface,
125 +                                   bool maximized, void *user_data)
126 +{
127 +       weston_log("ivi-shell: desktop_surface_maximized_requested is not supported\n");
128 +}
129 +
130 +static void
131 +desktop_surface_minimized_requested(struct weston_desktop_surface *surface,
132 +                                   void *user_data)
133 +{
134 +       weston_log("ivi-shell: desktop_surface_minimized_requested is not supported\n");
135 +}
136 +
137 +static void
138 +desktop_surface_set_xwayland_position(struct weston_desktop_surface *surface,
139 +                                     int32_t x, int32_t y, void *user_data)
140 +{
141 +       weston_log("ivi-shell: desktop_surface_set_xwayland_position is not supported\n");
142 +}
143 +
144 +static const struct weston_desktop_api shell_desktop_api = {
145 +       .struct_size = sizeof(struct weston_desktop_api),
146 +       .ping_timeout = desktop_surface_ping_timeout,
147 +       .pong = desktop_surface_pong,
148 +       .surface_added = desktop_surface_added,
149 +       .surface_removed = desktop_surface_removed,
150 +       .committed = desktop_surface_committed,
151 +
152 +       .move = desktop_surface_move,
153 +       .resize = desktop_surface_resize,
154 +       .fullscreen_requested = desktop_surface_fullscreen_requested,
155 +       .maximized_requested = desktop_surface_maximized_requested,
156 +       .minimized_requested = desktop_surface_minimized_requested,
157 +       .set_xwayland_position = desktop_surface_set_xwayland_position,
158 +};
159 +
160 +/*
161 + * end of libweston-desktop
162 + */
163 +
164  /*
165   * Initialization of ivi-shell.
166   */