[Spice-devel] [PATCH linux vdagent v5 6/7] Use new function in vdagent_x11_send_daemon_guest_xorg_res()
Jonathon Jongsma
jjongsma at redhat.com
Wed Jan 23 22:18:08 UTC 2019
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 | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
index 6265a6d..8ff5a76 100644
--- a/src/vdagent/x11-randr.c
+++ b/src/vdagent/x11-randr.c
@@ -1071,25 +1071,20 @@ 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) {
--
2.17.2
More information about the Spice-devel
mailing list