Skip to content

refactor: group Smallvil state into substates (plan step 8, 0.90.210–0.90.211) - #15

Merged
Fi3w0 merged 9 commits into
masterfrom
refactor/substates
Oct 28, 2026
Merged

Fi3w0 merged 9 commits into
masterfrom
refactor/substates

Conversation

@Fi3w0

@Fi3w0 Fi3w0 commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Plan step 8: the compositor's main state struct, Smallvil, goes from 226 flat fields to 119 by grouping related fields into named substates. Field lists approved by Fiw. Pure path moves: no behavior change, no accessors or forwarding methods, field names/types/docs unchanged.

Commit Substate Path Fields Sites
7fec946 (8a) IpcState self.ipc 4 24
8c04c3f (8b) FloatPhysicsState self.physics 13 111
9282d85 (8c) WorkspaceState + Ocean inside SpatialState self.spatial.workspaces, self.spatial.ocean 12 788
cfb7193 (8e) InputState (focus included) self.input 28 187
d94e90a (8d 1/3) RenderState::gpu (shader programs, GPU textures; Ebb attaches here) self.render.gpu 22 108
45636bd (8d 2/3) RenderState::windows (per-window render settings) self.render.windows 7 62
f400c55 (8d 3/3) RenderState::motion (animations, cameras, redraw) self.render.motion 21 185

Plus 2b0e295 (0.90.210) and 361d60a (0.90.211): version bumps and both changelogs.

Deliberately left on Smallvil: compositor UI fields (a later UiState), seat, the protocol globals, and engine-neutral overlays (fullscreen, maximized, groups).

Visibility: SpatialState, WorkspaceState and the moved layout/ocean fields stay pub, as on Smallvil. Narrowing them would expose test-only methods (Layouts::ratio_at, three OceanSpace methods, rectangle_gap_distance) to the dead-code lint; that cleanup is tracked separately. SpatialState drops its Copy/Clone/Debug derive and hit_tests_through_space takes &self.

Verification:

  • Per commit: fmt, 712 tests, strict Clippy (all and default features).
  • Pure-move check: each commit's non-structural files match their parent once the added path step, whitespace and rustfmt brace/comma changes are normalized away. Rewrites were limited to self/state/data receivers; the three XKB state.layout sites in virtual_keyboard.rs were restored by hand.
  • Release build.
  • Nested matrix with subscribers: 61 checks, 0 differences vs .209 and .210; subscriber checks pass in Classic, Scroll and Ocean.
  • Native .211: tidectl doctor 10/10, startup probe passes with user state unchanged, and 12 WM + 4 client fullscreen round trips across Scroll→Classic→Scroll with state restored.
  • Not run natively: an Ocean round trip.

Fi3w0 added 9 commits October 28, 2026 06:35
Plan step 8a, approved by Fiw. The four IPC subscriber fields move out of
Smallvil into state::ipc::IpcState, reached as self.ipc:

  ipc_subscribers        -> ipc.subscribers
  ipc_seen               -> ipc.seen        (was private; now pub(super))
  ipc_flush_token        -> ipc.flush_token
  next_ipc_subscriber_id -> ipc.next_subscriber_id

Field docs move verbatim; 24 use sites are rewritten to the new paths and
nothing else in their bodies changes. Two doc comments that named the old
fields now name the new ones. No accessors, no behavior change.

712 tests, fmt and strict Clippy pass.
Plan step 8b, approved by Fiw. Thirteen render-only motion fields move
out of Smallvil into state::physics::FloatPhysicsState, reached as
self.physics, with their names, types, visibility and docs unchanged:
window_viscosity, window_sway, window_float_physics,
window_float_ambient, window_float_bodies, float_physics_accum,
float_physics_last_tick, float_physics_wave_clock, window_currents,
window_buoyancy, buoyancy_dirty, buoyancy_camera_revision,
buoyancy_camera_was_moving. floating_dragging stays: it is grab state.

111 use sites gain the `.physics` step and nothing else; rustfmt rewraps
the chains that grew. Initializers move into one nested literal with the
same values. No accessors, no behavior change.

712 tests, fmt and strict Clippy pass.
Plan step 8c, approved by Fiw. Eleven workspace-owned fields leave
Smallvil for state::workspace::WorkspaceState, reached as
self.spatial.workspaces, with names, types and docs unchanged: layout,
floating_workspace, pinned, pseudo_tiled, scratchpad_previous,
scratchpad_named, workspace_previous, workspace_step_output,
workspace_created_empty_fired, output_pins and classic_depth. `ocean`
moves to self.spatial.ocean. SpatialState now holds the running engine
and both ownership models it selects between.

594 workspace and 194 Ocean use sites gain the path step and nothing
else; rustfmt rewraps the longer chains. A whitespace/brace-normalized
comparison against the parent shows no other change outside the three
structural files. Receivers were limited to self/state/data so
same-named fields (reef.layout, config.ocean, config.classic_depth, the
XKB layout in virtual_keyboard) are untouched.

SpatialState drops its Copy/Clone/Debug derive and
hit_tests_through_space takes &self. SpatialState, WorkspaceState and
the moved fields stay `pub`, as layout and ocean were on Smallvil;
narrowing them would expose test-only Layouts/OceanSpace methods to the
dead-code lint, which is a separate cleanup. Initializers nest inside
the spatial literal with the same values. No accessors, no behavior
change.

712 tests, fmt and strict Clippy (all and default features) pass.
Plan step 8e, approved by Fiw (focus fields included). Twenty-eight
fields leave Smallvil for state::focus::InputState, reached as
self.input, with names, types, visibility and docs unchanged: focus
authority (window_focus, on_demand_layer_focus, keyboard_focus,
focus_history, cycling_focus, popup_grab), key and bind state
(active_mode, rescue_keybinds_active, helper_keys_down,
keyboard_layout_state, virtual_keyboard_keymap, configured_keymap,
minimap_trigger_down), pointer grabs and gestures (compositor_gesture,
suppressed_pointer_buttons, classic_tile_drag, floating_dragging,
scroll_pointer_refresh_pending, last_pointer_motion,
cursor_idle_timer_armed, last_activity), cursor (cursor_status,
dnd_icon, cursor_theme) and devices (known_input_devices,
input_device_outputs, is_lid_closed, is_tablet_mode). `seat` and the
protocol globals stay on Smallvil.

187 use sites gain the `.input` step and nothing else; a normalized
comparison shows no other change outside mod.rs, init.rs and focus.rs.
reconcile_keyboard_focus remains the only writer of seat focus.
No accessors, no behavior change.

712 tests, fmt and strict Clippy (all and default features) pass.
Plan step 8d (1/3), approved by Fiw with nested render groups. Adds
state::render::RenderState, reached as self.render, and moves
twenty-two fields into its `gpu` member (RenderGpuState) with names,
types, visibility and docs unchanged: the twelve built-in shader
programs, the custom-shader cache (custom_shader_programs,
custom_shader_compile_budget, custom_shader_instances,
custom_shader_bypassed, custom_shader_bypasses) and the per-surface GPU
resources (backdrop_textures, layer_alpha_masks, layer_dim_buffers,
window_frame_snapshots, depth_schematics). This is the group Ebb's
accounting attaches to.

108 use sites gain the `.render.gpu` step and nothing else; a
normalized comparison shows no other change outside mod.rs, init.rs
and render.rs. No accessors, no behavior change.

712 tests, fmt and strict Clippy (all and default features) pass.
Plan step 8d (2/3). Seven fields leave Smallvil for the `windows`
member of RenderState (RenderWindowsState), reached as
self.render.windows, with names, types, visibility and docs unchanged:
window_opacity, window_glass_modes, window_shader_assignments,
layer_shader_assignments, glass_anim, window_depths and depth_last_tick.

62 use sites gain the `.render.windows` step and nothing else; a
normalized comparison shows no other change outside mod.rs, init.rs
and render.rs. No accessors, no behavior change.

712 tests, fmt and strict Clippy (all and default features) pass.
…tion

Plan step 8d (3/3). Twenty-one fields leave Smallvil for the `motion`
member of RenderState (RenderMotionState), reached as
self.render.motion, with names, types, visibility and docs unchanged:
ripples, the open/cascade/move/closing window animations, the pending
and active workspace transitions, workspace_glides, depth_transitions,
swim_cameras, workspace_scroll_cameras, the per-output ocean_canvases,
caustics and compasses, the depth background and its timer/deadline,
snap_preview, and the redraw_requests/redraw_wakeup/native_render_stats
scheduling state.

185 use sites gain the `.render.motion` step and nothing else; the
receiver filter leaves config.caustics alone, and a normalized
comparison shows no other change outside mod.rs, init.rs and
render.rs. No accessors, no behavior change.

712 tests, fmt and strict Clippy (all and default features) pass.
@Fi3w0
Fi3w0 merged commit 79a921c into master Oct 28, 2026
1 check passed
@Fi3w0
Fi3w0 deleted the refactor/substates branch October 28, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant