From df059de37e776874cf1fbe303141764f1c8fc34e Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 10 Dec 2022 10:19:54 +0100 Subject: "Public members Fl::awake_ring_*_ should be private" (#559) - cont'd --- src/Fl_System_Driver.H | 1 + src/Fl_lock.cxx | 7 +++++-- src/Fl_win32.cxx | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Fl_System_Driver.H b/src/Fl_System_Driver.H index b1901b133..42e2a9815 100644 --- a/src/Fl_System_Driver.H +++ b/src/Fl_System_Driver.H @@ -63,6 +63,7 @@ protected: // implement once for each platform static Fl_System_Driver *newSystemDriver(); Fl_System_Driver(); + static bool awake_ring_empty(); public: virtual ~Fl_System_Driver(); static int command_key; diff --git a/src/Fl_lock.cxx b/src/Fl_lock.cxx index 3aea98d95..fdf045be9 100644 --- a/src/Fl_lock.cxx +++ b/src/Fl_lock.cxx @@ -201,8 +201,11 @@ void Fl::unlock() { #ifndef FL_DOXYGEN -bool Fl::equal_awake_ring_ends() { - return awake_ring_head_ == Fl::awake_ring_tail_; +bool Fl_System_Driver::awake_ring_empty() { + Fl::system_driver()->lock_ring(); + bool retval = (Fl::awake_ring_head_ == Fl::awake_ring_tail_); + Fl::system_driver()->unlock_ring(); + return retval; } #endif // FL_DOXYGEN diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index e613e359e..ebe5355f1 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -491,7 +491,7 @@ double Fl_WinAPI_System_Driver::wait(double time_to_wait) { DispatchMessageW(&fl_msg); } - // The following conditional test: !Fl::equal_awake_ring_ends() + // The following conditional test: !Fl_System_Driver::awake_ring_empty() // equivalent to: // (Fl::awake_ring_head_ != Fl::awake_ring_tail_) // is a workaround / fix for STR #3143. This works, but a better solution @@ -512,7 +512,7 @@ double Fl_WinAPI_System_Driver::wait(double time_to_wait) { // recover and process any pending awake callbacks. // Normally the ring buffer head and tail indices will match and this // comparison will do nothing. Addresses STR #3143 - if (!Fl::equal_awake_ring_ends()) { + if (!Fl_System_Driver::awake_ring_empty()) { process_awake_handler_requests(); } -- cgit v1.2.3