mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
desktop: refactor desktop_cycle_view()
...in preparation for using common window-rule criteria with osd.c No functional change intended. Related-to #1454
This commit is contained in:
parent
6a35e8e78c
commit
777e6bb868
3 changed files with 77 additions and 90 deletions
42
src/view.c
42
src/view.c
|
|
@ -137,6 +137,48 @@ view_next(struct wl_list *head, struct view *view, enum lab_view_criteria criter
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct view *
|
||||
view_next_no_head_stop(struct wl_list *head, struct view *from,
|
||||
enum lab_view_criteria criteria)
|
||||
{
|
||||
assert(head);
|
||||
|
||||
struct wl_list *elm = from ? &from->link : head;
|
||||
|
||||
struct wl_list *end = elm;
|
||||
for (elm = elm->next; elm != end; elm = elm->next) {
|
||||
if (elm == head) {
|
||||
continue;
|
||||
}
|
||||
struct view *view = wl_container_of(elm, view, link);
|
||||
if (matches_criteria(view, criteria)) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
return from;
|
||||
}
|
||||
|
||||
struct view *
|
||||
view_prev_no_head_stop(struct wl_list *head, struct view *from,
|
||||
enum lab_view_criteria criteria)
|
||||
{
|
||||
assert(head);
|
||||
|
||||
struct wl_list *elm = from ? &from->link : head;
|
||||
|
||||
struct wl_list *end = elm;
|
||||
for (elm = elm->prev; elm != end; elm = elm->prev) {
|
||||
if (elm == head) {
|
||||
continue;
|
||||
}
|
||||
struct view *view = wl_container_of(elm, view, link);
|
||||
if (matches_criteria(view, criteria)) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
return from;
|
||||
}
|
||||
|
||||
void
|
||||
view_array_append(struct server *server, struct wl_array *views,
|
||||
enum lab_view_criteria criteria)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue