Mouse focused lost even if mouse inside window

Hi kids!

Sometimes when changing video mode between windowed and fullscreen I get the
SDL_APPMOUSEFOCUS (gain=0) event (I’ve tested this alot and it happens now
and then (suddenly it might work as expected)). This is strange because it
seems to be sent even if my mouse is within the application window! Has
anybody experienced this before? I saw in the ChangeLog that something was
done about this issue: "1.2.7: Fixed mouse focus events after resetting
video mode on Windows " but it doesn’t work here. Perhaps this is a newly
introduced bug?

Also, when going from fullscreen to windowed mode the SDL_ShowCursor(
SDL_DISABLE ) does not work since I sometimes get back the default SDL
cursor again. I ask using the SDL_ShowCursor( SDL_QUERY ) and receives that
the cursor is disabled. It is shown anyway! What?

All this happens when running SDL 1.2.7 (stable) under M$ Windows 2k.

Best Regards,
David Svanberg

What would I try :

Try to reexecute the SDL_ShowCursor(SDL_DISABLE); after each switch to
windowed / fullscreen.

If not working :
Free the surface you used to SDL_SetVideoMode, then SDL_SetVideoMode again.

If not working :
SDL_Quit(); and SDL_Init(SDL_INIT_VIDEO) again, with the new flags for
you screen format ( SDL_FULLSCREEN, or not )

As nobody answered you, I guess you may have find a trick yourself.

Tell me if some of my thinkings were right

Les.

David Svanberg a ?crit :> Hi kids!

Sometimes when changing video mode between windowed and fullscreen I get the
SDL_APPMOUSEFOCUS (gain=0) event (I’ve tested this alot and it happens now
and then (suddenly it might work as expected)). This is strange because it
seems to be sent even if my mouse is within the application window! Has
anybody experienced this before? I saw in the ChangeLog that something was
done about this issue: "1.2.7: Fixed mouse focus events after resetting
video mode on Windows " but it doesn’t work here. Perhaps this is a newly
introduced bug?

Also, when going from fullscreen to windowed mode the SDL_ShowCursor(
SDL_DISABLE ) does not work since I sometimes get back the default SDL
cursor again. I ask using the SDL_ShowCursor( SDL_QUERY ) and receives that
the cursor is disabled. It is shown anyway! What?

All this happens when running SDL 1.2.7 (stable) under M$ Windows 2k.

Best Regards,
David Svanberg


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Les HauSsebons wrote:

If not working :
Free the surface you used to SDL_SetVideoMode, then SDL_SetVideoMode
again.

Free the surface? AFAIK, you can’t free a video surface; that’s taken
care of automatically.

If not working :
SDL_Quit(); and SDL_Init(SDL_INIT_VIDEO) again, with the new flags for
you screen format ( SDL_FULLSCREEN, or not )

SDL_QuitSubSystem(SDL_INIT_VIDEO) and SDL_InitSubSystem(SDL_INIT_VIDEO)
might be sufficient.

Sebastian

Sometimes when changing video mode between windowed and fullscreen I get the
SDL_APPMOUSEFOCUS (gain=0) event (I’ve tested this alot and it happens now
and then (suddenly it might work as expected)). This is strange because it
seems to be sent even if my mouse is within the application window! Has
anybody experienced this before? I saw in the ChangeLog that something was
done about this issue: "1.2.7: Fixed mouse focus events after resetting
video mode on Windows " but it doesn’t work here. Perhaps this is a newly
introduced bug?

Can you reproduce this with the testwm test program in the SDL source archive?
If not, can you post a minimal test case I can use to see the problem?

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment