mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 03:06:29 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user