Changed the uiMainSteps() API as the GTK+ port will need it to be done this way...

This commit is contained in:
Pietro Gagliardi 2016-06-16 13:49:50 -04:00
parent da4b396aaf
commit d4492c06a9
3 changed files with 11 additions and 7 deletions

View File

@ -159,12 +159,13 @@ void uiMain(void)
[realNSApp() run];
}
void uiMainSteps(void)
void uiMainSteps(void (*f)(void *), void *data)
{
isRunning = ^{
return stepsIsRunning;
};
stepsIsRunning = YES;
(*f)(data);
}
// see also:

View File

@ -39,6 +39,12 @@ uiTab *mainTab;
uiBox *(*newhbox)(void);
uiBox *(*newvbox)(void);
static void stepsLoop(void *data)
{
while (uiMainStep(1))
;
}
int main(int argc, char *argv[])
{
uiInitOptions o;
@ -161,11 +167,8 @@ int main(int argc, char *argv[])
uiControlShow(uiControl(w));
if (!steps)
uiMain();
else {
uiMainSteps();
while (uiMainStep(1))
;
}
else
uiMainSteps(stepsLoop, NULL);
printf("after uiMain()\n");
uiUninit();
printf("after uiUninit()\n");

2
ui.h
View File

@ -45,7 +45,7 @@ _UI_EXTERN void uiUninit(void);
_UI_EXTERN void uiFreeInitError(const char *err);
_UI_EXTERN void uiMain(void);
_UI_EXTERN void uiMainSteps(void);
_UI_EXTERN void uiMainSteps(void (*f)(void *), void *data);
_UI_EXTERN int uiMainStep(int wait);
_UI_EXTERN void uiQuit(void);