mirror of
https://github.com/labwc/labwc.git
synced 2026-02-28 01:40:29 -05:00
view: add view_is_modal_dialog()
This commit is contained in:
parent
ac94e1d44c
commit
87586104cd
2 changed files with 12 additions and 5 deletions
|
|
@ -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_front(struct view *view);
|
||||||
void view_move_to_back(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_get_modal_dialog() - returns any modal dialog found among this
|
||||||
* view's children or siblings (or possibly this view itself). Applies
|
* view's children or siblings (or possibly this view itself). Applies
|
||||||
|
|
|
||||||
15
src/view.c
15
src/view.c
|
|
@ -2284,15 +2284,20 @@ view_move_to_back(struct view *view)
|
||||||
desktop_update_top_layer_visibility(view->server);
|
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 *
|
struct view *
|
||||||
view_get_modal_dialog(struct view *view)
|
view_get_modal_dialog(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
if (!view->impl->is_modal_dialog) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
/* check view itself first */
|
/* check view itself first */
|
||||||
if (view->impl->is_modal_dialog(view)) {
|
if (view_is_modal_dialog(view)) {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2305,7 +2310,7 @@ view_get_modal_dialog(struct view *view)
|
||||||
wl_array_init(&children);
|
wl_array_init(&children);
|
||||||
view_append_children(root, &children);
|
view_append_children(root, &children);
|
||||||
wl_array_for_each(child, &children) {
|
wl_array_for_each(child, &children) {
|
||||||
if (view->impl->is_modal_dialog(*child)) {
|
if (view_is_modal_dialog(*child)) {
|
||||||
dialog = *child;
|
dialog = *child;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue