Skip to content

feat(platform): implement bitty-platform crate skeleton: owned winit event adapter #17

Closed

Description

@Xuepoo

Implements CarryCtx task CTX-0014.

Scope

  • New workspace crate crates/bitty-platform: window/event-loop adapter adopting winit (~0.30.x) per ADR-0003 topology and the ADR-0004 decision row (adopt winit, reject crossterm as runtime input path).
  • Strictly owned public API: no winit type escapes the crate. Internal ApplicationHandler adapter translates WindowEvent/DeviceEvent streams into an owned PlatformEvent enum (keyboard/mouse/cursor/redraw/resized/focused/close/close-requested/DPI-scale-factor/resumed/suspended/about-to-wait).
  • DPI-aware size types: LogicalPixel, LogicalSize, PhysicalSize, ScaleFactor with validated, documented physical<->logical conversions.
  • Owned keyboard model (PhysicalKeyCode, mirrored named/character key enum, text, repeat, location) and mouse model (MouseButton, button state, cursor position).
  • Headless-friendly test seam: pure translation logic unit-tested without a display; display-dependent integration tests gated behind a default-off crate feature and documented; headless CI asserts graceful owned-error behavior instead of panics.
  • \#![forbid(unsafe_code)]; no render/grid coupling; no business semantics.
  • Workspace manifest edits kept minimal (members list only) — CTX-0015 runs in parallel on the same manifest for union-merge.

Acceptance

  • Unit tests: event-translation mapping table, DPI conversion round-trips and validation, close-request semantics, scale-factor handling.
  • just check green locally (fmt-check, clippy -D warnings --locked, test --locked, actionlint, markdownlint); CI green.

Refs: CTX-0014

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0area:packagearea:platformfeat

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions