mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
view: add view_for_each_reverse() macro
This commit is contained in:
parent
da1f28f3dd
commit
e274c588c0
2 changed files with 47 additions and 3 deletions
16
src/view.c
16
src/view.c
|
|
@ -269,6 +269,22 @@ view_next(struct wl_list *head, struct view *view, enum lab_view_criteria criter
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct view *
|
||||
view_prev(struct wl_list *head, struct view *view, enum lab_view_criteria criteria)
|
||||
{
|
||||
assert(head);
|
||||
|
||||
struct wl_list *elm = view ? &view->link : head;
|
||||
|
||||
for (elm = elm->prev; elm != head; elm = elm->prev) {
|
||||
view = wl_container_of(elm, view, link);
|
||||
if (matches_criteria(view, criteria)) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct view *
|
||||
view_next_no_head_stop(struct wl_list *head, struct view *from,
|
||||
enum lab_view_criteria criteria)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue