comparison src/video/fbcon/SDL_fbevents.c @ 1022:3d4f1930ed02

*** empty log message ***
author Sam Lantinga <slouken@libsdl.org>
date Tue, 04 Jan 2005 19:04:14 +0000
parents b8d311d90021
children 718d00094f82
comparison
equal deleted inserted replaced
1021:ddd058103e28 1022:3d4f1930ed02
833 video hardware and when we regain it. 833 video hardware and when we regain it.
834 */ 834 */
835 static void switch_vt(_THIS, unsigned short which) 835 static void switch_vt(_THIS, unsigned short which)
836 { 836 {
837 struct vt_stat vtstate; 837 struct vt_stat vtstate;
838 unsigned short current; 838 unsigned short v_active;
839 SDL_Surface *screen; 839 SDL_Surface *screen;
840 __u16 saved_pal[3*256]; 840 __u16 saved_pal[3*256];
841 Uint32 screen_arealen; 841 Uint32 screen_arealen;
842 Uint8 *screen_contents; 842 Uint8 *screen_contents;
843 843
844 /* Figure out whether or not we're switching to a new console */ 844 /* Figure out whether or not we're switching to a new console */
845 if ( (ioctl(keyboard_fd, VT_GETSTATE, &vtstate) < 0) || 845 if ( (ioctl(keyboard_fd, VT_GETSTATE, &vtstate) < 0) ||
846 (which == vtstate.v_active) ) { 846 (which == vtstate.v_active) ) {
847 return; 847 return;
848 } 848 }
849 current = vtstate.v_active; 849 v_active = vtstate.v_active;
850 850
851 /* Save the contents of the screen, and go to text mode */ 851 /* Save the contents of the screen, and go to text mode */
852 SDL_mutexP(hw_lock); 852 SDL_mutexP(hw_lock);
853 wait_idle(this); 853 wait_idle(this);
854 screen = SDL_VideoSurface; 854 screen = SDL_VideoSurface;
862 862
863 /* New console, switch to it */ 863 /* New console, switch to it */
864 if ( ioctl(keyboard_fd, VT_ACTIVATE, which) == 0 ) { 864 if ( ioctl(keyboard_fd, VT_ACTIVATE, which) == 0 ) {
865 /* Wait for our console to be activated again */ 865 /* Wait for our console to be activated again */
866 ioctl(keyboard_fd, VT_WAITACTIVE, which); 866 ioctl(keyboard_fd, VT_WAITACTIVE, which);
867 while ( ioctl(keyboard_fd, VT_WAITACTIVE, current) < 0 ) { 867 while ( ioctl(keyboard_fd, VT_WAITACTIVE, v_active) < 0 ) {
868 if ( (errno != EINTR) && (errno != EAGAIN) ) { 868 if ( (errno != EINTR) && (errno != EAGAIN) ) {
869 /* Unknown VT error - cancel this */ 869 /* Unknown VT error - cancel this */
870 break; 870 break;
871 } 871 }
872 SDL_Delay(500); 872 SDL_Delay(500);