SDL_WINDOW_FULLSCREEN and multiple monitors (Bug?)

Compiled version: 2.0.9
Linked version: 2.0.9

Hello, I’m trying to see if can get SDL2 to go fullscreen with a video mode change (SDL_WINDOW_FULLSCREEN) on other monitors than that of my primary monitor.

However, when I call SDL_SetWindowFullscreen after moving the window to another monitor, it will seemingly set it’s size, video mode, and position correctly but then will move the window back to the primary monitor, while keeping the video mode of the desired monitor, making both monitors have the same video mode while showing the window on the wrong monitor.

I’ve made a test app solely for the purpose of figuring this out, found at my github, using ImGui and imgui_sdl.

Running with the debug build of SDL2, I verified that SDL_SetWindowFullscreen works (if I first set it to windowed mode and set the position and size to that of another monitor) but when ImGuiSDL::Render(ImGui::GetDrawData()); is called, it switches the window back to the primary monitor. Internally, ImGuiSDL uses SDL_RenderFillRect, here’s a pseudo stack trace from there:

  1. SDL_RenderFillRect
  2. D3D_ActivateRenderer
  3. D3D_Reset
  4. IDirect3DDevice9_Reset :arrow_left: Window moves back to primary monitor here at render\direct3d\SDL_render_d3d.c:355

Even though I’m using ImGui, I don’t think it’s a problem with their side of things, since another app I’m trying to figure this out for simply uses the system window handle from SDL2 to initialize directx and runs into exactly the same problem.

Any thoughts as to why this might happen?

1 Like