<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 8, 2014 at 2:07 PM, Christophe Fergeau <span dir="ltr"><<a href="mailto:cfergeau@redhat.com" target="_blank">cfergeau@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On Wed, Aug 27, 2014 at 08:51:10PM +0200, Marc-André Lureau wrote:<br>
> From: Marc-Andre Lureau <<a href="mailto:marcandre.lureau@redhat.com">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>
<br>
</div></div>Enabling this on just root_window[0] will still allow us to get events<br>
for changes on any screen regardless of their root window?<br>
<span class=""><br></span></blockquote><div><br></div><div>This is randr code, there is a single root window.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">
<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>
<br>
</span>I think '0' is not good enough here and that the index of sce->window<br>
should be used (see ConfigureNotify handling in<br>
vdagent_x11_handle_event)<br></blockquote><div><br></div><div> same reason, only a single screen supported with randr.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class=""><br>
> +            break;<br>
> +        }<br>
> +        case RRNotify: {<br>
<br>
</span>'case RRCrtcChangeNotify' as this is what was selected earlier?<br></blockquote><div><br></div><div>RRCrtcChangeNotify is a event subtype of RRNotify, since that's the only one we can catch here, no need to filter futher.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class=""><font color="#888888"><br>
Christophe<br>
</font></span><br>_______________________________________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org">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>
<br></blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau
</div></div>