[gnome-remote-desktop] session-rdp: Synchronize kbd lock states when SynchronizeEvent is called
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] session-rdp: Synchronize kbd lock states when SynchronizeEvent is called
- Date: Thu, 4 Mar 2021 18:03:17 +0000 (UTC)
commit 3e40794663f32ee280d86a08513c407459a3b9cc
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Tue Feb 23 10:17:51 2021 +0100
session-rdp: Synchronize kbd lock states when SynchronizeEvent is called
Whenever the RDP client gets focused, the SynchronizeEvent is emitted.
When this event is emitted, the RDP client submits the current states
of its toggle keys.
Additionally, the RDP server resets all keys.
While the latter action is already implemented in gnome-remote-desktop,
the former one is not.
So, implement the former action too by submitting a fake key press and
fake key release of the lock keys, when the current state in mutter
differs from the state that the RDP client submitted.
Do this action using the previously implemented APIs in
GrdRdpEventQueue.
src/grd-session-rdp.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index 2f4d221..d87759c 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -1130,8 +1130,10 @@ rdp_input_synchronize_event (rdpInput *rdp_input,
{
RdpPeerContext *rdp_peer_context = (RdpPeerContext *) rdp_input->context;
GrdSessionRdp *session_rdp = rdp_peer_context->session_rdp;
+ GrdRdpEventQueue *rdp_event_queue = session_rdp->rdp_event_queue;
- if (!is_rdp_peer_flag_set (rdp_peer_context, RDP_PEER_ACTIVATED))
+ if (!is_rdp_peer_flag_set (rdp_peer_context, RDP_PEER_ACTIVATED) ||
+ is_view_only (session_rdp))
return TRUE;
g_hash_table_foreach_remove (session_rdp->pressed_keys,
@@ -1142,6 +1144,10 @@ rdp_input_synchronize_event (rdpInput *rdp_input,
notify_keysym_released,
session_rdp);
+ grd_rdp_event_queue_add_synchronization_event (rdp_event_queue,
+ !!(flags & KBD_SYNC_CAPS_LOCK),
+ !!(flags & KBD_SYNC_NUM_LOCK));
+
return TRUE;
}
@@ -1867,6 +1873,26 @@ grd_session_rdp_stream_ready (GrdSession *session,
session_rdp);
}
+static void
+grd_session_rdp_on_caps_lock_state_changed (GrdSession *session,
+ gboolean state)
+{
+ GrdSessionRdp *session_rdp = GRD_SESSION_RDP (session);
+ GrdRdpEventQueue *rdp_event_queue = session_rdp->rdp_event_queue;
+
+ grd_rdp_event_queue_update_caps_lock_state (rdp_event_queue, state);
+}
+
+static void
+grd_session_rdp_on_num_lock_state_changed (GrdSession *session,
+ gboolean state)
+{
+ GrdSessionRdp *session_rdp = GRD_SESSION_RDP (session);
+ GrdRdpEventQueue *rdp_event_queue = session_rdp->rdp_event_queue;
+
+ grd_rdp_event_queue_update_num_lock_state (rdp_event_queue, state);
+}
+
static void
grd_session_rdp_dispose (GObject *object)
{
@@ -1931,4 +1957,8 @@ grd_session_rdp_class_init (GrdSessionRdpClass *klass)
grd_session_rdp_remote_desktop_session_ready;
session_class->stop = grd_session_rdp_stop;
session_class->stream_ready = grd_session_rdp_stream_ready;
+ session_class->on_caps_lock_state_changed =
+ grd_session_rdp_on_caps_lock_state_changed;
+ session_class->on_num_lock_state_changed =
+ grd_session_rdp_on_num_lock_state_changed;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]