wl_backend: fix background not updating on first apply

Two issues:
1. bg_image scene node wasn't re-enabled when switching from solid
   color back to an image background
2. No frame was scheduled after background change, so the compositor
   wouldn't repaint until the next natural frame tick

Now explicitly enables the bg_image node and calls
wlr_output_schedule_frame() after any background change.
This commit is contained in:
Window Maker 2026-05-24 14:44:26 +02:00
parent 94054aeec8
commit 6ecdeca3fc
1 changed files with 7 additions and 0 deletions

View File

@ -7735,6 +7735,8 @@ static void wl_set_desktop_background(WScreen *scr, const char *texture_desc)
if (wl_state.bg_image)
wlr_scene_node_set_enabled(&wl_state.bg_image->node, false);
}
if (wl_state.output)
wlr_output_schedule_frame(wl_state.output);
WMReleasePropList(texpl);
return;
} else if ((strcasecmp(type, "vgradient") == 0 ||
@ -7917,6 +7919,7 @@ static void wl_set_desktop_background(WScreen *scr, const char *texture_desc)
/* Replace or create the background scene buffer */
if (wl_state.bg_image) {
wlr_scene_buffer_set_buffer(wl_state.bg_image, &buf->base);
wlr_scene_node_set_enabled(&wl_state.bg_image->node, true);
} else {
wl_state.bg_image = wlr_scene_buffer_create(
wl_state.level_trees[WL_LAYER_BACKGROUND], &buf->base);
@ -7926,6 +7929,10 @@ static void wl_set_desktop_background(WScreen *scr, const char *texture_desc)
if (wl_state.bg_wlr_buf)
wlr_buffer_drop(wl_state.bg_wlr_buf);
wl_state.bg_wlr_buf = &buf->base;
/* Schedule a frame to display the new background immediately */
if (wl_state.output)
wlr_output_schedule_frame(wl_state.output);
}
/* ------------------------------------------------------------------ */