[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Aug 30 10:21:32 1996 
Subject:Detecting events in Xlib using poplog 
From:Tony Lennard 
Volume-ID:960830.01 

/*
Hello all,

I am trying to detect events in an xlib window, but getting completely stuck !
If anyone has any ideas - they would be greatly appreciated.

I can't get XNextEvent to work - eg. in the following code from teach xlib
*/
    uses xlib;
    uses XHouseKeeping;
    uses XDrawingPrimitives;
    uses XGraphicsContext;
    uses XlibMacros;
    uses XWindowExistence;
    uses XWindowMapping;
    uses XEvents;

    vars dpy = XOpenDisplay('\(0)');

    vars
        W = WhitePixel(dpy, 0),
        B = BlackPixel(dpy, 0),
        size = 200,
        ;

    vars win = XCreateSimpleWindow(dpy, dpy #-> screens #-> root,
                    100, 100, size, size, 2, B, W);
    XMapWindow(dpy, win);
    XFlush(dpy);

    vars vals = initXGCValues(false);
    GXset -> vals #: function;
    vars gc = XCreateGC(dpy, win, GCFunction, vals);

/* If I add */

    XSelectInput(dpy,win,ButtonPressMask);
    XNextEvent(dpy,hope);

/* then the program waits till the button is pressed, but hope just contains

    : hope =>
    ** <NULL>

instead of the external pointer to the event structure that I had expected.

Any ideas (I've tried this on and off for the last year with no success !!)

Tony Lennard
*/