2008-09-19, 19:05
bdallen Wrote:I was curious about this, so I tried to create a simple SDL application exhibiting the fullscreen-mouse-grabbing behavior. Turns out it happens whenever you set the video mode to fullscreen, so I would say it really is a limitation of SDL, and the only way around it is changing SDL.Hope you don't mind put I copied you post into its own thread in the development forum, see: http://forum.xbmc.org/showthread.php?tid=37377
Here's the code I used if anyone is curious. Note that most of the code has to do with making q and Esc quit the demo and printing error messages if something goes wrong. The only relevent line is really the call to SDL_SetVideoMode with the SDL_FULLSCREEN flag.
If someone submitted a patch to SDL with a non-mouse grabbing fullscreen mode, that would be awesome, but I have no idea how complicated this would be.
Code:#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
SDL_Surface *screen;
if(SDL_Init(SDL_INIT_VIDEO) != 0)
{
printf("SDL Init failed: %s", SDL_GetError());
return 1;
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode(1600, 1200, 16, SDL_FULLSCREEN);
if(screen == NULL)
{
printf("Setting video mode failed: %s", SDL_GetError());
return 1;
}
SDL_Event event;
int quitFlag = 0;
while(quitFlag == 0)
{
while(SDL_PollEvent(&event))
{
if(event.type == SDL_KEYDOWN
&& (event.key.keysym.sym == SDLK_q
|| event.key.keysym.sym == SDLK_ESCAPE))
{
quitFlag = 1;
}
}
}
}
Thought it belong better there for code discussion