source: trunk/src/user32/oslibkbd.cpp@ 10367

Last change on this file since 10367 was 9810, checked in by sandervl, 23 years ago

ToAscii, GetKeyState, GetAsyncKeyState & GetKeyboardState fixes

File size: 3.4 KB
Line 
1/* $Id: oslibkbd.cpp,v 1.1 2003-02-16 15:31:10 sandervl Exp $ */
2/*
3 * Keyboard helpers for OS/2
4 *
5 *
6 * Copyright 2003 Sander van Leeuwen (sandervl@innotek.de)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#define INCL_WIN
13#define INCL_PM
14#define INCL_WINSWITCHLIST
15#define INCL_WININPUT
16#include <os2wrap.h>
17#include <stdlib.h>
18#include <stdio.h>
19#include <string.h>
20
21#include <dbglog.h>
22#include <win32type.h>
23#include <winconst.h>
24
25#define DBG_LOCALLOG DBG_oslibkbd
26#include "dbglocal.h"
27
28SHORT APIENTRY16 WinGetScanState( HWND, USHORT );
29BOOL APIENTRY16 WinSetScanStateTable(HWND,unsigned char *,BOOL);
30
31//******************************************************************************
32//******************************************************************************
33SHORT OSLibWinGetScanState(USHORT scan)
34{
35 SHORT state;
36 SHORT sel;
37
38 sel = RestoreOS2FS();
39 state = WinGetScanState(HWND_DESKTOP, scan);
40 SetFS(sel);
41
42 return state;
43}
44//******************************************************************************
45//******************************************************************************
46BOOL OSLibWinGetScanStateTable(unsigned char *PMScanState)
47{
48 SHORT ret;
49 SHORT sel;
50
51 sel = RestoreOS2FS();
52 ret = WinSetScanStateTable(HWND_DESKTOP, PMScanState, FALSE);
53 SetFS(sel);
54
55 if(ret == FALSE) {
56 dprintf(("WinSetScanStateTable failed with %x", WinGetLastError(0)));
57 }
58 return ret;
59}
60//******************************************************************************
61//******************************************************************************
62LONG OSLibWinGetPhysKeyState(LONG scan)
63{
64 return WinGetPhysKeyState(HWND_DESKTOP,scan);
65}
66//******************************************************************************
67//******************************************************************************
68BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
69{
70 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)PMKeyState, FALSE );
71}
72//******************************************************************************
73//******************************************************************************
74BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
75{
76 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)PMKeyState, TRUE );
77}
78//******************************************************************************
79//******************************************************************************
80USHORT APIENTRY WinTranslateChar2( USHORT /* Codepage (currently ignored) */
81 , PUSHORT /* Ptr to char to translate */
82 , PULONG /* Ptr to deadkey save info */
83 , USHORT /* Translation option (TC_xxx) */
84 , PUSHORT /* Ptr to shift state (TCF_xxx) */
85 );
86//******************************************************************************
87//******************************************************************************
88USHORT OSLibWinTranslateChar(USHORT usScanCode, ULONG type, USHORT shiftstate)
89{
90 USHORT usResult;
91 USHORT sel = GetFS();
92
93 usResult = WinTranslateChar2(0, &usScanCode, NULL, type, &shiftstate);
94 SetFS(sel);
95 return usScanCode;
96}
97//******************************************************************************
98//******************************************************************************
Note: See TracBrowser for help on using the repository browser.