1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-29 01:13:08 +00:00

Properly convert scancode into acsii representation in svga driver.

This commit is contained in:
Maxim Sobolev 2000-09-25 07:23:57 +00:00
parent 83b42f5540
commit 04b873263b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=33087
6 changed files with 94 additions and 42 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= sdl-devel
PORTVERSION= 1.1.4
PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://www.libsdl.org/release/ \
http://www.devolution.com/~slouken/SDL/release/

View File

@ -7,6 +7,7 @@
PORTNAME= sdl
PORTVERSION= 1.0.8
PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://www.libsdl.org/release/ \
http://www.devolution.com/~slouken/SDL/release/

View File

@ -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);
}

View File

@ -7,6 +7,7 @@
PORTNAME= sdl
PORTVERSION= 1.0.8
PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://www.libsdl.org/release/ \
http://www.devolution.com/~slouken/SDL/release/

View File

@ -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);
}

View File

@ -7,6 +7,7 @@
PORTNAME= sdl-devel
PORTVERSION= 1.1.4
PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://www.libsdl.org/release/ \
http://www.devolution.com/~slouken/SDL/release/