win32: wrap all windows.h-includes to always undef troubling macros

Günther Brammer 2011-03-13 15:48:45 +01:00
parent 7bc20a8dc3
commit c49f8b32d5
25 changed files with 52 additions and 38 deletions

View File

@ -458,6 +458,7 @@ set(OC_CLONK_SOURCES
src/platform/C4VideoPlayback.h
src/platform/C4ViewportWindow.cpp
src/platform/C4ViewportWindow.h
src/platform/C4windowswrapper.h
src/platform/PlatformAbstraction.h
src/platform/StdConfig.cpp
src/platform/StdConfig.h

View File

@ -461,6 +461,7 @@ src/platform/C4VideoPlayback.cpp \
src/platform/C4VideoPlayback.h \
src/platform/C4ViewportWindow.cpp \
src/platform/C4ViewportWindow.h \
src/platform/C4windowswrapper.h \
src/platform/PlatformAbstraction.h \
src/platform/StdAppCommon.cpp \
src/platform/StdAppCommon.h \

View File

@ -25,7 +25,7 @@
C4Config *GetCfg();
#ifdef _WIN32
#include <windows.h>
#include <C4windowswrapper.h>
#include <direct.h>
#endif

View File

@ -46,7 +46,7 @@
#include <C4ConfigShareware.h>
#include <StdRegistry.h>
#ifdef _WIN32
#include <windows.h>
#include <C4windowswrapper.h>
#endif
int globalArgC;

View File

@ -27,9 +27,6 @@
#include <C4Id.h>
// workaround wingdi.h
#undef GetObject
class C4Object;
class C4ObjectList;
class C4ObjectInfo;

View File

@ -28,7 +28,7 @@
#include <stdio.h>
#ifdef _WIN32
#include <io.h>
#include <windows.h>
#include <C4windowswrapper.h>
#define vsnprintf _vsnprintf
#else
#define O_BINARY 0

View File

@ -23,7 +23,7 @@
#include <sstream>
#include <time.h>
#ifdef _WIN32
#include <windows.h>
#include <C4windowswrapper.h>
#include <mmsystem.h>
#else
#include <arpa/inet.h>

View File

@ -26,8 +26,8 @@
#include "StdCompiler.h"
#include "StdScheduler.h"
#include "StdWindow.h"
#ifdef _WIN32
#include <C4windowswrapper.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#ifndef WINSOCK_VERSION

View File

@ -25,7 +25,7 @@
#define BITMAP256_H_INC
#ifdef _WIN32
#include <StdWindow.h>
#include <C4windowswrapper.h>
#else
#pragma pack(push,2)
typedef struct tagBITMAPFILEHEADER

View File

@ -30,7 +30,7 @@
#ifdef GENERATE_MINI_DUMP
// Dump generation on crash
#include <windows.h>
#include <C4windowswrapper.h>
#include <dbghelp.h>
#include <fcntl.h>
#include <string.h>

View File

@ -23,7 +23,7 @@
#include <C4FileClasses.h>
#include <StdRegistry.h>
#include <windows.h>
#include <C4windowswrapper.h>
#define C4FileClassContentType "application/vnd.clonk.c4group"

View File

@ -185,7 +185,7 @@ void C4FileMonitor::GetFDs(std::vector<struct pollfd> & fds)
}
#elif defined(_WIN32)
#include <windows.h>
#include <C4windowswrapper.h>
C4FileMonitor::C4FileMonitor(ChangeNotify pCallback)
: fStarted(false), pCallback(pCallback), pWatches(NULL)

View File

@ -0,0 +1,28 @@
#ifdef _WIN64
# define WINVER 0x0501
# define _WIN32_WINDOWS 0x0501
# define _WIN32_WINNT 0x0501
# define _WIN32_IE 0x0501
# define _AMD64_ 1
#else
# define WINVER 0x0500
# define _WIN32_WINDOWS 0x0500
# define _WIN32_WINNT 0x0501
# define _WIN32_IE 0x0501
# define _X86_ 1
#endif
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <windows.h>
#undef RGB
#undef GetRValue
#undef GetGValue
#undef GetBValue
#undef TextOut
#undef GetObject
#undef CreateFont
#undef LoadBitmap
#undef DrawText

View File

@ -33,7 +33,7 @@
#ifdef USE_DIRECTX
#include <windows.h>
#include <C4windowswrapper.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>

View File

@ -28,9 +28,6 @@
#include <StdFont.h>
#include <StdBuf.h>
// workaround wingdi.h
#undef TextOut
// texref-predef
class CStdDDraw;
class CTexRef;

View File

@ -40,7 +40,7 @@
#include <unistd.h>
#endif
#ifdef _WIN32
#include <windows.h>
#include <C4windowswrapper.h>
#endif
#include <errno.h>
#include <stdlib.h>

View File

@ -26,7 +26,6 @@
#include "C4Include.h"
#include <StdFont.h>
#include <StdWindow.h>
#include <StdBuf.h>
#include <StdDDraw2.h>
#include <StdSurface2.h>
@ -34,6 +33,10 @@
#include <stdexcept>
#include <string>
#ifdef _WIN32
#include <C4windowswrapper.h>
#endif
#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H

View File

@ -26,9 +26,6 @@
#include <StdBuf.h>
#include <stdio.h>
#include <map>
#ifdef _WIN32
#include <tchar.h>
#endif
// Font rendering flags
#define STDFONT_CENTERED 0x0001

View File

@ -31,7 +31,7 @@ static uint32_t dwStdGamepadMinX = 0;
static uint32_t dwStdGamepadMaxY = 0;
static uint32_t dwStdGamepadMinY = 0;
#include <windows.h>
#include <C4windowswrapper.h>
#include <windowsx.h>
uint32_t POV2Position(DWORD dwPOV, bool fVertical)

View File

@ -27,7 +27,7 @@
#include <StdRegistry.h>
#ifdef _WIN32
#include <windows.h>
#include <C4windowswrapper.h>
#include <stdio.h>
bool DeleteRegistryValue(const char *szSubKey, const char *szValueName)

View File

@ -32,6 +32,7 @@
#define STDSCHEDULER_EVENT_MESSAGE INVALID_HANDLE_VALUE
struct pollfd;
#ifndef STDSCHEDULER_USE_EVENTS
#include <C4windowswrapper.h>
#include <winsock2.h>
#endif // STDSCHEDULER_USE_EVENTS
#else // _WIN32

View File

@ -22,7 +22,7 @@
#define INC_StdSync
#ifdef _WIN32
#include <winbase.h>
#include <C4windowswrapper.h>
class CStdCSec
{

View File

@ -26,8 +26,7 @@
#ifdef _WIN32
#pragma once
#include <StdWindow.h>
#include <windows.h> // some vfw.h versions do not compile without this
#include <C4windowswrapper.h> // some vfw.h versions do not compile without this
#include <mmsystem.h>
#include <vfw.h>
#include <io.h>

View File

@ -35,7 +35,7 @@
#ifdef USE_DIRECTX
#include <StdD3D.h>
#endif
#include <windows.h>
#include <C4windowswrapper.h>
#include <mmsystem.h>
#include <stdio.h>
#include <io.h>

View File

@ -40,17 +40,7 @@ const int SEC1_TIMER=1,SEC1_MSEC=1000;
#endif
#ifdef _WIN32
#include <wingdi.h>
#undef RGB
#undef GetRValue
#undef GetGValue
#undef GetBValue
#undef TextOut
#undef GetObject
#undef CreateFont
#include <winuser.h>
#undef LoadBitmap
#undef DrawText
#include <C4windowswrapper.h>
#define K_ALT VK_MENU
#define K_ESCAPE VK_ESCAPE
#define K_PAUSE VK_PAUSE