xf86OSKbd.h revision a1ed278c
1/*
2 * Copyright (c) 2002-2003 by The XFree86 Project, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Except as contained in this notice, the name of the copyright holder(s)
23 * and author(s) shall not be used in advertising or otherwise to promote
24 * the sale, use or other dealings in this Software without prior written
25 * authorization from the copyright holder(s) and author(s).
26 *
27 * Author: Ivan Pascal.
28 */
29
30#include "xf86Xinput.h"
31
32Bool ATScancode(InputInfoPtr pInfo, int *scanCode);
33
34/* Public interface to OS-specific keyboard support. */
35
36typedef	int	(*KbdInitProc)(InputInfoPtr pInfo, int what);
37typedef	int	(*KbdOnProc)(InputInfoPtr pInfo, int what);
38typedef	int	(*KbdOffProc)(InputInfoPtr pInfo, int what);
39typedef	void	(*BellProc)(InputInfoPtr pInfo,
40                            int loudness, int pitch, int duration);
41typedef	void	(*SetLedsProc)(InputInfoPtr pInfo, int leds);
42typedef	int	(*GetLedsProc)(InputInfoPtr pInfo);
43typedef	void	(*KbdGetMappingProc)(InputInfoPtr pInfo,
44                                     KeySymsPtr pKeySyms, CARD8* pModMap);
45typedef	int	(*RemapScanCodeProc)(InputInfoPtr pInfo, int *scanCode);
46typedef	Bool	(*OpenKeyboardProc)(InputInfoPtr pInfo);
47typedef	void	(*PostEventProc)(InputInfoPtr pInfo,
48                                 unsigned int key, Bool down);
49typedef struct {
50    int                 begin;
51    int                 end;
52    unsigned char       *map;
53} TransMapRec, *TransMapPtr;
54
55typedef struct {
56    KbdInitProc		KbdInit;
57    KbdOnProc		KbdOn;
58    KbdOffProc		KbdOff;
59    BellProc		Bell;
60    SetLedsProc		SetLeds;
61    GetLedsProc		GetLeds;
62    KbdGetMappingProc	KbdGetMapping;
63    RemapScanCodeProc	RemapScanCode;
64
65    OpenKeyboardProc	OpenKeyboard;
66    PostEventProc	PostEvent;
67
68    unsigned long	leds;
69    unsigned long	xledsMask;
70    unsigned long	keyLeds;
71    int			scanPrefix;
72    Bool		CustomKeycodes;
73    Bool		isConsole;
74    TransMapPtr         scancodeMap;
75    TransMapPtr         specialMap;
76
77    /* os specific */
78    pointer		private;
79    int			consType;
80    int			wsKbdType;
81
82} KbdDevRec, *KbdDevPtr;
83
84typedef enum {
85    PROT_STD,
86    PROT_WSCONS,
87    PROT_UNKNOWN_KBD
88} KbdProtocolId;
89
90typedef struct {
91    const char		*name;
92    KbdProtocolId	id;
93} KbdProtocolRec;
94
95Bool xf86OSKbdPreInit(InputInfoPtr pInfo);
96