Skip to content

Commit

Permalink
Don't bother with Win9x compatibility when building 64-bit binaries.
Browse files Browse the repository at this point in the history
Fixes Bugzilla #1310.

Thanks to Ozkan Sezer for the patch!
  • Loading branch information
icculus committed Oct 13, 2011
1 parent 0002c69 commit b359efc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/video/wincommon/SDL_lowvideo.h
Expand Up @@ -140,9 +140,13 @@ extern void DX5_SoundFocus(HWND window);
GDL_CreateWindow as well */
LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);

#ifdef _WIN64
#define SDL_ToUnicode ToUnicode
#else
/* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */
typedef int (WINAPI *ToUnicodeFN)(UINT, UINT, const BYTE *, LPWSTR, int, UINT);

extern ToUnicodeFN SDL_ToUnicode;
#endif

#endif /* SDL_lowvideo_h */
12 changes: 9 additions & 3 deletions src/video/wincommon/SDL_sysevents.c
Expand Up @@ -95,13 +95,15 @@ void (*WIN_WinPAINT)(_THIS, HDC hdc);
extern void DIB_SwapGamma(_THIS);

#ifndef NO_GETKEYBOARDSTATE
#ifndef _WIN64
/* Variables and support functions for SDL_ToUnicode() */
static int codepage;
static int Is9xME();
static int GetCodePage();
static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, const BYTE *keystate, LPWSTR wchars, int wsize, UINT flags);

ToUnicodeFN SDL_ToUnicode = ToUnicode9xME;
#endif
#endif /* !NO_GETKEYBOARDSTATE */


Expand Down Expand Up @@ -650,9 +652,10 @@ this->hidden->hiresFix, &x, &y);
return(0);

#ifndef NO_GETKEYBOARDSTATE
case WM_INPUTLANGCHANGE: {
case WM_INPUTLANGCHANGE:
#ifndef _WIN64
codepage = GetCodePage();
}
#endif
return(TRUE);
#endif

Expand Down Expand Up @@ -760,13 +763,15 @@ int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
#endif /* WM_MOUSELEAVE */

#ifndef NO_GETKEYBOARDSTATE
#ifndef _WIN64
/* Initialise variables for SDL_ToUnicode() */
codepage = GetCodePage();

/* Cygwin headers don't match windows.h, so we have to cast around a
const issue here... */
SDL_ToUnicode = Is9xME() ? ToUnicode9xME : (ToUnicodeFN) ToUnicode;
#endif
#endif /* NO_GETKEYBOARDSTATE */

app_registered = 1;
return(0);
Expand All @@ -793,6 +798,7 @@ void SDL_UnregisterApp()
}

#ifndef NO_GETKEYBOARDSTATE
#ifndef _WIN64
/* JFP: Implementation of ToUnicode() that works on 9x/ME/2K/XP */

static int Is9xME()
Expand Down Expand Up @@ -829,5 +835,5 @@ static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, const BYTE *keystate,
}
return 0;
}

#endif
#endif /* !NO_GETKEYBOARDSTATE */

0 comments on commit b359efc

Please sign in to comment.