From 8efadf08b86308e8ade4736bd788f865ac45acf0 Mon Sep 17 00:00:00 2001 From: Jeremy Tan Date: Wed, 27 May 2015 20:25:48 +0800 Subject: [PATCH] Rely on bootstrap more to remove some Windows-specific code in some cases. Also: In preparation for UTF-8 fopen on MINGW/Windows. (Patching gnulib) Note: It turns out the gnulib implementation of select/send/recv causes the UI to be treacle slow (gxdraw.c). So don't use that. --- bootstrap.conf | 3 +++ fontforgeexe/fontview.c | 19 ------------------- fontforgeexe/startui.c | 5 ----- gdraw/gxdraw.c | 25 +++++++++++++------------ 4 files changed, 16 insertions(+), 36 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index 4da84c12e6..cb9de82c5f 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -42,11 +42,14 @@ gnulib_modules=' warnings manywarnings c-strtod + fopen gethostname getline iconv inet_ntop localeconv + open + mkdir progname strcase strtok_r diff --git a/fontforgeexe/fontview.c b/fontforgeexe/fontview.c index 0f7446dd94..4afd852942 100644 --- a/fontforgeexe/fontview.c +++ b/fontforgeexe/fontview.c @@ -70,10 +70,6 @@ #include "gutils/unicodelibinfo.h" #include "sfundo.h" -#if defined (__MINGW32__) -#include -#endif - #include "xvasprintf.h" @@ -5814,21 +5810,6 @@ static void FVMenuCollabCloseLocalServer(GWindow gw, struct gmenuitem *UNUSED(mi AskAndMaybeCloseLocalCollabServers(); } - -#if defined(__MINGW32__) -// -// This is an imperfect implemenation of kill() for windows. -// -static int kill( int pid, int sig ) -{ - HANDLE hHandle; - hHandle = OpenProcess( PROCESS_ALL_ACCESS, 0, pid ); - TerminateProcess( hHandle, 0 ); -} -#endif - - - static void collablistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { FontView *fv = (FontView *) GDrawGetUserData(gw); diff --git a/fontforgeexe/startui.c b/fontforgeexe/startui.c index a4245ddab1..26f7737b6e 100644 --- a/fontforgeexe/startui.c +++ b/fontforgeexe/startui.c @@ -98,11 +98,6 @@ extern void setup_cocoa_app(); //# endif #endif -#if defined(__MINGW32__) -#include -#define sleep(n) Sleep(1000 * (n)) -#endif - #include "collabclientui.h" #include "scripting.h" diff --git a/gdraw/gxdraw.c b/gdraw/gxdraw.c index 2faf4c0358..57fbd804a8 100644 --- a/gdraw/gxdraw.c +++ b/gdraw/gxdraw.c @@ -25,9 +25,9 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if defined(__MINGW32__) -#include -#include +#ifdef __MINGW32__ +# include +# include #endif #include "gxdrawP.h" @@ -35,19 +35,14 @@ #include #include - -#if !defined(__MINGW32__) -#include /* for timers & select */ -#endif -#include /* for timers & select */ -#include /* for timers & select */ #include /* error handler */ #include /* for setting the X locale properly */ -#ifdef HAVE_PTHREAD_H -# ifndef __MINGW32__ +#include /* for timers & select */ +#ifndef __MINGW32__ +# include /* for timers & select */ +# ifdef HAVE_PTHREAD_H # include -# include # endif #endif @@ -56,6 +51,12 @@ #include "fontP.h" #include +/* Hack to get around gnulib. */ +#ifdef __MINGW32__ +# undef gettimeofday +# undef timeval +#endif + enum cm_type { cmt_default=-1, cmt_current, cmt_copy, cmt_private }; void GDrawIErrorRun(const char *fmt,...);