ReactOS  0.4.14-dev-41-g31d7680
mouse.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _MOUSE_PACKET
 

Macros

#define MOUSE_MAX   255
 
#define MOUSE_LEFT_BUTTON   (1 << 0)
 
#define MOUSE_RIGHT_BUTTON   (1 << 1)
 
#define MOUSE_MIDDLE_BUTTON   (1 << 2)
 
#define MOUSE_ALWAYS_SET   (1 << 3)
 
#define MOUSE_X_SIGN   (1 << 4)
 
#define MOUSE_Y_SIGN   (1 << 5)
 
#define MOUSE_X_OVERFLOW   (1 << 6)
 
#define MOUSE_Y_OVERFLOW   (1 << 7)
 
#define MOUSE_4TH_BUTTON   (1 << 4)
 
#define MOUSE_5TH_BUTTON   (1 << 5)
 
#define MOUSE_BAT_SUCCESS   0xAA
 
#define MOUSE_ACK   0xFA
 
#define MOUSE_ERROR   0xFC
 
#define MOUSE_SCROLL_UP   1
 
#define MOUSE_SCROLL_DOWN   -1
 
#define MOUSE_SCROLL_RIGHT   2
 
#define MOUSE_SCROLL_LEFT   -2
 

Typedefs

typedef enum _MOUSE_MODE MOUSE_MODE
 
typedef enum _MOUSE_MODEPMOUSE_MODE
 
typedef struct _MOUSE_PACKET MOUSE_PACKET
 
typedef struct _MOUSE_PACKETPMOUSE_PACKET
 

Enumerations

enum  _MOUSE_MODE { MOUSE_STREAMING_MODE, MOUSE_REMOTE_MODE, MOUSE_WRAP_MODE }
 

Functions

VOID MouseEventHandler (PMOUSE_EVENT_RECORD MouseEvent)
 
VOID MouseGetDataFast (PCOORD CurrentPosition, PBYTE CurrentButtonState)
 
BOOLEAN MouseInit (BYTE PS2Connector)
 

Macro Definition Documentation

◆ MOUSE_4TH_BUTTON

#define MOUSE_4TH_BUTTON   (1 << 4)

Definition at line 28 of file mouse.h.

◆ MOUSE_5TH_BUTTON

#define MOUSE_5TH_BUTTON   (1 << 5)

Definition at line 29 of file mouse.h.

◆ MOUSE_ACK

#define MOUSE_ACK   0xFA

Definition at line 33 of file mouse.h.

◆ MOUSE_ALWAYS_SET

#define MOUSE_ALWAYS_SET   (1 << 3)

Definition at line 21 of file mouse.h.

◆ MOUSE_BAT_SUCCESS

#define MOUSE_BAT_SUCCESS   0xAA

Definition at line 32 of file mouse.h.

◆ MOUSE_ERROR

#define MOUSE_ERROR   0xFC

Definition at line 34 of file mouse.h.

◆ MOUSE_LEFT_BUTTON

#define MOUSE_LEFT_BUTTON   (1 << 0)

Definition at line 18 of file mouse.h.

◆ MOUSE_MAX

#define MOUSE_MAX   255

Definition at line 15 of file mouse.h.

◆ MOUSE_MIDDLE_BUTTON

#define MOUSE_MIDDLE_BUTTON   (1 << 2)

Definition at line 20 of file mouse.h.

◆ MOUSE_RIGHT_BUTTON

#define MOUSE_RIGHT_BUTTON   (1 << 1)

Definition at line 19 of file mouse.h.

◆ MOUSE_SCROLL_DOWN

#define MOUSE_SCROLL_DOWN   -1

Definition at line 44 of file mouse.h.

◆ MOUSE_SCROLL_LEFT

#define MOUSE_SCROLL_LEFT   -2

Definition at line 46 of file mouse.h.

◆ MOUSE_SCROLL_RIGHT

#define MOUSE_SCROLL_RIGHT   2

Definition at line 45 of file mouse.h.

◆ MOUSE_SCROLL_UP

#define MOUSE_SCROLL_UP   1

Definition at line 43 of file mouse.h.

◆ MOUSE_X_OVERFLOW

#define MOUSE_X_OVERFLOW   (1 << 6)

Definition at line 24 of file mouse.h.

◆ MOUSE_X_SIGN

#define MOUSE_X_SIGN   (1 << 4)

Definition at line 22 of file mouse.h.

◆ MOUSE_Y_OVERFLOW

#define MOUSE_Y_OVERFLOW   (1 << 7)

Definition at line 25 of file mouse.h.

◆ MOUSE_Y_SIGN

#define MOUSE_Y_SIGN   (1 << 5)

Definition at line 23 of file mouse.h.

Typedef Documentation

◆ MOUSE_MODE

◆ MOUSE_PACKET

◆ PMOUSE_MODE

◆ PMOUSE_PACKET

Enumeration Type Documentation

◆ _MOUSE_MODE

Enumerator
MOUSE_STREAMING_MODE 
MOUSE_REMOTE_MODE 
MOUSE_WRAP_MODE 

Definition at line 48 of file mouse.h.

49 {
enum _MOUSE_MODE MOUSE_MODE
enum _MOUSE_MODE * PMOUSE_MODE

Function Documentation

◆ MouseEventHandler()

VOID MouseEventHandler ( PMOUSE_EVENT_RECORD  MouseEvent)

Definition at line 427 of file mouse.c.

428 {
429  COORD NewPosition = MouseEvent->dwMousePosition;
431 
433  {
434  /* Text mode */
435  NewPosition.X *= 8;
436  NewPosition.Y *= 8;
437  }
438 
439  /* Adjust for double vision */
440  if (DoubleWidth) NewPosition.X /= 2;
441  if (DoubleHeight) NewPosition.Y /= 2;
442 
444 
445  /* Update the counters */
446  HorzCounter += (NewPosition.X - Position.X) << DoubleWidth;
447  VertCounter += (NewPosition.Y - Position.Y) << DoubleHeight;
448 
449  /* Update the position */
450  Position = NewPosition;
451 
452  /* Update the button state */
453  ButtonState = MouseEvent->dwButtonState;
454 
455  if (MouseEvent->dwEventFlags & MOUSE_WHEELED)
456  {
457  ScrollCounter += (SHORT)HIWORD(MouseEvent->dwButtonState);
458  }
459 
462 }
#define TRUE
Definition: types.h:120
DWORD dwEventFlags
Definition: wincon.h:245
static COORD Position
Definition: mouse.c:34
DWORD dwButtonState
Definition: wincon.h:243
static SHORT HorzCounter
Definition: mouse.c:40
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
short SHORT
Definition: pedump.c:59
ButtonState
Definition: button.c:143
COORD dwMousePosition
Definition: wincon.h:242
unsigned char BOOLEAN
ULONG X
Definition: bl.h:1340
BOOLEAN VgaGetDoubleVisionState(PBOOLEAN Horizontal, PBOOLEAN Vertical)
Definition: video.c:488
static BOOLEAN DoubleHeight
Definition: video.c:59
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
static BOOLEAN DoubleWidth
Definition: video.c:58
static BOOLEAN EventsOccurred
Definition: mouse.c:43
static CHAR ScrollCounter
Definition: mouse.c:42
static SHORT VertCounter
Definition: mouse.c:41
Definition: bl.h:1338
static HANDLE MouseMutex
Definition: mouse.c:30
#define HIWORD(l)
Definition: typedefs.h:246
#define MOUSE_WHEELED
Definition: wincon.h:155
#define INFINITE
Definition: serial.h:102
ULONG Y
Definition: bl.h:1341

Referenced by ConsoleEventThread().

◆ MouseGetDataFast()

VOID MouseGetDataFast ( PCOORD  CurrentPosition,
PBYTE  CurrentButtonState 
)

Definition at line 419 of file mouse.c.

420 {
423  *CurrentButtonState = LOBYTE(ButtonState);
425 }
#define LOBYTE(W)
Definition: jmemdos.c:487
static COORD Position
Definition: mouse.c:34
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
ULONG CurrentPosition
Definition: patchapi.h:57
ButtonState
Definition: button.c:143
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
static HANDLE MouseMutex
Definition: mouse.c:30
#define INFINITE
Definition: serial.h:102

Referenced by DosMouseIrq().

◆ MouseInit()

BOOLEAN MouseInit ( BYTE  PS2Connector)

Definition at line 464 of file mouse.c.

465 {
466  /* Finish to plug the mouse to the specified PS/2 port */
467  MousePS2Port = PS2Connector;
469 
471  if (MouseMutex == NULL) return FALSE;
472 
474  HZ_TO_NS(100),
476 
477  MouseReset();
478  return TRUE;
479 }
#define TRUE
Definition: types.h:120
static BYTE MousePS2Port
Definition: mouse.c:49
static PHARDWARE_TIMER StreamTimer
Definition: mouse.c:31
PHARDWARE_TIMER CreateHardwareTimer(ULONG Flags, ULONGLONG Delay, PHARDWARE_TIMER_PROC Callback)
Definition: clock.c:144
smooth NULL
Definition: ftsmooth.c:416
#define CreateMutex
Definition: winbase.h:3573
#define HARDWARE_TIMER_ENABLED
Definition: clock.h:15
static VOID MouseReset(VOID)
Definition: mouse.c:70
static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
Definition: mouse.c:155
static HANDLE MouseMutex
Definition: mouse.c:30
static VOID FASTCALL MouseStreamingCallback(ULONGLONG ElapsedTime)
Definition: mouse.c:404
VOID PS2SetDeviceCmdProc(BYTE PS2Port, LPVOID Param, PS2_DEVICE_CMDPROC DeviceCommand)
Definition: ps2.c:478
#define HZ_TO_NS(Freq)
Definition: clock.h:20

Referenced by EmulatorInitialize().