wayland/surface: Prepare for decoupled surface & resource lifetimes

Need to deal with surface->resource == NULL and
surface->pending_state == NULL in some places.

v2:
* Avoid expanding conditions to multiple lines.
  (Georges Basile Stavracas Neto)
v3:
* Use a single bailout condition in meta_wayland_client_owns_window as
  well.
v4:
* Remove spare empty line in meta_wayland_surface_apply_state.
  (Robert Mader)
* Add wl_resource_post_error calls in xdg-shell request handlers.
  (Robert Mader)
* Drop checks in functions which can only be called if there's a valid
  resource.
* Drop more checks which are unnecessary due to leaving the
  SURFACE_DESTROY signal emission in wl_surface_destructor later.
v5:
* Move resource = surface->resource assignments to if (!resource) tests.
  (Jonas Ådahl)
v6:
* Fix style issue per check-style.py.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1880>
This commit is contained in:
Michel Dänzer
2021-07-29 18:14:20 +02:00
committed by Michel Dänzer
parent a99198de83
commit 6379e54847
9 changed files with 98 additions and 26 deletions

View File

@ -371,7 +371,7 @@ meta_wayland_text_input_set_focus (MetaWaylandTextInput *text_input,
text_input->surface = NULL;
}
if (surface)
if (surface && surface->resource)
{
struct wl_resource *focus_surface_resource;