]> git.mdlowis.com Git - proto/labwc.git/commitdiff
move windows to back of cycle when they are minimized
authorbi4k8 <bi4k8@github>
Fri, 3 Dec 2021 02:36:38 +0000 (02:36 +0000)
committerARDiDo <90479315+ARDiDo@users.noreply.github.com>
Mon, 6 Dec 2021 14:59:06 +0000 (09:59 -0500)
include/labwc.h
src/desktop.c
src/view.c

index ceeb40a17ccff2b4cefef88475cfb8187c71d922..cff99900f63fdc3d2f698de20b54384145addab5 100644 (file)
@@ -397,6 +397,7 @@ void foreign_toplevel_handle_create(struct view *view);
  */
 
 void desktop_raise_view(struct view *view);
+void desktop_move_view_to_end_of_cycle(struct view *to_end);
 void desktop_focus_and_activate_view(struct seat *seat, struct view *view);
 
 enum lab_cycle_dir {
index 2dd050c9aeaa1cd04e11b2ac050cb0b7edb9fcd7..8963ee4a0b751fb41ef64893c33c8ed351d7e121 100644 (file)
@@ -170,6 +170,18 @@ desktop_cycle_view(struct server *server, struct view *current, enum lab_cycle_d
        return view;
 }
 
+void
+desktop_move_view_to_end_of_cycle(struct view *to_end) {
+       wl_list_remove(&to_end->link);
+       struct view *view;
+       wl_list_for_each_reverse (view, &to_end->server->views, link) {
+               wl_list_insert(&view->link, &to_end->link);
+               return;
+       }
+       /* if the foreach did not return, this window was the only one in the list, so just reinsert it at the start */
+       wl_list_insert(&to_end->server->views, &to_end->link);
+}
+
 static bool
 has_mapped_view(struct wl_list *wl_list)
 {
index b4d58295e556d3130dd608502ff741d1a16723b1..274c376e50a2684bb047fec5945226002a5cf143 100644 (file)
@@ -79,6 +79,7 @@ view_minimize(struct view *view, bool minimized)
        view->minimized = minimized;
        if (minimized) {
                view->impl->unmap(view);
+               desktop_move_view_to_end_of_cycle(view);
        } else {
                view->impl->map(view);
        }