-// Processes an X event.
-void wxApp::ProcessXEvent(WXEvent* _event)
-{
- XEvent* event = (XEvent*) _event;
-
- if (event->type == KeyPress)
- {
- if (CheckForAccelerator(_event))
- {
- // Do nothing! We intercepted and processed the event as an
- // accelerator.
- return;
- }
- else if (CheckForKeyDown(_event))
- {
- // We intercepted and processed the key down event
- return;
- }
- else
- {
- XtDispatchEvent(event);
- return;
- }
- }
- else if (event->type == PropertyNotify)
- {
- HandlePropertyChange(_event);
- return;
- }
- else if (event->type == ResizeRequest)
- {
- /* Terry Gitnick <terryg@scientech.com> - 1/21/98
- * If resize event, don't resize until the last resize event for this
- * window is recieved. Prevents flicker as windows are resized.
- */
-
- Display *disp = XtDisplay((Widget) wxTheApp->GetTopLevelWidget());
- Window win = event->xany.window;
- XEvent report;
-
- // to avoid flicker
- report = * event;
- while( XCheckTypedWindowEvent (disp, win, ResizeRequest, &report));
-
- // TODO: when implementing refresh optimization, we can use
- // XtAddExposureToRegion to expand the window's paint region.
-
- XtDispatchEvent(event);
- }
- else
- {
- XtDispatchEvent(event);
- }
-}
-
-// Returns TRUE if more time is needed.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- return event.MoreRequested();
-}
-
-void wxApp::ExitMainLoop()
-{
- m_keepGoing = FALSE;
-}
-
-// Is a message/event pending?
-bool wxApp::Pending()
-{
- XFlush(XtDisplay( (Widget) wxTheApp->GetTopLevelWidget() ));
-
- // Fix by Doug from STI, to prevent a stall if non-X event
- // is found.
- return ((XtAppPending( (XtAppContext) GetAppContext() ) & XtIMXEvent) != 0) ;
-}
-
-// Dispatch a message.
-void wxApp::Dispatch()
-{
- // XtAppProcessEvent( (XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
-
- XEvent event;
- XtAppNextEvent((XtAppContext) GetAppContext(), &event);
- ProcessXEvent((WXEvent*) & event);
-}
-