[gnome-remote-desktop] build: Make unicode input in RDP backend optional
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] build: Make unicode input in RDP backend optional
- Date: Wed, 13 Jan 2021 15:39:41 +0000 (UTC)
commit 5967e232f19113b9a31a4c723904217b172c328d
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Tue Jan 12 21:20:56 2021 +0100
build: Make unicode input in RDP backend optional
Although unicode input is a core functionality for RDP, and is
necessary to be able to type (keyboard input) for some clients
(e.g. Remmina), we need a non-deprecated version of libxkbcommon, to be
able to convert the unicode char into a keysym.
The freedesktop-sdk however, (which is apparently needed for Gnome OS)
can currently only provide an old version of libxkbcommon.
So, make the unicode input optional (breaking functionality) to be able
to make Gnome OS builds.
For Gnome 41, this commit can be reverted again.
config.h.meson | 3 +++
meson.build | 8 +++++++-
meson_options.txt | 5 +++++
src/grd-session-rdp.c | 22 ++++++++++++++++++++++
src/meson.build | 12 ++++++++++--
5 files changed, 47 insertions(+), 3 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index bbd5d83..672449d 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -5,3 +5,6 @@
/* The prefix for our gettext translation domains. */
#mesondefine GETTEXT_PACKAGE
+
+/* Defined if RDP unicode input is enabled */
+#mesondefine HAS_RDP_UNICODE_INPUT
diff --git a/meson.build b/meson.build
index 6a0c905..83c0d56 100644
--- a/meson.build
+++ b/meson.build
@@ -21,12 +21,18 @@ libvncclient_dep = dependency('libvncclient')
libsecret_dep = dependency('libsecret-1')
libnotify_dep = dependency('libnotify')
winpr_dep = dependency('winpr2', version: freerdp_req)
-xkbcommon_dep = dependency('xkbcommon', version: xkbcommon_req)
cdata = configuration_data()
cdata.set_quoted('GETTEXT_PACKAGE', 'gnome-remote-desktop')
cdata.set_quoted('VERSION', meson.project_version())
+has_rdp_unicode_input = get_option('rdp_unicode_input')
+if has_rdp_unicode_input
+ xkbcommon_dep = dependency('xkbcommon', version: xkbcommon_req)
+endif
+
+cdata.set('HAS_RDP_UNICODE_INPUT', has_rdp_unicode_input)
+
configure_file(input: 'config.h.meson',
output: 'config.h',
configuration: cdata)
diff --git a/meson_options.txt b/meson_options.txt
index 8a99430..6e9d799 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,8 @@
+option('rdp_unicode_input',
+ type: 'boolean',
+ value: true,
+ description: 'Unicode input for the RDP backend')
+
option('systemd_user_unit_dir',
type: 'string',
value: '',
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index 8714346..58c9ebd 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -25,7 +25,9 @@
#include <freerdp/peer.h>
#include <gio/gio.h>
#include <linux/input-event-codes.h>
+#ifdef HAS_RDP_UNICODE_INPUT
#include <xkbcommon/xkbcommon.h>
+#endif
#include "grd-context.h"
#include "grd-damage-utils.h"
@@ -79,7 +81,9 @@ struct _GrdSessionRdp
uint16_t pointer_x;
uint16_t pointer_y;
+#ifdef HAS_RDP_UNICODE_INPUT
GHashTable *pressed_unicode_keys;
+#endif
GThreadPool *thread_pool;
GCond pending_jobs_cond;
@@ -1014,6 +1018,7 @@ rdp_peer_refresh_region (freerdp_peer *peer,
++rdp_peer_context->frame_id;
}
+#ifdef HAS_RDP_UNICODE_INPUT
static gboolean
notify_keysym_released (gpointer key,
gpointer value,
@@ -1026,21 +1031,26 @@ notify_keysym_released (gpointer key,
return TRUE;
}
+#endif
static BOOL
rdp_input_synchronize_event (rdpInput *rdp_input,
uint32_t flags)
{
RdpPeerContext *rdp_peer_context = (RdpPeerContext *) rdp_input->context;
+#ifdef HAS_RDP_UNICODE_INPUT
GrdSessionRdp *session_rdp = rdp_peer_context->session_rdp;
GrdSession *session = GRD_SESSION (session_rdp);
+#endif
if (!(rdp_peer_context->flags & RDP_PEER_ACTIVATED))
return TRUE;
+#ifdef HAS_RDP_UNICODE_INPUT
g_hash_table_foreach_remove (session_rdp->pressed_unicode_keys,
notify_keysym_released,
session);
+#endif
return TRUE;
}
@@ -1161,15 +1171,18 @@ rdp_input_unicode_keyboard_event (rdpInput *rdp_input,
{
RdpPeerContext *rdp_peer_context = (RdpPeerContext *) rdp_input->context;
GrdSessionRdp *session_rdp = rdp_peer_context->session_rdp;
+#ifdef HAS_RDP_UNICODE_INPUT
GrdSession *session = GRD_SESSION (session_rdp);
uint32_t *code_utf32;
xkb_keysym_t keysym;
GrdKeyState key_state;
+#endif
if (!(rdp_peer_context->flags & RDP_PEER_ACTIVATED) ||
is_view_only (session_rdp))
return TRUE;
+#ifdef HAS_RDP_UNICODE_INPUT
code_utf32 = g_utf16_to_ucs4 (&code_utf16, 1, NULL, NULL, NULL);
if (!code_utf32)
return TRUE;
@@ -1194,6 +1207,7 @@ rdp_input_unicode_keyboard_event (rdpInput *rdp_input,
}
grd_session_notify_keyboard_keysym (session, keysym, key_state);
+#endif
return TRUE;
}
@@ -1387,7 +1401,9 @@ init_rdp_session (GrdSessionRdp *session_rdp,
rdp_settings->NSCodec = TRUE;
rdp_settings->FrameMarkerCommandEnabled = TRUE;
rdp_settings->SurfaceFrameMarkerEnabled = TRUE;
+#ifdef HAS_RDP_UNICODE_INPUT
rdp_settings->UnicodeInput = TRUE;
+#endif
peer->Capabilities = rdp_peer_capabilities;
peer->PostConnect = rdp_peer_post_connect;
@@ -1541,9 +1557,11 @@ grd_session_rdp_stop (GrdSession *session)
freerdp_peer_context_free (peer);
freerdp_peer_free (peer);
+#ifdef HAS_RDP_UNICODE_INPUT
g_hash_table_foreach_remove (session_rdp->pressed_unicode_keys,
notify_keysym_released,
session);
+#endif
g_clear_pointer (&session_rdp->last_frame, g_free);
g_hash_table_foreach_remove (session_rdp->pointer_cache,
@@ -1605,7 +1623,9 @@ grd_session_rdp_dispose (GObject *object)
{
GrdSessionRdp *session_rdp = GRD_SESSION_RDP (object);
+#ifdef HAS_RDP_UNICODE_INPUT
g_clear_pointer (&session_rdp->pressed_unicode_keys, g_hash_table_unref);
+#endif
g_clear_pointer (&session_rdp->pointer_cache, g_hash_table_unref);
G_OBJECT_CLASS (grd_session_rdp_parent_class)->dispose (object);
@@ -1641,7 +1661,9 @@ static void
grd_session_rdp_init (GrdSessionRdp *session_rdp)
{
session_rdp->pointer_cache = g_hash_table_new (NULL, are_pointer_bitmaps_equal);
+#ifdef HAS_RDP_UNICODE_INPUT
session_rdp->pressed_unicode_keys = g_hash_table_new (NULL, NULL);
+#endif
g_cond_init (&session_rdp->pending_jobs_cond);
g_mutex_init (&session_rdp->pending_jobs_mutex);
diff --git a/src/meson.build b/src/meson.build
index 5dc54ae..f657cbb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -35,6 +35,14 @@ daemon_sources = files([
'grd-vnc-server.h',
])
+optional_deps = []
+
+if has_rdp_unicode_input
+ optional_deps += [
+ xkbcommon_dep,
+ ]
+endif
+
gen_daemon_sources = []
gen_daemon_sources += gnome.gdbus_codegen('grd-dbus-screen-cast',
@@ -66,8 +74,8 @@ executable('gnome-remote-desktop-daemon',
libvncserver_dep,
libsecret_dep,
libnotify_dep,
- winpr_dep,
- xkbcommon_dep],
+ optional_deps,
+ winpr_dep],
include_directories: [configinc],
install: true,
install_dir: libexecdir)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]