diff options
| author | Manolo Gouy <Manolo> | 2016-04-11 19:14:47 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-04-11 19:14:47 +0000 |
| commit | 64b3d26daa983b7a1394c82b080068cb1a056950 (patch) | |
| tree | 543a65106a8057c7560e7ecf807ee2d140ee8660 /src/drivers/Darwin | |
| parent | 1411c119058743cd1b5ae68f8d076f11b9f85c10 (diff) | |
Create Fl_X11_System_Driver.{cxx,.H} and share Fl_Posix_System_Driver.{cxx,.H} between Darwin and USE_X11 platforms.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11583 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Darwin')
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 31 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | 40 |
2 files changed, 3 insertions, 68 deletions
diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index d51fdeedf..ac08fd8f4 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -25,11 +25,9 @@ #ifndef FL_DARWIN_SYSTEM_DRIVER_H #define FL_DARWIN_SYSTEM_DRIVER_H -#include <FL/Fl_System_Driver.H> +#include "../Posix/Fl_Posix_System_Driver.H" #include <stdlib.h> #include <unistd.h> -#include <fcntl.h> -#include <sys/stat.h> /* Move everything here that manages the system interface. @@ -42,28 +40,12 @@ - multithreading */ -class Fl_Darwin_System_Driver : public Fl_System_Driver +class Fl_Darwin_System_Driver : public Fl_Posix_System_Driver { -private: - int run_program(const char *program, char **argv, char *msg, int msglen); public: Fl_Darwin_System_Driver(); virtual int single_arg(const char *arg); virtual int arg_and_value(const char *name, const char *value); - virtual int mkdir(const char* f, int mode) {return ::mkdir(f, mode);} - virtual int open(const char* f, int oflags, int pmode) { - return pmode == -1 ? ::open(f, oflags) : ::open(f, oflags, pmode); - } - virtual FILE *fopen(const char* f, const char *mode) {return ::fopen(f, mode);} - virtual int system(const char* cmd) {return ::system(cmd);} - virtual int execvp(const char *file, char *const *argv) {return ::execvp(file, argv);} - virtual int chmod(const char* f, int mode) {return ::chmod(f, mode);} - virtual int access(const char* f, int mode) { return ::access(f, mode);} - virtual int stat(const char* f, struct stat *b) { return ::stat(f, b);} - virtual char *getcwd(char* b, int l) {return ::getcwd(b, l);} - virtual int unlink(const char* f) {return ::unlink(f);} - virtual int rmdir(const char* f) {return ::rmdir(f);} - virtual int rename(const char* f, const char *n) {return ::rename(f, n);} virtual int clocale_printf(FILE *output, const char *format, va_list args); static void *get_carbon_function(const char *name); static int calc_mac_os_version(); // computes the fl_mac_os_version global variable @@ -71,21 +53,12 @@ public: virtual int event_key(int k); virtual int get_key(int k); virtual int filename_list(const char *d, dirent ***list, int (*sort)(struct dirent **, struct dirent **) ); - virtual const char *getpwnam(const char *login); - virtual int need_menu_handle_part2() {return 1;} virtual int open_uri(const char *uri, char *msg, int msglen); virtual int need_test_shortcut_extra() {return 1;} virtual int file_browser_load_filesystem(Fl_File_Browser *browser, char *filename, Fl_File_Icon *icon); virtual void newUUID(char *uuidBuffer); virtual char *preference_rootnode(Fl_Preferences *prefs, Fl_Preferences::Root root, const char *vendor, const char *application); - virtual void *dlopen(const char *filename); - // these 4 are implemented in Fl_lock.cxx - virtual void awake(void*); - virtual int lock(); - virtual void unlock(); - virtual void* thread_message(); - virtual int file_type(const char *filename); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index e8082fbc6..806157103 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -61,7 +61,7 @@ Fl_System_Driver *Fl_System_Driver::newSystemDriver() return new Fl_Darwin_System_Driver(); } -Fl_Darwin_System_Driver::Fl_Darwin_System_Driver() { +Fl_Darwin_System_Driver::Fl_Darwin_System_Driver() : Fl_Posix_System_Driver() { if (fl_mac_os_version == 0) fl_mac_os_version = calc_mac_os_version(); } @@ -146,12 +146,6 @@ int Fl_Darwin_System_Driver::filename_list(const char *d, dirent ***list, int (* } -const char *Fl_Darwin_System_Driver::getpwnam(const char *login) { - struct passwd *pwd; - pwd = ::getpwnam(login); - return pwd ? pwd->pw_dir : NULL; -} - int Fl_Darwin_System_Driver::open_uri(const char *uri, char *msg, int msglen) { char *argv[3]; // Command-line arguments @@ -226,38 +220,6 @@ char *Fl_Darwin_System_Driver::preference_rootnode(Fl_Preferences *prefs, Fl_Pre return filename; } -void *Fl_Darwin_System_Driver::dlopen(const char *filename) { - return ::dlopen(filename, RTLD_LAZY); -} - -int Fl_Darwin_System_Driver::file_type(const char *filename) -{ - int filetype; - struct stat fileinfo; // Information on file - if (!::stat(filename, &fileinfo)) - { - if (S_ISDIR(fileinfo.st_mode)) - filetype = Fl_File_Icon::DIRECTORY; -# ifdef S_ISFIFO - else if (S_ISFIFO(fileinfo.st_mode)) - filetype = Fl_File_Icon::FIFO; -# endif // S_ISFIFO -# if defined(S_ISCHR) && defined(S_ISBLK) - else if (S_ISCHR(fileinfo.st_mode) || S_ISBLK(fileinfo.st_mode)) - filetype = Fl_File_Icon::DEVICE; -# endif // S_ISCHR && S_ISBLK -# ifdef S_ISLNK - else if (S_ISLNK(fileinfo.st_mode)) - filetype = Fl_File_Icon::LINK; -# endif // S_ISLNK - else - filetype = Fl_File_Icon::PLAIN; - } - else - filetype = Fl_File_Icon::PLAIN; - return filetype; -} - // // End of "$Id$". // |
