I have filed a bug report at
https://bugzilla.libsdl.org/show_bug.cgi?id=2260 but I am cross-posting
here in case someone has ever encountered this before.
Steps to reproduce:
- Grab the cursor with SDL_SetCursorGrab()
- Alt-tab away from the window
- Click on the titlebar of the window
This will cause the window to disappear underneath the taskbar!
This appears to be a general issue with ClipCursor() on windows, i.e. I am
getting the same behavior if I call ClipCursor() directly. Can anyone think
of a good workaround? I’ve tried ungrabbing the cursor on alt-tab (focus
lost) but this did not appear to help…
The following code reproduces the issue on Windows 7 SP1 and Windows 8.1.
#include “SDL.h”
#include “SDL_main.h”
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_EVERYTHING);
auto wnd = SDL_CreateWindow(
"Test",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
800,
600,
0);
SDL_SetWindowGrab(wnd, SDL_TRUE);
bool running = true;
while (running)
{
SDL_Event e;
if (SDL_PollEvent(&e))
{
switch (e.type)
{
case SDL_KEYDOWN:
case SDL_WINDOWEVENT_CLOSE:
case SDL_QUIT:
running = false;
break;
}
}
}
SDL_Quit();
return 0;
}