mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
329f0680e4
Sun Apr 14 12:51:27 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/menu.c] [include/dialog.h] [windows/dialog.c] Made the resource loading code always use the correct Windows layout for Winelib on other CPUs. * [include/module.h] [loader/module.c] Added self handle in NE_MODULE structure, so we can use a pointer instead of a handle. Added function MODULE_GetPtr() to validate a HMODULE. * [memory/heap.c] Implemented Win32 heap management. * [memory/selector.c] Fix selector limit for huge blocks. Sat Apr 13 00:19:12 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk> * [objects/metafile.c] Fixed memcpy bug to allow memory based metafiles to work. Fri Apr 12 19:25:41 1996 Frans van Dorsselaer <dorssel@rulhm1.leidenuniv.nl> * [controls/edit.c] [controls/EDIT.TODO] Complete rewrite. Everything changed: new features, new bugs. Main addition: WordWrap. Fri Apr 12 20:29:55 1996 Tristan Tarrant <tst@dcs.ed.ac.uk> * [resources/sysres_It.rc] Fixed a few mistakes in the file and resized some of the controls. Fri Apr 12 09:55:13 1996 John Harvey <john@division.co.uk> * [misc/winsocket.c] Fixed broken #if defined that stopped unixware compiling. * [win32/resource.c] Added missing return to end of FindResource32. Thu Apr 11 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/keyboard.c] [windows/event.c] Fixed GetKeyState for mouse buttons. * [windows/message.c] WM_MOUSEACTIVATE wasn't sent in some cases. Wed Apr 10 18:59:53 1996 Niels de Carpentier <niels@cindy.et.tudelft.nl> * [objects/font.c] Match slightly bigger font if height negative. Mon Apr 8 13:46:15 1996 Deano Calver <deano@rattie.demon.co.uk> * [multimedia/mmsystem.c] Changed read's to FILE_read's in mmsystem to fix mmio bug. Sun Apr 7 21:40:29 1996 Albrecht Kleine <kleine@ak.sax.de> * [misc/commdlg.c] [resources/sysres_En.rc] [resources/sysres_De.rc] Introduced ColorDlgProc() for ChooseColor() and replaced fitting En-,De- resources. As written in TODO: some national language support is needed here.
105 lines
2.7 KiB
C
105 lines
2.7 KiB
C
/*
|
|
* Keyboard related functions
|
|
*
|
|
* Copyright 1993 Bob Amstadt
|
|
*/
|
|
#include <string.h>
|
|
#include "win.h"
|
|
#include "windows.h"
|
|
|
|
extern BOOL MouseButtonsStates[3];
|
|
extern BOOL AsyncMouseButtonsStates[3];
|
|
extern BYTE KeyStateTable[256];
|
|
extern BYTE AsyncKeyStateTable[256];
|
|
|
|
/**********************************************************************
|
|
* GetKeyState [USER.106]
|
|
*/
|
|
INT GetKeyState(INT keycode)
|
|
{
|
|
INT retval;
|
|
|
|
switch(keycode) {
|
|
case VK_LBUTTON:
|
|
return MouseButtonsStates[0];
|
|
case VK_MBUTTON:
|
|
return MouseButtonsStates[1];
|
|
case VK_RBUTTON:
|
|
return MouseButtonsStates[2];
|
|
default:
|
|
retval = ( (INT)(KeyStateTable[keycode] & 0x80) << 8 ) |
|
|
(INT)(KeyStateTable[keycode] & 0x01);
|
|
}
|
|
|
|
return retval;
|
|
}
|
|
|
|
/**********************************************************************
|
|
* GetKeyboardState [USER.222]
|
|
*/
|
|
void GetKeyboardState(BYTE FAR *lpKeyState)
|
|
{
|
|
if (lpKeyState != NULL) {
|
|
KeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] >> 8;
|
|
KeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] >> 8;
|
|
KeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] >> 8;
|
|
memcpy(lpKeyState, KeyStateTable, 256);
|
|
}
|
|
}
|
|
|
|
/**********************************************************************
|
|
* SetKeyboardState [USER.223]
|
|
*/
|
|
void SetKeyboardState(BYTE FAR *lpKeyState)
|
|
{
|
|
if (lpKeyState != NULL) {
|
|
memcpy(KeyStateTable, lpKeyState, 256);
|
|
MouseButtonsStates[0] = KeyStateTable[VK_LBUTTON]? 0x8000: 0;
|
|
MouseButtonsStates[1] = KeyStateTable[VK_MBUTTON]? 0x8000: 0;
|
|
MouseButtonsStates[2] = KeyStateTable[VK_RBUTTON]? 0x8000: 0;
|
|
}
|
|
}
|
|
|
|
/**********************************************************************
|
|
* GetAsyncKeyState (USER.249)
|
|
*
|
|
* Determine if a key is or was pressed. retval has high-order
|
|
* byte set to 1 if currently pressed, low-order byte 1 if key has
|
|
* been pressed.
|
|
*
|
|
* This uses the variable AsyncMouseButtonsStates and
|
|
* AsyncKeyStateTable (set in event.c) which have the mouse button
|
|
* number or key number (whichever is applicable) set to true if the
|
|
* mouse or key had been depressed since the last call to
|
|
* GetAsyncKeyState.
|
|
*/
|
|
int GetAsyncKeyState(int nKey)
|
|
{
|
|
short retval;
|
|
|
|
switch (nKey) {
|
|
case VK_LBUTTON:
|
|
retval = AsyncMouseButtonsStates[0] |
|
|
MouseButtonsStates[0]? 0x0001: 0;
|
|
break;
|
|
case VK_MBUTTON:
|
|
retval = AsyncMouseButtonsStates[1] |
|
|
MouseButtonsStates[1]? 0x0001: 0;
|
|
break;
|
|
case VK_RBUTTON:
|
|
retval = AsyncMouseButtonsStates[2] |
|
|
MouseButtonsStates[2]? 0x0001: 0;
|
|
break;
|
|
default:
|
|
retval = AsyncKeyStateTable[nKey] |
|
|
(KeyStateTable[nKey] << 8);
|
|
break;
|
|
}
|
|
|
|
memset( AsyncMouseButtonsStates, 0, 3 ); /* all states to false */
|
|
memset( AsyncKeyStateTable, 0, 256 );
|
|
|
|
return retval;
|
|
}
|
|
|