diff --git a/VERSION b/VERSION
deleted file mode 100644
index 88c5fb891..000000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-1.4.0
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ff15cf04a..791c8add8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -300,6 +300,7 @@ elseif (ANDROID)
 
   set (DRIVER_FILES
     drivers/Android/Fl_Android_Application.cxx
+    drivers/Posix/Fl_Posix_System_Driver.cxx
     drivers/Android/Fl_Android_System_Driver.cxx
     drivers/Android/Fl_Android_Screen_Driver.cxx
     drivers/Android/Fl_Android_Screen_Keyboard.cxx
@@ -311,6 +312,7 @@ elseif (ANDROID)
   )
   set (DRIVER_HEADER_FILES
     drivers/Android/Fl_Android_Application.H
+    drivers/Posix/Fl_Posix_System_Driver.H
     drivers/Android/Fl_Android_System_Driver.H
     drivers/Android/Fl_Android_Screen_Driver.H
     drivers/Android/Fl_Android_Window_Driver.H
diff --git a/src/Fl_lock.cxx b/src/Fl_lock.cxx
index a98be46ec..07999a0a0 100644
--- a/src/Fl_lock.cxx
+++ b/src/Fl_lock.cxx
@@ -418,29 +418,29 @@ void unlock_ring() {}
 
 
 // TODO: can these functions be moved to the system drivers?
-#ifdef __ANDROID__
-
-static void unlock_ring()
-{
-  // TODO: implement me
-}
-
-static void lock_ring()
-{
-  // TODO: implement me
-}
-
-static void unlock_function()
-{
-  // TODO: implement me
-}
-
-static void lock_function()
-{
-  // TODO: implement me
-}
-
-#endif // __ANDROID__
+//#ifdef __ANDROID__
+//
+//static void unlock_ring()
+//{
+//  // TODO: implement me
+//}
+//
+//static void lock_ring()
+//{
+//  // TODO: implement me
+//}
+//
+//static void unlock_function()
+//{
+//  // TODO: implement me
+//}
+//
+//static void lock_function()
+//{
+//  // TODO: implement me
+//}
+//
+//#endif // __ANDROID__
 
 
 
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index e0d5c9f4b..4f0001c17 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -586,9 +586,11 @@ public:
   Fl_Win32_At_Exit() {}
   ~Fl_Win32_At_Exit() {
     fl_free_fonts(); // do some Windows cleanup
+  #ifndef __MINGW32__
     fl_cleanup_pens();
-    OleUninitialize();
     if (fl_graphics_driver) fl_brush_action(1);
+  #endif
+    OleUninitialize();
     fl_cleanup_dc_list();
     // This is actually too late in the cleanup process to remove the
     // clipboard notifications, but we have no earlier hook so we try
diff --git a/src/config_lib.h b/src/config_lib.h
index bbcfb75f5..aa16cd48b 100644
--- a/src/config_lib.h
+++ b/src/config_lib.h
@@ -78,7 +78,7 @@
 # define FL_CFG_SYS_POSIX
 #elif defined(_WIN32)
 # define FL_CFG_SYS_WIN32
-#elif defined(USE_X11) /* X11 */
+#elif defined(USE_X11) || defined(__ANDROID__) /* X11 */
 # define FL_CFG_SYS_POSIX
 #endif
 
diff --git a/src/drivers/Android/Fl_Android_System_Driver.H b/src/drivers/Android/Fl_Android_System_Driver.H
index 5e6dafb1e..a2b51a3e0 100644
--- a/src/drivers/Android/Fl_Android_System_Driver.H
+++ b/src/drivers/Android/Fl_Android_System_Driver.H
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <FL/fl_string.h>
 #include "../../Fl_System_Driver.H"
+#include "../Posix/Fl_Posix_System_Driver.H"
 #include <stdarg.h>
 
 /*
@@ -38,7 +39,7 @@
  - multithreading
  */
 
-class Fl_Android_System_Driver : public Fl_System_Driver
+class Fl_Android_System_Driver : public Fl_Posix_System_Driver
 {
 #if 0
 public:
@@ -118,13 +119,13 @@ public:
   virtual int clipboard_contains(const char *type);
   // this one is implemented in Fl_win32.cxx
   virtual void clipboard_notify_change();
+  virtual void gettime(time_t *sec, int *usec);
+#endif
   virtual void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0);
   virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0);
   virtual void remove_fd(int, int when);
   virtual void remove_fd(int);
-  virtual void gettime(time_t *sec, int *usec);
-#endif
-  virtual char *strdup(const char *s) {return ::strdup(s);}
+  // virtual char *strdup(const char *s) {return ::strdup(s);}
 };
 
 #endif // FL_ANDROID_SYSTEM_DRIVER_H
diff --git a/src/drivers/Android/Fl_Android_System_Driver.cxx b/src/drivers/Android/Fl_Android_System_Driver.cxx
index d25e96425..3145ec8fa 100644
--- a/src/drivers/Android/Fl_Android_System_Driver.cxx
+++ b/src/drivers/Android/Fl_Android_System_Driver.cxx
@@ -24,6 +24,124 @@
 #include <FL/Fl_File_Icon.H>
 #include "../../flstring.h"
 
+
+#  if USE_POLL
+
+#    include <poll.h>
+static pollfd *pollfds = 0;
+
+#  else
+#    if HAVE_SYS_SELECT_H
+#      include <sys/select.h>
+#    endif /* HAVE_SYS_SELECT_H */
+
+// The following #define is only needed for HP-UX 9.x and earlier:
+//#define select(a,b,c,d,e) select((a),(int *)(b),(int *)(c),(int *)(d),(e))
+
+static fd_set fdsets[3];
+static int maxfd;
+#    define POLLIN 1
+#    define POLLOUT 4
+#    define POLLERR 8
+
+#  endif /* USE_POLL */
+
+static int nfds = 0;
+static int fd_array_size = 0;
+struct FD {
+#  if !USE_POLL
+  int fd;
+  short events;
+#  endif
+  void (*cb)(int, void*);
+  void* arg;
+};
+
+static FD *fd = 0;
+
+void Fl_Android_System_Driver::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
+  remove_fd(n,events);
+  int i = nfds++;
+  if (i >= fd_array_size) {
+    FD *temp;
+    fd_array_size = 2*fd_array_size+1;
+
+    if (!fd) temp = (FD*)malloc(fd_array_size*sizeof(FD));
+    else temp = (FD*)realloc(fd, fd_array_size*sizeof(FD));
+
+    if (!temp) return;
+    fd = temp;
+
+#  if USE_POLL
+    pollfd *tpoll;
+
+    if (!pollfds) tpoll = (pollfd*)malloc(fd_array_size*sizeof(pollfd));
+    else tpoll = (pollfd*)realloc(pollfds, fd_array_size*sizeof(pollfd));
+
+    if (!tpoll) return;
+    pollfds = tpoll;
+#  endif
+  }
+  fd[i].cb = cb;
+  fd[i].arg = v;
+#  if USE_POLL
+  pollfds[i].fd = n;
+  pollfds[i].events = events;
+#  else
+  fd[i].fd = n;
+  fd[i].events = events;
+  if (events & POLLIN) FD_SET(n, &fdsets[0]);
+  if (events & POLLOUT) FD_SET(n, &fdsets[1]);
+  if (events & POLLERR) FD_SET(n, &fdsets[2]);
+  if (n > maxfd) maxfd = n;
+#  endif
+}
+
+void Fl_Android_System_Driver::add_fd(int n, void (*cb)(int, void*), void* v) {
+  add_fd(n, POLLIN, cb, v);
+}
+
+void Fl_Android_System_Driver::remove_fd(int n, int events) {
+  int i,j;
+# if !USE_POLL
+  maxfd = -1; // recalculate maxfd on the fly
+# endif
+  for (i=j=0; i<nfds; i++) {
+#  if USE_POLL
+    if (pollfds[i].fd == n) {
+      int e = pollfds[i].events & ~events;
+      if (!e) continue; // if no events left, delete this fd
+      pollfds[j].events = e;
+    }
+#  else
+    if (fd[i].fd == n) {
+      int e = fd[i].events & ~events;
+      if (!e) continue; // if no events left, delete this fd
+      fd[i].events = e;
+    }
+    if (fd[i].fd > maxfd) maxfd = fd[i].fd;
+#  endif
+    // move it down in the array if necessary:
+    if (j<i) {
+      fd[j] = fd[i];
+#  if USE_POLL
+      pollfds[j] = pollfds[i];
+#  endif
+    }
+    j++;
+  }
+  nfds = j;
+#  if !USE_POLL
+  if (events & POLLIN) FD_CLR(n, &fdsets[0]);
+  if (events & POLLOUT) FD_CLR(n, &fdsets[1]);
+  if (events & POLLERR) FD_CLR(n, &fdsets[2]);
+#  endif
+}
+
+void Fl_Android_System_Driver::remove_fd(int n) {
+  remove_fd(n, -1);
+}
+
 #if 0
 
 #include <stdio.h>
