Dominus wrote:It's a problem of SDL 1.2.
Here is to hoping that the devs switch to SDL2 soon
Indeed, 1.2 doesn't handle multiple displays without kludges; alas:
https://forums.libsdl.org/viewtopic.php?p=31144Incase the link or forum goes down, here's a copy for future-reference:
Posted: Tue Dec 20, 2011 5:18 pm by René Dudfield
On Mon, Dec 19, 2011 at 10:08 PM, Julian Mayer wrote:
hello all
first of all - thanks for SDL!
i've written a game that uses SDL for creating an OpenGL context under Windows and Linux. while everything seems to work fine on single-monitor systems, i've received a report from a linux user that the game actually spans both displays, while he only wants it displayed on the second display.
his setup: "Kubuntu 11.10 x64 with R600g video driver / Laptop Acer 7560G with external FullHD 27" display attached via HDMI. Configured via xrandr."
after some googling i've told him to try these variables:
SDL_VIDEO_FULLSCREEN_HEAD
SDL_VIDEO_X11_XINERAMA
SDL_VIDEO_X11_XINERAMA_SCREEN
SDL_VIDEO_X11_XRANDR
but he said even launching the game with SDL_VIDEO_FULLSCREEN_HEAD=1 doesn't fix the issue...any suggestions?
one issue seems to be that SDL_GetVideoInfo() returns the resolution of BOTH displays combined, i.e. [url=tel:3520%20x%201080]3520 x 1080[/url] ... shouldn't it return the resolution of the primary display?
(the rationale here is that calling SDL_SetVideoMode(info->current_w, info->current_h, 24, SDL_OPENGL | SDL_FULLSCREEN) should yield a usable fullscreen context on the main display and not some weird problem context that spans two displays)
however that can't be responsible for all problems seen here as he said even when forcing the game to a lower resolution, windowed mode and FULLSCREEN_HEAD=1 it still spans both displays.
so are there any suggestions how to make SDL work fine with a multi monitor setup on linux?
thanks, julian
btw: it seems like NONE of the environment variables listed above are documented
Hi,
One hack is to see the aspect ratio is very wide, and if so use half(or a division of a standardish aspect if they have 3 monitors) the width. Then set the position of the window based on that guess. Use the SDL_VIDEO_WINDOW_POS="x,y" environment variable to set the position (then re-init).
Otherwise, SDL 1.2 does not do multiple monitors.
Or wait for SDL 1.3 to be released ; Because that supports multi-monitors on some platforms.
cu!