[gnome-remote-desktop] session: Add methods to notify subclasses of updated kbd lock states
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] session: Add methods to notify subclasses of updated kbd lock states
- Date: Thu, 4 Mar 2021 18:03:17 +0000 (UTC)
commit dde507f1fb09854d2e32ab23285590984ff080a3
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Tue Feb 23 09:53:56 2021 +0100
session: Add methods to notify subclasses of updated kbd lock states
Add member functions for grd-session, which will be called, when the
keyboard lock states caps-lock or num-lock have changed on the mutter
side.
This allows the RDP backend to synchronize the keyboard lock states,
when necessary.
src/grd-session.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/grd-session.h | 5 +++++
2 files changed, 45 insertions(+)
---
diff --git a/src/grd-session.c b/src/grd-session.c
index 69f3819..de3fff2 100644
--- a/src/grd-session.c
+++ b/src/grd-session.c
@@ -697,6 +697,36 @@ on_remote_desktop_session_selection_transfer (GrdDBusRemoteDesktopSession *sessi
g_free (data);
}
+static void
+on_caps_lock_state_changed (GrdDBusRemoteDesktopSession *session_proxy,
+ GParamSpec *param_spec,
+ GrdSession *session)
+{
+ GrdSessionClass *klass = GRD_SESSION_GET_CLASS (session);
+ gboolean state;
+
+ state = grd_dbus_remote_desktop_session_get_caps_lock_state (session_proxy);
+ g_debug ("Caps lock state: %s", state ? "locked" : "unlocked");
+
+ if (klass->on_caps_lock_state_changed)
+ klass->on_caps_lock_state_changed (session, state);
+}
+
+static void
+on_num_lock_state_changed (GrdDBusRemoteDesktopSession *session_proxy,
+ GParamSpec *param_spec,
+ GrdSession *session)
+{
+ GrdSessionClass *klass = GRD_SESSION_GET_CLASS (session);
+ gboolean state;
+
+ state = grd_dbus_remote_desktop_session_get_num_lock_state (session_proxy);
+ g_debug ("Num lock state: %s", state ? "locked" : "unlocked");
+
+ if (klass->on_num_lock_state_changed)
+ klass->on_num_lock_state_changed (session, state);
+}
+
static void
on_remote_desktop_session_proxy_acquired (GObject *object,
GAsyncResult *result,
@@ -756,8 +786,18 @@ on_remote_desktop_session_proxy_acquired (GObject *object,
on_screen_cast_session_created,
session);
+ g_signal_connect (session_proxy, "notify::caps-lock-state",
+ G_CALLBACK (on_caps_lock_state_changed),
+ session);
+ g_signal_connect (session_proxy, "notify::num-lock-state",
+ G_CALLBACK (on_num_lock_state_changed),
+ session);
+
if (klass->remote_desktop_session_ready)
klass->remote_desktop_session_ready (session);
+
+ on_caps_lock_state_changed (session_proxy, NULL, session);
+ on_num_lock_state_changed (session_proxy, NULL, session);
}
static void
diff --git a/src/grd-session.h b/src/grd-session.h
index e3e1c11..f4457e3 100644
--- a/src/grd-session.h
+++ b/src/grd-session.h
@@ -67,6 +67,11 @@ struct _GrdSessionClass
void (*stream_ready) (GrdSession *session,
GrdStream *stream);
void (*stop) (GrdSession *session);
+
+ void (*on_caps_lock_state_changed) (GrdSession *session,
+ gboolean state);
+ void (*on_num_lock_state_changed) (GrdSession *session,
+ gboolean state);
};
GrdContext *grd_session_get_context (GrdSession *session);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]