diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glut/fbdev/colormap.c | 63 | ||||
-rw-r--r-- | src/glut/fbdev/input.c | 14 |
2 files changed, 32 insertions, 45 deletions
diff --git a/src/glut/fbdev/colormap.c b/src/glut/fbdev/colormap.c index 4c013c76463..89556ef4a5c 100644 --- a/src/glut/fbdev/colormap.c +++ b/src/glut/fbdev/colormap.c @@ -97,54 +97,39 @@ void RestoreColorMap(void) void LoadColorMap(void) { - /* we're assuming 256 entries here */ - int i; - - switch(VarInfo.bits_per_pixel) { - case 8: - case 24: - case 32: - ColorMap.len = 256; - break; - case 15: - ColorMap.len = 32; - break; - case 16: - ColorMap.len = 64; - break; - } - ColorMap.start = 0; ColorMap.red = RedColorMap; ColorMap.green = GreenColorMap; ColorMap.blue = BlueColorMap; ColorMap.transp = NULL; - if (ioctl(FrameBufferFD, FBIOGETCMAP, (void *) &ColorMap) < 0) - sprintf(exiterror, "ioctl(FBIOGETCMAP) failed!\n"); - - switch(VarInfo.bits_per_pixel) { - case 15: - for(i=0; i<32; i++) - RedColorMap[i] = GreenColorMap[i] = BlueColorMap[i] = i*65535/31; - break; - case 16: - for(i=0; i<32; i++) - RedColorMap[i] = BlueColorMap[i] = i*65535/31; - for(i=0; i<64; i++) - GreenColorMap[i] = i*65535/63; - break; - case 24: - case 32: - for(i=0; i<256; i++) - RedColorMap[i] = GreenColorMap[i] = BlueColorMap[i] = i*257; - break; - } + if(DisplayMode & GLUT_INDEX) { + ColorMap.len = 256; - RestoreColorMap(); + if (ioctl(FrameBufferFD, FBIOGETCMAP, (void *) &ColorMap) < 0) + sprintf(exiterror, "ioctl(FBIOGETCMAP) failed!\n"); - if(DisplayMode & GLUT_INDEX) FillReverseColorMap(); + } else { + int rcols = 1 << VarInfo.red.length; + int gcols = 1 << VarInfo.green.length; + int bcols = 1 << VarInfo.blue.length; + + int i; + + ColorMap.len = gcols; + + for (i = 0; i < rcols ; i++) + RedColorMap[i] = (65536/(rcols-1)) * i; + + for (i = 0; i < gcols ; i++) + GreenColorMap[i] = (65536/(gcols-1)) * i; + + for (i = 0; i < bcols ; i++) + BlueColorMap[i] = (65536/(bcols-1)) * i; + + RestoreColorMap(); + } } void glutSetColor(int cell, GLfloat red, GLfloat green, GLfloat blue) diff --git a/src/glut/fbdev/input.c b/src/glut/fbdev/input.c index 791466911e1..b1362245f2f 100644 --- a/src/glut/fbdev/input.c +++ b/src/glut/fbdev/input.c @@ -138,7 +138,7 @@ static void KeyboardHandler(int sig) if(labelval == K_RIGHT) if(ioctl(ConsoleFD, VT_GETSTATE, &st) >= 0) - vt = st.v_active - 1; + vt = st.v_active + 1; if(vt != -1) { if(Swapping) @@ -224,7 +224,8 @@ static int ReadKey(void) specialkey = GLUT_KEY_INSERT; break; case 51: - code = '\b'; goto stdkey; + code = '\b'; + goto stdkey; case 91: READKEY; specialkey = GLUT_KEY_F1 + code - 65; @@ -313,8 +314,8 @@ static int ReadKey(void) if(KeyboardLedState & LED_SCR) return 0; - if(labelval >= K_F1 && labelval <= K_F12) - specialkey = GLUT_KEY_F1 + labelval - K_F1; + if(labelvalnoshift >= K_F1 && labelvalnoshift <= K_F12) + specialkey = GLUT_KEY_F1 + labelvalnoshift - K_F1; else switch(labelvalnoshift) { case K_LEFT: @@ -335,8 +336,9 @@ static int ReadKey(void) specialkey = GLUT_KEY_END; break; case K_INSERT: specialkey = GLUT_KEY_INSERT; break; - case 127: - labelval = '\b'; break; + case K_REMOVE: + labelval = '\b'; + break; case K_ENTER: case K_ENTER - 1: /* keypad enter */ labelval = '\n'; break; |