Win32, toggle from full-screen to windowed, advice please

Hello,

I’m getting some strange behavior in my win32 app, which uses SDL with
DirectX8. I’m getting 2 problems:

Problem 1:

When I start my application in full-screen mode, then switch in to windowed
mode, the mouse pointer becomes confined to the applications’ window. I
tried freeing it with SDL_WM_GrabInput(SDL_GRAB_OFF), but that didn’t
resolve the issue.

Problem 2:

I’m also having another issue; when I start full-screen, toggle to windowed,
alt-tab out, then restore my application (by clicking on it in the
task-bar), it changes my desktop resolution to what the full-screen
resolution would be, but puts my game in to a window!

Obviously, I don’t want it to affect the desktop resolution when restoring
to windowed mode!.

Incidentally, when I start my game in windowed mode, then toggle full-screen
and back to windowed, I don’t get any of the above symptoms.

I think perhaps these 2 problems are related, is there anything special I
need to consider, when toggling between full-screen and windowed on Win32?–
View this message in context: http://old.nabble.com/Win32%2C-toggle-from-full-screen-to-windowed%2C-advice-please.-tp27591425p27591425.html
Sent from the SDL mailing list archive at Nabble.com.

I may have solved this, when I do the toggle, I’ve now added in a call to:

SDL_SetVideoMode(s_Width,s_Height,0,0);
or
SDL_SetVideoMode(s_Width,s_Height,0,SDL_FULLSCREEN);

Which I believe informs SDL if the game is in full-screen or windowed mode?
I wasn’t doing this before, and I think the problem was that when I changed
mode (using Win32 and directX), I wasn’t informing SDL (via call to
SDL_SetVideoMode), and so on a restore from minimized, SDL is jumping in and
setting the screen resolution to full-screen (because it thinks we’re still
full-screen etc).

Does that sound plausable?

Thanks,–
View this message in context: http://old.nabble.com/Win32%2C-toggle-from-full-screen-to-windowed%2C-advice-please.-tp27591425p27593340.html
Sent from the SDL mailing list archive at Nabble.com.

Jamie W wrote:

Hello,

I’m getting some strange behavior in my win32 app, which uses SDL with
DirectX8. I’m getting 2 problems:

Problem 1:

When I start my application in full-screen mode, then switch in to windowed
mode, the mouse pointer becomes confined to the applications’ window. I
tried freeing it with SDL_WM_GrabInput(SDL_GRAB_OFF), but that didn’t
resolve the issue.

i had this problem too… in my config, i was creating a window and
passing that window handle to SDL. the fix was to call SetWindowPos
after the call to SDL_SetVideoMode. Also removed one handler to
WM_WINDOWPOSCHANGED (i think it was returning incorrect return code).
regards,
s-