Improved uiMainSteps().
This commit is contained in:
parent
cc4c5f7bd5
commit
ae14542c9a
|
@ -18,6 +18,9 @@ This README is being written.<br>
|
|||
|
||||
*Note that today's entry (Eastern Time) may be updated later today.*
|
||||
|
||||
* **17 June 2016**
|
||||
* `uiMainSteps()` no longer takes any arguments and no longer needs to invoke a function to do the work. You still need to call it, but once you do, it will return immediately and you can then get right to your main loop.
|
||||
|
||||
* **16 June 2016**
|
||||
* Added `uiWindowContentSize()`, `uiWindowSetContentSize()`, and `uiWindowOnContentSizeChanged()` methods for manipulating uiWindow content sizes. Note the use of "content size"; the size you work with does NOT include window decorations (titlebars, menus, etc.).
|
||||
* Added `uiWindowFullscreen()` and `uiWindowSetFullscreen()` to allow making fullscreen uiWindows, taking advantage of OS facilities for fullscreen and without changing the screen resolution (!).
|
||||
|
|
|
@ -159,13 +159,12 @@ void uiMain(void)
|
|||
[realNSApp() run];
|
||||
}
|
||||
|
||||
void uiMainSteps(void (*f)(void *), void *data)
|
||||
void uiMainSteps(void)
|
||||
{
|
||||
isRunning = ^{
|
||||
return stepsIsRunning;
|
||||
};
|
||||
stepsIsRunning = YES;
|
||||
(*f)(data);
|
||||
}
|
||||
|
||||
// see also:
|
||||
|
|
|
@ -162,7 +162,7 @@ int main(int argc, char *argv[])
|
|||
if (!steps)
|
||||
uiMain();
|
||||
else {
|
||||
uiMainSteps(NULL, NULL);
|
||||
uiMainSteps();
|
||||
while (uiMainStep(1))
|
||||
;
|
||||
}
|
||||
|
|
2
ui.h
2
ui.h
|
@ -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 (*f)(void *), void *data);
|
||||
_UI_EXTERN void uiMainSteps(void);
|
||||
_UI_EXTERN int uiMainStep(int wait);
|
||||
_UI_EXTERN void uiQuit(void);
|
||||
|
||||
|
|
|
@ -39,13 +39,15 @@ void uiMain(void)
|
|||
|
||||
static gboolean stepsQuit = FALSE;
|
||||
|
||||
// the only difference is we ignore the return value from gtk_main_iteration_do(), since it will always be TRUE if gtk_main() was never called
|
||||
// gtk_main_iteration_do() will still run the main loop regardless
|
||||
static gboolean stepsIteration(gboolean block)
|
||||
{
|
||||
gtk_main_iteration_do(block);
|
||||
return stepsQuit;
|
||||
}
|
||||
|
||||
void uiMainSteps(void (*f)(void *), void *data)
|
||||
void uiMainSteps(void)
|
||||
{
|
||||
iteration = stepsIteration;
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ void uiMain(void)
|
|||
;
|
||||
}
|
||||
|
||||
void uiMainSteps(void (*f)(void *), void *data)
|
||||
void uiMainSteps(void)
|
||||
{
|
||||
(*f)(data);
|
||||
// don't need to do anything here
|
||||
}
|
||||
|
||||
static int peekMessage(MSG *msg)
|
||||
|
|
Loading…
Reference in New Issue