summaryrefslogtreecommitdiff
path: root/iup/src/win/iupwin_loop.c
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-09-09 02:26:30 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2010-09-09 02:32:26 +0200
commit7505e88db66798b2b8fcdff2d92a7136cd826b5b (patch)
treeb6ced565318f8e8112e35cb0ad53abe4212ef8de /iup/src/win/iupwin_loop.c
parente9a184546b18cf3b796bd560561f312934004c54 (diff)
Upgrading to IUP 3.2 - and cleaning up.
Diffstat (limited to 'iup/src/win/iupwin_loop.c')
-rwxr-xr-xiup/src/win/iupwin_loop.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/iup/src/win/iupwin_loop.c b/iup/src/win/iupwin_loop.c
index fd25537..4bcf38c 100755
--- a/iup/src/win/iupwin_loop.c
+++ b/iup/src/win/iupwin_loop.c
@@ -30,6 +30,19 @@ void iupdrvSetIdleFunction(Icallback f)
win_idle_cb = (IFidle)f;
}
+static int winLoopCallIdle(void)
+{
+ int ret = win_idle_cb();
+ if (ret == IUP_CLOSE)
+ {
+ win_idle_cb = NULL;
+ return IUP_CLOSE;
+ }
+ if (ret == IUP_IGNORE)
+ win_idle_cb = NULL;
+ return ret;
+}
+
void IupExitLoop(void)
{
PostQuitMessage(0);
@@ -74,15 +87,11 @@ int IupMainLoop(void)
}
else
{
- int ret = win_idle_cb();
- if (ret == IUP_CLOSE)
+ if (winLoopCallIdle() == IUP_CLOSE)
{
- win_idle_cb = NULL;
win_main_loop--;
return IUP_CLOSE;
}
- if (ret == IUP_IGNORE)
- win_idle_cb = NULL;
}
}
else
@@ -123,6 +132,8 @@ int IupLoopStep(void)
MSG msg;
if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
return winLoopProcessMessage(&msg);
+ else if (win_idle_cb)
+ return winLoopCallIdle();
return IUP_DEFAULT;
}