ReactOS  0.4.15-dev-5618-g8866b9d
mouse.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS system libraries
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Mouse keys notification icon handler
5  * COPYRIGHT: Copyright 2022 Mark Jansen <mark.jansen@reactos.org>
6  */
7 
8 #include "precomp.h"
9 
10 static MOUSEKEYS g_Mk;
11 static UINT g_MkState;
13 
16 {
17  TRACE("MouseKeys_Init!\n");
18 
19  return MouseKeys_Update(pSysTray);
20 }
21 
24 {
25  TRACE("MouseKeys_Shutdown!\n");
26 
27  if (g_MkStateIcon)
28  {
31  }
32 
33  if (g_MkState)
34  {
35  g_MkState = 0;
36  pSysTray->NotifyIcon(NIM_DELETE, ID_ICON_MOUSE, g_MkStateIcon, L"MouseKeys");
37  }
38 
39  return S_OK;
40 }
41 
44 {
45  TRACE("MouseKeys_Update!\n");
46 
47  g_Mk.cbSize = sizeof(g_Mk);
49 
50  UINT state = 0;
52  {
54  {
56  {
57  case 0:
58  default:
60  break;
61  case MKF_LEFTBUTTONSEL:
63  break;
64  case MKF_LEFTBUTTONDOWN:
67  break;
68  case MKF_RIGHTBUTTONSEL:
70  break;
74  break;
77  break;
83  break;
87  break;
91  break;
92  }
93  }
94  else
95  {
97  }
98  }
99 
100  UINT uId = NIM_MODIFY;
101  if (state != g_MkState)
102  {
103  if (g_MkStateIcon)
104  {
107  }
108 
109  if (g_MkState == 0)
110  uId = NIM_ADD;
111 
112  g_MkState = state;
113  if (g_MkState)
114  {
116  }
117  }
118 
119  if (g_MkState == 0)
120  {
121  uId = NIM_DELETE;
122  }
123 
124  return pSysTray->NotifyIcon(uId, ID_ICON_MOUSE, g_MkStateIcon, L"MouseKeys");
125 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static HICON
Definition: imagelist.c:84
static UINT g_MkState
Definition: mouse.cpp:11
#define SPI_GETMOUSEKEYS
Definition: winuser.h:1393
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define IDI_MOUSE_R_DOWN
Definition: resource.h:64
#define IDI_MOUSE_L_DOWN
Definition: resource.h:62
DWORD dwFlags
Definition: winuser.h:3402
#define MKF_INDICATOR
Definition: winuser.h:2137
#define IDI_MOUSE_R_ACTIVE
Definition: resource.h:63
#define IDI_MOUSE_DISABLED
Definition: resource.h:59
#define L(x)
Definition: ntvdm.h:50
#define IDI_MOUSE_LR_DOWN
Definition: resource.h:66
#define _In_
Definition: ms_sal.h:308
#define MKF_RIGHTBUTTONSEL
Definition: winuser.h:2143
#define IDI_MOUSE_LR_ACTIVE
Definition: resource.h:65
static HICON g_MkStateIcon
Definition: mouse.cpp:12
#define TRACE(s)
Definition: solgame.cpp:4
#define IDI_MOUSE_NOBTN
Definition: resource.h:60
LONG HRESULT
Definition: typedefs.h:79
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define NIM_DELETE
Definition: shellapi.h:93
#define MKF_LEFTBUTTONDOWN
Definition: winuser.h:2140
static MOUSEKEYS g_Mk
Definition: mouse.cpp:10
HRESULT STDMETHODCALLTYPE MouseKeys_Update(_In_ CSysTray *pSysTray)
Definition: mouse.cpp:43
#define IDI_MOUSE_L_ACTIVE_R_DOWN
Definition: resource.h:67
#define IDI_MOUSE_L_ACTIVE
Definition: resource.h:61
static int state
Definition: maze.c:121
HRESULT STDMETHODCALLTYPE MouseKeys_Init(_In_ CSysTray *pSysTray)
Definition: mouse.cpp:15
#define MKF_LEFTBUTTONSEL
Definition: winuser.h:2142
HRESULT STDMETHODCALLTYPE MouseKeys_Shutdown(_In_ CSysTray *pSysTray)
Definition: mouse.cpp:23
#define MKF_RIGHTBUTTONDOWN
Definition: winuser.h:2141
#define S_OK
Definition: intsafe.h:52
#define ID_ICON_MOUSE
Definition: precomp.h:36
#define MKF_MOUSEMODE
Definition: winuser.h:2144
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define IDI_MOUSE_R_ACTIVE_L_DOWN
Definition: resource.h:68
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define NIM_ADD
Definition: shellapi.h:91
UINT cbSize
Definition: winuser.h:3401
#define LoadIcon
Definition: winuser.h:5803
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
#define NIM_MODIFY
Definition: shellapi.h:92
#define MKF_MOUSEKEYSON
Definition: winuser.h:2132