Patches to make SDL compatible with Win95 again.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 11 Aug 2005 01:02:01 +0000
changeset 1114242a35a85852
parent 1113 39408f59a0f7
child 1115 040aa1bea9fc
Patches to make SDL compatible with Win95 again.
src/video/windx5/SDL_dx5events.c
     1.1 --- a/src/video/windx5/SDL_dx5events.c	Thu Aug 11 00:56:16 2005 +0000
     1.2 +++ b/src/video/windx5/SDL_dx5events.c	Thu Aug 11 01:02:01 2005 +0000
     1.3 @@ -68,6 +68,19 @@
     1.4     and give him a chance to handle some messages. */
     1.5  static WNDPROC userWindowProc = NULL;
     1.6  
     1.7 +static HWND GetTopLevelParent(HWND hWnd)
     1.8 +{
     1.9 +    HWND hParentWnd;
    1.10 +    while (1)
    1.11 +    {
    1.12 +        hParentWnd = GetParent(hWnd);
    1.13 +        if (hParentWnd == NULL)
    1.14 +            break;
    1.15 +        hWnd = hParentWnd;
    1.16 +    }
    1.17 +    return hWnd;
    1.18 +}
    1.19 +
    1.20  /* Convert a DirectInput return code to a text message */
    1.21  static void SetDIerror(char *function, int code)
    1.22  {
    1.23 @@ -168,7 +181,7 @@
    1.24  			SetDIerror("DirectInputDevice::QueryInterface", result);
    1.25  			return(-1);
    1.26  		}
    1.27 -		topwnd =  GetAncestor(SDL_Window, GA_ROOT);
    1.28 +		topwnd =  GetTopLevelParent(SDL_Window, GA_ROOT);
    1.29  		result = IDirectInputDevice2_SetCooperativeLevel(SDL_DIdev[i],
    1.30  					topwnd, inputs[i].win_level);
    1.31  		if ( result != DI_OK ) {
    1.32 @@ -652,7 +665,7 @@
    1.33  				level = inputs[i].win_level;
    1.34  			}
    1.35  			IDirectInputDevice2_Unacquire(SDL_DIdev[i]);
    1.36 -			topwnd = GetAncestor(SDL_Window, GA_ROOT);
    1.37 +			topwnd = GetTopLevelParent(SDL_Window, GA_ROOT);
    1.38  			result = IDirectInputDevice2_SetCooperativeLevel(
    1.39  					SDL_DIdev[i], topwnd, level);
    1.40  			IDirectInputDevice2_Acquire(SDL_DIdev[i]);