Fixed bug #437 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Jul 2007 20:38:36 +0000
branchSDL-1.2
changeset 4021cbad710a6509
parent 4020 33d34b7ce689
child 4022 c5a6dcdaef04
Fixed bug #437

Some X servers advertise the DGA extension don't support DGA1 anymore.
docs.html
src/video/dga/SDL_dgaevents.c
src/video/x11/SDL_x11dga.c
     1.1 --- a/docs.html	Sun Jul 08 14:24:27 2007 +0000
     1.2 +++ b/docs.html	Sun Jul 08 20:38:36 2007 +0000
     1.3 @@ -62,6 +62,9 @@
     1.4  
     1.5  <BLOCKQUOTE>
     1.6  <P>
     1.7 +	Fixed detection of X11 DGA mouse support.
     1.8 +</P>
     1.9 +<P>
    1.10  	Improved XIM support for asian character sets.
    1.11  </P>
    1.12  <P>
     2.1 --- a/src/video/dga/SDL_dgaevents.c	Sun Jul 08 14:24:27 2007 +0000
     2.2 +++ b/src/video/dga/SDL_dgaevents.c	Sun Jul 08 20:38:36 2007 +0000
     2.3 @@ -129,9 +129,6 @@
     2.4  		posted = SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
     2.5  	    }
     2.6  	    break;
     2.7 -
     2.8 -	    break;
     2.9 -
    2.10  	}
    2.11  	return(posted);
    2.12  }
     3.1 --- a/src/video/x11/SDL_x11dga.c	Sun Jul 08 14:24:27 2007 +0000
     3.2 +++ b/src/video/x11/SDL_x11dga.c	Sun Jul 08 20:38:36 2007 +0000
     3.3 @@ -22,8 +22,7 @@
     3.4  #include "SDL_config.h"
     3.5  
     3.6  /* This is currently only used to enable DGA mouse.
     3.7 -   The new fullscreen code makes it very difficult to handle DGA dynamically.
     3.8 -   There will be a completely separate DGA driver that is fullscreen-only.
     3.9 +   There is a completely separate DGA driver that is fullscreen-only.
    3.10  */
    3.11  
    3.12  #include "SDL_video.h"
    3.13 @@ -36,24 +35,33 @@
    3.14  void X11_EnableDGAMouse(_THIS)
    3.15  {
    3.16  #if SDL_VIDEO_DRIVER_X11_DGAMOUSE
    3.17 -    int dga_major, dga_minor;
    3.18 -    int use_dgamouse;
    3.19 -    const char *env_use_dgamouse;
    3.20 +    static int use_dgamouse = -1;
    3.21  
    3.22      /* Check configuration to see if we should use DGA mouse */
    3.23 -    use_dgamouse = 1;
    3.24 -    env_use_dgamouse = SDL_getenv("SDL_VIDEO_X11_DGAMOUSE");
    3.25 -    if ( env_use_dgamouse ) {
    3.26 -        use_dgamouse = atoi(env_use_dgamouse);
    3.27 +    if ( use_dgamouse < 0 ) {
    3.28 +        int dga_major, dga_minor;
    3.29 +        int dga_flags;
    3.30 +        const char *env_use_dgamouse;
    3.31 +
    3.32 +        use_dgamouse = 1;
    3.33 +        env_use_dgamouse = SDL_getenv("SDL_VIDEO_X11_DGAMOUSE");
    3.34 +        if ( env_use_dgamouse ) {
    3.35 +            use_dgamouse = SDL_atoi(env_use_dgamouse);
    3.36 +        }
    3.37 +        /* Check for buggy X servers */
    3.38 +        if ( use_dgamouse && BUGGY_XFREE86(==, 4000) ) {
    3.39 +            use_dgamouse = 0;
    3.40 +        }
    3.41 +        if ( !use_dgamouse || !local_X11 ||
    3.42 +             !SDL_NAME(XF86DGAQueryExtension)(SDL_Display, &dga_event, &dga_error) ||
    3.43 +             !SDL_NAME(XF86DGAQueryVersion)(SDL_Display, &dga_major, &dga_minor) ||
    3.44 +             !SDL_NAME(XF86DGAQueryDirectVideo)(SDL_Display, SDL_Screen, &dga_flags) ||
    3.45 +             !(dga_flags & XF86DGADirectPresent) ) {
    3.46 +            use_dgamouse = 0;
    3.47 +        }
    3.48      }
    3.49 -    /* Check for buggy X servers */
    3.50 -    if ( use_dgamouse && BUGGY_XFREE86(==, 4000) ) {
    3.51 -        use_dgamouse = 0;
    3.52 -    }
    3.53 -    /* Only use DGA mouse if the cursor is not showing (in relative mode) */
    3.54 -    if ( use_dgamouse && local_X11 && !(using_dga & DGA_MOUSE) &&
    3.55 -         SDL_NAME(XF86DGAQueryExtension)(SDL_Display, &dga_event, &dga_error) &&
    3.56 -         SDL_NAME(XF86DGAQueryVersion)(SDL_Display, &dga_major, &dga_minor) ) {
    3.57 +
    3.58 +    if ( use_dgamouse && !(using_dga & DGA_MOUSE) ) {
    3.59  	if ( SDL_NAME(XF86DGADirectVideo)(SDL_Display, SDL_Screen, XF86DGADirectMouse) ) {
    3.60              using_dga |= DGA_MOUSE;
    3.61          }
    3.62 @@ -65,13 +73,8 @@
    3.63  void X11_CheckDGAMouse(_THIS)
    3.64  {
    3.65  #if SDL_VIDEO_DRIVER_X11_DGAMOUSE
    3.66 -    int flags;
    3.67 -
    3.68      if ( using_dga & DGA_MOUSE ) {
    3.69 -        SDL_NAME(XF86DGAQueryDirectVideo)(SDL_Display, SDL_Screen, &flags);
    3.70 -        if ( ! (flags & XF86DGADirectMouse) ) {
    3.71 -                SDL_NAME(XF86DGADirectVideo)(SDL_Display,SDL_Screen,XF86DGADirectMouse);
    3.72 -        }
    3.73 +	SDL_NAME(XF86DGADirectVideo)(SDL_Display,SDL_Screen,XF86DGADirectMouse);
    3.74      }
    3.75  #endif
    3.76  }