Commit 9a765af0 authored by Sam Lantinga's avatar Sam Lantinga

Support for SVGALib 2.0, thanks to Benjamin Joel Stover

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4068
parent 09e27c08
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment