Possible bug in SDL_WINDOWPOS_CENTERED_DISPLAY(x)

Hi.

So I was doing some experiments with my code, mainly allowing the user to select in which monitor he wants to place the game window.
But I encounter an issue.

My setup:
Windows
I have a hi-dpi laptop (macbook retina) connected to a regular monitor via HDMI.

Case A:
Laptop monitor is 0 (primary)
External Monitor is 1

I can set SDL_WINDOWPOS_CENTERED_DISPLAY with 0 or 1 and the window will be placed at the appropriate monitor, in either full screen or window mode. Works ok.

Case B:

If on OS Display Settings I switch the External monitor to primary it doesn’t work anymore

External Monitor is 0 (primary)
Laptop monitor is 1

When I set SDL_WINDOWPOS_CENTERED_DISPLAY (0) the window gets placed correctly in either fullscreen or window mode. However, once I put

SDL_WINDOWPOS_CENTERED_DISPLAY (1) to set it to second screen it doesn’t work. In fullscreen it uses monitor 0, in window mode it gets placed at the center of the 2 screens (half of the window on each monitor).

Using SDL_WINDOW_ALLOW_HIGHDPI doesn’t seem to make any difference.

I think the problem has to do with having the external monitor (non-retina) as primary and trying to set it on a secondary one (hi-dpi)
but I don’t have a regular screen laptop to see if it makes difference, but I’m assuming that’s the culprit.

Can anyone test this and see if I’m crazy or not?------------------------
@DJ_Link

www.david-amador.com

After some investigation I found out that

WIN_GetDisplayBounds in SDL_windowsmodes.c always returns 0, which leads to part of the code in
SDL_GetDisplayBounds (SDL_video.c) never running, which may well the intend way. But in any case I’m still under the impression that
there is some issue when secondary monitor is hi-dpi and primary one is not.

Code:

if (_this->GetDisplayBounds) {
if (_this->GetDisplayBounds(_this, display, rect) == 0) {
return 0; //On windows always hits here??
}
}
//And never runs this code ??
/* Assume that the displays are left to right */
if (displayIndex == 0) {
rect->x = 0;
rect->y = 0;
} else {------------------------
twitter.com/DJ_Link

www.david-amador.com
www.upfallstudios.com

Forgot to mention, but this issue is reproducible on my system using testgl2 on SDL source code.
I just have to switch on SDL_test_common.c

from
state->window_x = SDL_WINDOWPOS_UNDEFINED;
state->window_y = SDL_WINDOWPOS_UNDEFINED;

to
state->window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(1);
state->window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(1);

on line 50

and using the setup I mentioned------------------------
twitter.com/DJ_Link

www.david-amador.com
www.upfallstudios.com