The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XEvent - package to access XEvent structure fields

SYNOPSIS

        use <a package that returns XEvents>;
        use X11::XEvent;

        $xevent = function_that_returns_xevent(its, parms);
        $type = $xevent->type;    

        # Any XEvent field can be read like this.

DESCRIPTION

This class/package provides an extension to perl that allows Perl programs read-only access to the XEvent structure. So. how do they get hold of an XEvent to read? Well, they use ANOTHER Perl extension that blesses pointers to XEvents into the XEvent class. Such an extension would do that by supplying a TYPEMAP as follows:

     XEvent *    T_PTROBJ

and then returning XEvent pointers from appropriate function calls.

An extension that does this is the X11::Xforms extension. So, using these two extensions the perl programmer can do some pretty powerful XWindows application programming.

So whats in this package. Well, quite simply, every method in this package is named after a field in the XEvent structure. Now, anyone who has seen that structure knows that it is, in fact, a union of a bunch of other structures, the only common field of which is the first field, the type field.

However, this package is written so that you don't have to know the REAL structure of the event you are interested in, you just have to know the name of the field you are after. ALL XEvent fields are catered for, even the wierd vector ones. ALL are returned as perl scalars of various intuitively obvious types.

There is one special function that might interest some of you. The all_fields function returns the values of all fields in the XEvent as a perl list.