source: branches/gcc-kmk/src/user32/oslibkbd.cpp@ 21811

Last change on this file since 21811 was 21811, checked in by dmik, 14 years ago

Port USER32.DLL (funal bunch).

File size: 3.5 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
28extern "C" {
29
30SHORT APIENTRY16 WinGetScanState( HWND, USHORT );
31BOOL APIENTRY16 WinSetScanStateTable(HWND,unsigned char *,BOOL);
32
33} // extern "C"
34
35//******************************************************************************
36//******************************************************************************
37SHORT OSLibWinGetScanState(USHORT scan)
38{
39 SHORT state;
40 SHORT sel;
41
42 sel = RestoreOS2FS();
43 state = WinGetScanState(HWND_DESKTOP, scan);
44 SetFS(sel);
45
46 return state;
47}
48//******************************************************************************
49//******************************************************************************
50BOOL OSLibWinGetScanStateTable(unsigned char *PMScanState)
51{
52 SHORT ret;
53 SHORT sel;
54
55 sel = RestoreOS2FS();
56 ret = WinSetScanStateTable(HWND_DESKTOP, PMScanState, FALSE);
57 SetFS(sel);
58
59 if(ret == FALSE) {
60 dprintf(("WinSetScanStateTable failed with %x", WinGetLastError(0)));
61 }
62 return ret;
63}
64//******************************************************************************
65//******************************************************************************
66LONG OSLibWinGetPhysKeyState(LONG scan)
67{
68 return WinGetPhysKeyState(HWND_DESKTOP,scan);
69}
70//******************************************************************************
71//******************************************************************************
72BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
73{
74 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)PMKeyState, FALSE );
75}
76//******************************************************************************
77//******************************************************************************
78BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
79{
80 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)PMKeyState, TRUE );
81}
82//******************************************************************************
83//******************************************************************************
84USHORT APIENTRY WinTranslateChar2( USHORT /* Codepage (currently ignored) */
85 , PUSHORT /* Ptr to char to translate */
86 , PULONG /* Ptr to deadkey save info */
87 , USHORT /* Translation option (TC_xxx) */
88 , PUSHORT /* Ptr to shift state (TCF_xxx) */
89 );
90//******************************************************************************
91//******************************************************************************
92USHORT OSLibWinTranslateChar(USHORT usScanCode, ULONG type, USHORT shiftstate)
93{
94 USHORT usResult;
95 USHORT sel = GetFS();
96
97 usResult = WinTranslateChar2(0, &usScanCode, NULL, type, &shiftstate);
98 SetFS(sel);
99 return usScanCode;
100}
101//******************************************************************************
102//******************************************************************************
Note: See TracBrowser for help on using the repository browser.