Rename scale → scale_mode in protocol/struct layer; add control grouping future note

- `Proto_Display_Device_Info.scale` → `scale_mode`
- `Proto_Start_Display.scale` → `scale_mode`
- `PROTO_DISPLAY_CTRL_SCALE` → `PROTO_DISPLAY_CTRL_SCALE_MODE`
- `proto_write_start_display` param and all callers updated
- `on_display` callback param and all sites updated
- `Display_Slot.scale` → `scale_mode` in node
- Control name "Scale" → "Scale Mode"
- planning.md: add control grouping deferred decision

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-30 00:54:22 +00:00
parent 7777292dfd
commit 8fa2f33bad
5 changed files with 32 additions and 31 deletions

View File

@@ -178,7 +178,7 @@ struct Display_Slot {
/* Config — written by handle_start_display before setting wanted */
int win_x, win_y;
int win_w, win_h;
Xorg_Scale scale;
Xorg_Scale scale_mode;
Xorg_Anchor anchor;
/* Pending frame — deposited by transport thread, consumed by main */
@@ -485,7 +485,7 @@ static void display_loop_tick(struct Node *node)
Xorg_Viewer *v = xorg_viewer_open(
d->win_x, d->win_y, d->win_w, d->win_h, title);
if (v) {
xorg_viewer_set_scale(v, d->scale);
xorg_viewer_set_scale(v, d->scale_mode);
xorg_viewer_set_anchor(v, d->anchor);
d->viewer = v;
pthread_mutex_lock(&d->mutex);
@@ -512,7 +512,7 @@ static void display_loop_tick(struct Node *node)
/* Sync scale/anchor — may be updated live via SET_CONTROL */
pthread_mutex_lock(&d->mutex);
Xorg_Scale cur_scale = d->scale;
Xorg_Scale cur_scale = d->scale_mode;
Xorg_Anchor cur_anchor = d->anchor;
pthread_mutex_unlock(&d->mutex);
xorg_viewer_set_scale(d->viewer, cur_scale);
@@ -889,7 +889,7 @@ static void handle_enum_devices(struct Node *node,
.win_y = (int16_t)d->win_y,
.win_w = (uint16_t)d->win_w,
.win_h = (uint16_t)d->win_h,
.scale = (uint8_t)d->scale,
.scale_mode = (uint8_t)d->scale_mode,
.anchor = (uint8_t)d->anchor,
};
pthread_mutex_unlock(&d->mutex);
@@ -923,15 +923,15 @@ static void handle_enum_controls(struct Node *node,
return;
}
pthread_mutex_lock(&disp->mutex);
int scale = (int)disp->scale;
int scale_mode = (int)disp->scale_mode;
int anchor = (int)disp->anchor;
int no_signal_fps = disp->no_signal_fps > 0 ? disp->no_signal_fps : 15;
pthread_mutex_unlock(&disp->mutex);
struct Proto_Control_Info ctrls[] = {
{ .id = PROTO_DISPLAY_CTRL_SCALE,
.type = 1, .name = "Scale",
{ .id = PROTO_DISPLAY_CTRL_SCALE_MODE,
.type = 1, .name = "Scale Mode",
.min = 0, .max = 3, .step = 1, .default_val = 1,
.current_val = scale },
.current_val = scale_mode },
{ .id = PROTO_DISPLAY_CTRL_ANCHOR,
.type = 1, .name = "Anchor",
.min = 0, .max = 1, .step = 1, .default_val = 0,
@@ -981,7 +981,7 @@ static void handle_get_control(struct Node *node,
int32_t value = 0;
int found = 1;
switch (req.control_id) {
case PROTO_DISPLAY_CTRL_SCALE: value = (int32_t)disp->scale; break;
case PROTO_DISPLAY_CTRL_SCALE_MODE: value = (int32_t)disp->scale_mode; break;
case PROTO_DISPLAY_CTRL_ANCHOR: value = (int32_t)disp->anchor; break;
case PROTO_DISPLAY_CTRL_NO_SIGNAL_FPS: value = disp->no_signal_fps > 0 ? disp->no_signal_fps : 15; break;
default: found = 0; break;
@@ -1032,9 +1032,9 @@ static void handle_set_control(struct Node *node,
pthread_mutex_lock(&disp->mutex);
int found = 1;
switch (req.control_id) {
case PROTO_DISPLAY_CTRL_SCALE:
case PROTO_DISPLAY_CTRL_SCALE_MODE:
if (req.value >= 0 && req.value <= 3) {
disp->scale = (Xorg_Scale)req.value;
disp->scale_mode = (Xorg_Scale)req.value;
}
break;
case PROTO_DISPLAY_CTRL_ANCHOR:
@@ -1250,7 +1250,7 @@ static void handle_start_display(struct Node *node,
d->win_y = (int)req.win_y;
d->win_w = req.win_w > 0 ? (int)req.win_w : 1280;
d->win_h = req.win_h > 0 ? (int)req.win_h : 720;
d->scale = proto_scale_to_xorg(req.scale);
d->scale_mode = proto_scale_to_xorg(req.scale_mode);
d->anchor = proto_anchor_to_xorg(req.anchor);
d->no_signal_fps = req.no_signal_fps > 0 ? (int)req.no_signal_fps : 15;
d->wanted_state = DISP_OPEN; /* reconciled by display_loop_tick */