[Spice-devel] [PATCH linux vdagent v4 6/9] Use new function in vdagent_x11_send_daemon_guest_xorg_res()
Lukáš Hrázký
lhrazky at redhat.com
Fri Jan 18 13:06:26 UTC 2019
Reviewed-by: Lukáš Hrázký <lhrazky at redhat.com>
On Thu, 2019-01-17 at 16:14 -0600, Jonathon Jongsma wrote:
> Rather than getting the current guest resolution in a
> VDAgentMonitorsConfig struct and then translating it to a new struct
> type for sending down to the daemon, simply use the new function that
> was factored out in a previous commit and populate the message struct
> directly.
> ---
> src/vdagent/x11-randr.c | 20 ++++++++------------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
> index 05a001e..f3972c8 100644
> --- a/src/vdagent/x11-randr.c
> +++ b/src/vdagent/x11-randr.c
> @@ -1066,25 +1066,21 @@ 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;
> -
> if (update)
> update_randr_res(x11, 0);
>
> - curr = get_current_mon_config(x11);
> - if (!curr)
> - goto no_info;
> -
> - screen_count = curr->num_of_monitors;
> + screen_count = x11->randr.res->noutput;
> res = g_new(struct vdagentd_guest_xorg_resolution, screen_count);
>
> for (i = 0; i < screen_count; i++) {
> - res[i].width = curr->monitors[i].width;
> - res[i].height = curr->monitors[i].height;
> - res[i].x = curr->monitors[i].x;
> - res[i].y = curr->monitors[i].y;
> + struct vdagentd_guest_xorg_resolution *curr = &res[i];
> + if (!get_monitor_info_for_output_index(x11, i, &curr->x, &curr->y,
> + &curr->width, &curr->height)
> + {
> + g_free(res);
> + goto no_info;
> + }
> }
> - g_free(curr);
> width = x11->width[0];
> height = x11->height[0];
> } else if (x11->has_xinerama) {
More information about the Spice-devel
mailing list