spice-vdagent/SOURCES/0005-x11-randr-Avoid-passin...

70 lines
2.5 KiB
Diff

From b6dfef73f2926c65ed146eea6ab061dd87d77f10 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <fziglio@redhat.com>
Date: Wed, 19 Dec 2018 18:25:51 +0000
Subject: [PATCH 5/9] x11-randr: Avoid passing XEvent as value
The structure is not that small and is not necessary to copy
the value.
This also removed a Coverity warning.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
---
src/vdagent/x11-priv.h | 2 +-
src/vdagent/x11-randr.c | 8 ++++----
src/vdagent/x11.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/vdagent/x11-priv.h b/src/vdagent/x11-priv.h
index 99676d2..730b9b3 100644
--- a/src/vdagent/x11-priv.h
+++ b/src/vdagent/x11-priv.h
@@ -152,7 +152,7 @@ void vdagent_x11_send_daemon_guest_xorg_res(struct vdagent_x11 *x11,
void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
int screen, int width, int height);
int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
- XEvent event);
+ const XEvent *event);
void vdagent_x11_set_error_handler(struct vdagent_x11 *x11,
int (*handler)(Display *, XErrorEvent *));
int vdagent_x11_restore_error_handler(struct vdagent_x11 *x11);
diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
index 4b022d6..3fb7a68 100644
--- a/src/vdagent/x11-randr.c
+++ b/src/vdagent/x11-randr.c
@@ -529,14 +529,14 @@ void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
}
int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
- XEvent event)
+ const XEvent *event)
{
int handled = TRUE;
- switch (event.type - x11->xrandr_event_base) {
+ switch (event->type - x11->xrandr_event_base) {
case RRScreenChangeNotify: {
- XRRScreenChangeNotifyEvent *sce =
- (XRRScreenChangeNotifyEvent *) &event;
+ const XRRScreenChangeNotifyEvent *sce =
+ (const XRRScreenChangeNotifyEvent *) event;
vdagent_x11_randr_handle_root_size_change(x11, 0,
sce->width, sce->height);
break;
diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
index c2515a8..61d7c69 100644
--- a/src/vdagent/x11.c
+++ b/src/vdagent/x11.c
@@ -545,7 +545,7 @@ static void vdagent_x11_handle_event(struct vdagent_x11 *x11, XEvent event)
}
#endif
- if (vdagent_x11_randr_handle_event(x11, event))
+ if (vdagent_x11_randr_handle_event(x11, &event))
return;
switch (event.type) {
--
2.21.0