brewery
notashelf /
889bd0a44f903c6418e76cd5ca860a1c1b928819

chroma

public

Lightweight wallpaper daemon for Wayland

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/chroma.git

Commit 889bd0a44f90

tarball

NotAShelf <raf@notashelf.dev> · 2026-06-19 16:54 UTC

unverified2 files changed+19-16
render: use transform-aware output dimension helpers

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I112815adaaa81b5d0f0e293320ad126e6a6a6964
diff --git a/src/core.c b/src/core.cindex b490a5e..948e682 100644--- a/src/core.c+++ b/src/core.c@@ -92,8 +92,9 @@ static int assign_wallpaper_to_output(chroma_state_t *state,    // Load or get cached image with output dimensions for intelligent   // downsampling-  chroma_image_t *image = chroma_image_get_or_load(-      state, image_path, output->width, output->height);+  chroma_image_t *image =+      chroma_image_get_or_load(state, image_path, chroma_output_width(output),+                               chroma_output_height(output));   if (!image) {     chroma_log("ERROR", "Failed to load image for output %u: %s", output->id,                image_path);@@ -205,10 +206,11 @@ void handle_output_done(chroma_state_t *state, chroma_output_t *output) {     return;   } -  chroma_log("INFO",-             "Output %u (%s) configuration complete: %dx%d@%d, scale=%d",-             output->id, output->name ? output->name : "unknown", output->width,-             output->height, 0, output->scale);+  chroma_log(+      "INFO",+      "Output %u (%s) configuration complete: %dx%d@%d, scale=%d, transform=%d",+      output->id, output->name ? output->name : "unknown", output->width,+      output->height, 0, output->scale, output->transform);    /* Assign wallpaper to this output */   if (assign_wallpaper_to_output(state, output) != CHROMA_OK) {diff --git a/src/render.c b/src/render.cindex 1cf6e49..4274389 100644--- a/src/render.c+++ b/src/render.c@@ -55,8 +55,8 @@ int chroma_buffer_create(chroma_state_t *state, chroma_output_t *output) {     return CHROMA_ERROR_INIT;   } -  int width = output->width;-  int height = output->height;+  int width = chroma_output_width(output);+  int height = chroma_output_height(output);   if (width <= 0 || height <= 0) {     return CHROMA_ERROR_INIT;   }@@ -167,8 +167,8 @@ static void draw_scaled_image(chroma_output_t *output, chroma_image_t *image) {     return;   } -  int out_w = output->width;-  int out_h = output->height;+  int out_w = chroma_output_width(output);+  int out_h = chroma_output_height(output);   int img_w = image->width;   int img_h = image->height;   uint32_t *dst = (uint32_t *)output->shm_data;@@ -393,8 +393,9 @@ int chroma_surface_create(chroma_state_t *state, chroma_output_t *output) {   }    // Configure layer surface-  zwlr_layer_surface_v1_set_size(output->layer_surface, (uint32_t)output->width,-                                 (uint32_t)output->height);+  zwlr_layer_surface_v1_set_size(output->layer_surface,+                                 (uint32_t)chroma_output_width(output),+                                 (uint32_t)chroma_output_height(output));   zwlr_layer_surface_v1_set_anchor(output->layer_surface,                                    ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP |                                        ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |@@ -415,7 +416,7 @@ int chroma_surface_create(chroma_state_t *state, chroma_output_t *output) {   wl_display_roundtrip(state->display);    chroma_log("INFO", "Created surface for output %u (%dx%d)", output->id,-             output->width, output->height);+             chroma_output_width(output), chroma_output_height(output));    return CHROMA_OK; }@@ -471,8 +472,8 @@ int chroma_render_wallpaper(chroma_state_t *state, chroma_output_t *output) {    // Attach buffer to surface   wl_surface_attach(output->surface, output->shm_buffer, 0, 0);-  wl_surface_damage_buffer(output->surface, 0, 0, output->width,-                           output->height);+  wl_surface_damage_buffer(output->surface, 0, 0, chroma_output_width(output),+                           chroma_output_height(output));   wl_surface_commit(output->surface);   if (wl_display_flush(state->display) < 0) {     chroma_log("ERROR", "Failed to flush Wayland display for output %u: %s",@@ -481,7 +482,7 @@ int chroma_render_wallpaper(chroma_state_t *state, chroma_output_t *output) {   }    chroma_log("INFO", "Rendered wallpaper to output %u (%dx%d)", output->id,-             output->width, output->height);+             chroma_output_width(output), chroma_output_height(output));    // Unmap client-side memory; compositor keeps its own fd reference   chroma_buffer_unmap(output);