Commit 302e86a4 authored by Sam Lantinga's avatar Sam Lantinga

Fixed more Win64 portability issues

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401476
parent 80395534
No preview for this file type
......@@ -166,7 +166,7 @@ static void __cdecl cleanup_output(void)
/* This is where execution begins [console apps] */
int console_main(int argc, char *argv[])
{
int n;
size_t n;
char *bufp, *appname;
int status;
......
......@@ -69,7 +69,7 @@ char *SDL_getenv(const char *name)
{
size_t bufferlen;
bufferlen = GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
bufferlen = GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
if ( bufferlen == 0 ) {
return NULL;
}
......@@ -80,7 +80,7 @@ char *SDL_getenv(const char *name)
}
SDL_envmem = newmem;
SDL_envmemlen = bufferlen;
GetEnvironmentVariable(name, SDL_envmem, SDL_envmemlen);
GetEnvironmentVariable(name, SDL_envmem, (DWORD)SDL_envmemlen);
}
return SDL_envmem;
}
......
......@@ -710,7 +710,7 @@ SDL_Surface *GAPI_SetVideoMode(_THIS, SDL_Surface *current,
style = 0;
if (!SDL_windowid)
SetWindowLong(SDL_Window, GWL_STYLE, style);
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
/* Allocate bitmap */
if(gapiBuffer)
......
......@@ -36,6 +36,9 @@
#ifndef SetWindowLongPtr
#define SetWindowLongPtr SetWindowLong
#endif
#ifndef GWLP_WNDPROC
#define GWLP_WNDPROC GWL_WNDPROC
#endif
#include "../SDL_sysvideo.h"
......
......@@ -562,7 +562,7 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Aparently it's too difficult for MS to check
inside their function, so I have to do it here.
*/
style = GetWindowLong(hwnd, GWL_STYLE);
style = GetWindowLongPtr(hwnd, GWL_STYLE);
AdjustWindowRect(
&size,
style,
......
......@@ -172,7 +172,7 @@ WMcursor *WIN_CreateWMCursor(_THIS,
/* Create the cursor */
cursor->curs = CreateCursor(
(HINSTANCE)GetWindowLongPtr(SDL_Window, GWL_HINSTANCE),
(HINSTANCE)GetWindowLongPtr(SDL_Window, GWLP_HINSTANCE),
hot_x, hot_y, allowed_x, allowed_y,
cursor->ands, cursor->xors);
if ( cursor->curs == NULL ) {
......
......@@ -45,7 +45,7 @@ static int WIN_GL_ResetWindow(_THIS)
/* Save the existing window attributes */
LONG style;
RECT rect = { 0, 0, 0, 0 };
style = GetWindowLong(SDL_Window, GWL_STYLE);
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
GetWindowRect(SDL_Window, &rect);
DestroyWindow(SDL_Window);
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
......
......@@ -43,7 +43,7 @@
/* The translation table from a Microsoft VK keysym to a SDL keysym */
static SDLKey VK_keymap[SDLK_LAST];
static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed);
static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed);
/* Masks for processing the windows KEYDOWN and KEYUP messages */
#define REPEATED_KEYMASK (1<<30)
......@@ -376,7 +376,7 @@ void DIB_InitOSKeymap(_THIS)
VK_keymap[VK_APPS] = SDLK_MENU;
}
static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed)
static SDL_keysym *TranslateKey(WPARAM vkey, UINT scancode, SDL_keysym *keysym, int pressed)
{
/* Set the keysym information */
keysym->scancode = (unsigned char) scancode;
......@@ -426,8 +426,8 @@ int DIB_CreateWindow(_THIS)
/* DJM: we want all event's for the user specified
window to be handled by SDL.
*/
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
} else {
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
......@@ -444,7 +444,7 @@ int DIB_CreateWindow(_THIS)
void DIB_DestroyWindow(_THIS)
{
if ( SDL_windowid ) {
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
} else {
DestroyWindow(SDL_Window);
}
......
......@@ -647,7 +647,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
screen_pal = DIB_CreatePalette(bpp);
}
style = GetWindowLong(SDL_Window, GWL_STYLE);
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
style &= ~(resizestyle|WS_MAXIMIZE);
if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
style &= ~windowstyle;
......@@ -677,7 +677,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
/* DJM: Don't piss of anyone who has setup his own window */
if ( !SDL_windowid )
SetWindowLong(SDL_Window, GWL_STYLE, style);
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
/* Delete the old bitmap if necessary */
if ( screen_bmp != NULL ) {
......@@ -780,7 +780,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
bounds.top = SDL_windowY;
bounds.right = SDL_windowX+video->w;
bounds.bottom = SDL_windowY+video->h;
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
width = bounds.right-bounds.left;
height = bounds.bottom-bounds.top;
if ( (flags & SDL_FULLSCREEN) ) {
......
......@@ -874,8 +874,8 @@ int DX5_CreateWindow(_THIS)
/* DJM: we want all event's for the user specified
window to be handled by SDL.
*/
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWL_WNDPROC);
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)WinMessage);
userWindowProc = (WNDPROCTYPE)GetWindowLongPtr(SDL_Window, GWLP_WNDPROC);
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)WinMessage);
} else {
SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
(WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
......@@ -903,7 +903,7 @@ void DX5_DestroyWindow(_THIS)
/* Destroy our window */
if ( SDL_windowid ) {
SetWindowLongPtr(SDL_Window, GWL_WNDPROC, (LONG_PTR)userWindowProc);
SetWindowLongPtr(SDL_Window, GWLP_WNDPROC, (LONG_PTR)userWindowProc);
} else {
DestroyWindow(SDL_Window);
}
......
......@@ -1123,7 +1123,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
}
#endif /* !NO_CHANGEDISPLAYSETTINGS */
style = GetWindowLong(SDL_Window, GWL_STYLE);
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
style &= ~(resizestyle|WS_MAXIMIZE);
if ( video->flags & SDL_FULLSCREEN ) {
style &= ~windowstyle;
......@@ -1148,7 +1148,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
/* DJM: Don't piss of anyone who has setup his own window */
if ( !SDL_windowid )
SetWindowLong(SDL_Window, GWL_STYLE, style);
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
/* Resize the window (copied from SDL WinDIB driver) */
if ( !SDL_windowid && !IsZoomed(SDL_Window) ) {
......@@ -1178,7 +1178,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
bounds.top = SDL_windowY;
bounds.right = SDL_windowX+video->w;
bounds.bottom = SDL_windowY+video->h;
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
width = bounds.right-bounds.left;
height = bounds.bottom-bounds.top;
if ( (flags & SDL_FULLSCREEN) ) {
......@@ -1217,7 +1217,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
}
/* Set the appropriate window style */
style = GetWindowLong(SDL_Window, GWL_STYLE);
style = GetWindowLongPtr(SDL_Window, GWL_STYLE);
style &= ~(resizestyle|WS_MAXIMIZE);
if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
style &= ~windowstyle;
......@@ -1239,7 +1239,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
}
/* DJM: Don't piss of anyone who has setup his own window */
if ( !SDL_windowid )
SetWindowLong(SDL_Window, GWL_STYLE, style);
SetWindowLongPtr(SDL_Window, GWL_STYLE, style);
/* Set DirectDraw sharing mode.. exclusive when fullscreen */
if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
......@@ -1264,7 +1264,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
bounds.top = 0;
bounds.right = GetSystemMetrics(SM_CXSCREEN);
bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
SetWindowPos(SDL_Window, HWND_TOPMOST,
bounds.left, bounds.top,
bounds.right - bounds.left,
......@@ -1581,7 +1581,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
bounds.top = SDL_windowY;
bounds.right = SDL_windowX+video->w;
bounds.bottom = SDL_windowY+video->h;
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
AdjustWindowRectEx(&bounds, GetWindowLongPtr(SDL_Window, GWL_STYLE), FALSE, 0);
width = bounds.right-bounds.left;
height = bounds.bottom-bounds.top;
if ( center ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment