while (*loop)
{
count++;
XtAppNextEvent( gui.app_context, &xevent );
Dispatch = True;
// Event types defined in X.h
switch(xevent.type)
{
case KeyPress:
#ifdef guixtTRACK_EVENTS
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " state " << xevent.xkey.state
<< " kcode " << xevent.xkey.keycode << endl;
#endif
case KeyRelease:
case ButtonPress:
case ButtonRelease:
#ifdef guixtTRACK_EVENTS
cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
#endif
case MotionNotify:
// cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
if(GuiTimerRestart != 0)
{
GuiTimerRestart();
}
break;
case ClientMessage:
#ifdef guixtTRACK_EVENTS
cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
#endif
/* printing sync with opening and closing windows */
if (xevent.xclient.data.b[0] == guixtDEFINE_P)
{
XFlush( xevent.xany.display );
guixtPrintFptr();
Dispatch = False;
}
/* indirectly set wait for last expose */
else
if (xevent.xclient.data.b[0] == guixtDEFINE_Q)
{
XClientMessageEvent msg;
XFlush( xevent.xany.display );
msg.type = ClientMessage;
msg.format = 8;
msg.display = xevent.xexpose.display;
msg.window = xevent.xexpose.window;
strcpy(msg.data.b,guixtDEFINE_P_STRING);
XSendEvent(msg.display, msg.window,
FALSE, 0, (XEvent *)&msg);
Dispatch = False;
}
break;
#ifdef guixtTRACK_EVENTS
case ConfigureNotify:
{
XConfigureEvent* cfg = (XConfigureEvent*) &xevent;
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " Event (win) " << cfg->event
<< " Window " << cfg->window << endl;
}
break;
case Expose:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << xevent.xexpose.count << endl;
break;
case GraphicsExpose:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << xevent.xgraphicsexpose.count << endl;
break;
case MapNotify:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << (void*)(xevent.xmap.window) << endl;
break;
case UnmapNotify:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << (void*) (xevent.xunmap.window) << endl;
break;
#endif
default:
#ifdef guixtTRACK_EVENTS
if (xevent.type < LASTEvent)
cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
else
cout << eloop << " " << count << " User defined " << xevent.type << endl;
#endif
break;
}
XtDispatchEvent( &xevent );
}
eloop--;
}