From 9a0be2c8df4c12f70ada36c25f6d64a8be52b0dc Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 11 Feb 2016 00:10:49 +0000 Subject: Move platform part of Fl::flush() git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11153 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Screen_Driver.H | 2 ++ FL/x.H | 2 +- src/Fl.cxx | 13 +------------ src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 6 ++++++ src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h | 2 ++ src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 6 ++++++ src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h | 2 ++ src/drivers/X11/Fl_X11_Screen_Driver.cxx | 9 ++++++++- src/drivers/X11/Fl_X11_Screen_Driver.h | 2 ++ 9 files changed, 30 insertions(+), 14 deletions(-) diff --git a/FL/Fl_Screen_Driver.H b/FL/Fl_Screen_Driver.H index 8532ffbc2..3fe3837b6 100644 --- a/FL/Fl_Screen_Driver.H +++ b/FL/Fl_Screen_Driver.H @@ -63,6 +63,8 @@ public: virtual void screen_work_area(int &X, int &Y, int &W, int &H); // --- audible output virtual void beep(int type) = 0; + // --- global events + virtual void flush() = 0; }; diff --git a/FL/x.H b/FL/x.H index d5a3e6e94..8ad59bade 100644 --- a/FL/x.H +++ b/FL/x.H @@ -31,7 +31,7 @@ # elif defined(__APPLE__) # include "mac.H" # elif defined(ANDROID) -# error "A clean port requires a driver-style system for Fl_X" +# pragma message "A clean port requires a driver-style system for Fl_X" # elif defined(FL_PORTING) # pragma message "FL_PORTING: write a header file based on this file, win32.H, or mac.H to define the FLTK core internals" # include "porting.H" diff --git a/src/Fl.cxx b/src/Fl.cxx index 52208b58f..9c5ca21c9 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -888,18 +888,7 @@ void Fl::flush() { if (i->region) {XDestroyRegion(i->region); i->region = 0;} } } -#if defined(USE_X11) - if (fl_display) XFlush(fl_display); -#elif defined(WIN32) - GdiFlush(); -#elif defined (__APPLE_QUARTZ__) - if (fl_gc) - CGContextFlush(fl_gc); -#elif defined(FL_PORTING) -# pragma message "FL_PORTING: flush your graphics context here" -#else -# error unsupported platform -#endif + screen_driver()->flush(); } diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 704c3dc72..787a9967a 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -113,6 +113,12 @@ void Fl_Cocoa_Screen_Driver::beep(int type) { } +void Fl_Cocoa_Screen_Driver::flush() { + if (fl_gc) + CGContextFlush(fl_gc); +} + + // // End of "$Id$". // diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h index 4c5cf8a7e..00ee70c18 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h @@ -57,6 +57,8 @@ public: virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n); // --- audible output virtual void beep(int type); + // --- global events + virtual void flush(); }; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index ddf9deaac..0569caca2 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -233,6 +233,12 @@ void Fl_WinAPI_Screen_Driver::beep(int type) } +void Fl_WinAPI_Screen_Driver::flush() +{ + GdiFlush(); +} + + // // End of "$Id$". diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h index f0f5c823c..14bd1ff2d 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h @@ -50,6 +50,8 @@ public: virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n); // --- audible output virtual void beep(int type); + // --- global events + virtual void flush(); }; diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index 6a53f65f6..e98dc3413 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -187,7 +187,8 @@ void Fl_X11_Screen_Driver::screen_dpi(float &h, float &v, int n) } -void Fl_X11_Screen_Driver::beep(int type) { +void Fl_X11_Screen_Driver::beep(int type) +{ switch (type) { case FL_BEEP_DEFAULT : case FL_BEEP_ERROR : @@ -202,6 +203,12 @@ void Fl_X11_Screen_Driver::beep(int type) { } +void Fl_X11_Screen_Driver::flush() +{ + if (fl_display) + XFlush(fl_display); +} + // // End of "$Id$". diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.h b/src/drivers/X11/Fl_X11_Screen_Driver.h index 635e975dc..b699a9ac4 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.h +++ b/src/drivers/X11/Fl_X11_Screen_Driver.h @@ -52,6 +52,8 @@ public: virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n); // --- audible output virtual void beep(int type); + // --- global events + virtual void flush() = 0; }; -- cgit v1.2.3