Skip to content

Commit

Permalink
Fixed bug #437
Browse files Browse the repository at this point in the history
Some X servers advertise the DGA extension don't support DGA1 anymore.
  • Loading branch information
slouken committed Jul 8, 2007
1 parent 34900d1 commit 612e9b9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
3 changes: 3 additions & 0 deletions docs.html
Expand Up @@ -61,6 +61,9 @@ <H3> General Notes </H3>
<H3> Unix Notes </H3>

<BLOCKQUOTE>
<P>
Fixed detection of X11 DGA mouse support.
</P>
<P>
Improved XIM support for asian character sets.
</P>
Expand Down
3 changes: 0 additions & 3 deletions src/video/dga/SDL_dgaevents.c
Expand Up @@ -129,9 +129,6 @@ printf("KeyRelease (X11 keycode = 0x%X)\n", xkey.keycode);
posted = SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
}
break;

break;

}
return(posted);
}
Expand Down
49 changes: 26 additions & 23 deletions src/video/x11/SDL_x11dga.c
Expand Up @@ -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"
Expand All @@ -36,24 +35,33 @@ int dga_event, dga_error = -1;
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);
}
/* Check for buggy X servers */
if ( use_dgamouse && BUGGY_XFREE86(==, 4000) ) {
use_dgamouse = 0;
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;
}
}
/* 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;
}
Expand All @@ -65,13 +73,8 @@ void X11_EnableDGAMouse(_THIS)
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
}
Expand Down

0 comments on commit 612e9b9

Please sign in to comment.