4 * Copyright 1993 Bob Amstadt
5 * Copyright 1996 Albrecht Kleine
6 * Copyright 1997 David Faure
7 * Copyright 1998 Morten Welinder
8 * Copyright 1998 Ulrich Weigand
23 #include "debugtools.h"
26 DEFAULT_DEBUG_CHANNEL(keyboard);
29 typedef struct _KBINFO
31 BYTE Begin_First_Range;
33 BYTE Begin_Second_Range;
34 BYTE End_Second_Range;
39 static FARPROC16 DefKeybEventProc;
40 static LPBYTE pKeyStateTable;
42 /***********************************************************************
43 * Inquire (KEYBOARD.1)
45 WORD WINAPI KEYBOARD_Inquire(LPKBINFO kbInfo)
47 kbInfo->Begin_First_Range = 0;
48 kbInfo->End_First_Range = 0;
49 kbInfo->Begin_Second_Range = 0;
50 kbInfo->End_Second_Range = 0;
51 kbInfo->StateSize = 16;
53 return sizeof(KBINFO);
56 /***********************************************************************
59 VOID WINAPI KEYBOARD_Enable( FARPROC16 proc, LPBYTE lpKeyState )
61 DefKeybEventProc = proc;
62 pKeyStateTable = lpKeyState;
64 memset( lpKeyState, 0, 256 ); /* all states to false */
67 /***********************************************************************
68 * Disable (KEYBOARD.3)
70 VOID WINAPI KEYBOARD_Disable(VOID)
72 DefKeybEventProc = NULL;
73 pKeyStateTable = NULL;
77 /**********************************************************************
78 * SetSpeed (KEYBOARD.7)
80 WORD WINAPI SetSpeed16(WORD unused)
82 FIXME("(%04x): stub\n", unused);
86 /**********************************************************************
87 * ScreenSwitchEnable (KEYBOARD.100)
89 VOID WINAPI ScreenSwitchEnable16(WORD unused)
91 FIXME("(%04x): stub\n", unused);
94 /**********************************************************************
95 * OemKeyScan (KEYBOARD.128)
96 * OemKeyScan (USER32.@)
98 DWORD WINAPI OemKeyScan(WORD wOemChar)
100 TRACE("(%d)\n", wOemChar);
105 /**********************************************************************
106 * VkKeyScan (KEYBOARD.129)
108 WORD WINAPI VkKeyScan16(CHAR cChar)
110 return VkKeyScanA( cChar );
113 /******************************************************************************
114 * GetKeyboardType (KEYBOARD.130)
116 INT16 WINAPI GetKeyboardType16(INT16 nTypeFlag)
118 return GetKeyboardType( nTypeFlag );
121 /******************************************************************************
122 * MapVirtualKey (KEYBOARD.131)
124 * MapVirtualKey translates keycodes from one format to another
126 UINT16 WINAPI MapVirtualKey16(UINT16 wCode, UINT16 wMapType)
128 return MapVirtualKeyA(wCode,wMapType);
131 /****************************************************************************
132 * GetKBCodePage (KEYBOARD.132)
134 INT16 WINAPI GetKBCodePage16(void)
136 return GetKBCodePage();
139 /****************************************************************************
140 * GetKeyNameText (KEYBOARD.133)
142 INT16 WINAPI GetKeyNameText16(LONG lParam, LPSTR lpBuffer, INT16 nSize)
144 return GetKeyNameTextA( lParam, lpBuffer, nSize );
147 /****************************************************************************
148 * ToAscii (KEYBOARD.4)
150 * The ToAscii function translates the specified virtual-key code and keyboard
151 * state to the corresponding Windows character or characters.
153 * If the specified key is a dead key, the return value is negative. Otherwise,
154 * it is one of the following values:
156 * 0 The specified virtual key has no translation for the current state of the keyboard.
157 * 1 One Windows character was copied to the buffer.
158 * 2 Two characters were copied to the buffer. This usually happens when a
159 * dead-key character (accent or diacritic) stored in the keyboard layout cannot
160 * be composed with the specified virtual key to form a single character.
162 * FIXME : should do the above (return 2 for non matching deadchar+char combinations)
165 INT16 WINAPI ToAscii16(UINT16 virtKey,UINT16 scanCode, LPBYTE lpKeyState,
166 LPVOID lpChar, UINT16 flags)
168 return ToAscii( virtKey, scanCode, lpKeyState, lpChar, flags );
171 /***********************************************************************
172 * MessageBeep (USER.104)
174 void WINAPI MessageBeep16( UINT16 i )
179 /***********************************************************************
180 * MessageBeep (USER32.@)
182 BOOL WINAPI MessageBeep( UINT i )
185 SystemParametersInfoA( SPI_GETBEEP, 0, &active, FALSE );
186 if (active) USER_Driver.pBeep();