From 5ee825c0816ca5391702ac6271bd1d30a900ddb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 29 Jan 2018 14:38:13 +0800 Subject: [PATCH] remote-desktop: Add keyboard keycode event support Keyboard keycode events will act as a physical keyboard thus depend on the active keyboard layout. --- src/backends/meta-remote-desktop-session.c | 33 ++++++++++++++++++++++ src/org.gnome.Mutter.RemoteDesktop.xml | 10 +++++++ 2 files changed, 43 insertions(+) diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c index 3c39ef6e4..eaf6e718b 100644 --- a/src/backends/meta-remote-desktop-session.c +++ b/src/backends/meta-remote-desktop-session.c @@ -255,6 +255,38 @@ handle_stop (MetaDBusRemoteDesktopSession *skeleton, return TRUE; } +static gboolean +handle_notify_keyboard_keycode (MetaDBusRemoteDesktopSession *skeleton, + GDBusMethodInvocation *invocation, + unsigned int keycode, + gboolean pressed) +{ + MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton); + ClutterKeyState state; + + if (!check_permission (session, invocation)) + { + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, + G_DBUS_ERROR_ACCESS_DENIED, + "Permission denied"); + return TRUE; + } + + if (pressed) + state = CLUTTER_KEY_STATE_PRESSED; + else + state = CLUTTER_KEY_STATE_RELEASED; + + clutter_virtual_input_device_notify_key (session->virtual_keyboard, + CLUTTER_CURRENT_TIME, + keycode, + state); + + meta_dbus_remote_desktop_session_complete_notify_keyboard_keycode (skeleton, + invocation); + return TRUE; +} + static gboolean handle_notify_keyboard_keysym (MetaDBusRemoteDesktopSession *skeleton, GDBusMethodInvocation *invocation, @@ -445,6 +477,7 @@ meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface { iface->handle_start = handle_start; iface->handle_stop = handle_stop; + iface->handle_notify_keyboard_keycode = handle_notify_keyboard_keycode; iface->handle_notify_keyboard_keysym = handle_notify_keyboard_keysym; iface->handle_notify_pointer_button = handle_notify_pointer_button; iface->handle_notify_pointer_axis_discrete = handle_notify_pointer_axis_discrete; diff --git a/src/org.gnome.Mutter.RemoteDesktop.xml b/src/org.gnome.Mutter.RemoteDesktop.xml index 7807f1608..4af5fe317 100644 --- a/src/org.gnome.Mutter.RemoteDesktop.xml +++ b/src/org.gnome.Mutter.RemoteDesktop.xml @@ -57,6 +57,16 @@ --> + + + + + +