Skip to main content

Module modifiers

Module modifiers 

Source
Expand description

Modifier key state — tracks which modifier keys are held.

Like Chrome’s WebInputEvent::modifiers_ — a u16 bitfield carried on every input event. Includes keyboard modifiers (Shift, Ctrl, Alt, Meta) and mouse button state (which buttons are currently pressed).

§Why a bitfield?

  • 2 bytes vs 8+ bytes for a struct of bools
  • Matches Chrome’s approach (kShiftKey | kControlKey | ...)
  • Cheap to copy, compare, combine with bitwise OR

Structs§

Modifiers
Modifier key and button state, carried on every input event.