Support for SVGALib 2.0, thanks to Benjamin Joel Stover

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4068
This commit is contained in:
Sam Lantinga 2001-06-16 01:32:09 +00:00
parent 09e27c082f
commit 9a765af003

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)