diff --git a/project/msvc/grafx2-win32.vcxproj b/project/msvc/grafx2-win32.vcxproj
index b349a568..f990c4dc 100644
--- a/project/msvc/grafx2-win32.vcxproj
+++ b/project/msvc/grafx2-win32.vcxproj
@@ -52,7 +52,7 @@
Disabled
NOTTF;__ENABLE_LUA__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;%(PreprocessorDefinitions)
4244
- ..\..\..\..\lua\include;%(AdditionalIncludeDirectories)
+ ..\..\..\..\lpng1634;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)
true
@@ -66,7 +66,7 @@
true
NOTTF;__ENABLE_LUA__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;%(PreprocessorDefinitions)
4244
- ..\..\..\..\lua\include;%(AdditionalIncludeDirectories)
+ ..\..\..\..\lpng1634;..\..\..\..\lua\include;%(AdditionalIncludeDirectories)
true
diff --git a/src/engine.c b/src/engine.c
index f9c098b1..6d1d5346 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1406,8 +1406,10 @@ void Main_handler(void)
}
else
{
+#if defined(USE_SDL) || defined(USE_SDL2)
// Removed all SDL_Delay() timing here: relying on Get_input()
SDL_Delay(10);
+#endif
}
// Gestion de la souris
diff --git a/src/filesel.c b/src/filesel.c
index 1cc883d1..5493984f 100644
--- a/src/filesel.c
+++ b/src/filesel.c
@@ -34,7 +34,7 @@
#include
#elif defined (__MINT__)
#include
-#elif defined(__WIN32__)
+#elif defined(WIN32)
#include
#include
#endif
@@ -92,15 +92,19 @@
byte Native_filesel(byte load)
{
//load = load;
-#ifdef __WIN32__
+#if WIN32
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";
- SDL_SysWMinfo wminfo;
HWND hwnd;
+#if defined(USE_SDL) || defined(USE_SDL2)
+ SDL_SysWMinfo wminfo;
SDL_VERSION(&wminfo.version);
SDL_GetWMInfo(&wminfo);
hwnd = wminfo.window;
+#else
+ hwnd = GetActiveWindow();
+#endif
ZeroMemory(&ofn, sizeof(ofn));
@@ -459,7 +463,7 @@ static void Read_dir_callback(void * pdata, const char *file_name, const word *u
// unreliable on non-physical drives :
// Sometimes it's missing, sometimes it's present even at root...
// We skip it here and add a specific check after the loop
-#if defined(__WIN32__)
+#if defined(WIN32)
if (!strcmp(file_name, PARENT_DIR))
return;
#endif
@@ -564,7 +568,7 @@ void Read_list_of_files(T_Fileselector *list, byte selected_format)
Add_element_to_list(list, PARENT_DIR, Format_filename(PARENT_DIR,19,1), 1, ICON_NONE);
list->Nb_directories ++;
-#elif defined (__WIN32__)
+#elif defined (WIN32)
// Windows :
if (((current_path[0]>='a'&¤t_path[0]<='z')||(current_path[0]>='A'&¤t_path[0]<='Z')) &&
current_path[1]==':' &&
@@ -674,7 +678,7 @@ void Read_list_of_drives(T_Fileselector *list, byte name_length)
UnLockDosList( LDF_VOLUMES | LDF_ASSIGNS | LDF_READ );
}
}
- #elif defined (__WIN32__)
+ #elif defined (WIN32)
{
char drive_name[]="A:\\";
int drive_bits = GetLogicalDrives();
diff --git a/src/graph.c b/src/graph.c
index 3eeccc6e..4639fa05 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -1135,7 +1135,9 @@ void Fill_general(byte fill_color)
if (! (Permanent_draw_count&7))
{
dword now = GFX2_GetTicks();
+#if defined(USE_SDL) || defined(USE_SDL2)
SDL_PumpEvents();
+#endif
if (now>= Permanent_draw_next_refresh)
{
Permanent_draw_next_refresh = now+100;
diff --git a/src/init.c b/src/init.c
index 481315bf..e2065c5f 100644
--- a/src/init.c
+++ b/src/init.c
@@ -25,7 +25,7 @@
// Signal handler: I activate it for the two platforms who certainly
// support them. Feel free to check with others.
-#if defined(__WIN32__) || defined(__linux__)
+#if defined(WIN32) || defined(__linux__)
#define GRAFX2_CATCHES_SIGNALS
#endif
@@ -49,7 +49,7 @@
#if defined(USE_SDL)
#include
#endif
-#if defined(__WIN32__)
+#if defined(WIN32)
#include // GetLogicalDrives(), GetDriveType(), DRIVE_*
#endif
#if !defined(__GP2X__) && defined(USE_SDL)
@@ -2872,7 +2872,10 @@ void Set_config_defaults(void)
#ifdef GRAFX2_CATCHES_SIGNALS
-#if defined(__WIN32__)
+#if defined(WIN32)
+#if defined(_MSC_VER)
+typedef void (*__p_sig_fn_t)(int);
+#endif
#define SIGHANDLER_T __p_sig_fn_t
#elif defined(__macosx__)
typedef void (*sig_t) (int);
@@ -3096,7 +3099,9 @@ void Define_icon(void)
LPVOID lpResIcon32;
HGLOBAL hMem;
WORD nID;
+#if defined(USE_SDL) || defined(USE_SDL2)
SDL_SysWMinfo info;
+#endif
hInstance = (HINSTANCE)GetModuleHandle(NULL);
if (hInstance==NULL)
@@ -3118,9 +3123,11 @@ void Define_icon(void)
if (lpResIconDir==NULL)
break;
+#if defined(USE_SDL) || defined(USE_SDL2)
SDL_VERSION(&info.version);
SDL_GetWMInfo(&info);
-
+#endif
+
//
// 16x16
//
@@ -3152,9 +3159,13 @@ void Define_icon(void)
16, 16, LR_DEFAULTCOLOR);
if (hicon==NULL)
break;
-
+
// Set it
+#if defined(USE_SDL) || defined(USE_SDL2)
SetClassLongPtr(info.window, GCL_HICONSM, (LONG_PTR)hicon);
+#else
+ // TODO
+#endif
//
@@ -3190,7 +3201,11 @@ void Define_icon(void)
break;
// Set it
+#if defined(USE_SDL) || defined(USE_SDL2)
SetClassLongPtr(info.window, GCL_HICON, (LONG_PTR)hicon);
+#else
+ // TODO
+#endif
// Success
diff --git a/src/input.c b/src/input.c
index 5f9cf6f3..e8b473a1 100644
--- a/src/input.c
+++ b/src/input.c
@@ -26,7 +26,7 @@
#include
#endif
-#ifdef __WIN32__
+#ifdef WIN32
#include
#include
#endif
diff --git a/src/io.c b/src/io.c
index e564d7ee..4941a428 100644
--- a/src/io.c
+++ b/src/io.c
@@ -598,7 +598,7 @@ void Get_full_filename(char * output_name, const char * file_name, const char *
}
/// Lock file used to prevent several instances of grafx2 from harming each others' backups
-#ifdef __WIN32__
+#ifdef WIN32
HANDLE Lock_file_handle = INVALID_HANDLE_VALUE;
#else
int Lock_file_handle = -1;
@@ -618,7 +618,7 @@ byte Create_lock_file(const char *file_directory)
#endif
strcat(lock_filename,"gfx2.lck");
- #ifdef __WIN32__
+ #ifdef WIN32
// Windowzy method for creating a lock file
Lock_file_handle = CreateFileA(
lock_filename,
@@ -655,7 +655,7 @@ void Release_lock_file(const char *file_directory)
{
char lock_filename[MAX_PATH_CHARACTERS];
- #ifdef __WIN32__
+ #ifdef WIN32
if (Lock_file_handle != INVALID_HANDLE_VALUE)
{
CloseHandle(Lock_file_handle);
diff --git a/src/io.h b/src/io.h
index 300feb91..0e74ef85 100644
--- a/src/io.h
+++ b/src/io.h
@@ -79,7 +79,7 @@ void Extract_path(char *dest, const char *source);
/// Finds the rightmost path separator in a full filename. Used to separate directory from file.
char * Find_last_separator(const char * str);
-#if defined(__WIN32__)
+#if defined(WIN32)
#define PATH_SEPARATOR "\\"
#elif defined(__MINT__)
#define PATH_SEPARATOR "\\"
diff --git a/src/misc.c b/src/misc.c
index 98e79fef..37159b4d 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -715,7 +715,7 @@ void Zoom_a_line(byte* original_line, byte* zoomed_line,
/*############################################################################*/
-#if defined(__WIN32__)
+#if defined(WIN32)
#include
#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#if defined(__OpenBSD__)
@@ -755,7 +755,7 @@ unsigned long Memory_free(void)
// If Grafx2 thinks the memory is full, weird things may happen. And if memory
// ever becomes full and you're still saying there are 10MB free here, the
// program will crash without saving any picture backup ! You've been warned...
-#if defined(__WIN32__)
+#if defined(WIN32)
MEMORYSTATUS mstt;
mstt.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&mstt);
diff --git a/src/readline.c b/src/readline.c
index 6645236f..b9c385c2 100644
--- a/src/readline.c
+++ b/src/readline.c
@@ -193,7 +193,7 @@ static int Valid_character(word c, int input_type)
// d'autres poseront des problèmes au shell, alors on évite.
// Sous Windows : c'est moins grave car le fopen() échouerait de toutes façons.
// AmigaOS4: Pas de ':' car utilisé pour les volumes.
-#if defined(__WIN32__)
+#if defined(WIN32)
char forbidden_char[] = {'/', '|', '?', '*', '<', '>', ':', '\\'};
#elif defined (__amigaos4__) || defined(__AROS__)
char forbidden_char[] = {'/', '|', '?', '*', '<', '>', ':'};
@@ -305,8 +305,9 @@ void Init_virtual_keyboard(word y_pos, word keyboard_width, word keyboard_height
// TODO X11 and others
static char* getClipboard(word * * unicode)
{
-#ifdef __WIN32__
+#ifdef WIN32
char* dst = NULL;
+#if defined(USE_SDL) || defined(USE_SDL2)
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
@@ -314,6 +315,10 @@ static char* getClipboard(word * * unicode)
if ( SDL_GetWMInfo(&info) )
{
if (OpenClipboard(info.window) )
+#else
+ {
+ if (OpenClipboard(GetActiveWindow()))
+#endif
{
HANDLE hMem;
if ( IsClipboardFormatAvailable(CF_TEXT) )
diff --git a/src/realpath.c b/src/realpath.c
index 430dbe7d..7aa45bbb 100644
--- a/src/realpath.c
+++ b/src/realpath.c
@@ -69,7 +69,7 @@
if (chdir(path)) {
if (errno == ENOTDIR) {
- #if defined(__WIN32__) || defined(__MORPHOS__) || defined(__amigaos__)
+ #if defined(WIN32) || defined(__MORPHOS__) || defined(__amigaos__)
// No symbolic links and no readlink()
l = -1;
#else
diff --git a/src/text.c b/src/text.c
index 4f39c9e9..056fb036 100644
--- a/src/text.c
+++ b/src/text.c
@@ -295,7 +295,7 @@ void Init_text(void)
snprintf(directory_name, sizeof(directory_name), "%s%s", Config_directory, "/fonts");
For_each_file(directory_name, Add_font);
- #if defined(__WIN32__)
+ #if defined(WIN32)
// Parcours du répertoire systeme windows "fonts"
#ifndef NOTTF
{
@@ -709,6 +709,8 @@ byte *Render_text(const char *str, int font_number, int size, int antialias, int
{
#if defined(USE_SDL) || defined(USE_SDL2)
return Render_text_SFont(str, font_number, width, height, palette);
+#else
+ return NULL;
#endif
}
}