Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed more Win64 portability issues
  • Loading branch information
slouken committed Mar 6, 2006
1 parent a626782 commit 851e264
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 25 deletions.
Binary file modified VisualCE.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/win32/SDL_win32_main.c
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/stdlib/SDL_getenv.c
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/video/gapi/SDL_gapivideo.c
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/video/wincommon/SDL_lowvideo.h
Expand Up @@ -36,6 +36,9 @@
#ifndef SetWindowLongPtr
#define SetWindowLongPtr SetWindowLong
#endif
#ifndef GWLP_WNDPROC
#define GWLP_WNDPROC GWL_WNDPROC
#endif

#include "../SDL_sysvideo.h"

Expand Down
2 changes: 1 addition & 1 deletion src/video/wincommon/SDL_sysevents.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/video/wincommon/SDL_sysmouse.c
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion src/video/wincommon/SDL_wingl.c
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/video/windib/SDL_dibevents.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand All @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/video/windib/SDL_dibvideo.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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) ) {
Expand Down
6 changes: 3 additions & 3 deletions src/video/windx5/SDL_dx5events.c
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
}
Expand Down
14 changes: 7 additions & 7 deletions src/video/windx5/SDL_dx5video.c
Expand Up @@ -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;
Expand All @@ -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) ) {
Expand Down Expand Up @@ -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) ) {
Expand Down Expand Up @@ -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;
Expand All @@ -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 ) {
Expand All @@ -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,
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit 851e264

Please sign in to comment.