[PATCH] Single screen fullscreen mode with Xinerama enabled


I noticed that on my two-monitor setup setting
SDL_VIDEO_FULLSCREEN_DISPLAY=0 actually pushes the fullscreen window to
the right, outside my primary monitor, making it half invisible. My
primary monitor is on the right side of my secondary monitor, which
probably accentuates the problem. If the primary monitor was on the
left, I imagine I would just always get fullscreen modes appearing on
both screens regardless of what I set SDL_VIDEO_FULLSCREEN_DISPLAY to.

What I found was that in SDL_x11modes.c the function get_real_resolution
would return the resolution it got from XRandr instead of the one from
Xinerama because that’s just the order in which they’re checked. As a
fix, I’ve swapped their places. I’m not sure if that’s the right
solution, but it fixes the problem I was having.

I think even with this fix, X11_EnterFullScreen will still set the mode
wrong because it uses DisplayWidth and DisplayHeight from Xlib to check
the resolution in addition to get_real_resolution and uses the larger
one, but it calls X11_ResizeFullScreen, which fixes the resolution. By
the way, I don’t quite understand why there’s such an overlap between
what X11_EnterFullScreen and X11_ResizeFullScreen do when the former
always calls the latter.

I’ve attached the patch that prioritises Xinerama over Xrandr in
Pekka Kujansuu
-------------- next part --------------
A non-text attachment was scrubbed…
Name: SDL_x11modes_xinerama_fix.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100214/b7a14667/attachment.bin