[Ubuntu] SDL display numbering

Hello!

I have extended an open source console emulator (mednafen) for dual monitor support with
window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED_DISPLAY(displayNumber), SDL_WINDOWPOS_UNDEFINED, newwidth, newheight, window_flags)))

This emulator gets called from a different program (xbmc) which allows to select a display, based on xrandr. I would like to confirm with you how to set up the SDL2 display numbers.
What I basically do is to look up the choosen displays name provided by xrandr in ~/.config/monitors.xml. If it’s marked ‘primary’ I set the display number to zero, otherwise to one.
Is that a valid way how to do this? Or, to put this question in a different way, does SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) always correspond to the primary monitor?

Thanks!

Regards,
beauman