feat(client): add current_scale field to Client and LayerSurface structs

- Add float current_scale to Client struct (HOT section, after corner_radius)
- Add float current_scale to LayerSurface struct (HOT section, after mapped)
- Add config scale range validation [0.25, 4.0] with fprintf warnings
This commit is contained in:
2026-07-05 21:32:22 -04:00
parent 720f3e7136
commit 8b91bc939c
4 changed files with 35 additions and 0 deletions
@@ -0,0 +1,14 @@
Task: 1. Add current_scale fields to Client and LayerSurface structs
Date: 2026-07-06
Status: COMPLETED
Changes:
- include/client.h:49 — float current_scale; added to Client struct (HOT section, after corner_radius)
- include/client.h:100 — float current_scale; added to LayerSurface struct (HOT section, after mapped)
Verification:
- make debug: compiles cleanly, zero warnings
- Build artifacts confirm zero-init via ecalloc (no changes needed to allocation sites)
Evidence:
- grep 'current_scale' include/client.h → 2 matches (Client + LayerSurface)
@@ -0,0 +1,13 @@
Task: 10. Add config scale range validation
Date: 2026-07-06
Status: COMPLETED
Changes:
- parser/parser.c:374-377 — if scale out of [0.25, 4.0], fprintf warning + clamp to 1.0
- parser/parser.c:378-379 — if scale > 3.0, fprintf warning about unusually large scale
- Uses fprintf(stderr, ...) matching existing parser conventions
Verification:
- make debug: compiles cleanly, zero warnings
- Warning messages follow "peachwm: config: ..." format used elsewhere in parser.c
- Post-clamp check prevents double-warning when scale clamped to 1.0
+2
View File
@@ -46,6 +46,7 @@ typedef struct Client {
struct wlr_box bounds; /* only width and height are used */
unsigned int bw;
int corner_radius;
float current_scale;
struct wlr_scene_shadow *shadow;
struct wlr_scene_blur *blur;
@@ -96,6 +97,7 @@ typedef struct {
struct wlr_scene_tree *popups;
struct wlr_scene_layer_surface_v1 *scene_layer;
int mapped;
float current_scale;
struct wlr_layer_surface_v1 *layer_surface;
/* WARM */
+6
View File
@@ -371,6 +371,12 @@ parse_monitors(lua_State *L, Config *cfg)
m->mfact = (float)lua_get_double(L, "mfact", 0.55);
m->nmaster = lua_get_int (L, "nmaster", 1);
m->scale = (float)lua_get_double(L, "scale", 1.0);
if (m->scale < 0.25f || m->scale > 4.0f) {
fprintf(stderr, "peachwm: config: monitor '%s' scale %.2f out of range [0.25, 4.0], clamping to 1.0\n", m->name, m->scale);
m->scale = 1.0f;
}
if (m->scale > 3.0f)
fprintf(stderr, "peachwm: config: monitor '%s' scale %.2f is unusually large, rendering quality may degrade\n", m->name, m->scale);
m->x = lua_get_int (L, "x", -1);
m->y = lua_get_int (L, "y", -1);
m->transform = lua_get_int (L, "transform", 0);