X11workbench Toolkit  1.0
'Hello World' sample using the X11workbench Toolkit
#include <stdio.h>
#include <stdlib.h>
#include "window_helper.h" // includes platform_helper.h and others as well
#include "dialog_window.h"
// NOTE: this example uses WBMain() - you could use 'main()' but additional function calls
// are needed. For more information, see platform_helper.c and 'main()'
int WBMain(int argc, char *argv[], char *envp[])
{
int iRval = 1;
if(WBInit(NULL))
{
"Hello World",
"Hello World using X11workbench Toolkit");
// if your application creates a modeless dialog window or frame window, you will
// need a message loop. For the sample, it is disabled with an '#if 0' block
#if 0
//=====================
// MAIN EVENT LOOP
//=====================
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.
// NOTE: sleeping allows the CPU to "not spin" and go into an idle state
// this will result in lower power consumption in most cases
WBDelay(100); // 100 microseconds (0.1 milliseconds)
// for MS Windows you might want to change this to 10 milliseconds due to the way in
// which windows handles the 'Sleep()' API. The actual wait time is likely to be
// about that long anyway, and delaying 'zero' spins the CPU.
continue; // skip the 'WBDispatch' since there was no event
}
WBDispatch(&event);
}
#endif // 0
WBExit(); // this frees toolkit resources and closes windows, etc.
iRval = 0; // return 'success'
}
return iRval;
}