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