[Spice-devel] [vdagent-linux v2] randr: handle XRRScreenChangeNotifyEvent

Christophe Fergeau cfergeau at redhat.com
Wed Oct 8 06:23:12 PDT 2014


On Wed, Oct 08, 2014 at 02:25:08PM +0200, Marc-André Lureau wrote:
> On Wed, Oct 8, 2014 at 2:07 PM, Christophe Fergeau <cfergeau at redhat.com>
> wrote:
> 
> > On Wed, Aug 27, 2014 at 08:51:10PM +0200, Marc-André Lureau wrote:
> > > From: Marc-Andre Lureau <marcandre.lureau at redhat.com>
> > >
> > > Make sure vdagent follows the current monitor configuration.  This
> > > solves a number of issue where the pointer input is off, because the
> > > uinput tablet isn't reconfigured.
> > >
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1086657
> > > ---
> > >  src/vdagent-x11-priv.h  |  4 +++-
> > >  src/vdagent-x11-randr.c | 34 +++++++++++++++++++++++++++++++++-
> > >  src/vdagent-x11.c       |  4 +++-
> > >  3 files changed, 39 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h
> > > index 38f852e..d60cc07 100644
> > > --- a/src/vdagent-x11-priv.h
> > > +++ b/src/vdagent-x11-priv.h
> > > @@ -95,6 +95,7 @@ struct vdagent_x11 {
> > >      int height[MAX_SCREENS];
> > >      int has_xfixes;
> > >      int xfixes_event_base;
> > > +    int xrandr_event_base;
> > >      int max_prop_size;
> > >      int expected_targets_notifies[256];
> > >      int clipboard_owner[256];
> > > @@ -145,7 +146,8 @@ void vdagent_x11_send_daemon_guest_xorg_res(struct
> > vdagent_x11 *x11,
> > >                                              int update);
> > >  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);
> > >  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 5faaee6..c6f790e 100644
> > > --- a/src/vdagent-x11-randr.c
> > > +++ b/src/vdagent-x11-randr.c
> > > @@ -132,12 +132,15 @@ void vdagent_x11_randr_init(struct vdagent_x11
> > *x11)
> > >          return;
> > >      }
> > >
> > > -    if (XRRQueryExtension(x11->display, &i, &i)) {
> > > +    if (XRRQueryExtension(x11->display, &x11->xrandr_event_base, &i)) {
> > >          XRRQueryVersion(x11->display, &x11->xrandr_major,
> > &x11->xrandr_minor);
> > >          if (x11->xrandr_major == 1 && x11->xrandr_minor >= 3)
> > >              x11->has_xrandr = 1;
> > >      }
> > >
> > > +    XRRSelectInput(x11->display, x11->root_window[0],
> > > +        RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask);
> > > +
> >
> > Enabling this on just root_window[0] will still allow us to get events
> > for changes on any screen regardless of their root window?
> >
> >
> This is randr code, there is a single root window.

Ah right, sorry.
>  same reason, only a single screen supported with randr.
> 
> 
> > > +            break;
> > > +        }
> > > +        case RRNotify: {
> >
> > 'case RRCrtcChangeNotify' as this is what was selected earlier?
> >
> 
> RRCrtcChangeNotify is a event subtype of RRNotify, since that's the only
> one we can catch here, no need to filter futher.

well, let's use the more specific type then, this is the one which was
used before so it makes things easier to follow, and RRCrtcChangeNotify
is documented in
http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt
while RRNotify is not.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141008/e4297e28/attachment.sig>


More information about the Spice-devel mailing list