summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-10 19:37:18 +0000
committerManolo Gouy <Manolo>2016-04-10 19:37:18 +0000
commit95fa60b71dceadffd65f8f135a89efb05a8d6fd7 (patch)
tree6c732ec5d896d1315a34c39cc4bc2424f6ca86d6
parent78213fc57eb11958b174b5f22172561e1998797e (diff)
Rewrite Fl_get_system_colors.cxx under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11577 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--FL/Fl_System_Driver.H2
-rw-r--r--src/Fl_get_system_colors.cxx10
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.H1
3 files changed, 5 insertions, 8 deletions
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H
index db3784d7b..0bcc7973b 100644
--- a/FL/Fl_System_Driver.H
+++ b/FL/Fl_System_Driver.H
@@ -29,6 +29,7 @@
#include <FL/filename.H>
#include <FL/Fl_Preferences.H>
#include <stdio.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
@@ -79,6 +80,7 @@ public:
// implement these to support cross-platform file operations
virtual char *utf2mbcs(const char *s) {return (char*)s;}
virtual char *getenv(const char* v);
+ virtual int putenv(char* v) {return ::putenv(v);}
virtual int open(const char* f, int oflags, int pmode) {return -1;}
virtual FILE *fopen(const char* f, const char *mode) {return NULL;}
virtual int system(const char* cmd) {return -1;}
diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx
index 55ba01d5b..59eb95422 100644
--- a/src/Fl_get_system_colors.cxx
+++ b/src/Fl_get_system_colors.cxx
@@ -18,6 +18,7 @@
#include <FL/Fl.H>
#include <FL/Fl_Screen_Driver.H>
+#include <FL/Fl_System_Driver.H>
#include <FL/fl_draw.H>
#include <FL/x.H>
#include <FL/math.h>
@@ -29,13 +30,6 @@
#include <FL/Fl_Tiled_Image.H>
#include "tile.xpm"
-#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-# define putenv _putenv
-#endif // WIN32 && !__CYGWIN__
-
-
/**
Changes fl_color(FL_BACKGROUND_COLOR) to the given color,
and changes the gray ramp from 32 to 56 to black to white. These are
@@ -184,7 +178,7 @@ int Fl::scheme(const char *s) {
static char e[1024];
strcpy(e,"FLTK_SCHEME=");
if (s) strlcat(e,s,sizeof(e));
- putenv(e);
+ Fl::system_driver()->putenv(e);
// Load the scheme...
return reload_scheme();
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
index 5ffe037a2..49fb1da63 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
@@ -47,6 +47,7 @@ public:
virtual void fatal(const char *format, va_list args);
virtual char *utf2mbcs(const char *s);
virtual char *getenv(const char* v);
+ virtual int putenv(char* v) {return _putenv(v);}
virtual int open(const char* f, int oflags, int pmode);
virtual FILE *fopen(const char* f, const char *mode);
virtual int system(const char* cmd);