summaryrefslogtreecommitdiff
path: root/ui/input-barrier.h
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2019-09-06 10:38:12 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-09-17 13:43:22 +0200
commit6105683da35babad9ae168a72d1e89e63e9d6974 (patch)
tree46faa844b75b726401f64c0ff52b2532ff122921 /ui/input-barrier.h
parente1b3d47751a420835cb0560fd029c39fea961a79 (diff)
downloadqemu-6105683da35babad9ae168a72d1e89e63e9d6974.zip
ui: add an embedded Barrier client
This allows to receive mouse and keyboard events from a Barrier server. This is enabled by adding the following parameter on the command line ... -object input-barrier,id=$id,name=$name ... Where $name is the name declared in the screens section of barrier.conf The barrier server (barriers) must be configured and must run on the local host. For instance: section: screens localhost: ... VM-1: ... end section: links localhost: right = VM-1 VM-1: left = localhost end Then on the QEMU command line: ... -object input-barrier,id=barrie0,name=VM-1 ... When the mouse will move out of the screen of the local host on the right, the mouse and the keyboard will be grabbed and all related events will be send to the guest OS. This is usefull when qemu is configured without emulated graphic card but with a VFIO attached graphic card. More information about Barrier can be found at: https://github.com/debauchee/barrier This avoids to install the Barrier server in the guest OS, for instance when it is not supported or during the installation. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-id: 20190906083812.29487-1-laurent@vivier.eu Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/input-barrier.h')
-rw-r--r--ui/input-barrier.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/ui/input-barrier.h b/ui/input-barrier.h
new file mode 100644
index 0000000000..e5b090590a
--- /dev/null
+++ b/ui/input-barrier.h
@@ -0,0 +1,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