Handle SDL_ACTIVEEVENT which notifies us of mouse focus change. If mouse focus is lost don't render cursor, reverting back to OS style. When focus is regained, render cursor again. Fixes #626

This was SVN commit r8789.
This commit is contained in:
historic_bruno
2010-12-05 05:17:28 +00:00
parent 819bacd538
commit 95da3789cd
3 changed files with 35 additions and 8 deletions
+12
View File
@@ -90,6 +90,18 @@ static InReaction MainInputHandler(const SDL_Event_* ev)
{
switch(ev->ev.type)
{
case SDL_ACTIVEEVENT:
if (ev->ev.active.state == SDL_APPMOUSEFOCUS)
{
// Tell renderer not to render cursor if mouse focus is lost
// this restores system cursor, until/if focus is regained
if (!ev->ev.active.gain)
RenderCursor(false);
else
RenderCursor(true);
}
break;
case SDL_QUIT:
kill_mainloop();
break;