[PATCH] dix: auto-float SD's with SendCoreEvents "false"

Peter Hutterer peter.hutterer at who-t.net
Mon Sep 7 20:32:16 PDT 2009


On Tue, Sep 08, 2009 at 12:56:59PM +1000, Daniel Stone wrote:
> Hi,
> 
> On Tue, Sep 08, 2009 at 10:09:43AM +1000, Peter Hutterer wrote:
> > AlwaysCore and SendCoreEvents specify whether a device is to send core
> > events. A device that has either disabled is not supposed to send core
> > events.
> > 
> > With MPX/XI2, a device that is attached automatically sends core events when
> > the event is routed through the master device. Floating a slave device
> > disables core events by breaking the route.
> > 
> > This patch automatically floats devices that have coreEvents disabled in the
> > xorg.conf/HAL. This replicates the behaviour of a SendCoreEvents "false"
> > device in server 1.6 and earlier.
> > 
> > The devices may still be reattached to a master at runtime.
> > 
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> 
> Acked-by: Daniel Stone <daniel at fooishbar.org>
> 
> (comment below)
> 
> > @@ -2357,7 +2360,13 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
> >       */
> >      if (!master)
> >      {
> > -        WindowPtr currentRoot = dev->spriteInfo->sprite->spriteTrace[0];
> > +        WindowPtr currentRoot;
> > +
> > +        if (dev->spriteInfo->sprite)
> > +            currentRoot = dev->spriteInfo->sprite->spriteTrace[0];
> > +        else
> > +            currentRoot = WindowTable[0];
> > +
> >          /* we need to init a fake sprite */
> >          screen = currentRoot->drawable.pScreen;
> >          screen->DeviceCursorInitialize(dev, screen);
> 
> Should this hnk go in as a separate fix though? Should we maybe just add
> a GetDeviceSpriteWindow helper function that does this for us?

I don't think we should split it up. This hunk is intertwined with the other
part since it cannot be triggered unless a disabled device is attached to a
NULL master.  Which can only happen for the SendCoreEvent false case.  I
think it's good to leave them together to make it obvious for git
bisect/blame.
I'll add a comment to the WindowTable[0] part that this is for auto-floating
devices only.

regarding helper function: for the ...spriteTrace[0] we have a macro in
dix/events.c (RootWindow(dev)). This macro serves as a typing helper and is
used both for reading and writing. There is no case where we simply want to
take WindowTable[0] as the sprite window other than during initialization.
If anything, adding such a helper function it may produce hard-to-debug
false positives instead of a simple crash.

Of course, the RootWindow macro could be moved out of dix/events.c into a
header to be re-used here but that would definitely be a separate patch
then.

Cheers,
  Peter


More information about the xorg-devel mailing list