-
-extern XtAppContext app;
-
-int
-analogtv_handle_events (analogtv *it)
-{
- XSync(it->dpy, False);
- if (XtAppPending (app) & (XtIMTimer|XtIMAlternateInput))
- XtAppProcessEvent (app, XtIMTimer|XtIMAlternateInput);
-
- while (XPending (it->dpy))
- {
- XEvent event;
- XNextEvent (it->dpy, &event);
- switch (event.xany.type)
- {
- case ButtonPress:
- return 1;
-
- case KeyPress:
- {
- KeySym keysym;
- char c = 0;
-
- if (it->key_handler) {
- if (it->key_handler (it->dpy, &event, it->key_data))
- return 1;
- } else {
- XLookupString (&event.xkey, &c, 1, &keysym, 0);
- if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
- return 1;
- }
- }
- break;
-
- /* I don't seem to get an event when clicking the "full
- screen" window manager icon, at least when using
- metacity. Thus, it doesn't change the video size. Is this
- some separate WM_* message I have to deal with?
- */
- case ConfigureNotify:
- if (event.xconfigure.width != it->xgwa.width ||
- event.xconfigure.height != it->xgwa.height)
- analogtv_reconfigure(it);
- break;
-
- case Expose:
- case GraphicsExpose:
- it->need_clear=1;
- break;
-
- default:
- break;
- }
- if (it->event_handler) {
- (*it->event_handler) (it->dpy, &event);
- }
- }
- return 0;
-}
-