diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-02-16 13:40:18 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-02-16 15:50:15 +0100 |
| commit | 98265d81a2c3fdfa76fa7d96fc9400f78113ddf7 (patch) | |
| tree | 8cbd6f4a3a5e3037920205c94d7e086e378813bb | |
| parent | e182c8bcd534e5496f502aacfcbe18877f0064d4 (diff) | |
Remove FL_CFG_WIN_X11 preprocessor variable from Fl_own_colormap.cxx
| -rw-r--r-- | src/Fl_own_colormap.cxx | 37 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 27 |
2 files changed, 28 insertions, 36 deletions
diff --git a/src/Fl_own_colormap.cxx b/src/Fl_own_colormap.cxx index 1615f582f..b606c3c4a 100644 --- a/src/Fl_own_colormap.cxx +++ b/src/Fl_own_colormap.cxx @@ -1,7 +1,7 @@ // // Private colormap support for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2021 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,44 +22,9 @@ // and copy the first 16 colors from the default colormap so that we won't // get huge color changes when switching windows. -#include "config_lib.h" #include <FL/Fl.H> -#include <FL/platform.H> #include "Fl_System_Driver.H" - -#if defined(FL_CFG_WIN_X11) && !defined(FL_DOXYGEN) -// X version -#include "drivers/X11/Fl_X11_System_Driver.H" - -void Fl_X11_System_Driver::own_colormap() { - fl_open_display(); -#if USE_COLORMAP - switch (fl_visual->c_class) { - case GrayScale : - case PseudoColor : - case DirectColor : - break; - default: - return; // don't do anything for non-colormapped visuals - } - int i; - XColor colors[16]; - // Get the first 16 colors from the default colormap... - for (i = 0; i < 16; i ++) colors[i].pixel = i; - XQueryColors(fl_display, fl_colormap, colors, 16); - // Create a new colormap... - fl_colormap = XCreateColormap(fl_display, - RootWindow(fl_display,fl_screen), - fl_visual->visual, AllocNone); - // Copy those first 16 colors to our own colormap: - for (i = 0; i < 16; i ++) - XAllocColor(fl_display, fl_colormap, colors + i); -#endif // USE_COLORMAP -} - -#endif // FL_CFG_WIN_X11 - /** \fn Fl::own_colormap() Makes FLTK use its <a href="fltk-colormap.png">own colormap</a>. This may make FLTK display better and will reduce conflicts with other programs that want lots of colors. diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx index 801189b44..1281e5d43 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.cxx +++ b/src/drivers/X11/Fl_X11_System_Driver.cxx @@ -18,6 +18,7 @@ #include "Fl_X11_System_Driver.H" #include <FL/Fl_File_Browser.H> #include <FL/fl_string.h> // fl_strdup +#include <FL/platform.H> #include "../../flstring.h" #include <X11/Xlib.h> @@ -713,4 +714,30 @@ const char *Fl_X11_System_Driver::shortcut_add_key_name(unsigned key, char *p, c } } +void Fl_X11_System_Driver::own_colormap() { + fl_open_display(); +#if USE_COLORMAP + switch (fl_visual->c_class) { + case GrayScale : + case PseudoColor : + case DirectColor : + break; + default: + return; // don't do anything for non-colormapped visuals + } + int i; + XColor colors[16]; + // Get the first 16 colors from the default colormap... + for (i = 0; i < 16; i ++) colors[i].pixel = i; + XQueryColors(fl_display, fl_colormap, colors, 16); + // Create a new colormap... + fl_colormap = XCreateColormap(fl_display, + RootWindow(fl_display,fl_screen), + fl_visual->visual, AllocNone); + // Copy those first 16 colors to our own colormap: + for (i = 0; i < 16; i ++) + XAllocColor(fl_display, fl_colormap, colors + i); +#endif // USE_COLORMAP +} + #endif // !defined(FL_DOXYGEN) |
