Skip to content

desk

windows, menus, a file browser and a picture viewer

NAME
    desk - windows, menus, a file browser and a picture viewer

SYNOPSIS
    desk

DESCRIPTION
    The window system (lib_wm, //#use wm): draggable overlapping
    windows with close boxes, a menu bar with press-drag-release
    pull-downs, per-window hardware clipping, painter's-algorithm
    repaint, focus, and text drawn by the card inside a window.
    The SHAPES window's content is recorded ONCE into a card-resident
    command list, so its every repaint costs TWO wire bytes (CLRUN)
    -- the scene lives on the card, the machine keeps geometry.

    THE MECHANISM: each window's content is drawn in its own LOCAL
    coordinates under a per-window WINDOW/VWPORT pair. WINDOW declares
    the local extent (0..w-1, 0..h-1), VWPORT places it on screen;
    with matching extents the map is a pure translation and the
    window edge is a hardware CLIP -- content cannot escape, so
    occlusion reduces to paint order, bottom to top. The CPU keeps
    only rectangles and a z-order.

    Four windows: SHAPES draws primitives that deliberately overrun
    its edge (the card clips them); TERM is a LIVE terminal with one
    rule: the line you type is a program invocation -- "paint.bin",
    "/bin/cube.bin", args and all -- launched on ENTER exactly like a
    click in FILES (SYS_EXEC, chained with -d). Navigation is FILES'
    job; the window IS dir, the Mac way; FILES browses the filesystem -- click or arrow to
    select, ENTER (or the OPEN menu item) opens: a directory
    navigates ('..' walks up), a .BIN LAUNCHES -- desk SYS_EXECs the
    program, which loads over desk's own memory, the System-1 way;
    programs that understand the "-d" argument (paint does) chain
    back to desk when they quit -- and a .P8I picture opens in VIEW,
    where the image BLITs from its file into window-local
    coordinates -- drag the window and the picture rides along. All
    text is the card's own stroke TEXT, placed in window-local
    coordinates like every other primitive.

KEYS AND MOUSE
    TAB               raise and focus the next window
    arrow keys        move the focused window 8 px -- except FILES,
                      where up/down move the SELECTION
    ENTER             open the FILES selection (when FILES has focus)
    printable keys    type into a focused TERM; ENTER scrolls;
                      backspace erases
    Ctrl-D            quit
    mouse             press a title bar and drag (complement outline;
                      release places it); press anywhere in a window
                      to raise it; click the small box on a title
                      bar to CLOSE the window; press DESK in the
                      menu bar and SLIDE, the Mac way -- release on
                      NEW TERM (a fresh terminal), CLOSE TOP, or
                      QUIT (see man paint, MOUSE, for how the mouse
                      reaches the machine)

NOTES
    Curves (CIRCLE/ELIPSE) clip at the SCREEN, not the window -- the
    engine draws them in device space after mapping (man gl). Windowed
    programs must keep curves inside their extent themselves; lines,
    RECTs, fills and TEXT all clip properly. Repaint is a full
    back-to-front replay; static window content rides card-resident
    lists (SHAPES does), dynamic content draws immediate (TERM must:
    its text changes, and TEXT cannot be recorded into a list -- the
    documented limitation). The library is /lib/lib_wm.c -- windows,
    z-order, chrome, hit tests, drag, the menu; a client provides
    wm_content()/wm_title() and pumps lib_ptr events.

NOTES ON LAUNCHING
    The TPA holds ONE program, so launching replaces desk in memory
    (SYS_EXEC, man basic has none of this -- see /src/os-bios for the
    syscall). A launched program that ignores "-d" simply exits to
    the shell; type desk to return. This is exactly how the original
    Finder worked: the application replaced it in RAM, and quitting
    brought it back.

SEE ALSO
    wdesk, paint, gl, gfx, basic

See also: wdesk, paint, gl, gfx, basic

The text of man desk on P8X (os/man/desk in the repository). All commands