diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-12-10 16:21:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-10 16:21:07 +0100 |
| commit | a23c77c5a14395db48be9afd3142a8913d767f90 (patch) | |
| tree | d662e17180f63c755d883a839187342c6969268b /src/drivers | |
| parent | 60d6e9be1469ae148d30c4a4366aac136580785a (diff) | |
Defer opening the display as much as possible (#586)
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index 34655bf6e..2a5239eae 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -29,6 +29,7 @@ #include <sys/time.h> #include "../../Fl_Timeout.h" +#include "../../flstring.h" #if HAVE_XINERAMA # include <X11/extensions/Xinerama.h> @@ -474,6 +475,15 @@ void Fl_X11_Screen_Driver::grab(Fl_Window* win) // Wrapper around XParseColor... int Fl_X11_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b) { + // before w open the display, we try interpreting this ourselves + // "None" will ultimately always return 0 + if ( (fl_ascii_strcasecmp(p, "none") == 0) + || (fl_ascii_strcasecmp(p, "#transparent") == 0) ) + return 0; + // if it's #rgb, we can do that ourselves + if (Fl_Screen_Driver::parse_color(p, r, g, b)) + return 1; + // it's neither "None" nor hex, so finally open the diplay and ask X11 XColor x; if (!fl_display) open_display(); if (XParseColor(fl_display, fl_colormap, p, &x)) { |
