void subsurface_parent_commit(struct ds_subsurface *subsurface,
bool synchronized);
+bool surface_is_ancestor_of(struct ds_surface *surface,
+ struct ds_surface *target_surface);
+
#endif
return NULL;
}
- if (ds_surface_is_ancestor_of(surface, parent)) {
+ if (surface_is_ancestor_of(surface, parent)) {
ds_inf("ds_surface(%p) is an ancestor of given parent(%p)",
surface, parent);
wl_resource_post_error(factory_resource,
}
bool
-ds_surface_is_ancestor_of(struct ds_surface *surface,
+surface_is_ancestor_of(struct ds_surface *surface,
struct ds_surface *target_surface)
{
- struct ds_subsurface *target_subsurface;
- struct ds_surface *parent_surface;
+ struct ds_subsurface *subsurface;
+ struct ds_surface *iter = target_surface;
- while (target_surface &&
- ds_surface_is_subsurface(target_surface)) {
- target_subsurface = ds_subsurface_from_surface(target_surface);
- if (!target_subsurface)
+ while (iter) {
+ subsurface = ds_subsurface_from_surface(iter);
+ if (!subsurface)
break;
- parent_surface = subsurface_get_parent(target_subsurface);
- if (surface == parent_surface)
+ iter = subsurface_get_parent(subsurface);
+ if (surface == iter)
return true;
-
- target_surface = parent_surface;
}
return false;
ds_surface_has_buffer(struct ds_surface *surface);
bool
-ds_surface_is_ancestor_of(struct ds_surface *surface,
- struct ds_surface *target_surface);
-
-bool
ds_surface_is_subsurface(struct ds_surface *surface);
#endif