179a8a9c6Smrg/*
279a8a9c6Smrg * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
379a8a9c6Smrg *
479a8a9c6Smrg * Permission to use, copy, modify, distribute, and sell this software and its
579a8a9c6Smrg * documentation for any purpose is hereby granted without fee, provided that
679a8a9c6Smrg * the above copyright notice appear in all copies and that both that
779a8a9c6Smrg * copyright notice and this permission notice appear in supporting
879a8a9c6Smrg * documentation, and that the name of Thomas Roell not be used in
979a8a9c6Smrg * advertising or publicity pertaining to distribution of the software without
1079a8a9c6Smrg * specific, written prior permission.  Thomas Roell makes no representations
1179a8a9c6Smrg * about the suitability of this software for any purpose.  It is provided
1279a8a9c6Smrg * "as is" without express or implied warranty.
1379a8a9c6Smrg *
1479a8a9c6Smrg * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1579a8a9c6Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1679a8a9c6Smrg * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1779a8a9c6Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1879a8a9c6Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1979a8a9c6Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2079a8a9c6Smrg * PERFORMANCE OF THIS SOFTWARE.
2179a8a9c6Smrg *
2279a8a9c6Smrg */
2379a8a9c6Smrg/*
2479a8a9c6Smrg * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
2579a8a9c6Smrg *
2679a8a9c6Smrg * Permission is hereby granted, free of charge, to any person obtaining a
2779a8a9c6Smrg * copy of this software and associated documentation files (the "Software"),
2879a8a9c6Smrg * to deal in the Software without restriction, including without limitation
2979a8a9c6Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
3079a8a9c6Smrg * and/or sell copies of the Software, and to permit persons to whom the
3179a8a9c6Smrg * Software is furnished to do so, subject to the following conditions:
3279a8a9c6Smrg *
3379a8a9c6Smrg * The above copyright notice and this permission notice shall be included in
3479a8a9c6Smrg * all copies or substantial portions of the Software.
3579a8a9c6Smrg *
3679a8a9c6Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3779a8a9c6Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3879a8a9c6Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
3979a8a9c6Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
4079a8a9c6Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
4179a8a9c6Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4279a8a9c6Smrg * OTHER DEALINGS IN THE SOFTWARE.
4379a8a9c6Smrg *
4479a8a9c6Smrg * Except as contained in this notice, the name of the copyright holder(s)
4579a8a9c6Smrg * and author(s) shall not be used in advertising or otherwise to promote
4679a8a9c6Smrg * the sale, use or other dealings in this Software without prior written
4779a8a9c6Smrg * authorization from the copyright holder(s) and author(s).
4879a8a9c6Smrg */
4979a8a9c6Smrg
5079a8a9c6Smrg#ifndef _ATKEYNAMES_H
5179a8a9c6Smrg#define _ATKEYNAMES_H
5279a8a9c6Smrg
5379a8a9c6Smrg#define XK_TECHNICAL
5479a8a9c6Smrg#define	XK_KATAKANA
5579a8a9c6Smrg#include <X11/keysym.h>
5679a8a9c6Smrg#include <X11/XF86keysym.h>
5779a8a9c6Smrg
5879a8a9c6Smrg#define GLYPHS_PER_KEY	4
5979a8a9c6Smrg#define NUM_KEYCODES	248
6079a8a9c6Smrg#define MIN_KEYCODE     8
6179a8a9c6Smrg#define MAX_KEYCODE     (NUM_KEYCODES + MIN_KEYCODE - 1)
6279a8a9c6Smrg
6379a8a9c6Smrg#define AltMask		Mod1Mask
6479a8a9c6Smrg#define NumLockMask	Mod2Mask
6579a8a9c6Smrg#define AltLangMask	Mod3Mask
6679a8a9c6Smrg#define KanaMask	Mod4Mask
6779a8a9c6Smrg#define ScrollLockMask	Mod5Mask
6879a8a9c6Smrg
6979a8a9c6Smrg#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
7079a8a9c6Smrg#define ModifierDown(k) ((keyc->state & (k)) == (k))
7179a8a9c6Smrg
7279a8a9c6Smrg/*
7379a8a9c6Smrg * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
7479a8a9c6Smrg *       sets of scancodes. Set3 can only be generated by a MF keyboard.
7579a8a9c6Smrg *       Set2 sends a makecode for keypress, and the same code prefixed by a
7679a8a9c6Smrg *       F0 for keyrelease. This is a little bit ugly to handle. Thus we use
7779a8a9c6Smrg *       here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
788d623946Smrg *       Bit 7 is set if the key is released. The code E0 switches to a
7979a8a9c6Smrg *       different meaning to add the new MF cursorkeys, while not breaking old
8079a8a9c6Smrg *       applications. E1 is another special prefix. Since I assume that there
8179a8a9c6Smrg *       will be further versions of PC/XT scancode compatible keyboards, we
8279a8a9c6Smrg *       may be in trouble one day.
8379a8a9c6Smrg *
8479a8a9c6Smrg * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
8579a8a9c6Smrg *       2) Use the keyboards native set and translate it to common keysyms.
8679a8a9c6Smrg */
8779a8a9c6Smrg
8879a8a9c6Smrg/*
8979a8a9c6Smrg * definition of the AT84/MF101/MF102 Keyboard:
9079a8a9c6Smrg * ============================================================
9179a8a9c6Smrg *       Defined             Key Cap Glyphs       Pressed value
9279a8a9c6Smrg *      Key Name            Main       Also       (hex)    (dec)
9379a8a9c6Smrg *      ----------------   ---------- -------    ------    ------
9479a8a9c6Smrg */
9579a8a9c6Smrg
9679a8a9c6Smrg#define KEY_Escape       /* Escape                0x01  */    1
9779a8a9c6Smrg#define KEY_1            /* 1           !         0x02  */    2
9879a8a9c6Smrg#define KEY_2            /* 2           @         0x03  */    3
9979a8a9c6Smrg#define KEY_3            /* 3           #         0x04  */    4
10079a8a9c6Smrg#define KEY_4            /* 4           $         0x05  */    5
10179a8a9c6Smrg#define KEY_5            /* 5           %         0x06  */    6
10279a8a9c6Smrg#define KEY_6            /* 6           ^         0x07  */    7
10379a8a9c6Smrg#define KEY_7            /* 7           &         0x08  */    8
10479a8a9c6Smrg#define KEY_8            /* 8           *         0x09  */    9
10579a8a9c6Smrg#define KEY_9            /* 9           (         0x0a  */   10
10679a8a9c6Smrg#define KEY_0            /* 0           )         0x0b  */   11
10779a8a9c6Smrg#define KEY_Minus        /* - (Minus)   _ (Under) 0x0c  */   12
10879a8a9c6Smrg#define KEY_Equal        /* = (Equal)   +         0x0d  */   13
10979a8a9c6Smrg#define KEY_BackSpace    /* Back Space            0x0e  */   14
11079a8a9c6Smrg#define KEY_Tab          /* Tab                   0x0f  */   15
11179a8a9c6Smrg#define KEY_Q            /* Q                     0x10  */   16
11279a8a9c6Smrg#define KEY_W            /* W                     0x11  */   17
11379a8a9c6Smrg#define KEY_E            /* E                     0x12  */   18
11479a8a9c6Smrg#define KEY_R            /* R                     0x13  */   19
11579a8a9c6Smrg#define KEY_T            /* T                     0x14  */   20
11679a8a9c6Smrg#define KEY_Y            /* Y                     0x15  */   21
11779a8a9c6Smrg#define KEY_U            /* U                     0x16  */   22
11879a8a9c6Smrg#define KEY_I            /* I                     0x17  */   23
11979a8a9c6Smrg#define KEY_O            /* O                     0x18  */   24
12079a8a9c6Smrg#define KEY_P            /* P                     0x19  */   25
12179a8a9c6Smrg#define KEY_LBrace       /* [           {         0x1a  */   26
12279a8a9c6Smrg#define KEY_RBrace       /* ]           }         0x1b  */   27
12379a8a9c6Smrg#define KEY_Enter        /* Enter                 0x1c  */   28
12479a8a9c6Smrg#define KEY_LCtrl        /* Ctrl(left)            0x1d  */   29
12579a8a9c6Smrg#define KEY_A            /* A                     0x1e  */   30
12679a8a9c6Smrg#define KEY_S            /* S                     0x1f  */   31
12779a8a9c6Smrg#define KEY_D            /* D                     0x20  */   32
12879a8a9c6Smrg#define KEY_F            /* F                     0x21  */   33
12979a8a9c6Smrg#define KEY_G            /* G                     0x22  */   34
13079a8a9c6Smrg#define KEY_H            /* H                     0x23  */   35
13179a8a9c6Smrg#define KEY_J            /* J                     0x24  */   36
13279a8a9c6Smrg#define KEY_K            /* K                     0x25  */   37
13379a8a9c6Smrg#define KEY_L            /* L                     0x26  */   38
13479a8a9c6Smrg#define KEY_SemiColon    /* ;(SemiColon) :(Colon) 0x27  */   39
13579a8a9c6Smrg#define KEY_Quote        /* ' (Apostr)  " (Quote) 0x28  */   40
13679a8a9c6Smrg#define KEY_Tilde        /* ` (Accent)  ~ (Tilde) 0x29  */   41
13779a8a9c6Smrg#define KEY_ShiftL       /* Shift(left)           0x2a  */   42
13879a8a9c6Smrg#define KEY_BSlash       /* \(BckSlash) |(VertBar)0x2b  */   43
13979a8a9c6Smrg#define KEY_Z            /* Z                     0x2c  */   44
14079a8a9c6Smrg#define KEY_X            /* X                     0x2d  */   45
14179a8a9c6Smrg#define KEY_C            /* C                     0x2e  */   46
14279a8a9c6Smrg#define KEY_V            /* V                     0x2f  */   47
14379a8a9c6Smrg#define KEY_B            /* B                     0x30  */   48
14479a8a9c6Smrg#define KEY_N            /* N                     0x31  */   49
14579a8a9c6Smrg#define KEY_M            /* M                     0x32  */   50
14679a8a9c6Smrg#define KEY_Comma        /* , (Comma)   < (Less)  0x33  */   51
14779a8a9c6Smrg#define KEY_Period       /* . (Period)  >(Greater)0x34  */   52
14879a8a9c6Smrg#define KEY_Slash        /* / (Slash)   ?         0x35  */   53
14979a8a9c6Smrg#define KEY_ShiftR       /* Shift(right)          0x36  */   54
15079a8a9c6Smrg#define KEY_KP_Multiply  /* *                     0x37  */   55
15179a8a9c6Smrg#define KEY_Alt          /* Alt(left)             0x38  */   56
15279a8a9c6Smrg#define KEY_Space        /*   (SpaceBar)          0x39  */   57
15379a8a9c6Smrg#define KEY_CapsLock     /* CapsLock              0x3a  */   58
15479a8a9c6Smrg#define KEY_F1           /* F1                    0x3b  */   59
15579a8a9c6Smrg#define KEY_F2           /* F2                    0x3c  */   60
15679a8a9c6Smrg#define KEY_F3           /* F3                    0x3d  */   61
15779a8a9c6Smrg#define KEY_F4           /* F4                    0x3e  */   62
15879a8a9c6Smrg#define KEY_F5           /* F5                    0x3f  */   63
15979a8a9c6Smrg#define KEY_F6           /* F6                    0x40  */   64
16079a8a9c6Smrg#define KEY_F7           /* F7                    0x41  */   65
16179a8a9c6Smrg#define KEY_F8           /* F8                    0x42  */   66
16279a8a9c6Smrg#define KEY_F9           /* F9                    0x43  */   67
16379a8a9c6Smrg#define KEY_F10          /* F10                   0x44  */   68
16479a8a9c6Smrg#define KEY_NumLock      /* NumLock               0x45  */   69
16579a8a9c6Smrg#define KEY_ScrollLock   /* ScrollLock            0x46  */   70
16679a8a9c6Smrg#define KEY_KP_7         /* 7           Home      0x47  */   71
16779a8a9c6Smrg#define KEY_KP_8         /* 8           Up        0x48  */   72
16879a8a9c6Smrg#define KEY_KP_9         /* 9           PgUp      0x49  */   73
16979a8a9c6Smrg#define KEY_KP_Minus     /* - (Minus)             0x4a  */   74
17079a8a9c6Smrg#define KEY_KP_4         /* 4           Left      0x4b  */   75
17179a8a9c6Smrg#define KEY_KP_5         /* 5                     0x4c  */   76
17279a8a9c6Smrg#define KEY_KP_6         /* 6           Right     0x4d  */   77
17379a8a9c6Smrg#define KEY_KP_Plus      /* + (Plus)              0x4e  */   78
17479a8a9c6Smrg#define KEY_KP_1         /* 1           End       0x4f  */   79
17579a8a9c6Smrg#define KEY_KP_2         /* 2           Down      0x50  */   80
17679a8a9c6Smrg#define KEY_KP_3         /* 3           PgDown    0x51  */   81
17779a8a9c6Smrg#define KEY_KP_0         /* 0           Insert    0x52  */   82
17879a8a9c6Smrg#define KEY_KP_Decimal   /* . (Decimal) Delete    0x53  */   83
17979a8a9c6Smrg#define KEY_SysReqest    /* SysReqest             0x54  */   84
18079a8a9c6Smrg                         /* NOTUSED               0x55  */
18179a8a9c6Smrg#define KEY_Less         /* < (Less)   >(Greater) 0x56  */   86
18279a8a9c6Smrg#define KEY_F11          /* F11                   0x57  */   87
18379a8a9c6Smrg#define KEY_F12          /* F12                   0x58  */   88
18479a8a9c6Smrg
18579a8a9c6Smrg#define KEY_Prefix0      /* special               0x60  */   96
1868d623946Smrg#define KEY_Prefix1      /* special               0x61  */   97
18779a8a9c6Smrg
18879a8a9c6Smrg/*
18979a8a9c6Smrg * The 'scancodes' below are generated by the server, because the MF101/102
19079a8a9c6Smrg * keyboard sends them as sequence of other scancodes
19179a8a9c6Smrg */
19279a8a9c6Smrg#define KEY_Home         /* Home                  0x59  */   89
19379a8a9c6Smrg#define KEY_Up           /* Up                    0x5a  */   90
19479a8a9c6Smrg#define KEY_PgUp         /* PgUp                  0x5b  */   91
19579a8a9c6Smrg#define KEY_Left         /* Left                  0x5c  */   92
19679a8a9c6Smrg#define KEY_Begin        /* Begin                 0x5d  */   93
19779a8a9c6Smrg#define KEY_Right        /* Right                 0x5e  */   94
19879a8a9c6Smrg#define KEY_End          /* End                   0x5f  */   95
19979a8a9c6Smrg#define KEY_Down         /* Down                  0x60  */   96
20079a8a9c6Smrg#define KEY_PgDown       /* PgDown                0x61  */   97
20179a8a9c6Smrg#define KEY_Insert       /* Insert                0x62  */   98
20279a8a9c6Smrg#define KEY_Delete       /* Delete                0x63  */   99
20379a8a9c6Smrg#define KEY_KP_Enter     /* Enter                 0x64  */  100
20479a8a9c6Smrg#define KEY_RCtrl        /* Ctrl(right)           0x65  */  101
20579a8a9c6Smrg#define KEY_Pause        /* Pause                 0x66  */  102
20679a8a9c6Smrg#define KEY_Print        /* Print                 0x67  */  103
20779a8a9c6Smrg#define KEY_KP_Divide    /* Divide                0x68  */  104
20879a8a9c6Smrg#define KEY_AltLang      /* AtlLang(right)        0x69  */  105
20979a8a9c6Smrg#define KEY_Break        /* Break                 0x6a  */  106
21079a8a9c6Smrg#define KEY_LMeta        /* Left Meta             0x6b  */  107
21179a8a9c6Smrg#define KEY_RMeta        /* Right Meta            0x6c  */  108
21279a8a9c6Smrg#define KEY_Menu         /* Menu                  0x6d  */  109
21379a8a9c6Smrg#define KEY_F13          /* F13                   0x6e  */  110
21479a8a9c6Smrg#define KEY_F14          /* F14                   0x6f  */  111
21579a8a9c6Smrg#define KEY_F15          /* F15                   0x70  */  112
21679a8a9c6Smrg#define KEY_HKTG         /* Hirugana/Katakana tog 0x70  */  112
21779a8a9c6Smrg#define KEY_F16          /* F16                   0x71  */  113
21879a8a9c6Smrg#define KEY_F17          /* F17                   0x72  */  114
21979a8a9c6Smrg#define KEY_KP_DEC       /* KP_DEC                0x73  */  115
22079a8a9c6Smrg#define KEY_BSlash2      /* \           _         0x73  */  115
22179a8a9c6Smrg#define KEY_KP_Equal	 /* Equal (Keypad)        0x76  */  118
22279a8a9c6Smrg#define KEY_XFER         /* Kanji Transfer        0x79  */  121
22379a8a9c6Smrg#define KEY_NFER         /* No Kanji Transfer     0x7b  */  123
22479a8a9c6Smrg#define KEY_Yen          /* Yen                   0x7d  */  125
22579a8a9c6Smrg
22679a8a9c6Smrg#define KEY_Power        /* Power Key             0x84  */  132
22779a8a9c6Smrg#define KEY_Mute         /* Audio Mute            0x85  */  133
22879a8a9c6Smrg#define KEY_AudioLower   /* Audio Lower           0x86  */  134
22979a8a9c6Smrg#define KEY_AudioRaise   /* Audio Raise           0x87  */  135
23079a8a9c6Smrg#define KEY_Help         /* Help                  0x88  */  136
23179a8a9c6Smrg#define KEY_L1           /* Stop                  0x89  */  137
23279a8a9c6Smrg#define KEY_L2           /* Again                 0x8a  */  138
23379a8a9c6Smrg#define KEY_L3           /* Props                 0x8b  */  139
23479a8a9c6Smrg#define KEY_L4           /* Undo                  0x8c  */  140
23579a8a9c6Smrg#define KEY_L5           /* Front                 0x8d  */  141
23679a8a9c6Smrg#define KEY_L6           /* Copy                  0x8e  */  142
23779a8a9c6Smrg#define KEY_L7           /* Open                  0x8f  */  143
23879a8a9c6Smrg#define KEY_L8           /* Paste                 0x90  */  144
23979a8a9c6Smrg#define KEY_L9           /* Find                  0x91  */  145
24079a8a9c6Smrg#define KEY_L10          /* Cut                   0x92  */  146
24179a8a9c6Smrg
24279a8a9c6Smrg/*
24379a8a9c6Smrg * Fake 'scancodes' in the following ranges are generated for 2-byte
24479a8a9c6Smrg * codes not handled elsewhere.  These correspond to most extended keys
24579a8a9c6Smrg * on so-called "Internet" keyboards:
24679a8a9c6Smrg *
24779a8a9c6Smrg *	0x79-0x93
24879a8a9c6Smrg *	0x96-0xa1
24979a8a9c6Smrg *	0xa3-0xac
25079a8a9c6Smrg *	0xb1-0xb4
25179a8a9c6Smrg *	0xba-0xbd
25279a8a9c6Smrg *	0xc2
25379a8a9c6Smrg *	0xcc-0xd2
25479a8a9c6Smrg *	0xd6-0xf7
25579a8a9c6Smrg */
25679a8a9c6Smrg
25779a8a9c6Smrg/*
25879a8a9c6Smrg * Remapped 'scancodes' are generated for single-byte codes in the range
25979a8a9c6Smrg * 0x59-0x5f,0x62-0x76.  These are used for some extra keys on some keyboards.
26079a8a9c6Smrg */
26179a8a9c6Smrg
26279a8a9c6Smrg#define KEY_0x59		0x95
26379a8a9c6Smrg#define KEY_0x5A		0xA2
26479a8a9c6Smrg#define KEY_0x5B		0xAD
26579a8a9c6Smrg#define KEY_0x5C		KEY_KP_EQUAL
26679a8a9c6Smrg#define KEY_0x5D		0xAE
26779a8a9c6Smrg#define KEY_0x5E		0xAF
26879a8a9c6Smrg#define KEY_0x5F		0xB0
26979a8a9c6Smrg#define KEY_0x62		0xB5
27079a8a9c6Smrg#define KEY_0x63		0xB6
27179a8a9c6Smrg#define KEY_0x64		0xB7
27279a8a9c6Smrg#define KEY_0x65		0xB8
27379a8a9c6Smrg#define KEY_0x66		0xB9
27479a8a9c6Smrg#define KEY_0x67		0xBE
27579a8a9c6Smrg#define KEY_0x68		0xBF
27679a8a9c6Smrg#define KEY_0x69		0xC0
27779a8a9c6Smrg#define KEY_0x6A		0xC1
27879a8a9c6Smrg#define KEY_0x6B		0xC3
27979a8a9c6Smrg#define KEY_0x6C		0xC4
28079a8a9c6Smrg#define KEY_0x6D		0xC5
28179a8a9c6Smrg#define KEY_0x6E		0xC6
28279a8a9c6Smrg#define KEY_0x6F		0xC7
28379a8a9c6Smrg#define KEY_0x70		0xC8
28479a8a9c6Smrg#define KEY_0x71		0xC9
28579a8a9c6Smrg#define KEY_0x72		0xCA
28679a8a9c6Smrg#define KEY_0x73		0xCB
28779a8a9c6Smrg#define KEY_0x74		0xD3
28879a8a9c6Smrg#define KEY_0x75		0xD4
28979a8a9c6Smrg#define KEY_0x76		0xD5
290414bd68fSmrg#define KEY_R_0xF4		0xF4
291414bd68fSmrg#define KEY_R_0xF5		0xF5
29279a8a9c6Smrg
29379a8a9c6Smrg/* These are for "notused" and "unknown" entries in translation maps. */
29479a8a9c6Smrg#define KEY_NOTUSED	  0
29579a8a9c6Smrg#define KEY_UNKNOWN	255
29679a8a9c6Smrg
29779a8a9c6Smrg#endif /* _ATKEYNAMES_H */
298