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 /src/drivers | |
| parent | e182c8bcd534e5496f502aacfcbe18877f0064d4 (diff) | |
Remove FL_CFG_WIN_X11 preprocessor variable from Fl_own_colormap.cxx
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
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) |
