aboutsummaryrefslogtreecommitdiff
path: root/ui/input-barrier.h
blob: e5b090590ad597c247001effbdf8dc7523878b87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 */

#ifndef UI_INPUT_BARRIER_H
#define UI_INPUT_BARRIER_H

/* Barrier protocol */
#define BARRIER_VERSION_MAJOR 1
#define BARRIER_VERSION_MINOR 6

enum barrierCmd {
    barrierCmdCNoop,
    barrierCmdCClose,
    barrierCmdCEnter,
    barrierCmdCLeave,
    barrierCmdCClipboard,
    barrierCmdCScreenSaver,
    barrierCmdCResetOptions,
    barrierCmdCInfoAck,
    barrierCmdCKeepAlive,
    barrierCmdDKeyDown,
    barrierCmdDKeyRepeat,
    barrierCmdDKeyUp,
    barrierCmdDMouseDown,
    barrierCmdDMouseUp,
    barrierCmdDMouseMove,
    barrierCmdDMouseRelMove,
    barrierCmdDMouseWheel,
    barrierCmdDClipboard,
    barrierCmdDInfo,
    barrierCmdDSetOptions,
    barrierCmdDFileTransfer,
    barrierCmdDDragInfo,
    barrierCmdQInfo,
    barrierCmdEIncompatible,
    barrierCmdEBusy,
    barrierCmdEUnknown,
    barrierCmdEBad,
    /* connection sequence */
    barrierCmdHello,
    barrierCmdHelloBack,
};

enum {
   barrierButtonNone,
   barrierButtonLeft,
   barrierButtonMiddle,
   barrierButtonRight,
   barrierButtonExtra0
};

struct barrierVersion {
    int16_t major;
    int16_t minor;
};

struct barrierMouseButton {
    int8_t buttonid;
};

struct barrierEnter {
    int16_t x;
    int16_t y;
    int32_t seqn;
    int16_t modifier;
};

struct barrierMousePos {
    int16_t x;
    int16_t y;
};

struct barrierKey {
    int16_t keyid;
    int16_t modifier;
    int16_t button;
};

struct barrierRepeat {
    int16_t keyid;
    int16_t modifier;
    int16_t repeat;
    int16_t button;
};

#define BARRIER_MAX_OPTIONS 32
struct barrierSet {
    int nb;
    struct {
        int id;
        char nul;
        int value;
    } option[BARRIER_MAX_OPTIONS];
};

struct barrierMsg {
    enum barrierCmd cmd;
    union {
        struct barrierVersion version;
        struct barrierMouseButton mousebutton;
        struct barrierMousePos mousepos;
        struct barrierEnter enter;
        struct barrierKey key;
        struct barrierRepeat repeat;
        struct barrierSet set;
    };
};
#endif