diff options
author | Sean D'Epagnier <[email protected]> | 2006-09-24 10:57:26 +0000 |
---|---|---|
committer | Sean D'Epagnier <[email protected]> | 2006-09-24 10:57:26 +0000 |
commit | e184bd861c0b3023c5fd5596083e12aaedb2d5e2 (patch) | |
tree | b6f14a2e00b8d21e610933f55bc986d23b12805e /src/glut/fbdev/fbdev.c | |
parent | 1ad12874b30dcb2228621da1f519b846b4975fde (diff) |
corrected cursor drawing
added handling of SIGWINCH
fixed input of recieving SIGIO while handling SIGIO
corrected input code for return
uncommented normal calculation to models
Diffstat (limited to 'src/glut/fbdev/fbdev.c')
-rw-r--r-- | src/glut/fbdev/fbdev.c | 71 |
1 files changed, 58 insertions, 13 deletions
diff --git a/src/glut/fbdev/fbdev.c b/src/glut/fbdev/fbdev.c index 1c6cea0434e..ce6419816dd 100644 --- a/src/glut/fbdev/fbdev.c +++ b/src/glut/fbdev/fbdev.c @@ -103,6 +103,9 @@ void TestVisible(void) { static void Cleanup(void) { + /* do not handle this signal when cleaning up */ + signal(SIGWINCH, SIG_IGN); + if(GameMode) glutLeaveGameMode(); @@ -236,6 +239,7 @@ void glutInit (int *argcp, char **argv) signal(SIGSEGV, CrashHandler); signal(SIGINT, CrashHandler); signal(SIGTERM, CrashHandler); + signal(SIGABRT, CrashHandler); if(nomouse == 0) InitializeMouse(); @@ -271,7 +275,7 @@ void glutInit (int *argcp, char **argv) exit(0); } - /* Get the fixed screen info */ + /* get the fixed screen info */ if (ioctl(FrameBufferFD, FBIOGET_FSCREENINFO, &FixedInfo)) { sprintf(exiterror, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n", strerror(errno)); @@ -410,10 +414,10 @@ void glutInitWindowSize (int width, int height) static void ProcessTimers(void) { - if(GlutTimers && GlutTimers->time < glutGet(GLUT_ELAPSED_TIME)) { + while(GlutTimers && GlutTimers->time <= glutGet(GLUT_ELAPSED_TIME)) { struct GlutTimer *timer = GlutTimers; - timer->func(timer->value); GlutTimers = timer->next; + timer->func(timer->value); free(timer); } } @@ -669,6 +673,47 @@ void CreateVisual(void) } } +static void ResizeVisual(void) +{ + if(!glFBDevMakeCurrent( Context, Buffer, Buffer )) { + sprintf(exiterror, "Failure to Make Current\n"); + exit(0); + } + + InitializeMenus(); + + if(ReshapeFunc) + ReshapeFunc(VarInfo.xres, VarInfo.yres); + Redisplay = 1; +} + +static void SignalWinch(int arg) +{ + /* we can't change bitdepth without destroying the visual */ + int bits_per_pixel = VarInfo.bits_per_pixel; + struct fb_bitfield red = VarInfo.red, green = VarInfo.green, + blue = VarInfo.blue, transp = VarInfo.transp; + + /* get the variable screen info */ + if (ioctl(FrameBufferFD, FBIOGET_VSCREENINFO, &VarInfo)) { + sprintf(exiterror, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n", + strerror(errno)); + exit(0); + } + + /* restore bitdepth and color masks only */ + VarInfo.bits_per_pixel = bits_per_pixel; + VarInfo.red = red; + VarInfo.green = green; + VarInfo.blue = blue; + VarInfo.transp = transp; + + SetVideoMode(); + CreateBuffer(); + + ResizeVisual(); +} + int glutCreateWindow (const char *title) { if(Initialized == 0) { @@ -713,6 +758,8 @@ int glutCreateWindow (const char *title) glutSetWindowTitle(title); + signal(SIGWINCH, SignalWinch); + Visible = 1; VisibleSwitch = 1; Redisplay = 1; @@ -787,19 +834,13 @@ void glutReshapeWindow(int width, int height) if(!ParseFBModes(width, width, height, height, 0, MAX_VSYNC)) return; + signal(SIGWINCH, SIG_IGN); + SetVideoMode(); CreateBuffer(); - - if(!glFBDevMakeCurrent( Context, Buffer, Buffer )) { - sprintf(exiterror, "Failure to Make Current\n"); - exit(0); - } - InitializeMenus(); - - if(ReshapeFunc) - ReshapeFunc(VarInfo.xres, VarInfo.yres); - Redisplay = 1; + ResizeVisual(); + signal(SIGWINCH, SignalWinch); } void glutFullScreen(void) @@ -836,6 +877,9 @@ static void UnIconifyWindow(int sig) strerror(errno)); exit(0); } + + RestoreColorMap(); + Redisplay = 1; VisibleSwitch = 1; Visible = 1; @@ -848,6 +892,7 @@ void glutIconifyWindow(void) if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &OrigVarInfo)) fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n", strerror(errno)); + raise(SIGSTOP); } |