[gnome-remote-desktop] vnc: Add VNC virtual monitor config
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] vnc: Add VNC virtual monitor config
- Date: Thu, 28 Jul 2022 08:38:51 +0000 (UTC)
commit 145ce940e37f0a0caa0fa6a030650b92c03b143b
Author: Vasilis Liaskovitis <vliaskovitis suse com>
Date: Thu Jul 14 17:48:18 2022 +0200
vnc: Add VNC virtual monitor config
VNC clients do not submit an initial monitor configuration upon connection.
However the monitor configuration can be changed during the session with
a setDesktopSize RFB request:
https://vncdotool.readthedocs.io/en/0.8.0/rfbproto.html#setdesktopsize
This commit adds a configuration struct for rudimentary virtual
monitors to be used in VNC sessions. Currently, only the size (width x
height) of the virtual monitor can be manipulated through the
setDesktopSize hook (to be implemented in a later commit).
Based on RDP virtual monitor commits by Pascal Nowack <Pascal Nowack gmx de>
https://gitlab.gnome.org/GNOME/gnome-remote-desktop/-/merge_requests/69
src/grd-session-vnc.c | 8 ++++++++
src/grd-vnc-monitor-config.h | 48 ++++++++++++++++++++++++++++++++++++++++++++
src/meson.build | 1 +
3 files changed, 57 insertions(+)
---
diff --git a/src/grd-session-vnc.c b/src/grd-session-vnc.c
index fbc66a41..44a9d44d 100644
--- a/src/grd-session-vnc.c
+++ b/src/grd-session-vnc.c
@@ -211,6 +211,14 @@ grd_session_vnc_set_client_clipboard_text (GrdSessionVnc *session_vnc,
rfbSendServerCutText(session_vnc->rfb_screen, text, text_length);
}
+static void
+grd_vnc_monitor_config_free (GrdVncMonitorConfig *monitor_config)
+{
+ g_clear_pointer (&monitor_config->connectors, g_strfreev);
+ g_free (monitor_config->virtual_monitors);
+ g_free (monitor_config);
+}
+
static void
maybe_queue_close_session_idle (GrdSessionVnc *session_vnc)
{
diff --git a/src/grd-vnc-monitor-config.h b/src/grd-vnc-monitor-config.h
new file mode 100644
index 00000000..d7baa496
--- /dev/null
+++ b/src/grd-vnc-monitor-config.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 Pascal Nowack
+ * Copyright (C) 2022 SUSE Software Solutions Germany GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef GRD_VNC_MONITOR_CONFIG_H
+#define GRD_VNC_MONITOR_CONFIG_H
+
+#define GRD_VNC_CLAMP_DESKTOP_SIZE(value) MAX (MIN (value, 8192), 200)
+#define GRD_VNC_DEFAULT_WIDTH 1920
+#define GRD_VNC_DEFAULT_HEIGHT 1080
+
+typedef struct _GrdVncVirtualMonitor
+{
+ uint16_t pos_x;
+ uint16_t pos_y;
+ uint16_t width; /* Valid values are in range of [200, 8192] */
+ uint16_t height; /* Valid values are in range of [200, 8192] */
+} GrdVncVirtualMonitor;
+
+typedef struct _GrdVncMonitorConfig
+{
+ gboolean is_virtual;
+
+ /* Server configs only */
+ char **connectors;
+ /* Client configs only */
+ GrdVncVirtualMonitor *virtual_monitors;
+ /* Count of items in connectors or virtual_monitors */
+ uint32_t monitor_count;
+} GrdVncMonitorConfig;
+
+#endif /* GRD_VNC_MONITOR_CONFIG_H */
diff --git a/src/meson.build b/src/meson.build
index 3def890f..6c0bf845 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -111,6 +111,7 @@ if have_vnc
'grd-session-vnc.h',
'grd-vnc-cursor.c',
'grd-vnc-cursor.h',
+ 'grd-vnc-monitor-config.h',
'grd-vnc-pipewire-stream.c',
'grd-vnc-pipewire-stream.h',
'grd-vnc-server.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]