Files
wlgol/openspec/specs/display-scaling/spec.md
T
arek d20f4d5481 fix(input): honor pointer entry position and make clear work
Pointer enter ignored the surface position, so the pattern preview
rendered at a stale cell until the first motion event. The clear
action only printed a message and toggle_grid had no default key
binding, leaving both unreachable without a hand-written config.

Set the cursor position from the enter event, implement clear via
grid_clear plus a dirty flag, and add g/c default bindings in both
the built-in table and the generated config template. Also defer
wl_buffer destruction on resize until the compositor releases it,
route pointer motion through a handler hook instead of reading
pointer_data directly, and clean up dead code (show_lines, unused
ternary, unchecked ftruncate, unfreed grid buffers). Fixes a
wl_callback proxy leak from frame-callback overwrite. Syncs the
keyboard-bindings and display-scaling specs and archives the
fix-review-findings change.
2026-11-11 18:04:50 +01:00

49 lines
2.1 KiB
Markdown

# display-scaling Specification
## Purpose
Keeps the application rendering crisp on displays with integer or fractional scaling by converting between logical and physical coordinates.
## Requirements
### Requirement: Fractional scale is applied when available
The system SHALL use the compositor-provided fractional preferred scale for rendering when the fractional scale protocol is available.
#### Scenario: Fractional display
- **WHEN** the compositor sends a preferred scale of 1.5
- **THEN** the render buffer is created at 1.5 times the logical size
- **AND** the buffer is displayed at the logical size
### Requirement: Integer scale is used as fallback
The system SHALL use the output's integer scale when fractional scale is unavailable.
#### Scenario: No fractional protocol
- **WHEN** the compositor does not support fractional scaling
- **THEN** the render buffer uses the output integer scale
- **AND** the buffer is displayed at the logical size
### Requirement: Input coordinates remain logical
The system SHALL report mouse positions and grid cells in logical coordinates regardless of the active scale.
#### Scenario: Scaled click
- **WHEN** the user clicks on a scaled display
- **THEN** the selected grid cell matches the visual location of the cursor
#### Scenario: Pointer entry without motion
- **WHEN** the pointer enters the canvas surface at a position and no motion event follows
- **THEN** the reported cursor position matches the entry point in logical coordinates
### Requirement: Rendering uses physical resolution
The system SHALL render all content at physical resolution so that lines and cells stay sharp at the active scale.
#### Scenario: Sharp cells
- **WHEN** the application runs on a 2x scaled display
- **THEN** cells are drawn with 2 physical pixels per logical pixel
### Requirement: Scale changes trigger re-render
The system SHALL recreate buffers and re-render when the active scale changes.
#### Scenario: Scale change
- **WHEN** the compositor changes the preferred scale
- **THEN** the application updates its buffers
- **AND** subsequent frames use the new scale