restore activates the window (SW_RESTORE), so restoring before keys made the window already in front: the window that was in front before was not brought back, and the game / full-screen check came after the window had moved. Keys now note the window in front and check for a game first, then restore inside the moment in front. A minimised window never takes keys behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>