Shape event using Xfixes region

Buola Buola buola69 at gmail.com
Fri Apr 29 15:35:36 PDT 2005


> A small test case which demonstrates the bug would be helpful in
> diagnosing whether your application or the X server is at fault.
> 
Here is a very short piece of code which still has the problem

#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/shape.h>

int main()
{
    Display *dpy;
    Screen *scr;
    Window w;
    int ev,err;
    XRectangle r={10,10,50,50};
    XEvent e;
    XserverRegion region;

    dpy=XOpenDisplay(0);
    scr=DefaultScreenOfDisplay(dpy);
    w=XCreateSimpleWindow(dpy,DefaultRootWindow(dpy),50,50,200,200,0,0,0);
    XMapWindow(dpy,w);
    XShapeQueryExtension(dpy,&ev,&err);
    XShapeSelectInput(dpy,w,ShapeNotifyMask);

    region=XFixesCreateRegion(dpy,&r,1);
    XFixesSetWindowShapeRegion(dpy,w,ShapeBounding,0,0,region);

    while(1)
    {
        XNextEvent(dpy,&e);

        if(e.type==ev+ShapeNotify)
        {
            printf("shape event received\n");
            break;
        }
    }
    XCloseDisplay(dpy);
}


I also send you exactly the same functionality without using regions:

#include <X11/Xlib.h>
#include <X11/extensions/shape.h>

int main()
{
    Display *dpy;
    Screen *scr;
    Window w;
    int ev,err;
    XRectangle r={10,10,50,50};
    XEvent e;

    dpy=XOpenDisplay(0);
    scr=DefaultScreenOfDisplay(dpy);
    w=XCreateSimpleWindow(dpy,DefaultRootWindow(dpy),50,50,200,200,0,0,0);
    XMapWindow(dpy,w);
    XShapeQueryExtension(dpy,&ev,&err);
    XShapeSelectInput(dpy,w,ShapeNotifyMask);

    XShapeCombineRectangles(dpy,w,ShapeBounding,0,0,&r,1,ShapeSet,Unsorted);

    while(1)
    {
        XNextEvent(dpy,&e);

        if(e.type==ev+ShapeNotify)
        {
            printf("shape event received\n");
            break;
        }
    }
    XCloseDisplay(dpy);
}


The version which only uses the XShape extension works fine, prints
the message and exits, while the one with Xfixes loops forever

Am I missing something?

Thanks a lot for your help,

   Xavi



More information about the xorg mailing list