From 70f7738c920fac5ff84c40a673bb7b87245d4d0c Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 13 Apr 2016 14:41:55 +0000 Subject: Rewrite Fl_own_colormap.cxx under the driver model. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11601 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_own_colormap.cxx | 44 ++++++++++++++-------------------- src/config_lib.h | 2 +- src/drivers/X11/Fl_X11_System_Driver.H | 2 ++ 3 files changed, 21 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/Fl_own_colormap.cxx b/src/Fl_own_colormap.cxx index ea04d30a4..49b640a96 100644 --- a/src/Fl_own_colormap.cxx +++ b/src/Fl_own_colormap.cxx @@ -24,36 +24,17 @@ // and copy the first 16 colors from the default colormap so that we won't // get huge color changes when switching windows. -#include +#include "config_lib.h" #include #include +#include -/** \fn Fl::own_colormap() - Makes FLTK use its own colormap. This may make FLTK display better - and will reduce conflicts with other programs that want lots of colors. - However the colors may flash as you move the cursor between windows. - -

This does nothing if the current visual is not colormapped. -*/ -#ifdef WIN32 -// There is probably something relevant to do on MSWindows 8-bit displays -// but I don't know what it is - -void Fl::own_colormap() {} - -#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform colormap -// MacOS X always provides a TrueColor interface... - -void Fl::own_colormap() {} - -#elif defined(FL_PORTING) - -# pragma message "FL_PORTING: implement color map handling if you don't have an RGB screen" -#else +#ifdef FL_CFG_WIN_X11 // X version +#include "drivers/X11/Fl_X11_System_Driver.H" -void Fl::own_colormap() { +void Fl_X11_System_Driver::own_colormap() { fl_open_display(); #if USE_COLORMAP switch (fl_visual->c_class) { @@ -76,10 +57,21 @@ void Fl::own_colormap() { // Copy those first 16 colors to our own colormap: for (i = 0; i < 16; i ++) XAllocColor(fl_display, fl_colormap, colors + i); -#endif +#endif // USE_COLORMAP } -#endif +#endif // FL_CFG_WIN_X11 + +/** \fn Fl::own_colormap() + Makes FLTK use its own colormap. This may make FLTK display better + and will reduce conflicts with other programs that want lots of colors. + However the colors may flash as you move the cursor between windows. + +

This does nothing if the current visual is not colormapped. + */ +void Fl::own_colormap() { + Fl::system_driver()->own_colormap(); +} // // End of "$Id$". diff --git a/src/config_lib.h b/src/config_lib.h index 465c1bfa6..56bc8af91 100644 --- a/src/config_lib.h +++ b/src/config_lib.h @@ -43,7 +43,7 @@ #ifdef __APPLE__ // default configurations # define FL_CFG_PRN_QUARTZ #elif defined(WIN32) -# define FL_CFG_WIN_WIN32 +# define FL_CFG_PRN_WIN32 #elif defined(FL_PORTING) # pragma message "FL_PORTING: please choose a printer driver" #else // X11 diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H index 0b309dc34..dc97c5f99 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.H +++ b/src/drivers/X11/Fl_X11_System_Driver.H @@ -43,6 +43,8 @@ public: const char *application); virtual int preferences_need_protection_check() {return 1;} virtual int utf8locale(); + // this one is in Fl_own_colormap.cxx + virtual void own_colormap(); }; #endif /* FL_X11_SYSTEM_DRIVER_H */ -- cgit v1.2.3