From 924e79f4f254bf17caba5d5bb0c6196039296ddf Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Wed, 17 Mar 2021 13:58:29 +0100 Subject: [PATCH] ivi-shell: emit created notification earlier for desktop surfaces Without this, the earliest signal the ivi controller receives for a new surface is configure_desktop_changed signal. And this is not emitted until the surface has the first buffer attached. By emitting the signal during surface creation, the controller is able to set the initial width and height for the first configure. Signed-off-by: Michael Olbrich --- ivi-shell/ivi-layout-shell.h | 3 ++- ivi-shell/ivi-layout.c | 16 +++++++++++++--- ivi-shell/ivi-shell.c | 4 +--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ivi-shell/ivi-layout-shell.h b/ivi-shell/ivi-layout-shell.h index 63f66fa9..1c10a8ba 100644 --- a/ivi-shell/ivi-layout-shell.h +++ b/ivi-shell/ivi-layout-shell.h @@ -44,7 +44,8 @@ ivi_layout_desktop_surface_configure(struct ivi_layout_surface *ivisurf, int32_t width, int32_t height); struct ivi_layout_surface* -ivi_layout_desktop_surface_create(struct weston_surface *wl_surface); +ivi_layout_desktop_surface_create(struct weston_surface *wl_surface, + struct weston_desktop_surface *surface); void ivi_layout_surface_configure(struct ivi_layout_surface *ivisurf, diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 0f0f4f8a..e685e356 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -1882,7 +1882,6 @@ ivi_layout_surface_set_id(struct ivi_layout_surface *ivisurf, ivisurf->id_surface = id_surface; - wl_signal_emit(&layout->surface_notification.created, ivisurf); wl_signal_emit(&layout->surface_notification.configure_changed, ivisurf); @@ -1979,9 +1978,20 @@ ivi_layout_desktop_surface_configure(struct ivi_layout_surface *ivisurf, } struct ivi_layout_surface* -ivi_layout_desktop_surface_create(struct weston_surface *wl_surface) +ivi_layout_desktop_surface_create(struct weston_surface *wl_surface, + struct weston_desktop_surface *surface) { - return surface_create(wl_surface, IVI_INVALID_ID); + struct ivi_layout *layout = get_instance(); + struct ivi_layout_surface *ivisurf; + + ivisurf = surface_create(wl_surface, IVI_INVALID_ID); + + if (ivisurf) { + ivisurf->weston_desktop_surface = surface; + wl_signal_emit(&layout->surface_notification.created, ivisurf); + } + + return ivisurf; } void diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c index 5ec1349e..eb6bbbe7 100644 --- a/ivi-shell/ivi-shell.c +++ b/ivi-shell/ivi-shell.c @@ -489,13 +489,11 @@ desktop_surface_added(struct weston_desktop_surface *surface, struct weston_surface *weston_surf = weston_desktop_surface_get_surface(surface); - layout_surface = ivi_layout_desktop_surface_create(weston_surf); + layout_surface = ivi_layout_desktop_surface_create(weston_surf, surface); if (!layout_surface) { return; } - layout_surface->weston_desktop_surface = surface; - ivisurf = zalloc(sizeof *ivisurf); if (!ivisurf) { return;