Patch for Xinerama/Fullscreen support

Hi

I made a small patch to handle fullscreen support in Xinerama in a
better way, so that the application now starts on the first Xinerama
"screen" and not any longer above all Xinerama “screens”. I found
Xinerama suppport already in SDL (1.2.5), but it was disabled as it
simply doesn’t work correctly.

Any discussion about my patch would be appreciated. Maybe it will be
applied (in an improved form) for future releases of SDL.

Stefan

Public Key available----------------------------------------------------
Stefan Dirsch (Res. & Dev.) SuSE Linux AG
Tel: 0911-740530 Deutschherrnstr. 15-19
FAX: +49 911 741 77 55 D-90429 N?rnberg
http://www.suse.de Germany

-------------- next part --------------
diff -x requests -x Makefile.in -x Makefile -u -w -r /abuild/buildsystem.shannon.sndirsch/usr/src/packages/BUILD/SDL-1.2.5/src/video/x11/SDL_x11modes.c ./src/video/x11/SDL_x11modes.c
— /abuild/buildsystem.shannon.sndirsch/usr/src/packages/BUILD/SDL-1.2.5/src/video/x11/SDL_x11modes.c 2002-09-30 02:35:25.000000000 +0200
+++ ./src/video/x11/SDL_x11modes.c 2003-11-12 17:06:49.684088094 +0100
@@ -170,8 +170,10 @@

static void get_real_resolution(_THIS, int* w, int* h)
{

  • Bool haveXinerama = SDL_NAME(XineramaIsActive) (SDL_Display);

#ifdef XFREE86_VM

  • if ( use_vidmode ) {
  • if ( (use_vidmode) && (! haveXinerama)) {
    SDL_NAME(XF86VidModeModeLine) mode;
    int unused;

@@ -201,8 +203,16 @@
}
#endif /* XIG_XME */

  • if (! haveXinerama) {
    *w = DisplayWidth(SDL_Display, SDL_Screen);
    *h = DisplayHeight(SDL_Display, SDL_Screen);
  • } else {
  •    int screens;
    
  •    SDL_NAME(XineramaScreenInfo) *xinerama;
    
  •    xinerama = SDL_NAME(XineramaQueryScreens)(SDL_Display, &screens);
    
  •    *w = xinerama[0].width;
    
  •    *h = xinerama[0].height;
    
  • }
    }

/* Called after mapping a window - waits until the window is mapped */
@@ -610,6 +620,7 @@
int real_w, real_h;
int screen_w;
int screen_h;

  • Bool haveXinerama = SDL_NAME(XineramaIsActive) (SDL_Display);

    screen_w = DisplayWidth(SDL_Display, SDL_Screen);
    screen_h = DisplayHeight(SDL_Display, SDL_Screen);
    @@ -622,12 +633,14 @@
    set_best_resolution(this, current_w, current_h);
    move_cursor_to(this, x, y);
    get_real_resolution(this, &real_w, &real_h);

  •    if (! haveXinerama) {
       if ( current_w > real_w ) {
           real_w = MAX(real_w, screen_w);
       }
       if ( current_h > real_h ) {
           real_h = MAX(real_h, screen_h);
       }
    
  •    }
       XMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
       move_cursor_to(this, real_w/2, real_h/2);
    

@@ -673,12 +686,14 @@
screen_w = DisplayWidth(SDL_Display, SDL_Screen);
screen_h = DisplayHeight(SDL_Display, SDL_Screen);
get_real_resolution(this, &real_w, &real_h);

  • if (! (SDL_NAME(XineramaIsActive) (SDL_Display)) ) {
    if ( current_w > real_w ) {
    real_w = MAX(real_w, screen_w);
    }
    if ( current_h > real_h ) {
    real_h = MAX(real_h, screen_h);
    }
  • }
    XMoveResizeWindow(SDL_Display, FSwindow,
    xinerama_x, xinerama_y, real_w, real_h);
    XMapRaised(SDL_Display, FSwindow);

Can it not be controlled on what Xinerana “screen” it is displayed on.
Say the first by default, but the second at an option. Or is this a job
for the window manager?

I’ve not really looked at Xinerana support in SDL, as I’m developing for
single headed machines. I’m developing on a dual headed box, and it
would be useful to force my output to the second screen, and debug in
the first.

David BeanOn Thu, 2003-11-13 at 11:21, Stefan Dirsch wrote:

Hi

I made a small patch to handle fullscreen support in Xinerama in a
better way, so that the application now starts on the first Xinerama
"screen" and not any longer above all Xinerama “screens”. I found
Xinerama suppport already in SDL (1.2.5), but it was disabled as it
simply doesn’t work correctly.

Any discussion about my patch would be appreciated. Maybe it will be
applied (in an improved form) for future releases of SDL.

Stefan

Hi

I made a small patch to handle fullscreen support in Xinerama in a
better way, so that the application now starts on the first Xinerama
"screen" and not any longer above all Xinerama “screens”. I found
Xinerama suppport already in SDL (1.2.5), but it was disabled as it
simply doesn’t work correctly.

Any discussion about my patch would be appreciated. Maybe it will be
applied (in an improved form) for future releases of SDL.

Stefan

Can it not be controlled on what Xinerana “screen” it is displayed on.
Say the first by default, but the second at an option.

Should be possible. I simply didn’t implement this. Will be a bit more
diffult, I suppose.

Or is this a job for the window manager?

I don’t think so.

I’ve not really looked at Xinerana support in SDL, as I’m developing for
single headed machines. I’m developing on a dual headed box, and it
would be useful to force my output to the second screen, and debug in
the first.

I’m not sure if this makes sense, as the application usually grabs
your mouse/keyboard anyway.

Stefan

Public Key availableOn Thu, Nov 13, 2003 at 12:11:02PM +0000, David Bean wrote:

On Thu, 2003-11-13 at 11:21, Stefan Dirsch wrote:


Stefan Dirsch (Res. & Dev.) SuSE Linux AG
Tel: 0911-740530 Deutschherrnstr. 15-19
FAX: +49 911 741 77 55 D-90429 N?rnberg
http://www.suse.de Germany

snip 8<

I’ve not really looked at Xinerana support in SDL, as I’m developing for
single headed machines. I’m developing on a dual headed box, and it
would be useful to force my output to the second screen, and debug in
the first.

I’m not sure if this makes sense, as the application usually grabs
your mouse/keyboard anyway.

My debugging is usually just looking at the terminal for debug
statements where I expect them, while doing stuff in the application. I
can’t do this so well if the application is covering the terminal.

Also some keypresses are still handles by X. Control + Alt + Backspace
for one. If there is one there are probably others.

David BeanOn Thu, 2003-11-13 at 13:35, Stefan Dirsch wrote:

I’m not sure if this makes sense, as the application usually grabs
your mouse/keyboard anyway.

Lots of SDL-based games treat CTRL-G as a signal to grab/ungrab the
mouse at runtime, so windowed games can relinquish input and let you
check your mail, etc. It’s an unofficial Linux convention, most likely
compliments of Loki Games.

–ryan.

Hi

I made a small patch to handle fullscreen support in Xinerama in a
better way, so that the application now starts on the first Xinerama
"screen" and not any longer above all Xinerama “screens”. I found
Xinerama suppport already in SDL (1.2.5), but it was disabled as it
simply doesn’t work correctly.

Any discussion about my patch would be appreciated. Maybe it will be
applied (in an improved form) for future releases of SDL.

Your patch was added to bugzilla:
https://bugzilla.libsdl.org/show_bug.cgi?id=45

If some people could try it out and let us know how it works, that would
be great.

Thanks!
-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment