VDAgentMonitorsConfigV2 contains the guest_output_id field. TODO: Add a capability and check for the version of the message to use. Signed-off-by: Lukáš Hrázký <lhrazky@xxxxxxxxxx> --- src/vdagent/vdagent.c | 2 +- src/vdagent/x11-priv.h | 2 +- src/vdagent/x11-randr.c | 32 ++++++++++++++++---------------- src/vdagent/x11.h | 2 +- src/vdagentd-proto.h | 4 ++-- src/vdagentd/vdagentd.c | 18 +++++++++--------- src/vdagentd/xorg-conf.c | 2 +- src/vdagentd/xorg-conf.h | 2 +- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c index c5e5952..281805b 100644 --- a/src/vdagent/vdagent.c +++ b/src/vdagent/vdagent.c @@ -178,7 +178,7 @@ static void daemon_read_complete(struct udscs_connection **connp, switch (header->type) { case VDAGENTD_MONITORS_CONFIG: - vdagent_x11_set_monitor_config(agent->x11, (VDAgentMonitorsConfig *)data, 0); + vdagent_x11_set_monitor_config(agent->x11, (VDAgentMonitorsConfigV2 *)data, 0); break; case VDAGENTD_CLIPBOARD_REQUEST: vdagent_clipboard_request(agent->clipboards, header->arg1, header->arg2); diff --git a/src/vdagent/x11-priv.h b/src/vdagent/x11-priv.h index e7c64bd..26d8960 100644 --- a/src/vdagent/x11-priv.h +++ b/src/vdagent/x11-priv.h @@ -132,7 +132,7 @@ struct vdagent_x11 { int max_height; int num_monitors; struct monitor_size monitor_sizes[MONITOR_SIZE_COUNT]; - VDAgentMonitorsConfig *failed_conf; + VDAgentMonitorsConfigV2 *failed_conf; } randr; /* NB: we cache this assuming the driver isn't changed under our feet */ diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c index bfa1a02..1c33c86 100644 --- a/src/vdagent/x11-randr.c +++ b/src/vdagent/x11-randr.c @@ -562,7 +562,7 @@ static void constrain_to_screen(struct vdagent_x11 *x11, int *w, int *h) } } -static int monitor_enabled(VDAgentMonConfig *mon) +static int monitor_enabled(VDAgentMonConfigV2 *mon) { return mon->width != 0 && mon->height != 0; } @@ -580,7 +580,7 @@ static int monitor_enabled(VDAgentMonConfig *mon) * max_height >= height >= min_height for all monitors in mon_config */ static void zero_base_monitors(struct vdagent_x11 *x11, - VDAgentMonitorsConfig *mon_config, + VDAgentMonitorsConfigV2 *mon_config, int *width, int *height) { int i, min_x = INT_MAX, min_y = INT_MAX, max_x = INT_MIN, max_y = INT_MIN; @@ -615,7 +615,7 @@ static void zero_base_monitors(struct vdagent_x11 *x11, *height = max_y; } -static int enabled_monitors(VDAgentMonitorsConfig *mon) +static int enabled_monitors(VDAgentMonitorsConfigV2 *mon) { int i, enabled = 0; @@ -626,8 +626,8 @@ static int enabled_monitors(VDAgentMonitorsConfig *mon) return enabled; } -static int same_monitor_configs(VDAgentMonitorsConfig *conf1, - VDAgentMonitorsConfig *conf2) +static int same_monitor_configs(VDAgentMonitorsConfigV2 *conf1, + VDAgentMonitorsConfigV2 *conf2) { int i; @@ -636,8 +636,8 @@ static int same_monitor_configs(VDAgentMonitorsConfig *conf1, return 0; for (i = 0; i < conf1->num_of_monitors; i++) { - VDAgentMonConfig *mon1 = &conf1->monitors[i]; - VDAgentMonConfig *mon2 = &conf2->monitors[i]; + VDAgentMonConfigV2 *mon1 = &conf1->monitors[i]; + VDAgentMonConfigV2 *mon2 = &conf2->monitors[i]; /* NOTE: we don't compare depth. */ if (mon1->x != mon2->x || mon1->y != mon2->y || mon1->width != mon2->width || mon1->height != mon2->height) @@ -648,16 +648,16 @@ static int same_monitor_configs(VDAgentMonitorsConfig *conf1, static int config_size(int num_of_monitors) { - return sizeof(VDAgentMonitorsConfig) + - num_of_monitors * sizeof(VDAgentMonConfig); + return sizeof(VDAgentMonitorsConfigV2) + + num_of_monitors * sizeof(VDAgentMonConfigV2); } -static VDAgentMonitorsConfig *get_current_mon_config(struct vdagent_x11 *x11) +static VDAgentMonitorsConfigV2 *get_current_mon_config(struct vdagent_x11 *x11) { int i, num_of_monitors = 0; XRRModeInfo *mode; XRRScreenResources *res = x11->randr.res; - VDAgentMonitorsConfig *mon_config; + VDAgentMonitorsConfigV2 *mon_config; mon_config = calloc(1, config_size(res->noutput)); if (!mon_config) { @@ -701,11 +701,11 @@ error: } static void dump_monitors_config(struct vdagent_x11 *x11, - VDAgentMonitorsConfig *mon_config, + VDAgentMonitorsConfigV2 *mon_config, const char *prefix) { int i; - VDAgentMonConfig *m; + VDAgentMonConfigV2 *m; syslog(LOG_DEBUG, "Monitors config %s: %d, %x", prefix, mon_config->num_of_monitors, mon_config->flags); @@ -729,12 +729,12 @@ static void dump_monitors_config(struct vdagent_x11 *x11, * invalid configuration request from client. */ void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11, - VDAgentMonitorsConfig *mon_config, + VDAgentMonitorsConfigV2 *mon_config, int fallback) { int primary_w, primary_h; int i, real_num_of_monitors = 0; - VDAgentMonitorsConfig *curr = NULL; + VDAgentMonitorsConfigV2 *curr = NULL; if (!x11->has_xrandr) goto exit; @@ -909,7 +909,7 @@ void vdagent_x11_send_daemon_guest_xorg_res(struct vdagent_x11 *x11, int update) int i, width = 0, height = 0, screen_count = 0; if (x11->has_xrandr) { - VDAgentMonitorsConfig *curr; + VDAgentMonitorsConfigV2 *curr; if (update) update_randr_res(x11, 0); diff --git a/src/vdagent/x11.h b/src/vdagent/x11.h index 1505f58..ad619eb 100644 --- a/src/vdagent/x11.h +++ b/src/vdagent/x11.h @@ -40,7 +40,7 @@ int vdagent_x11_get_fd(struct vdagent_x11 *x11); void vdagent_x11_do_read(struct vdagent_x11 *x11); void vdagent_x11_set_monitor_config(struct vdagent_x11 *x11, - VDAgentMonitorsConfig *mon_config, int fallback); + VDAgentMonitorsConfigV2 *mon_config, int fallback); #ifndef WITH_GTK void vdagent_x11_clipboard_grab(struct vdagent_x11 *x11, uint8_t selection, diff --git a/src/vdagentd-proto.h b/src/vdagentd-proto.h index f72a890..2d663ec 100644 --- a/src/vdagentd-proto.h +++ b/src/vdagentd-proto.h @@ -31,8 +31,8 @@ enum { 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_MONITORS_CONFIG, /* daemon -> client, VDAgentMonitorsConfigV2 + followed by num_monitors VDAgentMonConfigV2-s */ VDAGENTD_CLIPBOARD_GRAB, /* arg1: sel, data: array of supported types */ VDAGENTD_CLIPBOARD_REQUEST, /* arg1: selection, arg 2 = type */ VDAGENTD_CLIPBOARD_DATA, /* arg1: sel, arg 2: type, data: data */ diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c index 682761a..2589549 100644 --- a/src/vdagentd/vdagentd.c +++ b/src/vdagentd/vdagentd.c @@ -69,7 +69,7 @@ static struct vdagent_virtio_port *virtio_port = NULL; static GHashTable *active_xfers = NULL; static struct session_info *session_info = NULL; static struct vdagentd_uinput *uinput = NULL; -static VDAgentMonitorsConfig *mon_config = NULL; +static VDAgentMonitorsConfigV2 *mon_config = NULL; static uint32_t *capabilities = NULL; static int capabilities_size = 0; static const char *active_session = NULL; @@ -175,16 +175,16 @@ void do_client_mouse(struct vdagentd_uinput **uinputp, VDAgentMouseState *mouse) } static void do_client_monitors(struct vdagent_virtio_port *vport, int port_nr, - VDAgentMessage *message_header, VDAgentMonitorsConfig *new_monitors) + VDAgentMessage *message_header, VDAgentMonitorsConfigV2 *new_monitors) { VDAgentReply reply; uint32_t size; /* Store monitor config to send to agents when they connect */ - size = sizeof(VDAgentMonitorsConfig) + - new_monitors->num_of_monitors * sizeof(VDAgentMonConfig); + size = sizeof(VDAgentMonitorsConfigV2) + + new_monitors->num_of_monitors * sizeof(VDAgentMonConfigV2); if (message_header->size != size) { - syslog(LOG_ERR, "invalid message size for VDAgentMonitorsConfig"); + syslog(LOG_ERR, "invalid message size for VDAgentMonitorsConfigV2"); return; } @@ -396,7 +396,7 @@ static gsize vdagent_message_min_size[] = { -1, /* Does not exist */ sizeof(VDAgentMouseState), /* VD_AGENT_MOUSE_STATE */ - sizeof(VDAgentMonitorsConfig), /* VD_AGENT_MONITORS_CONFIG */ + sizeof(VDAgentMonitorsConfigV2), /* VD_AGENT_MONITORS_CONFIG */ sizeof(VDAgentReply), /* VD_AGENT_REPLY */ sizeof(VDAgentClipboard), /* VD_AGENT_CLIPBOARD */ sizeof(VDAgentDisplayConfig), /* VD_AGENT_DISPLAY_CONFIG */ @@ -538,7 +538,7 @@ static int virtio_port_read_complete( case VD_AGENT_MONITORS_CONFIG: virtio_msg_uint32_from_le(data, message_header->size, 0); do_client_monitors(vport, port_nr, message_header, - (VDAgentMonitorsConfig *)data); + (VDAgentMonitorsConfigV2 *)data); break; case VD_AGENT_ANNOUNCE_CAPABILITIES: virtio_msg_uint32_from_le(data, message_header->size, 0); @@ -820,8 +820,8 @@ static void update_active_session_connection(struct udscs_connection *new_conn) if (active_session_conn && mon_config) udscs_write(active_session_conn, VDAGENTD_MONITORS_CONFIG, 0, 0, - (uint8_t *)mon_config, sizeof(VDAgentMonitorsConfig) + - mon_config->num_of_monitors * sizeof(VDAgentMonConfig)); + (uint8_t *)mon_config, sizeof(VDAgentMonitorsConfigV2) + + mon_config->num_of_monitors * sizeof(VDAgentMonConfigV2)); release_clipboards(); diff --git a/src/vdagentd/xorg-conf.c b/src/vdagentd/xorg-conf.c index 9f3dac5..a50e67c 100644 --- a/src/vdagentd/xorg-conf.c +++ b/src/vdagentd/xorg-conf.c @@ -43,7 +43,7 @@ } \ } while(0) -void vdagentd_write_xorg_conf(VDAgentMonitorsConfig *monitor_conf) +void vdagentd_write_xorg_conf(VDAgentMonitorsConfigV2 *monitor_conf) { #ifdef HAVE_PCIACCESS int i, r, count, min_x = INT_MAX, min_y = INT_MAX; diff --git a/src/vdagentd/xorg-conf.h b/src/vdagentd/xorg-conf.h index 9934359..124d986 100644 --- a/src/vdagentd/xorg-conf.h +++ b/src/vdagentd/xorg-conf.h @@ -24,6 +24,6 @@ #include <stdio.h> #include <spice/vd_agent.h> -void vdagentd_write_xorg_conf(VDAgentMonitorsConfig *monitor_conf); +void vdagentd_write_xorg_conf(VDAgentMonitorsConfigV2 *monitor_conf); #endif -- 2.18.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel