# The trackpad features, asserted without a trackpad, plus the rest of the # pointer vocabulary. # # Trackpad.button(fingers:) is pure policy with no NSEvent in it, so a script # can name how many fingers were resting and get back the button a hand would # have produced: two or more fingers is acme's button 2 (Exec), one finger is # left to select, and a deep press is button 3 (Look). pardes_take_haptic is # the other half — it is how the pulse the core armed is read back on a machine # with nothing to feel it with. # # Coordinates are 0-based cells, which is what pardes_mouse takes. The tty # suite's press/release are 1-based SGR and so read one higher. start 30 100 wait 8000 Newcol Joincol wait 8000 $ stable 700 20000 # something to look at; split so the echoed command line is not the match text printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' key enter wait 10000 MARK c stable 700 10000 # A raw pane hands clicks to the program on the other end. Normal mode is where # the three buttons mean Select, Exec and Look. key c-b stable 600 8000 snap ready # THE ADAPTER ITSELF, before any of the decoded paths below. `nsclick` builds a # real NSEvent and hands it to the view's own rightMouseDown, so this is the one # command that exercises the code between AppKit and the entry points. It is # here because an adapter that silently dropped every mouse event once passed # this entire suite: everything else calls the entry points directly. nsclick right 4 3 wait 10000 @p0: stable 700 15000 haptic look snap adapter # Back to a clean slate for the finger-count cases below. haptic none # A DEEP PRESS = button 3 = Look. MARK names no file, so looking at it # searches, and the hits land in a +Search buffer split under the shell. force 4 3 wait 10000 @p0: stable 700 15000 haptic look snap look # ...and taking the pulse cleared it haptic none # The three press phases one at a time rather than through `click`, which is # what proves press, drag and release are separate entry points and not a lump. mouse left press 2 3 mouse left drag 9 3 mouse left release 9 3 stable 700 10000 snap dragged # ponytail: `y` here would yank that selection into the core's register and # fire set_clipboard, which is what the harness's `clipboard ` asserts. # It is not scripted because the expected text has to be READ off this golden # first — a guessed span would hand the next person a failing script instead of # a capture. Add the two lines once `snap dragged` shows what got selected. # A button-less hover: the core tracks it for the link and definition underline. mouse none motion 4 5 stable 400 5000 snap hover # A trackpad's precise scroll is fractional rows the core accumulates into whole # wheel presses; a real mouse notch skips the smoothing and arrives as an # ordinary button. Both spellings, so the two paths stay distinguishable. scroll -3 4 5 stable 700 10000 snap scrolled wheel wheeldown 4 5 stable 700 10000 snap notched # TWO FINGERS = button 2 = Exec. `New` in the column tag is a builtin, so this # spawns a pane rather than running something the machine would have to own. fingers 2 3 1 stable 700 20000 haptic exec snap exec # THREE FINGERS are the same button 2, and that is the case the finger count # exists for: macOS delivers them on the right stream exactly like two, so a # view that trusted the stream would Look here. `Newcol` proves this one went # somewhere different from the click above. fingers 3 1 0 stable 700 20000 haptic exec snap exec3 # One finger is still an ordinary left press, and selecting is not a verb the # hand should feel. fingers 1 4 3 stable 700 10000 haptic none snap select draw trackpad