From 7505e88db66798b2b8fcdff2d92a7136cd826b5b Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 9 Sep 2010 02:26:30 +0200 Subject: Upgrading to IUP 3.2 - and cleaning up. --- iup/src/win/iupwin_loop.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'iup/src/win/iupwin_loop.c') 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; } -- cgit v1.2.3