File: map.c

package info (click to toggle)
svncviewer 1:0.1.1-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 336 kB
  • ctags: 304
  • sloc: ansic: 2,608; makefile: 60; sh: 29
file content (29 lines) | stat: -rw-r--r-- 556 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#define	NUM_KEYCODES	150
#define	GLYPHS_PER_KEY	4


#include <X11/X.h>
#include <X11/keysym.h>
#include "xf86Keymap.h"

KeySym scan2x(int scan)
{
  static int shift = 0, caps = 0, numlock = 0;
  switch (scan) {
    case 0x3a: caps ^= 1; break;
    case 0x2a: case 0x36: shift = 1; break;
    case 0xaa: case 0xb6: shift = 0; break;
    case 0x45: numlock ^= 1; break;
  }
  if (numlock && scan>=0x47 && scan<=0x53) {
    return numkeys[scan-0x47];
  } else {
    return map[scan * 4 + caps * 2 + shift];
  }
}

void main()
{
printf("%d\n", scan2x(31));
}