diff options
author | Maxim Sobolev <sobomax@FreeBSD.org> | 2000-09-25 07:23:57 +0000 |
---|---|---|
committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2000-09-25 07:23:57 +0000 |
commit | 04b873263b3b549552ba2e3af2962cb4200a599b (patch) | |
tree | 335fa56f264fc5e146c54f6442dc97be4b28b87b /devel/sdl/files | |
parent | Clean up with USE_LINUX. (diff) |
Properly convert scancode into acsii representation in svga driver.
Notes
Notes:
svn path=/head/; revision=33087
Diffstat (limited to 'devel/sdl/files')
-rw-r--r-- | devel/sdl/files/patch-an | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/devel/sdl/files/patch-an b/devel/sdl/files/patch-an index 6cb0a945aaeb..25d170673525 100644 --- a/devel/sdl/files/patch-an +++ b/devel/sdl/files/patch-an @@ -1,15 +1,32 @@ ---- src/video/svga/SDL_svgaevents.c 2000/08/25 03:55:01 1.1 -+++ src/video/svga/SDL_svgaevents.c 2000/08/29 19:58:36 -@@ -42,8 +42,6 @@ +--- src/video/svga/SDL_svgaevents.c.orig Wed Nov 24 01:46:25 1999 ++++ src/video/svga/SDL_svgaevents.c Sun Sep 24 00:28:45 2000 +@@ -28,12 +28,14 @@ + /* Handle the event stream, converting X11 events into SDL events */ + + #include <stdio.h> ++#include <stdlib.h> + + #include <vga.h> + #include <vgamouse.h> + #include <vgakeyboard.h> + #include <linux/kd.h> + #include <linux/keyboard.h> ++#include <sys/kbio.h> + + #include "SDL.h" + #include "SDL_sysevents.h" +@@ -42,9 +44,8 @@ #include "SDL_svgaevents_c.h" /* The translation tables from a console scancode to a SDL keysym */ -#define NUM_VGAKEYMAPS (1<<KG_CAPSSHIFT) -static Uint16 vga_keymap[NUM_VGAKEYMAPS][NR_KEYS]; static SDLKey keymap[128]; ++keymap_t *vga_keymap = NULL; static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym); -@@ -54,70 +52,6 @@ + /* Ugh, we have to duplicate the kernel's keysym mapping code... +@@ -54,69 +55,10 @@ */ void SVGA_initkeymaps(int fd) { @@ -76,29 +93,35 @@ - } - } - } -- } ++ vga_keymap = malloc(sizeof(keymap_t)); ++ if (ioctl(fd, GIO_KEYMAP, vga_keymap) == -1) { ++ free(vga_keymap); ++ vga_keymap = NULL; + } } - int posted = 0; -@@ -312,38 +246,10 @@ +@@ -312,38 +254,24 @@ keysym->sym = keymap[scancode]; keysym->mod = KMOD_NONE; - /* If UNICODE is on, get the UNICODE value for the key */ keysym->unicode = 0; - if ( SDL_TranslateUNICODE ) { -- int map; -- SDLMod modstate; -- -- modstate = SDL_GetModState(); -- map = 0; -- if ( modstate & KMOD_SHIFT ) { +- if ( SDL_TranslateUNICODE ) { ++ if ( (SDL_TranslateUNICODE) && (vga_keymap != NULL) ) { + int map; + SDLMod modstate; + + modstate = SDL_GetModState(); + map = 0; + if ( modstate & KMOD_SHIFT ) { - map |= (1<<KG_SHIFT); -- } -- if ( modstate & KMOD_CTRL ) { ++ map += 1; + } + if ( modstate & KMOD_CTRL ) { - map |= (1<<KG_CTRL); -- } -- if ( modstate & KMOD_ALT ) { ++ map += 2; + } + if ( modstate & KMOD_ALT ) { - map |= (1<<KG_ALT); - } - if ( modstate & KMOD_MODE ) { @@ -115,9 +138,10 @@ - } - } else { - keysym->unicode = KVAL(vga_keymap[map][scancode]); -- } -+ /* Populate the unicode field with the ASCII value */ -+ keysym->unicode = scancode; ++ map += 4; + } ++ if ( !(vga_keymap->key[scancode].spcl & (0x80 >> map)) ) ++ keysym->unicode = vga_keymap->key[scancode].map[map]; } return(keysym); } |