Input Events

  • An event is a message to notify an application that something happened
  • The transformed low-level input is a state (not an event)
  • The windowing system generates events when the state changes
  • keydown, keyup, mousedown, mouseup, mousemove are fundamental low-level input events. Basic mouse and keyboard input is described by these 5 events
  • The windowing system maintains a list of all windows ordered from back to front, the front most window has focus. Events are sent to focused window
  • The event queue is a buffer between the user and each window
    • Toolkit should refer to event timestamp, not time when the event was pulled off the queue or handled by the application code
  • a mousedown followed by a mouseup within a short time and with little movement is a mouse button click

image.png

  • a click followed by another click with a short time is a dblclick

image.png

  • the dragstart event is sent when the mouse button is held down and the mouse moves more than a small amount. Once in the dragging state, each mousemove triggers a drag event. mouseup from dragging state also sends a dragend event

image.png

  • Translated events will have same timestamp as fundamental event that triggered it
    • e.g. click will have same timestamp as the mouseup
  • All translated events must be dispatched in deterministic order. Application can assume sequence if listening to multiple events. e.g. a click will come after a mouseup
  • a mousedown followed by little movement and no mouseup for a long time is a longpress

image.png

  • Event coalescing is an optimization technique where high-frequency events like mousemove (which describe a continuous state) are combined or reduced to avoid overwhelming the system, since not every intermediate movement is important. In contrast, discrete events like mousedown or mouseup are low-frequency and significant, so they must be handled individually. Coalescing improves performance but should be avoided when precise, per-event data is required—such as for capturing exact pointer paths in signatures or drawing.