We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 511

Summary: Fullscreen on Twinview gives unexpected behaviour
Product: SDL Reporter: Trygve Vea <trygve.vea>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: superjoe30
Version: 1.2.11   
Hardware: x86   
OS: Linux   
Attachments: Don't touch the modelist from xvidmode if use_xinerama.

Description Trygve Vea 2007-10-29 12:07:14 UTC
All SDL applications in my Debian installation is giving unexpected behaviour in fullscreen on my Twinview configuration. Turning off Twinview removes the problem.

It can be described like this;

I have two monitors set up with TwinView. If an application goes fullscreen (dosbox, scummvm, mplayer -vo sdl, or latest and most important; Enemy Territory: Quake Wars) - the full-screen window appears on monitor no. 2 - but

* The image isn't stretched from corner to corner.
* The image is placed centered on right edge of monitor 2.

To give a better explenation of how this appears for the end-user - I have enclosed a descriptive picture on the following URL:

http://anticrap.net/sdl-fullscreen-bug.png

(To explain the image, the two black squares represent my monitors (1680x1050) - the res square represent how a 640x480 image would appear in full screen mode.)

Please, don't hesitate to contact me if you have questions regarding my configuration - or if there's any form of testing I can help you with.
Comment 1 Sam Lantinga 2007-12-29 13:44:51 UTC
I'm pretty sure it's related to the Xinerama code.  SDL probably thinks your monitors are reversed and it's trying to center between them.

You can debug into X11_EnterFullScreen(), and see what the Xinerama info is that it's using for positioning.

I can't test this configuration myself, so please let me know what you find!
Comment 2 Trygve Vea 2008-03-22 14:05:13 UTC
(In reply to comment #1)
> I'm pretty sure it's related to the Xinerama code.  SDL probably thinks your
> monitors are reversed and it's trying to center between them.
> 
> You can debug into X11_EnterFullScreen(), and see what the Xinerama info is
> that it's using for positioning.
> 
> I can't test this configuration myself, so please let me know what you find!
> 

I would, but;

I don't want to sound to incompetent here --- but could you point me in the right direction? I have a hard time finding any documentation on X11_EnterFullScreen().

Thank you.
Comment 3 Andrew Kelley 2008-07-04 21:05:52 UTC
I can confirm this bug; the exact same behavior happens on my debian TwinView setup. Are there any workarounds while this is resolved?

(In reply to comment #2)
> 
> I would, but;
> 
> I don't want to sound to incompetent here --- but could you point me in the
> right direction? I have a hard time finding any documentation on
> X11_EnterFullScreen().
> 
> Thank you.
> 

He wants you to look into the SDL code itself and figure out what SDL's fullscreen function uses to determine coordinates. 

Comment 4 Trygve Vea 2008-07-06 13:14:15 UTC
OK, so I think I figured out how to solve this.

I've done some testing on my own, and it seems that if I change this:

#if SDL_VIDEO_DRIVER_X11_VIDMODE
    /* XVidMode */
    if ( !use_xrandr &&
#if SDL_VIDEO_DRIVER_X11_XINERAMA
         (!use_xinerama || xinerama_info.screen_number == 0) &&
#endif
         CheckVidMode(this, &vm_major, &vm_minor) &&

to

#if SDL_VIDEO_DRIVER_X11_VIDMODE
    /* XVidMode */
    if ( !use_xrandr &&
#if SDL_VIDEO_DRIVER_X11_XINERAMA
         (!use_xinerama) &&
#endif
         CheckVidMode(this, &vm_major, &vm_minor) &&

... the vidmode-code stops overwriting the modelist which was just built for xinerama - and stuff are placed where it's supposed to be. I can confirm that this works very well for my positioning problem.
Comment 5 Trygve Vea 2008-07-06 14:11:27 UTC
(In reply to comment #4)
> OK, so I think I figured out how to solve this.

Here's patch

diff -ruN SDL-1.2.orig/src/video/x11/SDL_x11modes.c SDL-1.2/src/video/x11/SDL_x11modes.c
--- SDL-1.2.orig/src/video/x11/SDL_x11modes.c	2008-07-06 23:08:02.000000000 +0200
+++ SDL-1.2/src/video/x11/SDL_x11modes.c	2008-07-06 23:03:00.000000000 +0200
@@ -630,7 +630,7 @@
     /* XVidMode */
     if ( !use_xrandr &&
 #if SDL_VIDEO_DRIVER_X11_XINERAMA
-         (!use_xinerama || xinerama_info.screen_number == 0) &&
+         !use_xinerama &&
 #endif
          CheckVidMode(this, &vm_major, &vm_minor) &&
          SDL_NAME(XF86VidModeGetAllModeLines)(SDL_Display, SDL_Screen,&nmodes,&modes) )
Comment 6 Trygve Vea 2008-07-07 08:16:35 UTC
Created attachment 258 [details]
Don't touch the modelist from xvidmode if use_xinerama.

I am not aware if there is any scenarios where you would like the xvidmode to overwrite the modelist just generated for xinerama. If that is the case - my patch will probably break it.

I apoligize for my two latest posts ... I am not that familiar with using these tools - but I'm learning :)

Regards, Trygve
Comment 7 Andrew Kelley 2008-07-07 08:26:45 UTC
(In reply to comment #6)
> Created an attachment (id=258) [details]
> Don't touch the modelist from xvidmode if use_xinerama.
> 
> I am not aware if there is any scenarios where you would like the xvidmode to
> overwrite the modelist just generated for xinerama. If that is the case - my
> patch will probably break it.
> 
> I apoligize for my two latest posts ... I am not that familiar with using these
> tools - but I'm learning :)
> 
> Regards, Trygve
> 

Thanks for the updates! These are helpful.
Comment 8 Trygve Vea 2008-07-07 10:51:19 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Created an attachment (id=258) [details] [details]
> > Don't touch the modelist from xvidmode if use_xinerama.
> > 
> > I am not aware if there is any scenarios where you would like the xvidmode to
> > overwrite the modelist just generated for xinerama. If that is the case - my
> > patch will probably break it.
> > 
> > I apoligize for my two latest posts ... I am not that familiar with using these
> > tools - but I'm learning :)
> > 
> > Regards, Trygve
> > 
> 
> Thanks for the updates! These are helpful.
> 

Looking through more bugs, and found something interesting.

It seems that this is a duplicate, and someone have solved it somewhat better than I did. Check out http://bugzilla.libsdl.org/show_bug.cgi?id=562
Comment 9 Ryan C. Gordon 2009-09-13 15:38:40 UTC
Bugzilla cleanup day: marking this bug a dupe of Bug #562.

--ryan.

*** This bug has been marked as a duplicate of bug 562 ***