Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Fixed bug where Xinerama was treated as being available even if it wa…
…sn't.

Also added additional logging for X11 video modes
  • Loading branch information
slouken committed Sep 27, 2012
1 parent a51ee16 commit cc4f35c274821049af9a883230c52eabf373b6ca
Showing with 37 additions and 3 deletions.
  1. +37 −3 src/video/x11/SDL_x11modes.c
@@ -204,7 +204,7 @@ X11_InitModes(_THIS)
mode.refresh_rate = 0;
mode.driverdata = NULL;

displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
displaydata = (SDL_DisplayData *) SDL_calloc(1, sizeof(*displaydata));
if (!displaydata) {
continue;
}
@@ -272,19 +272,31 @@ CheckXinerama(Display * display, int *major, int *minor)
/* Allow environment override */
env = getenv("SDL_VIDEO_X11_XINERAMA");
if (env && !SDL_atoi(env)) {
#ifdef X11MODES_DEBUG
printf("Xinerama disabled due to environment variable\n");
#endif
return SDL_FALSE;
}

if (!SDL_X11_HAVE_XINERAMA) {
#ifdef X11MODES_DEBUG
printf("Xinerama support not available\n");
#endif
return SDL_FALSE;
}

/* Query the extension version */
if (!XineramaQueryExtension(display, &event_base, &error_base) ||
!XineramaQueryVersion(display, major, minor) ||
!XineramaIsActive(display)) {
#ifdef X11MODES_DEBUG
printf("Xinerama not active on the display\n");
#endif
return SDL_FALSE;
}
#ifdef X11MODES_DEBUG
printf("Xinerama available!\n");
#endif
return SDL_TRUE;
}
#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
@@ -301,17 +313,29 @@ CheckXRandR(Display * display, int *major, int *minor)
/* Allow environment override */
env = getenv("SDL_VIDEO_X11_XRANDR");
if (env && !SDL_atoi(env)) {
#ifdef X11MODES_DEBUG
printf("XRandR disabled due to environment variable\n");
#endif
return SDL_FALSE;
}

if (!SDL_X11_HAVE_XRANDR) {
#ifdef X11MODES_DEBUG
printf("XRandR support not available\n");
#endif
return SDL_FALSE;
}

/* Query the extension version */
if (!XRRQueryVersion(display, major, minor)) {
#ifdef X11MODES_DEBUG
printf("XRandR not active on the display\n");
#endif
return SDL_FALSE;
}
#ifdef X11MODES_DEBUG
printf("XRandR available!\n");
#endif
return SDL_TRUE;
}
#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
@@ -328,19 +352,31 @@ CheckVidMode(Display * display, int *major, int *minor)
/* Allow environment override */
env = getenv("SDL_VIDEO_X11_XVIDMODE");
if (env && !SDL_atoi(env)) {
#ifdef X11MODES_DEBUG
printf("XVidMode disabled due to environment variable\n");
#endif
return SDL_FALSE;
}

if (!SDL_X11_HAVE_XVIDMODE) {
#ifdef X11MODES_DEBUG
printf("XVidMode support not available\n");
#endif
return SDL_FALSE;
}

/* Query the extension version */
vm_error = -1;
if (!XF86VidModeQueryExtension(display, &vm_event, &vm_error)
|| !XF86VidModeQueryVersion(display, major, minor)) {
#ifdef X11MODES_DEBUG
printf("XVidMode not active on the display\n");
#endif
return SDL_FALSE;
}
#ifdef X11MODES_DEBUG
printf("XVidMode available!\n");
#endif
return SDL_TRUE;
}

@@ -437,8 +473,6 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
mode.format = sdl_display->current_mode.format;
mode.driverdata = NULL;

data->use_xrandr = 0;
data->use_vidmode = 0;
screen_w = DisplayWidth(display, data->screen);
screen_h = DisplayHeight(display, data->screen);

0 comments on commit cc4f35c

Please sign in to comment.