changeset 67:3647c809813d

Support for SVGALib 2.0, thanks to Benjamin Joel Stover
author Sam Lantinga <slouken@lokigames.com>
date Sat, 16 Jun 2001 01:32:09 +0000
parents 7c26b77e610d
children ac6645260d31
files src/video/svga/SDL_svgavideo.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/svga/SDL_svgavideo.c	Sat Jun 16 01:03:49 2001 +0000
+++ b/src/video/svga/SDL_svgavideo.c	Sat Jun 16 01:32:09 2001 +0000
@@ -32,6 +32,9 @@
 #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 @@
 {
 	/* 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 @@
 			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)