SDL_GetDisplayMode() on multi-monitor only reports for one screen

I am seeing weird behaviour for ‘SDL_GetDisplayMode()’ on my multi-monitor
setup, it only seems to be reporting for one of the outputs.

My (unusual) system is triple monitor on 2 outputs of GFX; DVI into one
monitor, and a Matrox DualHead2Go spliting VGA onto other two monitors.

As a side effect of this (I believe) when I switch to full screen it is
just on one monitor.

Ideally I want my application to be able to display fullscreen, across all
monitors. How can I achieve this?

Small test app attached…–
simon at bigbox:~$ gcc -o sdl_test sdl_test.c sdl2-config --cflags --libs
simon at bigbox:~$ ./sdl_test
INFO: Number of displays: 1
INFO: Display 0 (3840x1024)
INFO: Number of display modes: 15
INFO: 1280x1024 60 Hz
INFO: 1152x864 75 Hz
INFO: 1024x768 75 Hz
INFO: 1024x768 70 Hz
INFO: 1024x768 60 Hz
INFO: 832x624 74 Hz
INFO: 800x600 75 Hz
INFO: 800x600 72 Hz
INFO: 800x600 60 Hz
INFO: 800x600 56 Hz
INFO: 720x400 70 Hz
INFO: 640x480 75 Hz
INFO: 640x480 72 Hz
INFO: 640x480 66 Hz
INFO: 640x480 60 Hz

Note ‘SDL_GetDisplayBounds()’ reports the full size of the desktop.

Cheers,
Simon
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl_test.c
Type: text/x-csrc
Size: 1496 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130924/e6c5c958/attachment.c
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: xrandr.txt
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130924/e6c5c958/attachment.txt

I had a similar issue about a year ago and solved it using borderless
windows positioned on each display and sized using SDL_GetDisplayBounds.
Worked on Linux anyway.On 24 Sep 2013 22:35, wrote:

I am seeing weird behaviour for ‘SDL_GetDisplayMode()’ on my multi-monitor
setup, it only seems to be reporting for one of the outputs.

My (unusual) system is triple monitor on 2 outputs of GFX; DVI into one
monitor, and a Matrox DualHead2Go spliting VGA onto other two monitors.

As a side effect of this (I believe) when I switch to full screen it is
just on one monitor.

Ideally I want my application to be able to display fullscreen, across all
monitors. How can I achieve this?

Small test app attached…

simon at bigbox:~$ gcc -o sdl_test sdl_test.c sdl2-config --cflags --libs
simon at bigbox:~$ ./sdl_test
INFO: Number of displays: 1
INFO: Display 0 (3840x1024)
INFO: Number of display modes: 15
INFO: 1280x1024 60 Hz
INFO: 1152x864 75 Hz
INFO: 1024x768 75 Hz
INFO: 1024x768 70 Hz
INFO: 1024x768 60 Hz
INFO: 832x624 74 Hz
INFO: 800x600 75 Hz
INFO: 800x600 72 Hz
INFO: 800x600 60 Hz
INFO: 800x600 56 Hz
INFO: 720x400 70 Hz
INFO: 640x480 75 Hz
INFO: 640x480 72 Hz
INFO: 640x480 66 Hz
INFO: 640x480 60 Hz

Note ‘SDL_GetDisplayBounds()’ reports the full size of the desktop.

Cheers,
Simon


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ideally I want my application to be able to display fullscreen, across all
monitors. How can I achieve this?

BTW my system is Xubuntu 13.04, with Nouvuea drivers on 8400GS.

I managed a work around for full screen which works for me. Automatically
uses either the whole of the desktop, or goes fullscreen on one monitor
depending on the width/height given.–
if (bFullScreen) {
SDL_Rect bounds;

                /* Work around SDL2 bug */
                if (SDL_GetDisplayBounds(0, &bounds) == 0) {
                        if (bounds.w == nWinWidth && bounds.h == nWinHeight)
                                SDL_SetWindowFullscreen(GfuiWindow,

SDL_WINDOW_FULLSCREEN_DESKTOP);
else SDL_SetWindowFullscreen(GfuiWindow,
SDL_WINDOW_FULLSCREEN);
} else SDL_SetWindowFullscreen(GfuiWindow,
SDL_WINDOW_FULLSCREEN);
}

However the weird reporting continues; a co-developer on Windows sent in
the following log, which show bounds being limited to each screen rather
than the combined amount.

INFO: Number of displays: 2
INFO: Display 0 (1680x1050)
INFO: Number of display modes: 76
INFO: 1680x1050 60 Hz
INFO: 1680x1050 60 Hz
INFO: 1600x900 60 Hz

INFO: Display 1 (1920x1080)
INFO: Number of display modes: 116
INFO: 1920x1080 60 Hz
INFO: 1920x1080 59 Hz

Cheers,
Simon

2013/9/24

I am seeing weird behaviour for ‘SDL_GetDisplayMode()’ on my multi-monitor
setup, it only seems to be reporting for one of the outputs.

My (unusual) system is triple monitor on 2 outputs of GFX; DVI into one
monitor, and a Matrox DualHead2Go spliting VGA onto other two monitors.

As a side effect of this (I believe) when I switch to full screen it is
just on one monitor.

Ideally I want my application to be able to display fullscreen, across all
monitors. How can I achieve this?

Small test app attached…

simon at bigbox:~$ gcc -o sdl_test sdl_test.c sdl2-config --cflags --libs
simon at bigbox:~$ ./sdl_test
INFO: Number of displays: 1
INFO: Display 0 (3840x1024)
INFO: Number of display modes: 15
INFO: 1280x1024 60 Hz
INFO: 1152x864 75 Hz
INFO: 1024x768 75 Hz
INFO: 1024x768 70 Hz
INFO: 1024x768 60 Hz
INFO: 832x624 74 Hz
INFO: 800x600 75 Hz
INFO: 800x600 72 Hz
INFO: 800x600 60 Hz
INFO: 800x600 56 Hz
INFO: 720x400 70 Hz
INFO: 640x480 75 Hz
INFO: 640x480 72 Hz
INFO: 640x480 66 Hz
INFO: 640x480 60 Hz

Note ‘SDL_GetDisplayBounds()’ reports the full size of the desktop.

This may be a bug, what Linux system are you using? Did you compile SDL
yourself? Do you have Xrandr and Xinerama support enabled?

From your Xrandr output, SDL should be seeing 2 displays.

Regarding your question of having the app span all monitors, this can not
be done currently. Search the forums, there’s been a discussion about what
needs to be done (not only in SDL) for this to be possible.

This is the output of your test in my Ubuntu 13.04, nVidia binaries system:

INFO: Number of displays: 2
INFO: Display 0 (2560x1440)
INFO: Number of display modes: 1
INFO: 2560x1440 59 Hz
INFO: Display 1 (1920x1080)
INFO: Number of display modes: 19
INFO: 1920x1080 60 Hz
INFO: 1680x1050 59 Hz
INFO: 1440x900 74 Hz
INFO: 1440x900 59 Hz
INFO: 1280x1024 75 Hz
INFO: 1280x1024 60 Hz
INFO: 1280x960 60 Hz
INFO: 1280x800 59 Hz
INFO: 1152x864 75 Hz
INFO: 1024x768 75 Hz
INFO: 1024x768 70 Hz
INFO: 1024x768 60 Hz
INFO: 800x600 75 Hz
INFO: 800x600 72 Hz
INFO: 800x600 60 Hz
INFO: 800x600 56 Hz
INFO: 640x480 75 Hz
INFO: 640x480 72 Hz
INFO: 640x480 59 Hz

(Matches Xrandr)

BTW my system is Xubuntu 13.04, with Nouvuea drivers on 8400GS.

I was getting ready to blame this on Nouveau but this also occurs on my
Dell laptop (with Intel GFX), on Xubuntu 13.10 64bit…

SDL2 self built with ’ $ ./configure --prefix=/usr --exec-prefix=/usr’
(xrandr and xinemera are on by default).

With just inbuilt LCD result looks fine–
xubuntu at xubuntu:~$ ./sdl_test
INFO: Number of displays: 1
INFO: Display 0 (1440x900)
INFO: Number of display modes: 8
INFO: 1440x900 59 Hz
INFO: 1440x900 40 Hz
INFO: 1360x768 59 Hz
INFO: 1152x864 59 Hz
INFO: 1024x768 60 Hz
INFO: 800x600 60 Hz
INFO: 800x600 56 Hz
INFO: 640x480 59 Hz

However if I ‘plus’ monitor on VGA I get the same behaviour as my other
system, namely incorrect number of displays listed and weird bounds
behaviour.

xubuntu at xubuntu:~$ ./sdl_test
INFO: Number of displays: 1
INFO: Display 0 (2384x768) <-------- note larger 'bounds’
INFO: Number of display modes: 8
INFO: 1440x900 59 Hz
INFO: 1440x900 40 Hz
INFO: 1360x768 59 Hz
INFO: 1152x864 59 Hz
INFO: 1024x768 60 Hz
INFO: 800x600 60 Hz
INFO: 800x600 56 Hz
INFO: 640x480 59 Hz

Additional screen was configured to be active with

$ xrandr --output eDP1 --mode 1360x768
$ xrandr --output VGA1 --mode 1024x768
$ xrandr --output eDP1 --primary
$ xrandr --output VGA1 --left-of eDP1

Cheers,
Simon
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl_test.c
Type: text/x-csrc
Size: 1496 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130926/418b9171/attachment-0001.c
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: xrandr_dell.txt
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130926/418b9171/attachment-0002.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed…
Name: xrandr_dell_plus.txt
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130926/418b9171/attachment-0003.txt