mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
src/view.c: refactor
This commit is contained in:
parent
d3e9f9a07f
commit
ff03f1d6aa
1 changed files with 5 additions and 4 deletions
|
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
static bool is_toplevel(struct view *view)
|
static bool is_toplevel(struct view *view)
|
||||||
{
|
{
|
||||||
|
if (!view->been_mapped)
|
||||||
|
return false;
|
||||||
switch (view->type) {
|
switch (view->type) {
|
||||||
case LAB_XDG_SHELL_VIEW:
|
case LAB_XDG_SHELL_VIEW:
|
||||||
return view->xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL;
|
return view->xdg_surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL;
|
||||||
case LAB_XWAYLAND_VIEW:
|
case LAB_XWAYLAND_VIEW:
|
||||||
return xwl_nr_parents(view) > 0 ? false : true;
|
return xwl_nr_parents(view) == 0;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -151,14 +153,13 @@ void view_focus(struct view *view)
|
||||||
wlr_seat_keyboard_notify_enter(seat, view->surface, keyboard->keycodes,
|
wlr_seat_keyboard_notify_enter(seat, view->surface, keyboard->keycodes,
|
||||||
keyboard->num_keycodes,
|
keyboard->num_keycodes,
|
||||||
&keyboard->modifiers);
|
&keyboard->modifiers);
|
||||||
|
/* TODO: bring child views to front */
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *view_front_toplevel(struct server *server)
|
struct view *view_front_toplevel(struct server *server)
|
||||||
{
|
{
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each (view, &server->views, link) {
|
wl_list_for_each (view, &server->views, link) {
|
||||||
if (!view->been_mapped)
|
|
||||||
continue;
|
|
||||||
if (is_toplevel(view))
|
if (is_toplevel(view))
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +173,7 @@ struct view *next_toplevel(struct view *current)
|
||||||
struct view *view = current;
|
struct view *view = current;
|
||||||
do {
|
do {
|
||||||
view = wl_container_of(view->link.next, view, link);
|
view = wl_container_of(view->link.next, view, link);
|
||||||
} while (!view->been_mapped || !is_toplevel(view));
|
} while (!is_toplevel(view));
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue