From d211e3173cf1d1ac920a39f8a66638b74272a372 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 15 Jun 2022 15:56:00 +0100 Subject: [PATCH] xdg-shell: Use weston_surface_has_content() Now that we've got a wrapper telling us whether or not the surface has content, just use it. Signed-off-by: Daniel Stone --- libweston-desktop/xdg-shell-v6.c | 8 ++++---- libweston-desktop/xdg-shell.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libweston-desktop/xdg-shell-v6.c b/libweston-desktop/xdg-shell-v6.c index 955fccad..ff3a6344 100644 --- a/libweston-desktop/xdg-shell-v6.c +++ b/libweston-desktop/xdg-shell-v6.c @@ -645,11 +645,11 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev struct weston_surface *wsurface = weston_desktop_surface_get_surface(toplevel->base.desktop_surface); - if (!wsurface->buffer_ref.buffer && !toplevel->added) { + if (!weston_surface_has_content(wsurface) && !toplevel->added) { weston_desktop_xdg_toplevel_ensure_added(toplevel); return; } - if (!wsurface->buffer_ref.buffer) + if (!weston_surface_has_content(wsurface)) return; struct weston_geometry geometry = @@ -1209,7 +1209,7 @@ weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface, struct weston_surface *wsurface = weston_desktop_surface_get_surface (dsurface); - if (wsurface->buffer_ref.buffer && !surface->configured) { + if (weston_surface_has_content(wsurface) && !surface->configured) { wl_resource_post_error(surface->resource, ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, "xdg_surface has never been configured"); @@ -1397,7 +1397,7 @@ weston_desktop_xdg_shell_protocol_get_xdg_surface(struct wl_client *wl_client, if (surface->resource == NULL) return; - if (wsurface->buffer_ref.buffer != NULL) { + if (weston_surface_has_content(wsurface)) { wl_resource_post_error(surface->resource, ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, "xdg_surface must not have a buffer at creation"); diff --git a/libweston-desktop/xdg-shell.c b/libweston-desktop/xdg-shell.c index 6cbf55e4..4b0509b1 100644 --- a/libweston-desktop/xdg-shell.c +++ b/libweston-desktop/xdg-shell.c @@ -693,11 +693,11 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev struct weston_surface *wsurface = weston_desktop_surface_get_surface(toplevel->base.desktop_surface); - if (!wsurface->buffer_ref.buffer && !toplevel->added) { + if (!weston_surface_has_content(wsurface) && !toplevel->added) { weston_desktop_xdg_toplevel_ensure_added(toplevel); return; } - if (!wsurface->buffer_ref.buffer) + if (!weston_surface_has_content(wsurface)) return; struct weston_geometry geometry = @@ -1351,7 +1351,7 @@ weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface, struct weston_surface *wsurface = weston_desktop_surface_get_surface (dsurface); - if (wsurface->buffer_ref.buffer && !surface->configured) { + if (weston_surface_has_content(wsurface) && !surface->configured) { wl_resource_post_error(surface->resource, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER, "xdg_surface has never been configured"); @@ -1518,7 +1518,7 @@ weston_desktop_xdg_shell_protocol_get_xdg_surface(struct wl_client *wl_client, return; } - if (wsurface->buffer_ref.buffer != NULL) { + if (weston_surface_has_content(wsurface)) { wl_resource_post_error(resource, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER, "xdg_surface must not have a buffer at creation");