fix: clean up stale WINGs frame_bufs on toplevel map so second WPrefs launch does not skip wManageWindow

This commit is contained in:
lkn 2026-06-06 11:55:22 +02:00
parent b26a4c733c
commit fc27be21e3
1 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include <WINGs/WINGsP.h>
/* Forward declarations for functions defined in other wl_*.c files */
extern void W_UnregisterBacking(unsigned long id);
void view_attach_scene_destroy_listener(struct wl_toplevel_view *view);
void wl_pointer_warp_to(int x, int y);
void wm_dock_app_add(struct wl_toplevel_view *v);
@ -237,9 +238,17 @@ handle_toplevel_map(struct wl_listener *listener, void *data)
int is_popup = (app_id_check && strcmp(app_id_check, "wings-popup") == 0);
if (app_id_check && strcmp(app_id_check, "WINGs") == 0) {
struct wl_frame_buf *_fb;
wl_list_for_each(_fb, &wl_state.frame_list, link) {
struct wl_frame_buf *_fb, *_next;
wl_list_for_each_safe(_fb, _next, &wl_state.frame_list, link) {
if (_fb->id >= 0x20000000 && !wl_find_view_by_id(_fb->id)) {
/* Stale WINGs frame_buf from a previous session whose
* parent toplevel no longer exists — clean it up. */
if (_fb->parent_id && !frame_buf_find(_fb->parent_id)) {
W_UnregisterBacking(_fb->id);
wl_list_remove(&_fb->link);
wlr_buffer_drop(&_fb->base);
continue;
}
wwarning("wl_backend: WINGs dialog id 0x%lx", (unsigned long)_fb->id);
view->id = _fb->id;
view->frame_id = _fb->parent_id;