mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
desktop: give focus to a modal dialog rather than its parent
Fixes: #2722
This commit is contained in:
parent
ea1df930e9
commit
9782ffa868
4 changed files with 73 additions and 15 deletions
30
src/view.c
30
src/view.c
|
@ -2343,6 +2343,36 @@ view_append_children(struct view *view, struct wl_array *children)
|
|||
}
|
||||
}
|
||||
|
||||
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)) {
|
||||
return view;
|
||||
}
|
||||
|
||||
/* check sibling views */
|
||||
struct view *dialog = NULL;
|
||||
struct view *root = view_get_root(view);
|
||||
struct wl_array children;
|
||||
struct view **child;
|
||||
|
||||
wl_array_init(&children);
|
||||
view_append_children(root, &children);
|
||||
wl_array_for_each(child, &children) {
|
||||
if (view->impl->is_modal_dialog(*child)) {
|
||||
dialog = *child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
wl_array_release(&children);
|
||||
return dialog;
|
||||
}
|
||||
|
||||
bool
|
||||
view_has_strut_partial(struct view *view)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue