mirror of
https://github.com/labwc/labwc.git
synced 2026-02-11 04:27:51 -05:00
cycle: remember cycled window list in server->cycle.views
This allows changing the cycled order in the future, e.g. focused order vs created order. Functionally, this commit also changes the initially selected window; before this commit, the previous/next of the topmost window was always selected, but now the previous/next of the active window is selected first if it is in the cycled list. This won't change behaviors for most users, but this ensures that the user can go back to the focused window with Alt-Tab + Alt-Shift-Tab even when it is not the topmost window. This commit fixes the TODO in the previous commit by trying to preserve the selected view when a view is destroyed during window cycling.
This commit is contained in:
parent
b6c1a9ea59
commit
9f5ff391cc
8 changed files with 92 additions and 110 deletions
42
src/view.c
42
src/view.c
|
|
@ -345,48 +345,6 @@ view_prev(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