mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
view: move xwayland sub-views to front on focus
This commit is contained in:
parent
e99d0bb34e
commit
d782e48204
1 changed files with 30 additions and 1 deletions
31
src/view.c
31
src/view.c
|
|
@ -99,6 +99,35 @@ bool view_hasfocus(struct view *view)
|
||||||
return (view->surface == seat->keyboard_state.focused_surface);
|
return (view->surface == seat->keyboard_state.focused_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct wlr_xwayland_surface *top_parent_of(struct view *view)
|
||||||
|
{
|
||||||
|
struct wlr_xwayland_surface *s = view->xwayland_surface;
|
||||||
|
while (s->parent)
|
||||||
|
s = s->parent;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void move_xwayland_sub_views_to_front(struct view *parent)
|
||||||
|
{
|
||||||
|
if (!parent || parent->type != LAB_XWAYLAND_VIEW)
|
||||||
|
return;
|
||||||
|
struct view *view, *next;
|
||||||
|
wl_list_for_each_reverse_safe(view, next, &parent->server->views, link)
|
||||||
|
{
|
||||||
|
/* need to stop here, otherwise loops keeps going forever */
|
||||||
|
if (view == parent)
|
||||||
|
break;
|
||||||
|
if (view->type != LAB_XWAYLAND_VIEW)
|
||||||
|
continue;
|
||||||
|
if (!view->mapped && !view->minimized)
|
||||||
|
continue;
|
||||||
|
if (top_parent_of(view) != parent->xwayland_surface)
|
||||||
|
continue;
|
||||||
|
move_to_front(view);
|
||||||
|
/* TODO: we should probably focus on these too here */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void view_focus(struct view *view)
|
void view_focus(struct view *view)
|
||||||
{
|
{
|
||||||
/* Note: this function only deals with keyboard focus. */
|
/* Note: this function only deals with keyboard focus. */
|
||||||
|
|
@ -137,7 +166,7 @@ void view_focus(struct view *view)
|
||||||
keyboard->num_keycodes,
|
keyboard->num_keycodes,
|
||||||
&keyboard->modifiers);
|
&keyboard->modifiers);
|
||||||
|
|
||||||
/* TODO: move xwayland decendants to front */
|
move_xwayland_sub_views_to_front(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct view *first_view(struct server *server)
|
static struct view *first_view(struct server *server)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue