This commit is contained in:
parent
733ffed630
commit
f5628aa66d
23
src/Fl.cxx
23
src/Fl.cxx
@ -479,29 +479,6 @@ void Fl::run_idle() {
|
||||
occurs (this will happen on X11 if a signal happens).
|
||||
*/
|
||||
double Fl::wait(double time_to_wait) {
|
||||
|
||||
// platform independent part:
|
||||
|
||||
// delete all widgets that were listed during callbacks
|
||||
do_widget_deletion();
|
||||
|
||||
Fl_Timeout::do_timeouts(); // execute timer callbacks
|
||||
|
||||
Fl::run_checks();
|
||||
|
||||
Fl::run_idle();
|
||||
|
||||
// the idle function may turn off idle, we can then wait,
|
||||
// or it leaves Fl::idle active and we set time_to_wait to 0
|
||||
if (Fl::idle) {
|
||||
time_to_wait = 0.0;
|
||||
} else {
|
||||
// limit time by next timer interval
|
||||
time_to_wait = Fl_Timeout::time_to_wait(time_to_wait);
|
||||
}
|
||||
|
||||
// platform dependent part:
|
||||
|
||||
return system_driver()->wait(time_to_wait);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// A base class for platform specific system calls
|
||||
// for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 2010-2021 by Bill Spitzak and others.
|
||||
// Copyright 2010-2022 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -241,7 +241,7 @@ public:
|
||||
virtual Fl_Sys_Menu_Bar_Driver *sys_menu_bar_driver() { return NULL; }
|
||||
virtual void lock_ring() {}
|
||||
virtual void unlock_ring() {}
|
||||
virtual double wait(double) { return 0.0; } // must override
|
||||
virtual double wait(double); // must override
|
||||
virtual int ready() { return 0; } // must override
|
||||
};
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//
|
||||
// A base class for platform specific system calls.
|
||||
//
|
||||
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||
// Copyright 1998-2022 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "Fl_System_Driver.H"
|
||||
#include <FL/Fl.H>
|
||||
#include "Fl_Timeout.h"
|
||||
#include <FL/Fl_File_Icon.H>
|
||||
#include <FL/fl_utf8.h>
|
||||
#include <stdlib.h>
|
||||
@ -502,6 +503,43 @@ void Fl_System_Driver::gettime(time_t *sec, int *usec) {
|
||||
*usec = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Execute platform independent parts of Fl::wait(double).
|
||||
|
||||
Platform drivers \b MUST override this virtual method to do
|
||||
their own stuff and call this base class method to run
|
||||
the platform independent wait functions.
|
||||
|
||||
Overriden methods will typically call this method early and perform
|
||||
platform-specific operations after that in order to work with the
|
||||
\p time_to_wait value possibly modified by this method.
|
||||
However, some platform drivers may need to do extra stuff before
|
||||
calling this method, for instance setting up a memory pool on macOS.
|
||||
|
||||
\param[in] time_to_wait max time to wait
|
||||
|
||||
\return new (max) time to wait after elapsing timeouts
|
||||
*/
|
||||
double Fl_System_Driver::wait(double time_to_wait) {
|
||||
|
||||
// delete all widgets that were listed during callbacks
|
||||
Fl::do_widget_deletion();
|
||||
|
||||
Fl_Timeout::do_timeouts();
|
||||
Fl::run_checks();
|
||||
Fl::run_idle();
|
||||
|
||||
// the idle function may turn off idle, we can then wait,
|
||||
// or it leaves Fl::idle active and we set time_to_wait to 0
|
||||
if (Fl::idle) {
|
||||
time_to_wait = 0.0;
|
||||
} else {
|
||||
// limit time by next timer interval
|
||||
time_to_wait = Fl_Timeout::time_to_wait(time_to_wait);
|
||||
}
|
||||
return time_to_wait;
|
||||
}
|
||||
|
||||
/**
|
||||
\}
|
||||
\endcond
|
||||
|
||||
@ -792,6 +792,9 @@ double Fl_Darwin_System_Driver::wait(double time_to_wait)
|
||||
drain_dropped_files_list();
|
||||
}
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
time_to_wait = Fl_System_Driver::wait(time_to_wait);
|
||||
|
||||
if (fl_mac_os_version < 101100) NSDisableScreenUpdates(); // 10.3 Makes updates to all windows appear as a single event
|
||||
Fl::flush();
|
||||
if (fl_mac_os_version < 101100) NSEnableScreenUpdates(); // 10.3
|
||||
|
||||
@ -417,6 +417,8 @@ static void process_awake_handler_requests(void) {
|
||||
// always returns 1.
|
||||
double Fl_WinAPI_System_Driver::wait(double time_to_wait) {
|
||||
|
||||
time_to_wait = Fl_System_Driver::wait(time_to_wait);
|
||||
|
||||
int have_message = 0;
|
||||
|
||||
if (nfds) {
|
||||
|
||||
@ -837,6 +837,7 @@ int Fl_Unix_System_Driver::poll_or_select() {
|
||||
|
||||
double Fl_Unix_System_Driver::wait(double time_to_wait)
|
||||
{
|
||||
time_to_wait = Fl_System_Driver::wait(time_to_wait);
|
||||
if (time_to_wait <= 0.0) {
|
||||
// do flush second so that the results of events are visible:
|
||||
int ret = this->poll_or_select_with_delay(0.0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user