The VkApp::run() function is ObjectPak's main event loop. run() implements the event handling normally supported by XtAppMainLoop() or XtMainLoop(). Additionally, run() also supports events not normally handled by the Xt dispatch mechanism. For example, run() can handle events registered for non-widgets (such as a PropertyNotify event on the root window).
When run() receives an event not handled by the Xt dispatch mechanism, it calls the virtual function VkApp::handleRawEvent():
virtual void handleRawEvent(XEvent *event)
The default action of VkApp::handleRawEvent() is to pass the event to the handleRawEvent() function of each instance of VkSimpleWindow (or subclass) in the application. By default, these members function are empty.
To handle events through this mechanism, call XSelectInput(3) to select the events that you want to receive, and override handleRawEvent() in a VkApp or VkSimpleWindow subclass to implement your event processing. Generally, in keeping with object-oriented practice, you should override handleRawEvent() in a VkSimpleWindow subclass rather than a VkApp subclass, unless your event processing has an application-wide effect. If you override VkApp::handleRawEvent() in a derived class, call the base class's handleRawEvent() function after performing your event processing.
Note: If you explicitly call XtNextEvent(3) and XtDispatchEvent(3) in your application, you should pass any undispatched events to handleRawEvent().
In addition to the automatic event dispatching provided by run(), you can force your application to handle all pending events immediately by calling VkApp::handlePendingEvents():
virtual void handlePendingEvents()
This function retrieves and dispatches all X events as long as there are events pending. Unlike XmUpdateDisplay(3Xm), which handles only Expose events, handlePendingEvents() handles all events. In other words, handlePendingEvents() does not just refresh windows, it also handles all pending events including user input. You might want to call this function periodically to process events during a time-consuming task.