mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-01 18:58:34 +00:00
libweston: support API to detect an unmapping commit of surface
Add the weston_surface_is_unmapping() api, this will help the shell to detect the commit of a surface is unmapping or not. Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net> Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
This commit is contained in:
parent
51ef88a7f4
commit
7ba87d7062
|
@ -1718,7 +1718,7 @@ struct weston_surface {
|
|||
*/
|
||||
const char *role_name;
|
||||
|
||||
bool is_mapped;
|
||||
bool is_mapped, is_unmapping;
|
||||
bool is_opaque;
|
||||
|
||||
/* An list of per seat pointer constraints. */
|
||||
|
@ -1994,6 +1994,9 @@ weston_view_schedule_repaint(struct weston_view *view);
|
|||
bool
|
||||
weston_surface_is_mapped(struct weston_surface *surface);
|
||||
|
||||
bool
|
||||
weston_surface_is_unmapping(struct weston_surface *surface);
|
||||
|
||||
void
|
||||
weston_surface_set_size(struct weston_surface *surface,
|
||||
int32_t width, int32_t height);
|
||||
|
|
|
@ -1806,6 +1806,18 @@ weston_surface_is_mapped(struct weston_surface *surface)
|
|||
return surface->is_mapped;
|
||||
}
|
||||
|
||||
/** Check if the weston_surface is emitting an unmapping commit
|
||||
*
|
||||
* @param surface The weston_surface.
|
||||
*
|
||||
* Returns true if the surface is emitting an unmapping commit.
|
||||
*/
|
||||
WL_EXPORT bool
|
||||
weston_surface_is_unmapping(struct weston_surface *surface)
|
||||
{
|
||||
return surface->is_unmapping;
|
||||
}
|
||||
|
||||
static void
|
||||
surface_set_size(struct weston_surface *surface, int32_t width, int32_t height)
|
||||
{
|
||||
|
@ -2570,8 +2582,11 @@ weston_surface_attach(struct weston_surface *surface,
|
|||
BUFFER_WILL_NOT_BE_ACCESSED);
|
||||
|
||||
if (!buffer) {
|
||||
if (weston_surface_is_mapped(surface))
|
||||
if (weston_surface_is_mapped(surface)) {
|
||||
weston_surface_unmap(surface);
|
||||
/* This is the unmapping commit */
|
||||
surface->is_unmapping = true;
|
||||
}
|
||||
}
|
||||
|
||||
surface->compositor->renderer->attach(surface, buffer);
|
||||
|
@ -4007,6 +4022,9 @@ weston_surface_commit_state(struct weston_surface *surface,
|
|||
weston_surface_set_desired_protection(surface, state->desired_protection);
|
||||
|
||||
wl_signal_emit(&surface->commit_signal, surface);
|
||||
|
||||
/* Surface is fully unmapped now */
|
||||
surface->is_unmapping = false;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue