summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-09-22 14:32:53 +0200
committerHans de Goede <hdegoede@redhat.com>2011-09-22 14:36:21 +0200
commit3e7f2a287d21b57b167d3d49fa3d8640ffcf2d60 (patch)
treec76fce46948aabfa4aaa628a0ce8d2ae93b9aa5b
parent16d8bda4ec2966643aa7fd2623af7ba47095b954 (diff)
Change VDAGENTD_GUEST_XORG_RESOLUTION message to work with multiple monitors
And also bump the version (a bit early in the cycle), since this breaks protocol compatibility between the system level agentd daemon and the per session agent process. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--configure.ac2
-rw-r--r--src/vdagent-x11.c9
-rw-r--r--src/vdagentd-proto.h6
-rw-r--r--src/vdagentd.c16
4 files changed, 21 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 9ed8407..c23d7f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.65)
-AC_INIT([spice-vdagent], [0.8.1])
+AC_INIT([spice-vdagent], [0.8.2])
AC_CONFIG_SRCDIR([configure.ac])
AM_CONFIG_HEADER([src/config.h])
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
index 795ed41..b01b5ab 100644
--- a/src/vdagent-x11.c
+++ b/src/vdagent-x11.c
@@ -564,13 +564,8 @@ void vdagent_x11_do_read(struct vdagent_x11 *x11)
static void vdagent_x11_send_daemon_guest_xorg_res(struct vdagent_x11 *x11)
{
- struct vdagentd_guest_xorg_resolution res;
-
- res.width = x11->width;
- res.height = x11->height;
-
- udscs_write(x11->vdagentd, VDAGENTD_GUEST_XORG_RESOLUTION, 0, 0,
- (uint8_t *)&res, sizeof(res));
+ udscs_write(x11->vdagentd, VDAGENTD_GUEST_XORG_RESOLUTION, x11->width,
+ x11->height, NULL, 0);
}
static const char *vdagent_x11_get_atom_name(struct vdagent_x11 *x11, Atom a)
diff --git a/src/vdagentd-proto.h b/src/vdagentd-proto.h
index 9d96540..08279a3 100644
--- a/src/vdagentd-proto.h
+++ b/src/vdagentd-proto.h
@@ -26,7 +26,9 @@
#define VDAGENTD_SOCKET "/var/run/spice-vdagentd/spice-vdagent-sock"
enum {
- VDAGENTD_GUEST_XORG_RESOLUTION, /* client -> daemon */
+ VDAGENTD_GUEST_XORG_RESOLUTION, /* client -> daemon, arg1: overall width,
+ arg2: overall height, data: array of
+ vdagentd_guest_xorg_resolution */
VDAGENTD_MONITORS_CONFIG, /* daemon -> client, VDAgentMonitorsConfig
followed by num_monitors VDAgentMonConfig-s */
VDAGENTD_CLIPBOARD_GRAB, /* arg1: sel, data: array of supported types */
@@ -40,6 +42,8 @@ enum {
struct vdagentd_guest_xorg_resolution {
int width;
int height;
+ int x;
+ int y;
};
#endif
diff --git a/src/vdagentd.c b/src/vdagentd.c
index 291e4e3..18d7950 100644
--- a/src/vdagentd.c
+++ b/src/vdagentd.c
@@ -554,8 +554,18 @@ void agent_read_complete(struct udscs_connection **connp,
case VDAGENTD_GUEST_XORG_RESOLUTION: {
struct vdagentd_guest_xorg_resolution *res =
(struct vdagentd_guest_xorg_resolution *)data;
+ int n = header->size / sizeof(*res);
- if (header->size != sizeof(*res)) {
+ /* Detect older version session agent, but don't disconnect, as
+ that stops it from getting the VDAGENTD_VERSION message, and then
+ it will never re-exec the new version... */
+ if (header->arg1 == 0 && header->arg2 == 0) {
+ fprintf(logfile, "got old session agent xorg resolution message, ignoring\n");
+ free(data);
+ return;
+ }
+
+ if (header->size != n * sizeof(*res)) {
fprintf(logfile,
"guest xorg resolution message has wrong size, disconnecting agent\n");
udscs_destroy_connection(connp);
@@ -563,8 +573,8 @@ void agent_read_complete(struct udscs_connection **connp,
return;
}
- agent_data->width = res->width;
- agent_data->height = res->height;
+ agent_data->width = header->arg1;
+ agent_data->height = header->arg2;
check_xorg_resolution();
break;
}