diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/vdagent-x11.c | 9 | ||||
| -rw-r--r-- | src/vdagentd-proto.h | 6 | ||||
| -rw-r--r-- | src/vdagentd.c | 16 |
3 files changed, 20 insertions, 11 deletions
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; } |
