Detecting events in Xlib using poplog 
Author Message
 Detecting events in Xlib using poplog

/*
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
*/



Tue, 16 Feb 1999 03:00:00 GMT  
 Detecting events in Xlib using poplog

Quote:

> Date: Fri, 30 Aug 1996 10:21:32 GMT
> Organization: Computing Department, Lancaster University.

> I can't get XNextEvent to work - eg. in the following code from teach xlib
> ...
> ....
> /* 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.

I guess you are supposed to create the external pointer yourself
and assign it to hope before you call XNextEvent.

Unfortunately REF XEvents assumes you know how to do that and does
not tell you how. I don't know how either, but maybe you can find
out from

    REF EXTERNAL or REF EXTERNAL_DATA or REF DEFSTRUCT

It looks to me as if there is a bug in the system. Instead of giving
"hope" that NULL value it should have caused an error.

It appears simply to have corrupted whatever value hope had before
(probably an undef record if you had not assigned anything to it.)

Sorry I can't be of more help.

Aaron
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs )
School of Computer Science, The University of Birmingham, B15 2TT, England

Phone: +44-121-414-4775 (Sec 3711)       Fax:   +44-121-414-4281



Tue, 16 Feb 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. using multiple event structures polling for panel closing event

2. Drawing in C-Code using the XLib emulation

3. ANNOUNCE: Using Xlib With Tcl/Tk Tutorial

4. Scripting an Xlib GUI using Tcl Without Tk

5. Using Xlib drawing inside Tcl/Tk 8.0 on Windows Platform

6. Xlib problems using tcl/tk

7. Embeding a TCl/Tk program in an application using Xlib

8. Using Xlib call on tcl windows

9. HELP -xlib error using TCL/TK

10. using Xlib drawing function?

11. Drawing to Tk widgets using Xlib

12. how to detect change in color scheme, unknown events

 

 
Powered by phpBB® Forum Software