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 <daniels@collabora.com>
This commit is contained in:
Daniel Stone
2022-06-15 15:56:00 +01:00
committed by Marius Vlad
parent 13ead893e2
commit d211e3173c
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -645,11 +645,11 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
struct weston_surface *wsurface = struct weston_surface *wsurface =
weston_desktop_surface_get_surface(toplevel->base.desktop_surface); 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); weston_desktop_xdg_toplevel_ensure_added(toplevel);
return; return;
} }
if (!wsurface->buffer_ref.buffer) if (!weston_surface_has_content(wsurface))
return; return;
struct weston_geometry geometry = struct weston_geometry geometry =
@@ -1209,7 +1209,7 @@ weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface,
struct weston_surface *wsurface = struct weston_surface *wsurface =
weston_desktop_surface_get_surface (dsurface); 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, wl_resource_post_error(surface->resource,
ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER,
"xdg_surface has never been configured"); "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) if (surface->resource == NULL)
return; return;
if (wsurface->buffer_ref.buffer != NULL) { if (weston_surface_has_content(wsurface)) {
wl_resource_post_error(surface->resource, wl_resource_post_error(surface->resource,
ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER, ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER,
"xdg_surface must not have a buffer at creation"); "xdg_surface must not have a buffer at creation");
+4 -4
View File
@@ -693,11 +693,11 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
struct weston_surface *wsurface = struct weston_surface *wsurface =
weston_desktop_surface_get_surface(toplevel->base.desktop_surface); 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); weston_desktop_xdg_toplevel_ensure_added(toplevel);
return; return;
} }
if (!wsurface->buffer_ref.buffer) if (!weston_surface_has_content(wsurface))
return; return;
struct weston_geometry geometry = struct weston_geometry geometry =
@@ -1351,7 +1351,7 @@ weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface,
struct weston_surface *wsurface = struct weston_surface *wsurface =
weston_desktop_surface_get_surface (dsurface); 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, wl_resource_post_error(surface->resource,
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
"xdg_surface has never been configured"); "xdg_surface has never been configured");
@@ -1518,7 +1518,7 @@ weston_desktop_xdg_shell_protocol_get_xdg_surface(struct wl_client *wl_client,
return; return;
} }
if (wsurface->buffer_ref.buffer != NULL) { if (weston_surface_has_content(wsurface)) {
wl_resource_post_error(resource, wl_resource_post_error(resource,
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
"xdg_surface must not have a buffer at creation"); "xdg_surface must not have a buffer at creation");