Support for SVGALib 2.0, thanks to Benjamin Joel Stover

This commit is contained in:
Sam Lantinga
2001-06-16 01:32:09 +00:00
parent 600011881a
commit a937a9eaf5

View File

@@ -32,6 +32,9 @@ static char rcsid =
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#if defined(linux)
#include <linux/vt.h>
@@ -77,7 +80,11 @@ static int SVGA_Available(void)
{
/* Check to see if we are root and stdin is a virtual console */
int console;
/* SVGALib 1.9.x+ doesn't require root (via /dev/svga) */
int svgalib2 = -1;
/* See if we are connected to a virtual terminal */
console = STDIN_FILENO;
if ( console >= 0 ) {
struct stat sb;
@@ -88,7 +95,14 @@ static int SVGA_Available(void)
console = -1;
}
}
return((geteuid() == 0) && (console >= 0));
/* See if SVGAlib 2.0 is available */
svgalib2 = open("/dev/svga", O_RDONLY);
if (svgalib2 != -1) {
close(svgalib2);
}
return(((svgalib2 != -1) || (geteuid() == 0)) && (console >= 0));
}
static void SVGA_DeleteDevice(SDL_VideoDevice *device)