diff src/video/fbcon/SDL_fbevents.c @ 109:5a9c36a45db1

Fixed switching away from the SDL at the framebuffer console
author Sam Lantinga <slouken@lokigames.com>
date Sat, 14 Jul 2001 19:10:06 +0000
parents a746656b7599
children 2604a7be65af
line wrap: on
line diff
--- a/src/video/fbcon/SDL_fbevents.c	Sat Jul 14 19:08:25 2001 +0000
+++ b/src/video/fbcon/SDL_fbevents.c	Sat Jul 14 19:10:06 2001 +0000
@@ -311,7 +311,7 @@
 
 static enum {
 	MOUSE_NONE = -1,
-	MOUSE_GPM,	/* Note: GPM uses the MSC protocol */
+	MOUSE_MSC,	/* Note: GPM uses the MSC protocol */
 	MOUSE_PS2,
 	MOUSE_IMPS2,
 	MOUSE_MS,
@@ -535,7 +535,7 @@
 #ifdef DEBUG_MOUSE
 fprintf(stderr, "Using GPM mouse\n");
 #endif
-					mouse_drv = MOUSE_GPM;
+					mouse_drv = MOUSE_MSC;
 				}
 			}
 		}
@@ -642,7 +642,7 @@
 	}
 }
 
-/* For now, use GPM, PS/2, and MS protocols
+/* For now, use MSC, PS/2, and MS protocols
    Driver adapted from the SVGAlib mouse driver code (taken from gpm, etc.)
  */
 static void handle_mouse(_THIS)
@@ -663,7 +663,7 @@
 			/* Ack! */
 			read(mouse_fd, mousebuf, BUFSIZ);
 			return;
-		case MOUSE_GPM:
+		case MOUSE_MSC:
 			packetsize = 5;
 			break;
 		case MOUSE_IMPS2:
@@ -709,8 +709,8 @@
 		switch (mouse_drv) {
 			case MOUSE_NONE:
 				break;
-			case MOUSE_GPM:
-				/* GPM protocol has 0x80 in high byte */
+			case MOUSE_MSC:
+				/* MSC protocol has 0x80 in high byte */
 				if ( (mousebuf[i] & 0xF8) != 0x80 ) {
 					/* Go to next byte */
 					i -= (packetsize-1);
@@ -825,7 +825,11 @@
 	return;
 }
 
-/* Handle switching to another VC, returns when our VC is back */
+/* Handle switching to another VC, returns when our VC is back.
+   This isn't necessarily the best solution.  For SDL 1.3 we need
+   a way of notifying the application when we lose access to the
+   video hardware and when we regain it.
+ */
 static void switch_vt(_THIS, unsigned short which)
 {
 	struct vt_stat vtstate;
@@ -844,6 +848,7 @@
 
 	/* Save the contents of the screen, and go to text mode */
 	SDL_mutexP(hw_lock);
+	wait_idle(this);
 	screen = SDL_VideoSurface;
 	screen_arealen = (screen->h*screen->pitch);
 	screen_contents = (Uint8 *)malloc(screen_arealen);
@@ -908,7 +913,9 @@
 		    case SDLK_F11:
 		    case SDLK_F12:
 			if ( SDL_GetModState() & KMOD_ALT ) {
-				switch_vt(this, (keysym.sym-SDLK_F1)+1);
+				if ( pressed ) {
+					switch_vt(this, (keysym.sym-SDLK_F1)+1);
+				}
 				break;
 			}
 			/* Fall through to normal processing */