<div dir="ltr">ping<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 8, 2014 at 11:34 AM, Marc-André Lureau <span dir="ltr"><<a href="mailto:marcandre.lureau@gmail.com" target="_blank">marcandre.lureau@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">ping<br></div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Wed, Aug 27, 2014 at 8:51 PM, Marc-André Lureau <span dir="ltr"><<a href="mailto:marcandre.lureau@redhat.com" target="_blank">marcandre.lureau@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Marc-Andre Lureau <<a href="mailto:marcandre.lureau@redhat.com" target="_blank">marcandre.lureau@redhat.com</a>><br>
<br>
Make sure vdagent follows the current monitor configuration. This<br>
solves a number of issue where the pointer input is off, because the<br>
uinput tablet isn't reconfigured.<br>
<br>
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1086657" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1086657</a><br>
---<br>
src/vdagent-x11-priv.h | 4 +++-<br>
src/vdagent-x11-randr.c | 34 +++++++++++++++++++++++++++++++++-<br>
src/vdagent-x11.c | 4 +++-<br>
3 files changed, 39 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h<br>
index 38f852e..d60cc07 100644<br>
--- a/src/vdagent-x11-priv.h<br>
+++ b/src/vdagent-x11-priv.h<br>
@@ -95,6 +95,7 @@ struct vdagent_x11 {<br>
int height[MAX_SCREENS];<br>
int has_xfixes;<br>
int xfixes_event_base;<br>
+ int xrandr_event_base;<br>
int max_prop_size;<br>
int expected_targets_notifies[256];<br>
int clipboard_owner[256];<br>
@@ -145,7 +146,8 @@ void vdagent_x11_send_daemon_guest_xorg_res(struct vdagent_x11 *x11,<br>
int update);<br>
void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,<br>
int screen, int width, int height);<br>
-<br>
+int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,<br>
+ XEvent event);<br>
void vdagent_x11_set_error_handler(struct vdagent_x11 *x11,<br>
int (*handler)(Display *, XErrorEvent *));<br>
int vdagent_x11_restore_error_handler(struct vdagent_x11 *x11);<br>
diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c<br>
index 5faaee6..c6f790e 100644<br>
--- a/src/vdagent-x11-randr.c<br>
+++ b/src/vdagent-x11-randr.c<br>
@@ -132,12 +132,15 @@ void vdagent_x11_randr_init(struct vdagent_x11 *x11)<br>
return;<br>
}<br>
<br>
- if (XRRQueryExtension(x11->display, &i, &i)) {<br>
+ if (XRRQueryExtension(x11->display, &x11->xrandr_event_base, &i)) {<br>
XRRQueryVersion(x11->display, &x11->xrandr_major, &x11->xrandr_minor);<br>
if (x11->xrandr_major == 1 && x11->xrandr_minor >= 3)<br>
x11->has_xrandr = 1;<br>
}<br>
<br>
+ XRRSelectInput(x11->display, x11->root_window[0],<br>
+ RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask);<br>
+<br>
if (x11->has_xrandr) {<br>
update_randr_res(x11, 0);<br>
} else {<br>
@@ -466,6 +469,8 @@ static int set_screen_to_best_size(struct vdagent_x11 *x11, int width, int heigh<br>
void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,<br>
int screen, int width, int height)<br>
{<br>
+ update_randr_res(x11, 0);<br>
+<br>
if (width == x11->width[screen] && height == x11->height[screen]) {<br>
return;<br>
}<br>
@@ -481,6 +486,33 @@ void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,<br>
}<br>
}<br>
<br>
+int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,<br>
+ XEvent event)<br>
+{<br>
+ int handled = TRUE;<br>
+<br>
+ switch (event.type - x11->xrandr_event_base) {<br>
+ case RRScreenChangeNotify: {<br>
+ XRRScreenChangeNotifyEvent *sce =<br>
+ (XRRScreenChangeNotifyEvent *) &event;<br>
+ vdagent_x11_randr_handle_root_size_change(x11, 0,<br>
+ sce->width, sce->height);<br>
+ break;<br>
+ }<br>
+ case RRNotify: {<br>
+ update_randr_res(x11, 0);<br>
+ if (!x11->dont_send_guest_xorg_res)<br>
+ vdagent_x11_send_daemon_guest_xorg_res(x11, 1);<br>
+ break;<br>
+ }<br>
+ default:<br>
+ handled = FALSE;<br>
+ break;<br>
+ }<br>
+<br>
+ return handled;<br>
+}<br>
+<br>
static int min_int(int x, int y)<br>
{<br>
return x > y ? y : x;<br>
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c<br>
index 752b337..9619dc5 100644<br>
--- a/src/vdagent-x11.c<br>
+++ b/src/vdagent-x11.c<br>
@@ -503,9 +503,11 @@ static void vdagent_x11_handle_event(struct vdagent_x11 *x11, XEvent event)<br>
return;<br>
}<br>
<br>
+ if (vdagent_x11_randr_handle_event(x11, event))<br>
+ return;<br>
+<br>
switch (event.type) {<br>
case ConfigureNotify:<br>
- // TODO: handle CrtcConfigureNotify, OutputConfigureNotify can be ignored.<br>
for (i = 0; i < x11->screen_count; i++)<br>
if (event.xconfigure.window == x11->root_window[i])<br>
break;<br>
<span><font color="#888888">--<br>
1.9.3<br>
<br>
_______________________________________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org" target="_blank">Spice-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>Marc-André Lureau
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau
</div>