changeset 4021:cbad710a6509 SDL-1.2

Fixed bug #437 Some X servers advertise the DGA extension don't support DGA1 anymore.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 08 Jul 2007 20:38:36 +0000
parents 33d34b7ce689
children c5a6dcdaef04
files docs.html src/video/dga/SDL_dgaevents.c src/video/x11/SDL_x11dga.c
diffstat 3 files changed, 29 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/docs.html	Sun Jul 08 14:24:27 2007 +0000
+++ b/docs.html	Sun Jul 08 20:38:36 2007 +0000
@@ -62,6 +62,9 @@
 
 <BLOCKQUOTE>
 <P>
+	Fixed detection of X11 DGA mouse support.
+</P>
+<P>
 	Improved XIM support for asian character sets.
 </P>
 <P>
--- a/src/video/dga/SDL_dgaevents.c	Sun Jul 08 14:24:27 2007 +0000
+++ b/src/video/dga/SDL_dgaevents.c	Sun Jul 08 20:38:36 2007 +0000
@@ -129,9 +129,6 @@
 		posted = SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
 	    }
 	    break;
-
-	    break;
-
 	}
 	return(posted);
 }
--- a/src/video/x11/SDL_x11dga.c	Sun Jul 08 14:24:27 2007 +0000
+++ b/src/video/x11/SDL_x11dga.c	Sun Jul 08 20:38:36 2007 +0000
@@ -22,8 +22,7 @@
 #include "SDL_config.h"
 
 /* This is currently only used to enable DGA mouse.
-   The new fullscreen code makes it very difficult to handle DGA dynamically.
-   There will be a completely separate DGA driver that is fullscreen-only.
+   There is a completely separate DGA driver that is fullscreen-only.
 */
 
 #include "SDL_video.h"
@@ -36,24 +35,33 @@
 void X11_EnableDGAMouse(_THIS)
 {
 #if SDL_VIDEO_DRIVER_X11_DGAMOUSE
-    int dga_major, dga_minor;
-    int use_dgamouse;
-    const char *env_use_dgamouse;
+    static int use_dgamouse = -1;
 
     /* Check configuration to see if we should use DGA mouse */
-    use_dgamouse = 1;
-    env_use_dgamouse = SDL_getenv("SDL_VIDEO_X11_DGAMOUSE");
-    if ( env_use_dgamouse ) {
-        use_dgamouse = atoi(env_use_dgamouse);
+    if ( use_dgamouse < 0 ) {
+        int dga_major, dga_minor;
+        int dga_flags;
+        const char *env_use_dgamouse;
+
+        use_dgamouse = 1;
+        env_use_dgamouse = SDL_getenv("SDL_VIDEO_X11_DGAMOUSE");
+        if ( env_use_dgamouse ) {
+            use_dgamouse = SDL_atoi(env_use_dgamouse);
+        }
+        /* Check for buggy X servers */
+        if ( use_dgamouse && BUGGY_XFREE86(==, 4000) ) {
+            use_dgamouse = 0;
+        }
+        if ( !use_dgamouse || !local_X11 ||
+             !SDL_NAME(XF86DGAQueryExtension)(SDL_Display, &dga_event, &dga_error) ||
+             !SDL_NAME(XF86DGAQueryVersion)(SDL_Display, &dga_major, &dga_minor) ||
+             !SDL_NAME(XF86DGAQueryDirectVideo)(SDL_Display, SDL_Screen, &dga_flags) ||
+             !(dga_flags & XF86DGADirectPresent) ) {
+            use_dgamouse = 0;
+        }
     }
-    /* Check for buggy X servers */
-    if ( use_dgamouse && BUGGY_XFREE86(==, 4000) ) {
-        use_dgamouse = 0;
-    }
-    /* Only use DGA mouse if the cursor is not showing (in relative mode) */
-    if ( use_dgamouse && local_X11 && !(using_dga & DGA_MOUSE) &&
-         SDL_NAME(XF86DGAQueryExtension)(SDL_Display, &dga_event, &dga_error) &&
-         SDL_NAME(XF86DGAQueryVersion)(SDL_Display, &dga_major, &dga_minor) ) {
+
+    if ( use_dgamouse && !(using_dga & DGA_MOUSE) ) {
 	if ( SDL_NAME(XF86DGADirectVideo)(SDL_Display, SDL_Screen, XF86DGADirectMouse) ) {
             using_dga |= DGA_MOUSE;
         }
@@ -65,13 +73,8 @@
 void X11_CheckDGAMouse(_THIS)
 {
 #if SDL_VIDEO_DRIVER_X11_DGAMOUSE
-    int flags;
-
     if ( using_dga & DGA_MOUSE ) {
-        SDL_NAME(XF86DGAQueryDirectVideo)(SDL_Display, SDL_Screen, &flags);
-        if ( ! (flags & XF86DGADirectMouse) ) {
-                SDL_NAME(XF86DGADirectVideo)(SDL_Display,SDL_Screen,XF86DGADirectMouse);
-        }
+	SDL_NAME(XF86DGADirectVideo)(SDL_Display,SDL_Screen,XF86DGADirectMouse);
     }
 #endif
 }