Bug report: SDL_GetAppState on OS X after switching to full screen

There appears to be a serious bug with SDL_GetAppState on OS X (10.3.9).
When first running in windowed mode and then switching to full screen
mode by calling SDL_SetVideoMode, SDL_GetAppState returns 4
(SDL_APPACTIVE) instead of 7 (SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS |
SDL_APPACTIVE). However, the SDL application clearly does have the
keyboard focus, since it is able to receive keyboard events. Below is a
small test program (in C++) which demonstrates this problem:

#include “SDL.h”
#include <stdio.h>

namespace {

void wait_for_key()
{
SDL_Event e;
while (SDL_WaitEvent(&e)) {
if (e.type == SDL_KEYDOWN || e.type == SDL_QUIT) return;
}
}

}

int main(int, char *[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(640, 480, 32, 0);
printf(“AppState = %d\n”, SDL_GetAppState());
wait_for_key();
SDL_SetVideoMode(640, 480, 32, SDL_FULLSCREEN);
printf(“AppState = %d\n”, SDL_GetAppState());
wait_for_key();
SDL_Quit();
return 0;
}–
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com

Rainer Deyke wrote:

There appears to be a serious bug with SDL_GetAppState on OS X (10.3.9).
When first running in windowed mode and then switching to full screen
mode by calling SDL_SetVideoMode, SDL_GetAppState returns 4
(SDL_APPACTIVE) instead of 7 (SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS |
SDL_APPACTIVE). However, the SDL application clearly does have the
keyboard focus, since it is able to receive keyboard events. Below is a
small test program (in C++) which demonstrates this problem:

Here’s a patch to SDL CVS that should fix it.

–ryan.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: SDL-quartz-appinput-fullscreen-toggle-RYAN-1.diff
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050815/48c01213/attachment.asc

There appears to be a serious bug with SDL_GetAppState on OS X (10.3.9).
When first running in windowed mode and then switching to full screen
mode by calling SDL_SetVideoMode, SDL_GetAppState returns 4
(SDL_APPACTIVE) instead of 7 (SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS |
SDL_APPACTIVE). However, the SDL application clearly does have the
keyboard focus, since it is able to receive keyboard events. Below is a
small test program (in C++) which demonstrates this problem:

Here’s a patch to SDL CVS that should fix it.

(I put this fix in CVS.)

–ryan.