libweston/desktop: committed when transiting from valid to invalid buffer

Every shells have an implementation of weston_desktop_api structures.
It includes some callbacks to listen to xdg_surface signals. Committed callback
is one of them.

Currently, the xdg_shell don't invoke the weston_desktop_api->committed
callback when the xdg_surface is initial stage or no surface content.

In the case: the client attached a null buffer after the valid buffer,
the shell isn't going to invoke to xdg_surface committed, and don't know
the surface is disappeared. If the surface is fullscreen, we will get
a black background on the screen until a new valid frame come. That
should not happen.

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
This commit is contained in:
Tran Ba Khang(MS/EMC31-XC) 2023-02-01 17:25:28 +07:00 committed by Marius Vlad
parent 7ba87d7062
commit 776fafe13a
3 changed files with 21 additions and 3 deletions

View file

@ -2064,8 +2064,16 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
bool was_fullscreen, should_set_fullscreen;
bool was_maximized, should_set_maximized;
if (surface->width == 0)
if (!weston_surface_has_content(surface) &&
weston_surface_is_unmapping(surface) &&
shsurf->state.fullscreen) {
unset_fullscreen(shsurf);
return;
}
if (surface->width == 0) {
return;
}
was_fullscreen = shsurf->state.fullscreen;
was_maximized = shsurf->state.maximized;

View file

@ -649,8 +649,13 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
weston_desktop_xdg_toplevel_ensure_added(toplevel);
return;
}
if (!weston_surface_has_content(wsurface))
if (!weston_surface_has_content(wsurface)) {
if (weston_surface_is_unmapping(wsurface))
weston_desktop_api_committed(toplevel->base.desktop,
toplevel->base.desktop_surface, sx, sy);
return;
}
struct weston_geometry geometry =
weston_desktop_surface_get_geometry(toplevel->base.desktop_surface);

View file

@ -732,8 +732,13 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
weston_desktop_xdg_toplevel_ensure_added(toplevel);
return;
}
if (!weston_surface_has_content(wsurface))
if (!weston_surface_has_content(wsurface)) {
if (weston_surface_is_unmapping(wsurface))
weston_desktop_api_committed(toplevel->base.desktop,
toplevel->base.desktop_surface, sx, sy);
return;
}
struct weston_geometry geometry =
weston_desktop_surface_get_geometry(toplevel->base.desktop_surface);