Laurent Vivier | 6105683 | 2019-09-06 10:38:12 +0200 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | * |
| 4 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 5 | * See the COPYING file in the top-level directory. |
| 6 | */ |
| 7 | |
| 8 | #ifndef UI_INPUT_BARRIER_H |
| 9 | #define UI_INPUT_BARRIER_H |
| 10 | |
| 11 | /* Barrier protocol */ |
| 12 | #define BARRIER_VERSION_MAJOR 1 |
| 13 | #define BARRIER_VERSION_MINOR 6 |
| 14 | |
| 15 | enum barrierCmd { |
| 16 | barrierCmdCNoop, |
| 17 | barrierCmdCClose, |
| 18 | barrierCmdCEnter, |
| 19 | barrierCmdCLeave, |
| 20 | barrierCmdCClipboard, |
| 21 | barrierCmdCScreenSaver, |
| 22 | barrierCmdCResetOptions, |
| 23 | barrierCmdCInfoAck, |
| 24 | barrierCmdCKeepAlive, |
| 25 | barrierCmdDKeyDown, |
| 26 | barrierCmdDKeyRepeat, |
| 27 | barrierCmdDKeyUp, |
| 28 | barrierCmdDMouseDown, |
| 29 | barrierCmdDMouseUp, |
| 30 | barrierCmdDMouseMove, |
| 31 | barrierCmdDMouseRelMove, |
| 32 | barrierCmdDMouseWheel, |
| 33 | barrierCmdDClipboard, |
| 34 | barrierCmdDInfo, |
| 35 | barrierCmdDSetOptions, |
| 36 | barrierCmdDFileTransfer, |
| 37 | barrierCmdDDragInfo, |
| 38 | barrierCmdQInfo, |
| 39 | barrierCmdEIncompatible, |
| 40 | barrierCmdEBusy, |
| 41 | barrierCmdEUnknown, |
| 42 | barrierCmdEBad, |
| 43 | /* connection sequence */ |
| 44 | barrierCmdHello, |
| 45 | barrierCmdHelloBack, |
| 46 | }; |
| 47 | |
| 48 | enum { |
| 49 | barrierButtonNone, |
| 50 | barrierButtonLeft, |
| 51 | barrierButtonMiddle, |
| 52 | barrierButtonRight, |
| 53 | barrierButtonExtra0 |
| 54 | }; |
| 55 | |
| 56 | struct barrierVersion { |
| 57 | int16_t major; |
| 58 | int16_t minor; |
| 59 | }; |
| 60 | |
| 61 | struct barrierMouseButton { |
| 62 | int8_t buttonid; |
| 63 | }; |
| 64 | |
| 65 | struct barrierEnter { |
| 66 | int16_t x; |
| 67 | int16_t y; |
| 68 | int32_t seqn; |
| 69 | int16_t modifier; |
| 70 | }; |
| 71 | |
| 72 | struct barrierMousePos { |
| 73 | int16_t x; |
| 74 | int16_t y; |
| 75 | }; |
| 76 | |
| 77 | struct barrierKey { |
| 78 | int16_t keyid; |
| 79 | int16_t modifier; |
| 80 | int16_t button; |
| 81 | }; |
| 82 | |
| 83 | struct barrierRepeat { |
| 84 | int16_t keyid; |
| 85 | int16_t modifier; |
| 86 | int16_t repeat; |
| 87 | int16_t button; |
| 88 | }; |
| 89 | |
| 90 | #define BARRIER_MAX_OPTIONS 32 |
| 91 | struct barrierSet { |
| 92 | int nb; |
| 93 | struct { |
| 94 | int id; |
| 95 | char nul; |
| 96 | int value; |
| 97 | } option[BARRIER_MAX_OPTIONS]; |
| 98 | }; |
| 99 | |
| 100 | struct barrierMsg { |
| 101 | enum barrierCmd cmd; |
| 102 | union { |
| 103 | struct barrierVersion version; |
| 104 | struct barrierMouseButton mousebutton; |
| 105 | struct barrierMousePos mousepos; |
| 106 | struct barrierEnter enter; |
| 107 | struct barrierKey key; |
| 108 | struct barrierRepeat repeat; |
| 109 | struct barrierSet set; |
| 110 | }; |
| 111 | }; |
| 112 | #endif |