|
| 1 | +#pragma once |
| 2 | + |
| 3 | +/** This file contains main definitions of commands used by far2l TTY extensions, |
| 4 | + as well as some documentation for them. |
| 5 | +*/ |
| 6 | + |
| 7 | +//////////////////// |
| 8 | +/** |
| 9 | +FARTTY_INTERRACT_* commands are send from client to server to request it to perform some action. |
| 10 | +Request looks as "\x1b_far2l:"BASE64-encoded-arguments-stack"\x07" |
| 11 | +For details of arguments stack encoding see utils/StackSerializer.h and utils/StackSerializer.cpp. |
| 12 | +Each request's stack has on top 8-bit ID followed by any of FARTTY_INTERRACT_* and related arguments. |
| 13 | +If request ID is zero then server doesnt reply on such request, if ID is not zero then upon its |
| 14 | +completion server sends back to client reply that has similar encoding and same ID on top of its |
| 15 | +arguments stack, however other reply's arguments represent result of requested operation. |
| 16 | +*/ |
| 17 | + |
| 18 | +/** Initiates ad-hoc copy-pasting starting at last mouse click position |
| 19 | + In: N/A |
| 20 | + Out: N/A |
| 21 | +*/ |
| 22 | +#define FARTTY_INTERRACT_CONSOLE_ADHOC_QEDIT 'e' |
| 23 | + |
| 24 | +/** Maximizes window |
| 25 | + In: N/A |
| 26 | + Out: N/A |
| 27 | +*/ |
| 28 | +#define FARTTY_INTERRACT_WINDOW_MAXIMIZE 'M' |
| 29 | + |
| 30 | +/** Makes window to be not-maximized |
| 31 | + In: N/A |
| 32 | + Out: N/A |
| 33 | +*/ |
| 34 | +#define FARTTY_INTERRACT_WINDOW_RESTORE 'm' |
| 35 | + |
| 36 | +/** Various operations with clipboard, see also FARTTY_INTERRACT_CLIP_* |
| 37 | + In: char (FARTTY_INTERRACT_CLIP_* subcommand); subcommands-specific |
| 38 | + Out: specific to subcommands |
| 39 | +*/ |
| 40 | +#define FARTTY_INTERRACT_CLIPBOARD 'c' |
| 41 | + |
| 42 | +/** Changes height of cursor in percents |
| 43 | + In: uint8_t (cursor height to set from 0% to 100%) |
| 44 | + Out: N/A |
| 45 | +*/ |
| 46 | +#define FARTTY_INTERRACT_SET_CURSOR_HEIGHT 'h' |
| 47 | + |
| 48 | +/** Gets maximum possible size of window |
| 49 | + In: N/A |
| 50 | + Out: COORD (window size) |
| 51 | +*/ |
| 52 | +#define FARTTY_INTERRACT_GET_WINDOW_MAXSIZE 'w' |
| 53 | + |
| 54 | +/** Sets titles of F-keys board if host supports this (invented for Mac touchbar) |
| 55 | + In: 12 elements each is either [uint8_t (state) = 0] either [uint8_t (state) != 0; string (F-key title)] |
| 56 | + Out: bool (true on success; false if operation impossible) |
| 57 | +*/ |
| 58 | +#define FARTTY_INTERRACT_DESKTOP_NOTIFICATION 'n' |
| 59 | + |
| 60 | +/** Displays desktop notification with given title and text |
| 61 | + In: STRING (title); STRING (text); |
| 62 | + Out: N/A |
| 63 | +*/ |
| 64 | +#define FARTTY_INTERRACT_SET_FKEY_TITLES 'f' |
| 65 | + |
| 66 | +/** Declares that client supports specified extra features, so server _may_ change its hehaviour accordingly if it also supports some of them |
| 67 | + In: uint64_t (set of FARTTY_FEAT_* bit flags) |
| 68 | + Out: N/A |
| 69 | +*/ |
| 70 | +#define FARTTY_INTERRACT_CHOOSE_EXTRA_FEATURES 'x' |
| 71 | + |
| 72 | +/////////////////////// |
| 73 | + |
| 74 | +/** Authorizes clipboard accessor and opens clipboard for any subsequent operation. |
| 75 | + In: string (32 <= length <=256 - random client ID used as passcode in following clipboard opens) |
| 76 | + Out: char (1 - success, 0 - failure, -1 - access denied); uint64_t (OPTIONAL; combination of FARTTY_FEATCLIP_* supported by server) |
| 77 | +*/ |
| 78 | +#define FARTTY_INTERRACT_CLIP_OPEN 'o' |
| 79 | + |
| 80 | +/** Closes clipboard, must be used to properly finalize required clipboard action. |
| 81 | + In: N/A |
| 82 | + Out: char (1 - success, 0 - failure, -1 - clipboard wasn't open) |
| 83 | +*/ |
| 84 | +#define FARTTY_INTERRACT_CLIP_CLOSE 'c' |
| 85 | + |
| 86 | +/** Empties clipboard. |
| 87 | + In: N/A |
| 88 | + Out: char (1 - success, 0 - failure, -1 - clipboard wasn't open) |
| 89 | +*/ |
| 90 | +#define FARTTY_INTERRACT_CLIP_EMPTY 'e' |
| 91 | + |
| 92 | +/** Checks if given format available for get'ing from clipboard. |
| 93 | + In: uint32_t - format ID |
| 94 | + Out: char (1 - there is data of such format, 0 - there is no data of such format) |
| 95 | +*/ |
| 96 | +#define FARTTY_INTERRACT_CLIP_ISAVAIL 'a' |
| 97 | + |
| 98 | +/** Allows chunked clipboard data setting by sendings multiple chunks berfore final SETDATA. |
| 99 | + Special case: chunk with zero size treated as dismissing all previously queued chunks. |
| 100 | + OPTIONAL: can be used only if server reported FARTTY_FEATCLIP_CHUNKED_SET as supported feature |
| 101 | + In: uint16_t (chunk size, shifted right by 8 bits); data of specified size |
| 102 | + Out: N/A |
| 103 | +*/ |
| 104 | +#define FARTTY_INTERRACT_CLIP_SETDATACHUNK 'S' |
| 105 | + |
| 106 | +/** Puts into clipboard data of specified format. Prepends given data with pending chunks (if any). |
| 107 | + In: uint32_t (format ID); uint32_t (size); data of specified size |
| 108 | + Out: char (1 - success, 0 - failure, -1 - clipboard wasn't open); uint64_t (OPTIONAL; clipboard data ID) |
| 109 | +*/ |
| 110 | +#define FARTTY_INTERRACT_CLIP_SETDATA 's' |
| 111 | + |
| 112 | +/** Gets from clipboard data of specified format. |
| 113 | + In: uint32_t (format ID); |
| 114 | + Out: char (1 - success, 0 - failure, -1 - clipboard wasn't open); uint32_t (size); data of specified size; uint64_t (OPTIONAL; clipboard data ID) |
| 115 | +*/ |
| 116 | +#define FARTTY_INTERRACT_CLIP_GETDATA 'g' |
| 117 | + |
| 118 | +/** Gets ID of current clipboard data of specified format. |
| 119 | + OPTIONAL: can be used only if server reported FARTTY_FEATCLIP_DATA_ID as supported feature |
| 120 | + In: uint32_t (format ID); |
| 121 | + Out: uint64_t (0 - failure, nonzero value - clipboard data ID) |
| 122 | +*/ |
| 123 | +#define FARTTY_INTERRACT_CLIP_GETDATAID 'i' |
| 124 | + |
| 125 | +/** Registers arbitrary clipboard data format. |
| 126 | + In: string (format name to be registered); |
| 127 | + Out: uint32_t (0 - failure, nonzero value - registered format ID) |
| 128 | +*/ |
| 129 | +#define FARTTY_INTERRACT_CLIP_REGISTER_FORMAT 'r' |
| 130 | + |
| 131 | +/////////////////////// |
| 132 | + |
| 133 | +/** Client may specify this wanted extra feature if it supports compact input events. |
| 134 | + If server supports this feature it may send such events, however client should be ready to |
| 135 | + receive not-compact events as well. |
| 136 | +*/ |
| 137 | +#define FARTTY_FEAT_COMPACT_INPUT 0x00000001 |
| 138 | + |
| 139 | +/** Server reports this on respoce of FARTTY_INTERRACT_CLIP_OPEN if it supports clipboard data ID. |
| 140 | + Clipboard data ID allows client-side caching of clipboard data and avoid known data transfers. |
| 141 | +*/ |
| 142 | +#define FARTTY_FEATCLIP_DATA_ID 0x00000001 |
| 143 | + |
| 144 | +/** Server reports this on respoce of FARTTY_INTERRACT_CLIP_OPEN if it supports chunked clipboard data set. |
| 145 | + This feature allows client to implement background and cancellable clipboard copy. |
| 146 | +*/ |
| 147 | +#define FARTTY_FEATCLIP_CHUNKED_SET 0x00000002 |
| 148 | + |
| 149 | +/////////////////////// |
| 150 | +/** |
| 151 | +FARTTY_INPUT_* notifications are send from server to client to inform about specific event happened. |
| 152 | +Notification looks as "\x1b_f2l:"BASE64-encoded-arguments-stack"\x07" |
| 153 | +For details of arguments stack encoding see utils/StackSerializer.h and utils/StackSerializer.cpp. |
| 154 | +Unlike FARTTY_INTERRACT_* there is no ID and no replies are expected from client to server, all arguments |
| 155 | +are defined by FARTTY_INPUT_* notification ID - see below. |
| 156 | +*/ |
| 157 | + |
| 158 | + |
| 159 | +/** Server sends this to inform avoid mouse event. See MOUSE_EVENT_RECORD for details. |
| 160 | + uint32_t (dwControlKeyState); uint32_t (dwControlKeyState); uint32_t (dwButtonState); uint16_t (pos.Y); uint16_t (pos.X); |
| 161 | +*/ |
| 162 | +#define FARTTY_INPUT_MOUSE 'M' |
| 163 | + |
| 164 | +/** Server sends this to inform avoid mouse event if compact input is enabled and possible. See MOUSE_EVENT_RECORD for details. |
| 165 | + uint8_t (dwControlKeyState); uint8_t (dwControlKeyState); uint8_t (dwButtonState); uint16_t (pos.Y); uint16_t (pos.X); |
| 166 | +*/ |
| 167 | +#define FARTTY_INPUT_MOUSE_COMPACT 'm' |
| 168 | + |
| 169 | +/** Server sends this to inform avoid keydown or keyup event. See KEY_EVENT_RECORD for details. |
| 170 | + uint32_t (UTF32 code); uint32_t (dwControlKeyState); uint16_t (wVirtualScanCode); uint16_t (wVirtualKeyCode); uint16_t (wRepeatCount); |
| 171 | +*/ |
| 172 | +#define FARTTY_INPUT_KEYDOWN 'K' |
| 173 | +#define FARTTY_INPUT_KEYUP 'k' |
| 174 | + |
| 175 | +/** Server sends this to inform avoid keydown or keyup event if compact input is enabled and possible. See KEY_EVENT_RECORD for details. |
| 176 | + Note that event doesn't specify wVirtualScanCode and wRepeatCount thus client must assume wVirtualScanCode = 0 and wRepeatCount = 1 |
| 177 | + uint8_t (UTF32 code represented as single-byte); uint32_t (dwControlKeyState); uint16_t (wVirtualKeyCode) |
| 178 | +*/ |
| 179 | +#define FARTTY_INPUT_KEYDOWN_COMPACT_CHAR 'C' |
| 180 | +#define FARTTY_INPUT_KEYUP_COMPACT_CHAR 'c' |
| 181 | + |
| 182 | +/** Server sends this to inform avoid keydown or keyup event if compact input is enabled and possible. See KEY_EVENT_RECORD for details. |
| 183 | + Note that event doesn't specify wVirtualScanCode and wRepeatCount thus client must assume wVirtualScanCode = 0 and wRepeatCount = 1 |
| 184 | + uint32_t (UTF32 code); uint32_t (dwControlKeyState); uint16_t (wVirtualKeyCode) |
| 185 | +*/ |
| 186 | +#define FARTTY_INPUT_KEYDOWN_COMPACT_WIDE 'W' |
| 187 | +#define FARTTY_INPUT_KEYUP_COMPACT_WIDE 'w' |
| 188 | + |
0 commit comments