I still don't know why the "hello world" code does not working as I expect. But 
I write a piece of code who works as expected. I'm not sure that's well 
written, (if someone want to take a look). Mouse pointer is rendered, when a 
button is pressed or when a key is release the while loop is stoped.


#include<X11/Xlib.h>
#include<X11/cursorfont.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define DPYW DisplayWidth(dpy,scr)
#define DPYH DisplayHeight(dpy,scr)


int main(int argc, char *argv[]){
        Display *dpy;
        int scr, stop=0;
       
 Window rootwin;
        Window wbg;
        XEvent e;
    Cursor theCursor;

    dpy = XOpenDisplay(NULL);

        scr=DefaultScreen(dpy);
        rootwin=RootWindow(dpy, scr);
        wbg=XCreateSimpleWindow(dpy,rootwin,0,0,
                                DPYW,DPYH,0,
                                BlackPixel(dpy,
 scr),
                                BlackPixel(dpy, scr) );


        XStoreName(dpy, wbg, "background");
        XSelectInput(dpy, wbg, 
ExposureMask|KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask);
        XMapWindow(dpy, wbg);


    theCursor = XCreateFontCursor(dpy, XC_left_ptr);

    XDefineCursor(dpy,wbg,theCursor);

        while(stop==0) {
                XNextEvent(dpy, &e);
                if(e.type==Expose
 && e.xexpose.count<1) {
        XFlush(dpy);
                }

        switch(e.type){
            case KeyRelease     : stop=1;break;
            case ButtonPress     : stop=1;break;
        }        

        }

    XFreeCursor(dpy,theCursor);
        XCloseDisplay(dpy);

        return 0;
}
_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com

Reply via email to