view: add view_is_modal_dialog()

This commit is contained in:
tokyo4j 2026-01-27 17:53:50 +09:00 committed by Johan Malm
parent ac94e1d44c
commit 87586104cd
2 changed files with 12 additions and 5 deletions

View file

@ -555,6 +555,8 @@ void view_move_to_output(struct view *view, struct output *output);
void view_move_to_front(struct view *view);
void view_move_to_back(struct view *view);
bool view_is_modal_dialog(struct view *view);
/**
* view_get_modal_dialog() - returns any modal dialog found among this
* view's children or siblings (or possibly this view itself). Applies

View file

@ -2284,15 +2284,20 @@ view_move_to_back(struct view *view)
desktop_update_top_layer_visibility(view->server);
}
bool
view_is_modal_dialog(struct view *view)
{
assert(view);
assert(view->impl->is_modal_dialog);
return view->impl->is_modal_dialog(view);
}
struct view *
view_get_modal_dialog(struct view *view)
{
assert(view);
if (!view->impl->is_modal_dialog) {
return NULL;
}
/* check view itself first */
if (view->impl->is_modal_dialog(view)) {
if (view_is_modal_dialog(view)) {
return view;
}
@ -2305,7 +2310,7 @@ view_get_modal_dialog(struct view *view)
wl_array_init(&children);
view_append_children(root, &children);
wl_array_for_each(child, &children) {
if (view->impl->is_modal_dialog(*child)) {
if (view_is_modal_dialog(*child)) {
dialog = *child;
break;
}