[SDL] [PATCH] GrabInput

John Popplewell john at johnnypops.demon.co.uk
Wed Dec 15 20:37:11 PST 2004


On Wed, Dec 15, 2004 at 10:39:57PM +0300, Dmitry Yakimov wrote:
> Hi,
> 
>   file: SDL_sysevents.c
>   function: WinMessage
> 
>    case WM_ACTIVATE: {
>            SDL_VideoDevice *this = current_video;
>            BOOL minimized;
>            Uint8 appstate;
>            minimized = HIWORD(wParam);
>            if ( !minimized && (LOWORD(wParam) != WA_INACTIVE) ) {
>                    /* Gain the following states */
>                    appstate = SDL_APPACTIVE|SDL_APPINPUTFOCUS;
>                    if ( this->input_grab != SDL_GRAB_OFF ) {
> 
> The last line must be:
> 
>                    if ( this->input_grab != SDL_GRAB_ON ) {
> 
> otherwise we never call WIN_GrabInput(this, SDL_GRAB_ON)
> 
Must be? No.

The fragment (this->input_grab != SDL_GRAB_OFF) is a synomym for:
'Is grabbing requested by the application?'. It is used because there
are multiple values that mean grab requested, but only one value, 0,
that means grabbing is not requested.

In case WM_ACTIVATE:, there are two code paths that either switch
grabbing on or switch grabbing off (if grabbing is requested) depending
on whether the application window is minimized/maximized,
active/inactive, etc.

There might be a bug in the input grabbing behaviour, but that isn't it,

cheers,
John Popplewell.

> -- 
> Best regards,
>  Dmitry Yakimov, ISDEF member
> ActiveKitten.com
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl




More information about the SDL mailing list