cycle: refactor to aggregate type definitions into cycle.h

We declared `cycle_state` struct in `labwc.h` and `cycle_osd_scene`
struct in `output.h`, which was unclean in terms of separation of
concerns.

So this commit firstly moves `cycle_state` to `cycle.h`, then replaces
`cycle_osd_scene` in `output.h` with `cycle_osd_output` in `cycle.h`
which is dynamically allocated in a similar manner to
`session_lock_output`. This ensures that all states about alt-tabbing
are stored in `server->cycle`.

Also, this commit fixes a rare memory leak in `output->cycle_osd.items`
when an output is destroyed while alt-tabbing, by freeing it when the
osd tree is destroyed.
This commit is contained in:
tokyo4j 2025-12-29 02:50:45 +09:00 committed by Johan Malm
parent 276d4e61f9
commit dfe428ae14
8 changed files with 95 additions and 72 deletions

View file

@ -550,6 +550,7 @@ server_init(struct server *server)
wl_list_init(&server->views);
wl_list_init(&server->unmanaged_surfaces);
wl_list_init(&server->cycle.views);
wl_list_init(&server->cycle.osd_outputs);
server->scene = wlr_scene_create();
if (!server->scene) {