summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-09-20 13:48:55 +0000
committerManolo Gouy <Manolo>2016-09-20 13:48:55 +0000
commit6347dbde58f1a463e297a082d237272880066cd2 (patch)
treef8a435723e544ac7ba3a9e74f13e7d516a23d9f1 /src
parent26601983c67ee3af607c4b793d263c6f8d312207 (diff)
Restructure the code behind double Fl_Cocoa_Screen_Driver::wait(double time_to_wait)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11958 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm17
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx9
2 files changed, 7 insertions, 19 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 6e3bcfeef..cfda0e768 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -96,7 +96,6 @@ void *fl_capture = 0; // (NSWindow*) we need this to compensate for a missing(
Window fl_window;
// forward declarations of variables in this file
-static int got_events = 0;
static Fl_Window* resize_from_system;
static int main_screen_height; // height of menubar-containing screen used to convert between Cocoa and FLTK global screen coordinates
// through_drawRect = YES means the drawRect: message was sent to the view,
@@ -802,10 +801,10 @@ void Fl_Cocoa_Screen_Driver::remove_timeout(Fl_Timeout_Handler cb, void* data)
/*
* This function is the central event handler.
* It reads events from the event queue using the given maximum time
- * Funny enough, it returns the same time that it got as the argument.
*/
-static double do_queued_events( double time = 0.0 )
+static int do_queued_events( double time = 0.0 )
{
+ static int got_events; // not sure the static is necessary here
got_events = 0;
// Check for re-entrant condition
@@ -834,12 +833,12 @@ static double do_queued_events( double time = 0.0 )
Fl::handle(FL_MOVE, fl_xmousewin);
}
#endif
-
- return time;
+ return got_events;
}
-
-double fl_mac_flush_and_wait(double time_to_wait) {
+double Fl_Cocoa_Screen_Driver::wait(double time_to_wait)
+{
+ Fl::run_checks();
static int in_idle = 0;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (Fl::idle) {
@@ -856,15 +855,13 @@ double fl_mac_flush_and_wait(double time_to_wait) {
NSEnableScreenUpdates(); // 10.3
if (Fl::idle && !in_idle) // 'idle' may have been set within flush()
time_to_wait = 0.0;
- do_queued_events( time_to_wait );
- double retval = got_events;
+ int retval = do_queued_events(time_to_wait);
Fl_Cocoa_Window_Driver::q_release_context();
[pool release];
return retval;
}
-
static NSInteger max_normal_window_level(void)
{
Fl_X *x;
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
index a3defafcc..c43b872f1 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
@@ -31,8 +31,6 @@
extern "C" void NSBeep(void);
-extern double fl_mac_flush_and_wait(double time_to_wait);
-
int Fl_Cocoa_Screen_Driver::next_marked_length = 0;
/*
@@ -144,13 +142,6 @@ void Fl_Cocoa_Screen_Driver::flush() {
}
-double Fl_Cocoa_Screen_Driver::wait(double time_to_wait)
-{
- Fl::run_checks();
- return fl_mac_flush_and_wait(time_to_wait);
-}
-
-
extern void fl_fix_focus(); // in Fl.cxx
extern void *fl_capture;