X11workbench Toolkit  1.0
Core API


 Window 'Core'
 Event Handling
 Exposure and Mapping/Visibility
 Graphics Abstraction Layer
 Timer Functions
 Clipboard and Selections
 Default Parameters and Definitions
 'Core' Structures
 Window Manager and Clipboard-related Atoms

Detailed Description

The 'Core' API for the X11workbench Toolkit identifies those functions that implement the most essential functions, such as the creation and destruction of windows, and the main event loop, All programs using the API must correctly initialize and make use of these functions in lieu of calling their X11 counterparts.

Typically, your application will need a basic event handling loop, such as:

while (!bQuitFlag)
if(!WBCheckGetEvent(pX11Display, &event))
// SLEEP if no event while in message loop (function returns without blocking)
// otherwise I can do background tasks during this loop iteration.
WBDelay(100); // 100 microseconds (0.1 milliseconds)
continue; // skip the 'WBDispatch' since there was no event

The call to WBDispatch will process the retrieved events by passing them to the appropriate registered callback functions.

The 'WBDelay()' call is a way of ensuring that your application does not 'spin' with 100% CPU utilization while waiting for an event. This can help with battery life, and so on.

If you have no background processing to perform, you can use WBNextEvent() instead of WBCheckGetEvent(), and avoid the need of the surrounding 'if' block.

See also
'Hello World' sample using the X11workbench Toolkit, Event Handling