[Spice-devel] [PATCH linux/vd_agent 2/2] Handling keyboard description message

Pavel Grunt pgrunt at redhat.com
Tue Nov 4 23:54:00 PST 2014


The agent tries to set the appropriate keyboard layout
when the message is received.

RFE: https://bugs.freedesktop.org/show_bug.cgi?id=85332
---
depends on http://lists.freedesktop.org/archives/spice-devel/2014-November/017821.html
---
 src/vdagent.c                |  4 ++++
 src/vdagentd-proto-strings.h |  1 +
 src/vdagentd-proto.h         |  1 +
 src/vdagentd.c               | 10 ++++++++++
 4 files changed, 16 insertions(+)

diff --git a/src/vdagent.c b/src/vdagent.c
index 9d130d5..b4175a1 100644
--- a/src/vdagent.c
+++ b/src/vdagent.c
@@ -127,6 +127,10 @@ void daemon_read_complete(struct udscs_connection **connp,
                                                            fx_open_dir, debug);
         }
         break;
+    case VDAGENTD_KEYBOARD_DESCRIPTION:
+        vdagent_x11_set_keyboard_description(x11, data);
+        free(data);
+        break;
     default:
         syslog(LOG_ERR, "Unknown message from vdagentd type: %d, ignoring",
                header->type);
diff --git a/src/vdagentd-proto-strings.h b/src/vdagentd-proto-strings.h
index e76cb3b..4ee0f9d 100644
--- a/src/vdagentd-proto-strings.h
+++ b/src/vdagentd-proto-strings.h
@@ -34,6 +34,7 @@ static const char * const vdagentd_messages[] = {
         "file xfer status",
         "file xfer data",
         "client disconnected",
+        "keyboard description",
 };
 
 #endif
diff --git a/src/vdagentd-proto.h b/src/vdagentd-proto.h
index 25e6a36..5cb0a26 100644
--- a/src/vdagentd-proto.h
+++ b/src/vdagentd-proto.h
@@ -40,6 +40,7 @@ enum {
     VDAGENTD_FILE_XFER_STATUS,
     VDAGENTD_FILE_XFER_DATA,
     VDAGENTD_CLIENT_DISCONNECTED,  /* daemon -> client */
+    VDAGENTD_KEYBOARD_DESCRIPTION,
     VDAGENTD_NO_MESSAGES /* Must always be last */
 };
 
diff --git a/src/vdagentd.c b/src/vdagentd.c
index b5c7d14..eea7f4d 100644
--- a/src/vdagentd.c
+++ b/src/vdagentd.c
@@ -293,6 +293,13 @@ static void do_client_file_xfer(struct vdagent_virtio_port *vport,
     udscs_write(conn, msg_type, 0, 0, data, message_header->size);
 }
 
+static void do_client_keyboard_description(VDAgentMessage *message_header,
+                                           uint8_t *data)
+{
+    udscs_write(active_session_conn, VDAGENTD_KEYBOARD_DESCRIPTION, 0, 0,
+                data, message_header->size);
+}
+
 int virtio_port_read_complete(
         struct vdagent_virtio_port *vport,
         int port_nr,
@@ -379,6 +386,9 @@ int virtio_port_read_complete(
         syslog(LOG_DEBUG, "Set max clipboard: %d", msg->max);
         max_clipboard = msg->max;
         break;
+    case VD_AGENT_KEYBOARD_DESCRIPTION:
+        do_client_keyboard_description(message_header, data);
+        break;
     default:
         syslog(LOG_WARNING, "unknown message type %d, ignoring",
                message_header->type);
-- 
1.9.3



More information about the Spice-devel mailing list