SDL and TwinView

Anyone who has ever used an SDL application on an X11-based GUI with nVidia TwinView (most Linux users with an nVidia video card and two monitors) has probably been bitten by this one once or twice… With nVidia TwinView, fullscreen SDL apps size themselves correctly, but center themselves across the entire desktop, rather than just one screen.

I haven’t had a chance to test this workaround, but it comes highly recommended and I’ll try it out as soon as I can find a chance to restart my X server.

  1. Find/add the TwinView MetaModes Option line in /etc/X11/xorg.conf and add an entry that has NULL as one of the values. For example, if your existing line is:
    Option "MetaModes" "1024x768, 1024x768"
    Then the new line would be:
    Option "MetaModes" "1024x768, 1024x768; 1024x768,NULL"
  2. Restart your X server
  3. When your game appears centered across both monitors, press Ctrl+Alt+Plus (the plus key) and X will switch to a video mode where one monitor is disabled. SDL will re-center the drawing window and you’ll be good to go.

UPDATE: Over 4 years later, I’ve ended up listing alternatives to letting the game play with your resolutions.

CC BY-SA 4.0 SDL and TwinView by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

1 Response to SDL and TwinView

  1. Pingback: A Brief List of Ways to Make Xinerama and Games Get Along | Stephan Sokolow's Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.

All comments are moderated. If your comment is generic enough to apply to any post, it will be assumed to be spam. Borderline comments will have their URL field erased before being approved.