|
|
1.1 root 1: #include "copyright.h"
2:
3: /* $Header: XGetMoEv.c,v 11.13 87/09/11 08:04:16 toddb Exp $ */
4: /* Copyright Massachusetts Institute of Technology 1986 */
5:
6: #define NEED_REPLIES
7: #include "Xlibint.h"
8:
9: XTimeCoord *XGetMotionEvents(dpy, w, start, stop, nEvents)
10: register Display *dpy;
11: Time start, stop;
12: Window w;
13: int *nEvents; /* RETURN */
14: {
15: xGetMotionEventsReply rep;
16: register xGetMotionEventsReq *req;
17: XTimeCoord *tc;
18: long nbytes;
19: LockDisplay(dpy);
20: GetReq(GetMotionEvents, req);
21: req->window = w;
22: /* XXX is this right for all machines? */
23: req->start = start;
24: req->stop = stop;
25: if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
26: UnlockDisplay(dpy);
27: SyncHandle();
28: *nEvents = 0;
29: return (NULL);
30: }
31:
32: *nEvents = rep.nEvents;
33: tc = (XTimeCoord *) Xmalloc (
34: (unsigned)(nbytes = (long)rep.nEvents * sizeof (XTimeCoord)));
35: if (!tc) {
36: /* XXX this is wrong!! we need to read and throw away the data
37: somehow. Probably we should try to malloc less space and repeatedly
38: read the events into the smaller space.... */
39: *nEvents = 0;
40: UnlockDisplay(dpy);
41: SyncHandle();
42: return (NULL);
43: }
44: _XRead (dpy, (char *) tc, nbytes);
45: /* XXX need to do something different if short isn't 16-bits, or long
46: isn't 32-bits, since in that case XTimeCoord won't be the same as
47: protocol structure */
48:
49: UnlockDisplay(dpy);
50: SyncHandle();
51: return (tc);
52: }
53:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.