summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-01-18 16:28:59 +0000
committerManolo Gouy <Manolo>2014-01-18 16:28:59 +0000
commitd7cc67d2f192683a450c9732eb00670bbcd23f48 (patch)
tree00991cf3b5f7331c29f618c9aa825eae55ee3e9c /src
parent35bdf594a88ab228743c7fcc1adf379ec9ed1fea (diff)
Mac OS: put idle processing under an alloc/release pair of an NSAutoreleasePool.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10066 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx15
-rw-r--r--src/Fl_cocoa.mm12
2 files changed, 14 insertions, 13 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 268232309..fcb16555d 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -67,7 +67,7 @@ void fl_cleanup_pens(void);
void fl_release_dc(HWND,HDC);
void fl_cleanup_dc_list(void);
#elif defined(__APPLE__)
-extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle);
+extern double fl_mac_flush_and_wait(double time_to_wait);
#endif // WIN32
//
@@ -430,7 +430,7 @@ static void run_checks()
}
}
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
static char in_idle;
#endif
@@ -520,16 +520,7 @@ double Fl::wait(double time_to_wait) {
#elif defined(__APPLE__)
run_checks();
- if (idle) {
- if (!in_idle) {
- in_idle = 1;
- idle();
- in_idle = 0;
- }
- // the idle function may turn off idle, we can then wait:
- if (idle) time_to_wait = 0.0;
- }
- return fl_mac_flush_and_wait(time_to_wait, in_idle);
+ return fl_mac_flush_and_wait(time_to_wait);
#else
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 65705bfb2..085e14069 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -752,8 +752,18 @@ int fl_wait( double time )
return (got_events);
}
-double fl_mac_flush_and_wait(double time_to_wait, char in_idle) {
+double fl_mac_flush_and_wait(double time_to_wait) {
+ static int in_idle = 0;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ if (Fl::idle) {
+ if (!in_idle) {
+ in_idle = 1;
+ Fl::idle();
+ in_idle = 0;
+ }
+ // the idle function may turn off idle, we can then wait:
+ if (Fl::idle) time_to_wait = 0.0;
+ }
Fl::flush();
if (Fl::idle && !in_idle) // 'idle' may have been set within flush()
time_to_wait = 0.0;