[47424] | 1 | /** @file
|
---|
| 2 | * VBox Remote Desktop Extension (VRDE) - Input interface.
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*
|
---|
[98103] | 6 | * Copyright (C) 2013-2023 Oracle and/or its affiliates.
|
---|
[47424] | 7 | *
|
---|
[96407] | 8 | * This file is part of VirtualBox base platform packages, as
|
---|
| 9 | * available from https://www.virtualbox.org.
|
---|
[47424] | 10 | *
|
---|
[96407] | 11 | * This program is free software; you can redistribute it and/or
|
---|
| 12 | * modify it under the terms of the GNU General Public License
|
---|
| 13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 14 | * License.
|
---|
| 15 | *
|
---|
| 16 | * This program is distributed in the hope that it will be useful, but
|
---|
| 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 19 | * General Public License for more details.
|
---|
| 20 | *
|
---|
| 21 | * You should have received a copy of the GNU General Public License
|
---|
| 22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 23 | *
|
---|
[47424] | 24 | * The contents of this file may alternatively be used under the terms
|
---|
| 25 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
[47424] | 28 | * CDDL are applicable instead of those of the GPL.
|
---|
| 29 | *
|
---|
| 30 | * You may elect to license modified versions of this file under the
|
---|
| 31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[96407] | 32 | *
|
---|
| 33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[47424] | 34 | */
|
---|
| 35 |
|
---|
[76558] | 36 | #ifndef VBOX_INCLUDED_RemoteDesktop_VRDEInput_h
|
---|
| 37 | #define VBOX_INCLUDED_RemoteDesktop_VRDEInput_h
|
---|
[76507] | 38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 39 | # pragma once
|
---|
| 40 | #endif
|
---|
[47424] | 41 |
|
---|
[68675] | 42 | #include <VBox/RemoteDesktop/VRDE.h>
|
---|
[47424] | 43 |
|
---|
| 44 | /*
|
---|
| 45 | * Interface for receiving input events from the client.
|
---|
| 46 | */
|
---|
| 47 |
|
---|
| 48 | /* All structures in this file are packed.
|
---|
| 49 | * Everything is little-endian.
|
---|
| 50 | */
|
---|
| 51 | #pragma pack(1)
|
---|
| 52 |
|
---|
| 53 | /*
|
---|
| 54 | * The application interface between VirtualBox and the VRDE server.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | #define VRDE_INPUT_INTERFACE_NAME "VRDE::INPUT"
|
---|
| 58 |
|
---|
| 59 | /*
|
---|
| 60 | * Supported input methods.
|
---|
| 61 | */
|
---|
| 62 | #define VRDE_INPUT_METHOD_TOUCH 1
|
---|
| 63 |
|
---|
| 64 | /*
|
---|
| 65 | * fu32Flags for VRDEInputSetup
|
---|
| 66 | */
|
---|
| 67 | #define VRDE_INPUT_F_ENABLE 1
|
---|
| 68 |
|
---|
| 69 | /* The interface entry points. Interface version 1. */
|
---|
| 70 | typedef struct VRDEINPUTINTERFACE
|
---|
| 71 | {
|
---|
| 72 | /* The header. */
|
---|
| 73 | VRDEINTERFACEHDR header;
|
---|
| 74 |
|
---|
| 75 | /* Tell the server that an input method will be used or disabled, etc.
|
---|
| 76 | * VRDECallbackInputSetup will be called with a result.
|
---|
| 77 | *
|
---|
| 78 | * @param hServer The VRDE server instance.
|
---|
| 79 | * @param u32Method The method VRDE_INPUT_METHOD_*.
|
---|
| 80 | * @param fu32Flags What to do with the method VRDE_INPUT_F_*.
|
---|
| 81 | * @param pvSetup Method specific parameters (optional).
|
---|
| 82 | * @param cbSetup Size of method specific parameters (optional).
|
---|
| 83 | */
|
---|
| 84 | DECLR3CALLBACKMEMBER(void, VRDEInputSetup, (HVRDESERVER hServer,
|
---|
| 85 | uint32_t u32Method,
|
---|
| 86 | uint32_t fu32Flags,
|
---|
| 87 | const void *pvSetup,
|
---|
| 88 | uint32_t cbSetup));
|
---|
| 89 | } VRDEINPUTINTERFACE;
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | /* Interface callbacks. */
|
---|
| 93 | typedef struct VRDEINPUTCALLBACKS
|
---|
| 94 | {
|
---|
| 95 | /* The header. */
|
---|
| 96 | VRDEINTERFACEHDR header;
|
---|
| 97 |
|
---|
| 98 | /* VRDPInputSetup async result.
|
---|
| 99 | *
|
---|
| 100 | * @param pvCallback The callbacks context specified in VRDEGetInterface.
|
---|
| 101 | * @param rcSetup The result code of the request.
|
---|
| 102 | * @param u32Method The method VRDE_INPUT_METHOD_*.
|
---|
| 103 | * @param pvResult The result information.
|
---|
| 104 | * @param cbResult The size of buffer pointed by pvResult.
|
---|
| 105 | */
|
---|
| 106 | DECLR3CALLBACKMEMBER(void, VRDECallbackInputSetup,(void *pvCallback,
|
---|
| 107 | int rcRequest,
|
---|
| 108 | uint32_t u32Method,
|
---|
| 109 | const void *pvResult,
|
---|
| 110 | uint32_t cbResult));
|
---|
| 111 |
|
---|
| 112 | /* Input event.
|
---|
| 113 | *
|
---|
| 114 | * @param pvCallback The callbacks context specified in VRDEGetInterface.
|
---|
| 115 | * @param u32Method The method VRDE_INPUT_METHOD_*.
|
---|
| 116 | * @param pvEvent The event data.
|
---|
| 117 | * @param cbEvent The size of buffer pointed by pvEvent.
|
---|
| 118 | */
|
---|
| 119 | DECLR3CALLBACKMEMBER(void, VRDECallbackInputEvent,(void *pvCallback,
|
---|
| 120 | uint32_t u32Method,
|
---|
| 121 | const void *pvEvent,
|
---|
| 122 | uint32_t cbEvent));
|
---|
| 123 | } VRDEINPUTCALLBACKS;
|
---|
| 124 |
|
---|
| 125 |
|
---|
| 126 | /*
|
---|
| 127 | * Touch input definitions VRDE_INPUT_METHOD_TOUCH.
|
---|
| 128 | */
|
---|
| 129 |
|
---|
| 130 | /* pvResult is not used */
|
---|
| 131 |
|
---|
| 132 | /* RDPINPUT_HEADER */
|
---|
| 133 | typedef struct VRDEINPUTHEADER
|
---|
| 134 | {
|
---|
| 135 | uint16_t u16EventId;
|
---|
| 136 | uint32_t u32PDULength;
|
---|
| 137 | } VRDEINPUTHEADER;
|
---|
| 138 |
|
---|
| 139 | /* VRDEINPUTHEADER::u16EventId */
|
---|
| 140 | #define VRDEINPUT_EVENTID_SC_READY 0x0001
|
---|
| 141 | #define VRDEINPUT_EVENTID_CS_READY 0x0002
|
---|
| 142 | #define VRDEINPUT_EVENTID_TOUCH 0x0003
|
---|
| 143 | #define VRDEINPUT_EVENTID_SUSPEND_TOUCH 0x0004
|
---|
| 144 | #define VRDEINPUT_EVENTID_RESUME_TOUCH 0x0005
|
---|
| 145 | #define VRDEINPUT_EVENTID_DISMISS_HOVERING_CONTACT 0x0006
|
---|
| 146 |
|
---|
| 147 | /* RDPINPUT_SC_READY_PDU */
|
---|
| 148 | typedef struct VRDEINPUT_SC_READY_PDU
|
---|
| 149 | {
|
---|
| 150 | VRDEINPUTHEADER header;
|
---|
| 151 | uint32_t u32ProtocolVersion;
|
---|
| 152 | } VRDEINPUT_SC_READY_PDU;
|
---|
| 153 |
|
---|
| 154 | #define VRDEINPUT_PROTOCOL_V1 0x00010000
|
---|
[49626] | 155 | #define VRDEINPUT_PROTOCOL_V101 0x00010001
|
---|
[47424] | 156 |
|
---|
| 157 | /* RDPINPUT_CS_READY_PDU */
|
---|
| 158 | typedef struct VRDEINPUT_CS_READY_PDU
|
---|
| 159 | {
|
---|
| 160 | VRDEINPUTHEADER header;
|
---|
| 161 | uint32_t u32Flags;
|
---|
| 162 | uint32_t u32ProtocolVersion;
|
---|
| 163 | uint16_t u16MaxTouchContacts;
|
---|
| 164 | } VRDEINPUT_CS_READY_PDU;
|
---|
| 165 |
|
---|
| 166 | #define VRDEINPUT_READY_FLAGS_SHOW_TOUCH_VISUALS 0x00000001
|
---|
| 167 | #define VRDEINPUT_READY_FLAGS_DISABLE_TIMESTAMP_INJECTION 0x00000002
|
---|
| 168 |
|
---|
| 169 | /* RDPINPUT_CONTACT_DATA */
|
---|
| 170 | typedef struct VRDEINPUT_CONTACT_DATA
|
---|
| 171 | {
|
---|
| 172 | uint8_t u8ContactId;
|
---|
| 173 | uint16_t u16FieldsPresent;
|
---|
| 174 | int32_t i32X;
|
---|
| 175 | int32_t i32Y;
|
---|
| 176 | uint32_t u32ContactFlags;
|
---|
| 177 | int16_t i16ContactRectLeft;
|
---|
| 178 | int16_t i16ContactRectTop;
|
---|
| 179 | int16_t i16ContactRectRight;
|
---|
[47463] | 180 | int16_t i16ContactRectBottom;
|
---|
[47424] | 181 | uint32_t u32Orientation;
|
---|
| 182 | uint32_t u32Pressure;
|
---|
| 183 | } VRDEINPUT_CONTACT_DATA;
|
---|
| 184 |
|
---|
| 185 | #define VRDEINPUT_CONTACT_DATA_CONTACTRECT_PRESENT 0x0001
|
---|
| 186 | #define VRDEINPUT_CONTACT_DATA_ORIENTATION_PRESENT 0x0002
|
---|
| 187 | #define VRDEINPUT_CONTACT_DATA_PRESSURE_PRESENT 0x0004
|
---|
| 188 |
|
---|
| 189 | #define VRDEINPUT_CONTACT_FLAG_DOWN 0x0001
|
---|
| 190 | #define VRDEINPUT_CONTACT_FLAG_UPDATE 0x0002
|
---|
| 191 | #define VRDEINPUT_CONTACT_FLAG_UP 0x0004
|
---|
| 192 | #define VRDEINPUT_CONTACT_FLAG_INRANGE 0x0008
|
---|
| 193 | #define VRDEINPUT_CONTACT_FLAG_INCONTACT 0x0010
|
---|
| 194 | #define VRDEINPUT_CONTACT_FLAG_CANCELED 0x0020
|
---|
| 195 |
|
---|
| 196 | /* RDPINPUT_TOUCH_FRAME */
|
---|
| 197 | typedef struct VRDEINPUT_TOUCH_FRAME
|
---|
| 198 | {
|
---|
| 199 | uint16_t u16ContactCount;
|
---|
| 200 | uint64_t u64FrameOffset;
|
---|
| 201 | VRDEINPUT_CONTACT_DATA aContacts[1];
|
---|
| 202 | } VRDEINPUT_TOUCH_FRAME;
|
---|
| 203 |
|
---|
| 204 | /* RDPINPUT_TOUCH_EVENT_PDU */
|
---|
| 205 | typedef struct VRDEINPUT_TOUCH_EVENT_PDU
|
---|
| 206 | {
|
---|
| 207 | VRDEINPUTHEADER header;
|
---|
| 208 | uint32_t u32EncodeTime;
|
---|
| 209 | uint16_t u16FrameCount;
|
---|
| 210 | VRDEINPUT_TOUCH_FRAME aFrames[1];
|
---|
| 211 | } VRDEINPUT_TOUCH_EVENT_PDU;
|
---|
| 212 |
|
---|
| 213 | /* RDPINPUT_SUSPEND_TOUCH_PDU */
|
---|
| 214 | typedef struct VRDEINPUT_SUSPEND_TOUCH_PDU
|
---|
| 215 | {
|
---|
| 216 | VRDEINPUTHEADER header;
|
---|
| 217 | } VRDEINPUT_SUSPEND_TOUCH_PDU;
|
---|
| 218 |
|
---|
| 219 | /* RDPINPUT_RESUME_TOUCH_PDU */
|
---|
| 220 | typedef struct VRDEINPUT_RESUME_TOUCH_PDU
|
---|
| 221 | {
|
---|
| 222 | VRDEINPUTHEADER header;
|
---|
| 223 | } VRDEINPUT_RESUME_TOUCH_PDU;
|
---|
| 224 |
|
---|
| 225 | /* RDPINPUT_DISMISS_HOVERING_CONTACT_PDU */
|
---|
| 226 | typedef struct VRDEINPUT_DISMISS_HOVERING_CONTACT_PDU
|
---|
| 227 | {
|
---|
| 228 | VRDEINPUTHEADER header;
|
---|
| 229 | uint8_t u8ContactId;
|
---|
| 230 | } VRDEINPUT_DISMISS_HOVERING_CONTACT_PDU;
|
---|
| 231 |
|
---|
| 232 | #pragma pack()
|
---|
| 233 |
|
---|
[76585] | 234 | #endif /* !VBOX_INCLUDED_RemoteDesktop_VRDEInput_h */
|
---|