xf86OSKbd.h revision 57ba8e8b
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
32#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
33#define LogMessageVerbSigSafe xf86MsgVerb
34#endif
35
36Bool ATScancode(InputInfoPtr pInfo, int *scanCode);
37
38/* Public interface to OS-specific keyboard support. */
39
40typedef	int	(*KbdInitProc)(InputInfoPtr pInfo, int what);
41typedef	int	(*KbdOnProc)(InputInfoPtr pInfo, int what);
42typedef	int	(*KbdOffProc)(InputInfoPtr pInfo, int what);
43typedef	void	(*BellProc)(InputInfoPtr pInfo,
44                            int loudness, int pitch, int duration);
45typedef	void	(*SetLedsProc)(InputInfoPtr pInfo, int leds);
46typedef	int	(*GetLedsProc)(InputInfoPtr pInfo);
47typedef	void	(*KbdGetMappingProc)(InputInfoPtr pInfo,
48                                     KeySymsPtr pKeySyms, CARD8* pModMap);
49typedef	int	(*RemapScanCodeProc)(InputInfoPtr pInfo, int *scanCode);
50typedef	Bool	(*OpenKeyboardProc)(InputInfoPtr pInfo);
51typedef	void	(*PostEventProc)(InputInfoPtr pInfo,
52                                 unsigned int key, Bool down);
53typedef struct {
54    int                 begin;
55    int                 end;
56    unsigned char       *map;
57} TransMapRec, *TransMapPtr;
58
59typedef struct {
60    KbdInitProc		KbdInit;
61    KbdOnProc		KbdOn;
62    KbdOffProc		KbdOff;
63    BellProc		Bell;
64    SetLedsProc		SetLeds;
65    GetLedsProc		GetLeds;
66    KbdGetMappingProc	KbdGetMapping;
67    RemapScanCodeProc	RemapScanCode;
68
69    OpenKeyboardProc	OpenKeyboard;
70    PostEventProc	PostEvent;
71
72    unsigned long	leds;
73    unsigned long	xledsMask;
74    unsigned long	keyLeds;
75    int			scanPrefix;
76    Bool		CustomKeycodes;
77    Bool		isConsole;
78    TransMapPtr         scancodeMap;
79    TransMapPtr         specialMap;
80
81    /* os specific */
82    pointer		private;
83    int			consType;
84    int			wsKbdType;
85    char		wsKbdDev[256];
86
87} KbdDevRec, *KbdDevPtr;
88
89typedef enum {
90    PROT_STD,
91    PROT_WSCONS,
92    PROT_UNKNOWN_KBD
93} KbdProtocolId;
94
95typedef struct {
96    const char		*name;
97    KbdProtocolId	id;
98} KbdProtocolRec;
99
100_X_EXPORT Bool xf86OSKbdPreInit(InputInfoPtr pInfo);
101