Skip to content

Commit

Permalink
Patches to make SDL compatible with Win95 again.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 11, 2005
1 parent 904e811 commit 784ec81
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/video/windx5/SDL_dx5events.c
Expand Up @@ -68,6 +68,19 @@ static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed);
and give him a chance to handle some messages. */
static WNDPROC userWindowProc = NULL;

static HWND GetTopLevelParent(HWND hWnd)
{
HWND hParentWnd;
while (1)
{
hParentWnd = GetParent(hWnd);
if (hParentWnd == NULL)
break;
hWnd = hParentWnd;
}
return hWnd;
}

/* Convert a DirectInput return code to a text message */
static void SetDIerror(char *function, int code)
{
Expand Down Expand Up @@ -168,7 +181,7 @@ static int DX5_DInputInit(_THIS)
SetDIerror("DirectInputDevice::QueryInterface", result);
return(-1);
}
topwnd = GetAncestor(SDL_Window, GA_ROOT);
topwnd = GetTopLevelParent(SDL_Window, GA_ROOT);
result = IDirectInputDevice2_SetCooperativeLevel(SDL_DIdev[i],
topwnd, inputs[i].win_level);
if ( result != DI_OK ) {
Expand Down Expand Up @@ -652,7 +665,7 @@ void DX5_DInputReset(_THIS, int fullscreen)
level = inputs[i].win_level;
}
IDirectInputDevice2_Unacquire(SDL_DIdev[i]);
topwnd = GetAncestor(SDL_Window, GA_ROOT);
topwnd = GetTopLevelParent(SDL_Window, GA_ROOT);
result = IDirectInputDevice2_SetCooperativeLevel(
SDL_DIdev[i], topwnd, level);
IDirectInputDevice2_Acquire(SDL_DIdev[i]);
Expand Down

0 comments on commit 784ec81

Please sign in to comment.