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>
dev
Daniel Stone 2 years ago committed by Marius Vlad
parent 13ead893e2
commit d211e3173c
  1. 8
      libweston-desktop/xdg-shell-v6.c
  2. 8
      libweston-desktop/xdg-shell.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");

@ -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");

Loading…
Cancel
Save