X11 Work Bench Toolkit  1.0
X11workbench Toolkit - Hello World sample
#include <stdio.h>
#include <stdlib.h>
#include "window_helper.h"
#include "dialog_window.h"
int main(int argc, char *argv0[], char *envp0[])
{
int iRval = 1;
char **argv = argv0; // re-define as char ** so I can re-allocate it as needed
char **envp = envp0;
if(!WBParseStandardArguments(&argc, &argv, &envp))
{
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 MESSAGE 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.
// the configure script should determine if your OS supports 'nanosleep'
#ifdef HAVE_NANOSLEEP
struct timespec tsp;
tsp.tv_sec = 0;
tsp.tv_nsec = 100000; // wait for .1 msec
nanosleep(&tsp, NULL);
#else // HAVE_NANOSLEEP
usleep(100); // 100 microsecs - a POSIX alternative to 'nanosleep'
#endif // HAVE_NANOSLEEP
continue; // skip the 'WBDispatch' since there was no event
}
WBDispatch(&event);
}
#endif // 0
WBExit();
}
if(envp && envp != envp0)
{
free(envp);
}
if(argv && argv != argv0)
{
free(argv);
}
}
else
{
}
return iRval;
}