Mercurial > sdl-ios-xcode
comparison src/video/fbcon/SDL_fbevents.c @ 1241:4b2146866b82
Properly restore vidmode when switching back to SDL's virtual terminal with
the fbcon driver: Fixes Bugzilla #37.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Tue, 10 Jan 2006 20:52:35 +0000 |
parents | 718d00094f82 |
children | c9b51268668f |
comparison
equal
deleted
inserted
replaced
1240:3b8a43c428bb | 1241:4b2146866b82 |
---|---|
880 a way of notifying the application when we lose access to the | 880 a way of notifying the application when we lose access to the |
881 video hardware and when we regain it. | 881 video hardware and when we regain it. |
882 */ | 882 */ |
883 static void switch_vt(_THIS, unsigned short which) | 883 static void switch_vt(_THIS, unsigned short which) |
884 { | 884 { |
885 struct fb_var_screeninfo vinfo; | |
885 struct vt_stat vtstate; | 886 struct vt_stat vtstate; |
886 unsigned short v_active; | 887 unsigned short v_active; |
887 SDL_Surface *screen; | 888 SDL_Surface *screen; |
888 __u16 saved_pal[3*256]; | 889 __u16 saved_pal[3*256]; |
889 Uint32 screen_arealen; | 890 Uint32 screen_arealen; |
904 screen_contents = (Uint8 *)malloc(screen_arealen); | 905 screen_contents = (Uint8 *)malloc(screen_arealen); |
905 if ( screen_contents ) { | 906 if ( screen_contents ) { |
906 memcpy(screen_contents, screen->pixels, screen_arealen); | 907 memcpy(screen_contents, screen->pixels, screen_arealen); |
907 } | 908 } |
908 FB_SavePaletteTo(this, 256, saved_pal); | 909 FB_SavePaletteTo(this, 256, saved_pal); |
910 ioctl(console_fd, FBIOGET_VSCREENINFO, &vinfo); | |
909 ioctl(keyboard_fd, KDSETMODE, KD_TEXT); | 911 ioctl(keyboard_fd, KDSETMODE, KD_TEXT); |
910 | 912 |
911 /* New console, switch to it */ | 913 /* New console, switch to it */ |
912 if ( ioctl(keyboard_fd, VT_ACTIVATE, which) == 0 ) { | 914 if ( ioctl(keyboard_fd, VT_ACTIVATE, which) == 0 ) { |
913 /* Wait for our console to be activated again */ | 915 /* Wait for our console to be activated again */ |
921 } | 923 } |
922 } | 924 } |
923 | 925 |
924 /* Restore graphics mode and the contents of the screen */ | 926 /* Restore graphics mode and the contents of the screen */ |
925 ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS); | 927 ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS); |
928 ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo); | |
926 FB_RestorePaletteFrom(this, 256, saved_pal); | 929 FB_RestorePaletteFrom(this, 256, saved_pal); |
927 if ( screen_contents ) { | 930 if ( screen_contents ) { |
928 memcpy(screen->pixels, screen_contents, screen_arealen); | 931 memcpy(screen->pixels, screen_contents, screen_arealen); |
929 free(screen_contents); | 932 free(screen_contents); |
930 } | 933 } |