home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.centerline.com!noc.near.net!bigboote.WPI.EDU!omar.WPI.EDU!kimshi
- From: kimshi@omar.WPI.EDU (Erik H Currin)
- Newsgroups: comp.windows.x.apps
- Subject: Re: REQUEST: some way of recording Xevents
- Date: 11 Sep 1992 14:59:04 GMT
- Organization: Worcester Polytechnic Institute
- Lines: 48
- Message-ID: <18qc7oINN90q@bigboote.WPI.EDU>
- References: <1992Sep10.151200.28214@bmerh85.bnr.ca> <16910@ucdavis.ucdavis.edu>
- NNTP-Posting-Host: omar.wpi.edu
- Summary: Use XtAddEventHandler
-
- Ok, I thought of something that _might_ work.
-
- First, if you have access to an X manual, look up XtAddEventHandler()
- to get better understanding of what exactly the procedure does. The
- file /usr/include/X11/X.h has a list of events with their masks, you
- might want to look their also.
-
- So, within your program, try the following:
-
- XtAddEventHandler(widget, eventmask, nonmaskable, handler,
- client_data);
- Widget widget; /* The widget you use to record events */
- XtEventMask event_mask; /* If want all of them, set to NoEventMask */
- Boolean nonmaskable; /* Set to TRUE if want application to receive
- event(s) nonconditionally */
- XtEventHandler handler; /* The procedure name to call on event */
- caddr_t client_data; /* Data that might want to pass to handler */
-
- For example:
-
- XtAddEventHandler(w, ButtonPressMask, FALSE, button, my_data);
-
- will call the procedure button on a button press event.
- The button procedure takes the following parameters:
-
- void button(w, client_data, event)
- Widget w; /* The widget above in XtAddEventHandler */
- caddr_t client_data; /* Any typed data, same type as above */
- XEvent event; /* The actual event */
-
- For example:
-
- void button(w, my_data, event)
- Widget w;
- My_Struct my_data;
- XEvent event;
- {
- XCloseDisplay(XDisplay(w));
- exit(0);
- }
-
- would close the display and exit out.
-
- So just look up the XEvent structure, extract what you want, then write it
- to a file. Simple, heh?
-
- Erik Currin
- CS at WPI
-