Changeset 2892 for trunk/Ohana/src/kii/event/EventLoop.c
- Timestamp:
- Jan 4, 2005, 10:26:17 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kii/event/EventLoop.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kii/event/EventLoop.c
r2466 r2892 1 1 # include "Ximage.h" 2 # define MAX_STRING 100 3 /* WARNING: this is defined because the HP UX installation i have does not 4 seem to know this structure, though it should */ 5 # ifdef DUMMY 6 struct Ktimeval { 7 unsigned long tv_sec; /* seconds */ 8 long tv_usec; /* and microseconds */ 9 }; 10 # endif 2 3 int LastEvent (Display *display, int type, XEvent *event) { 4 5 int found; 6 7 found = FALSE; 8 while (XCheckTypedEvent (display, type, event)) { 9 found = TRUE; 10 } 11 return (found); 12 } 11 13 12 14 int EventLoop (Graphic *graphic, Layout *layout) { … … 14 16 XEvent event; 15 17 int status; 18 Display *display; 16 19 17 /* gettimeofday (&then, (struct timeval *) NULL); */18 19 20 Refresh (graphic, layout, 1); 20 21 … … 30 31 } 31 32 32 if (XCheckMaskEvent (graphic[0].display, EVENT_MASK, &event)) {33 display = graphic[0].display; 33 34 34 switch (event.type) { 35 36 case MotionNotify: 37 if (XEventsQueued (graphic[0].display, QueuedAlready) < 2) { 38 UpdatePointer (graphic, layout, (XMotionEvent *) &event); 39 } 40 break; 41 case ButtonPress: 42 status = InterpretPresses (graphic, layout, (XButtonEvent *) &event); 43 break; 44 45 case Expose: 46 if (XEventsQueued (graphic[0].display, QueuedAlready) < 2) { 47 Refresh (graphic, layout, 1); 48 } 49 break; 50 /* if (event.xexpose.count == 0) */ 51 52 case ConfigureNotify: 53 status = Reconfig (graphic, layout, &event); 54 /* 55 if (XEventsQueued (graphic[0].display, QueuedAlready) < 2) { 56 status = Reconfig (graphic, layout, &event); 57 } 58 */ 59 break; 60 61 case KeyPress: 62 status = InterpretKeys (graphic, layout, &event); 63 break; 64 65 case MappingNotify: 66 if (XEventsQueued (graphic[0].display, QueuedAlready) < 2) { 67 XRefreshKeyboardMapping ((XMappingEvent *) &event); 68 } 69 break; 70 71 } 72 } 35 /* only do the last entry for these events */ 36 /* this ignores the return status from these functions */ 37 if (LastEvent (display, ConfigureNotify, &event)) Reconfig (graphic, layout, &event); 38 if (LastEvent (display, Expose, &event)) Refresh (graphic, layout, 1); 39 if (LastEvent (display, MappingNotify, &event)) XRefreshKeyboardMapping ((XMappingEvent *) &event); 40 if (LastEvent (display, MotionNotify, &event)) UpdatePointer (graphic, layout, (XMotionEvent *) &event); 41 if (LastEvent (display, ButtonPress, &event)) InterpretPresses (graphic, layout, (XButtonEvent *) &event); 42 if (LastEvent (display, KeyPress, &event)) InterpretKeys (graphic, layout, &event); 73 43 } 74 44 return (status); 75 45 } 76 46 77 /* 78 while (XPending (graphic[0].display) { 79 if (readfds && display_mask) { 80 */ 81 /* 82 while (1) { 83 fprintf (stderr, "window in EventLoop: %x %d\n", graphic[0].display, graphic[0].window); 84 XNextEvent (graphic[0].display, &event); 85 if (event.type == ClientMessage) { 86 fprintf (stderr, "choice 1\n"); 87 } 88 89 if (event.xclient.send_event) { 90 fprintf (stderr, "choice 2\n"); 91 } 92 } 93 */ 94 47 # if (0) 48 /* WARNING: this is defined because the HP UX installation i have does not 49 seem to know this structure, though it should. Clearly a need for autoconf.. */ 50 struct Ktimeval { 51 unsigned long tv_sec; /* seconds */ 52 long tv_usec; /* and microseconds */ 53 }; 54 # endif 55
Note:
See TracChangeset
for help on using the changeset viewer.
