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
This commit is contained in:
Manolo Gouy
2016-04-13 14:41:55 +00:00
parent 8653a5353e
commit 70f7738c92
4 changed files with 23 additions and 27 deletions
+2
View File
@@ -180,6 +180,8 @@ public:
// the implementations of local_to_mac_roman() and mac_roman_to_local() are in fl_encoding_mac_roman.cxx
virtual const char *local_to_mac_roman(const char *t, int n);
virtual const char *mac_roman_to_local(const char *t, int n);
// the default implementation is most probably enough
virtual void own_colormap() {}
};
#endif // FL_SYSTEM_DRIVER_H
+18 -26
View File
@@ -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 <config.h>
#include "config_lib.h"
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/Fl_System_Driver.H>
/** \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.
<P>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.
<P>This does nothing if the current visual is not colormapped.
*/
void Fl::own_colormap() {
Fl::system_driver()->own_colormap();
}
//
// End of "$Id$".
+1 -1
View File
@@ -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
+2
View File
@@ -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 */