Trame

Feel: delays, repeats and steps

How the interface answers the hand is one struct, ui.Feel, held by ui.State. ui.init sets ui.FEEL_DEFAULT. A program reads the values with ui.feel, changes some, and gives them back with ui.set_feel. A settings page shows each field as a preference.

Formula
f := ui.feel(&app.state)
f.tooltip_delay_ms = 800
f.step_shift = 5
ui.set_feel(&app.state, f)

ui.set_feel(s, f) takes f for every build from then on. It brings each value within what works (below), and gives the platform its part through platform.set_input_defaults. The other settings of the State keep their own setters: set_zoom, set_density, set_rounding, set_scrollbar_size, set_scrollbar_autohide, set_scrollbar_overlay, set_toast_position, set_scroll_settings, set_autoscroll_settings, set_animations, set_smooth_scroll. Every one of them is a standard preference of the settings page (settings.md): prefs_page.standard_watch applies them.

Motion

Build_Params.animations is what the system asks (platform.os_animations_enabled: its setting to reduce motion). The user's word goes over it:

Formula
ui.set_animations(&s, .Off)        // System (the default): as Build_Params.animations; On: always; Off: never
ui.set_smooth_scroll(&s, .On)      // Follow (the default): a notch glides when the window animates; On: always; Off: never
a := ui.animations(&s)             // the setting; animations_on() says whether this build animates
m := ui.smooth_scroll(&s)

Both take effect at the next build. set_smooth_scroll replaces the former Build_Params.smooth_scroll.

Fields

FieldUnitDefaultWhat it sets
tooltip_delay_msms500The pointer rests this long on a box before its tooltip shows: hovered_for, a folded pane's title, a table's cut cell, a segment's tip.
menu_hover_msms280The pointer rests this long on a submenu's item before it opens (or before another one closes).
menu_item_emem1.9The height of a menu item, times the density (dense). At least 1.2.
palette_fade_msms160A change of palette cross-fades every colour for this long.
typeahead_msms900Keys typed in a list within this much of each other add up to one prefix.
undo_stepssteps200The edit history a line_edit and a text_edit keep. A lower value set later trims the history at the next edit. At least 1.
undo_merge_msms1000Typing (or deleting) within this much of the previous edit of the same kind is the same undo step. 0: each edit is a step.
repeat_delay_msms420A held button repeats after this long: repeat_pressed (a number's buttons).
repeat_interval_msms55Then once every this much. At least 1.
step_shiftfactor10Shift multiplies a step: a slider's arrow and Page keys and wheel notch, a number's buttons and wheel, a number in text (num_step_delta).
step_ctrlfactor100Ctrl multiplies the step of a number in text.
step_altfactor0.1Alt multiplies the step of a number in text.
step_pagesteps10Page Up and Page Down move this many steps: a slider, a number in text.
caret_motionui.Caret_MotionGlideHow a caret goes to its new place: .Jump, .Glide, .Spring, .Trail (ui.caret_glide, caret-motion.md). None when the window does not animate (caret_feel).
caret_msms90And in how long, 0 to CARET_MS_MAX (400); 0: it jumps.
zoom_stepfactor1.1The interface's zoom (zoom, set_zoom) is multiplied or divided by it: Ctrl+wheel (per notch), Ctrl+= and Ctrl+-. At least 1.01. It stays between ZOOM_MIN and ZOOM_MAX. A zoom zone's zoom takes the same step (zoom-zones.md).
wheel_lineslines3The lines a notch of the wheel moves where the system does not say: Linux always, Windows when the setting cannot be read (platform.wheel_lines).
key_repeat_delay_msms600A held key repeats after this long, where the program makes the repeats and the system has not said its own (Wayland, until the compositor sends its rate).
key_repeat_rateper second25Then this many times a second, likewise. 0: no repeat.
fling_stop_speedpx/s20A fling of the finger is over under this speed (platform.touch_fling).

A duration or a count below 0 becomes 0.

The zoom steps of a preview (PREVIEW_ZOOM_STEP, 1.25), a node_graph (GRAPH_ZOOM_STEP, 1.2) and a term view (term.ZOOM_STEP) are not zoom_step: they zoom a picture, a graph or a grid inside the window, in coarser steps than the interface's own zoom.

The platform's part

platform.Input_Defaults holds what the platform takes where the system says nothing: wheel_lines, key_repeat_delay_ms, key_repeat_rate, fling_stop_speed (defaults: platform.INPUT_DEFAULTS). platform.set_input_defaults(d) sets them for the calling thread and platform.input_defaults() reads them. They belong to the thread: its interface sets them and its windows read them. ui.set_feel (and ui.init) call it with the fields of Feel; a program that uses ui does not call it itself.

Held buttons

repeat_pressed(sig) is true at the press of a button, then every repeat_interval_ms after repeat_delay_ms while the pointer stays on it. Off the button it waits; back on it, it goes on. It wakes the loop at the next repeat only. The arrow buttons of a scroll bar repeat by the same rule with the times of their standard, 400 ms then 60 ms, not the Feel's (scroll-bar.md).

Edit this page on GitHub