From 87586104cdaf0dc3c0f268b90b72abd075b97c8a Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Tue, 27 Jan 2026 17:53:50 +0900 Subject: [PATCH] view: add view_is_modal_dialog() --- include/view.h | 2 ++ src/view.c | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/view.h b/include/view.h index 6299e2e6..e8532b72 100644 --- a/include/view.h +++ b/include/view.h @@ -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 diff --git a/src/view.c b/src/view.c index 415becc8..ffcbd18f 100644 --- a/src/view.c +++ b/src/view.c @@ -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; }