[geany/geany] 2e76e3: win32: port some defines from win32-config.h & waf to a new win32defines.h

Thomas Martitz git-noreply at xxxxx
Sun Jul 5 16:25:24 UTC 2015


Branch:      refs/heads/master
Author:      Thomas Martitz <kugel at rockbox.org>
Committer:   Thomas Martitz <kugel at rockbox.org>
Date:        Sun, 05 Jul 2015 16:25:24 UTC
Commit:      2e76e3792e7d8a568aeadc5a9cdbf37c9eca8661
             https://github.com/geany/geany/commit/2e76e3792e7d8a568aeadc5a9cdbf37c9eca8661

Log Message:
-----------
win32: port some defines from win32-config.h & waf to a new win32defines.h

autotools based build system uses only config.h. This file was lacking some
important defines. Rather than maintaining the defines in all build systems,
we can simply define in a specialized header that is included by all .c files
that use windows.h


Modified Paths:
--------------
    src/Makefile.am
    src/socket.c
    src/spawn.c
    src/win32.c
    src/win32defines.h
    win32-config.h
    wscript

Modified: src/Makefile.am
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -147,7 +147,7 @@ WINDRES = $(host_alias)-windres
 geany_private.res: $(top_srcdir)/geany_private.rc
 	$(WINDRES) -i $(top_srcdir)/geany_private.rc --input-format=rc -o $@ -O coff
 
-libgeany_la_SOURCES += win32.c win32.h
+libgeany_la_SOURCES += win32.c win32.h win32defines.h
 libgeany_la_LIBADD  += -lole32 -lwsock32 -lcomdlg32
 libgeany_la_LDFLAGS += -Wl,-luuid -mwindows -mms-bitfields -no-undefined
 


Modified: src/socket.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -79,6 +79,7 @@
 # include <netinet/in.h>
 # include <glib/gstdio.h>
 #else
+# include "win32defines.h"
 # include <winsock2.h>
 # include <windows.h>
 # include <gdk/gdkwin32.h>


Modified: src/spawn.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -49,6 +49,7 @@
 #include "spawn.h"
 
 #ifdef G_OS_WIN32
+# include "win32defines.h"
 # include <ctype.h>    /* isspace() */
 # include <fcntl.h>    /* _O_RDONLY, _O_WRONLY */
 # include <io.h>       /* _open_osfhandle, _close */


Modified: src/win32.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -31,6 +31,8 @@
 
 #ifdef G_OS_WIN32
 
+#include "win32defines.h"
+
 #include "dialogs.h"
 #include "document.h"
 #include "editor.h"
@@ -47,8 +49,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define VC_EXTRALEAN
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <commdlg.h>
 #include <shellapi.h>


Modified: src/win32defines.h
31 lines changed, 31 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,31 @@
+/*
+ *      win32defines.h - this file is part of Geany, a fast and lightweight IDE
+ *
+ *      This program is free software; you can redistribute it and/or modify
+ *      it under the terms of the GNU General Public License as published by
+ *      the Free Software Foundation; either version 2 of the License, or
+ *      (at your option) any later version.
+ *
+ *      This program is distributed in the hope that it will be useful,
+ *      but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *      GNU General Public License for more details.
+ *
+ *      You should have received a copy of the GNU General Public License along
+ *      with this program; if not, write to the Free Software Foundation, Inc.,
+ *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef WIN32DEFINES_H
+#define WIN32DEFINES_H 1
+
+/* These defines are necessary defines *before* windows.h is included */
+
+#define VC_EXTRALEAN
+#define WIN32_LEAN_AND_MEAN
+/* Need Windows XP for SHGetFolderPathAndSubDirW */
+#define WINVER 0x0501
+/* Needed for SHGFP_TYPE */
+#define _WIN32_IE 0x0500
+
+#endif /* WIN32DEFINES_H */


Modified: win32-config.h
6 lines changed, 0 insertions(+), 6 deletions(-)
===================================================================
@@ -317,9 +317,3 @@
 
 /* Define if you want to detect a running instance */
 #define HAVE_SOCKET 1
-
-// Need Windows XP for SHGetFolderPathAndSubDirW
-#define WINVER 0x0501
-
-// Needed for SHGFP_TYPE
-#define _WIN32_IE 0x0500


Modified: wscript
3 lines changed, 0 insertions(+), 3 deletions(-)
===================================================================
@@ -274,9 +274,6 @@ but you then may not have a local copy of the HTML manual.'''
             '-static-libgcc',
             '-static-libstdc++'])
         conf.env.append_value('LIB_WIN32', ['wsock32', 'uuid', 'ole32', 'comdlg32'])
-        # explicitly define Windows version for older Mingw environments
-        conf.define('WINVER', '0x0501', quote=False)  # for SHGetFolderPathAndSubDirW
-        conf.define('_WIN32_IE', '0x0500', quote=False)  # for SHGFP_TYPE
     else:
         conf.env['cshlib_PATTERN'] = '%s.so'
         # DATADIR and LOCALEDIR are defined by the intltool tool



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list