ReactOS 0.4.16-dev-197-g92996da
hotkey.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for hotkey.c:

Go to the source code of this file.

Classes

struct  tagHOTKEY_INFO
 

Macros

#define IsOnlySet(flags)   (infoPtr->CurrMod == (flags))
 

Typedefs

typedef struct tagHOTKEY_INFO HOTKEY_INFO
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (hotkey)
 
static LRESULT HOTKEY_SetFont (HOTKEY_INFO *infoPtr, HFONT hFont, BOOL redraw)
 
static BOOL HOTKEY_IsCombInv (const HOTKEY_INFO *infoPtr)
 
static void HOTKEY_DrawHotKey (HOTKEY_INFO *infoPtr, HDC hdc, LPCWSTR KeyName, WORD NameLen)
 
static void HOTKEY_Refresh (HOTKEY_INFO *infoPtr, HDC hdc)
 
static void HOTKEY_Paint (HOTKEY_INFO *infoPtr, HDC hdc)
 
static LRESULT HOTKEY_GetHotKey (const HOTKEY_INFO *infoPtr)
 
static void HOTKEY_SetHotKey (HOTKEY_INFO *infoPtr, WORD hotKey)
 
static void HOTKEY_SetRules (HOTKEY_INFO *infoPtr, WORD invComb, WORD invMod)
 
static LRESULT HOTKEY_Create (HOTKEY_INFO *infoPtr, const CREATESTRUCTW *lpcs)
 
static LRESULT HOTKEY_Destroy (HOTKEY_INFO *infoPtr)
 
static LRESULT HOTKEY_EraseBackground (const HOTKEY_INFO *infoPtr, HDC hdc)
 
static LRESULT HOTKEY_GetFont (const HOTKEY_INFO *infoPtr)
 
static LRESULT HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags)
 
static LRESULT HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, DWORD key)
 
static LRESULT HOTKEY_KillFocus (HOTKEY_INFO *infoPtr)
 
static LRESULT HOTKEY_LButtonDown (const HOTKEY_INFO *infoPtr)
 
static LRESULT HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs)
 
static LRESULT HOTKEY_SetFocus (HOTKEY_INFO *infoPtr)
 
static LRESULT WINAPI HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void HOTKEY_Register (void)
 
void HOTKEY_Unregister (void)
 

Variables

static const WCHAR HOTKEY_plussep [] = { ' ', '+', ' ' }
 

Macro Definition Documentation

◆ IsOnlySet

#define IsOnlySet (   flags)    (infoPtr->CurrMod == (flags))

Definition at line 64 of file hotkey.c.

Typedef Documentation

◆ HOTKEY_INFO

Function Documentation

◆ HOTKEY_Create()

static LRESULT HOTKEY_Create ( HOTKEY_INFO infoPtr,
const CREATESTRUCTW lpcs 
)
static

Definition at line 230 of file hotkey.c.

231{
232 infoPtr->hwndNotify = lpcs->hwndParent;
233
235
236 return 0;
237}
static LRESULT HOTKEY_SetFont(HOTKEY_INFO *infoPtr, HFONT hFont, BOOL redraw)
Definition: hotkey.c:440
HWND hwndNotify
Definition: hotkey.c:48
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define SYSTEM_FONT
Definition: wingdi.h:911

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_Destroy()

static LRESULT HOTKEY_Destroy ( HOTKEY_INFO infoPtr)
static

Definition at line 241 of file hotkey.c.

242{
243 /* free hotkey info data */
244 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
245 heap_free (infoPtr);
246 return 0;
247}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
HWND hwndSelf
Definition: hotkey.c:47
#define SetWindowLongPtrW
Definition: winuser.h:5358

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_DrawHotKey()

static void HOTKEY_DrawHotKey ( HOTKEY_INFO infoPtr,
HDC  hdc,
LPCWSTR  KeyName,
WORD  NameLen 
)
static

Definition at line 96 of file hotkey.c.

97{
98 SIZE TextSize;
99 INT nXStart, nYStart;
100 COLORREF clrOldText, clrOldBk;
101 HFONT hFontOld;
102
103 /* Make a gap from the frame */
104 nXStart = GetSystemMetrics(SM_CXBORDER);
105 nYStart = GetSystemMetrics(SM_CYBORDER);
106
107 hFontOld = SelectObject(hdc, infoPtr->hFont);
109 {
112 }
113 else
114 {
117 }
118
119 TextOutW(hdc, nXStart, nYStart, KeyName, NameLen);
120
121 /* Get the text width for the caret */
122 GetTextExtentPoint32W(hdc, KeyName, NameLen, &TextSize);
123 infoPtr->CaretPos = nXStart + TextSize.cx;
124
125 SetBkColor(hdc, clrOldBk);
126 SetTextColor(hdc, clrOldText);
127 SelectObject(hdc, hFontOld);
128
129 /* position the caret */
130 SetCaretPos(infoPtr->CaretPos, nYStart);
131}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
HDC hdc
Definition: main.c:9
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define WS_DISABLED
Definition: pedump.c:621
COLORREF clrBtnFace
Definition: comctl32.h:174
COLORREF clrWindow
Definition: comctl32.h:182
COLORREF clrGrayText
Definition: comctl32.h:184
COLORREF clrWindowText
Definition: comctl32.h:183
LONG cx
Definition: kdterminal.h:27
HFONT hFont
Definition: hotkey.c:49
INT CaretPos
Definition: hotkey.c:56
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SM_CYBORDER
Definition: winuser.h:968
#define SM_CXBORDER
Definition: winuser.h:967
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)
#define GWL_STYLE
Definition: winuser.h:855
int WINAPI GetSystemMetrics(_In_ int)

Referenced by HOTKEY_Refresh().

◆ HOTKEY_EraseBackground()

static LRESULT HOTKEY_EraseBackground ( const HOTKEY_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 251 of file hotkey.c.

252{
253 HBRUSH hBrush, hSolidBrush = NULL;
254 RECT rc;
255
257 hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrBtnFace);
258 else
259 {
260 hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLOREDIT,
261 (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
262 if (!hBrush)
263 hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrWindow);
264 }
265
266 GetClientRect (infoPtr->hwndSelf, &rc);
267
268 FillRect (hdc, &rc, hBrush);
269
270 if (hSolidBrush)
271 DeleteObject(hSolidBrush);
272
273 return -1;
274}
#define NULL
Definition: types.h:112
pKey DeleteObject()
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_CTLCOLOREDIT
Definition: winuser.h:1770
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_GetFont()

static LRESULT HOTKEY_GetFont ( const HOTKEY_INFO infoPtr)
inlinestatic

Definition at line 278 of file hotkey.c.

279{
280 return (LRESULT)infoPtr->hFont;
281}
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_GetHotKey()

static LRESULT HOTKEY_GetHotKey ( const HOTKEY_INFO infoPtr)
static

Definition at line 201 of file hotkey.c.

202{
203 TRACE("(infoPtr=%p) Modifiers: 0x%x, Virtual Key: %d\n", infoPtr,
204 HIBYTE(infoPtr->HotKey), LOBYTE(infoPtr->HotKey));
205 return (LRESULT)infoPtr->HotKey;
206}
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define TRACE(s)
Definition: solgame.cpp:4
WORD HotKey
Definition: hotkey.c:52

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_IsCombInv()

static BOOL HOTKEY_IsCombInv ( const HOTKEY_INFO infoPtr)
static

Definition at line 67 of file hotkey.c.

68{
69 TRACE("(infoPtr=%p)\n", infoPtr);
70 if((infoPtr->InvComb & HKCOMB_NONE) && !infoPtr->CurrMod)
71 return TRUE;
72 if((infoPtr->InvComb & HKCOMB_S) && IsOnlySet(HOTKEYF_SHIFT))
73 return TRUE;
74 if((infoPtr->InvComb & HKCOMB_C) && IsOnlySet(HOTKEYF_CONTROL))
75 return TRUE;
76 if((infoPtr->InvComb & HKCOMB_A) && IsOnlySet(HOTKEYF_ALT))
77 return TRUE;
78 if((infoPtr->InvComb & HKCOMB_SC) &&
80 return TRUE;
82 return TRUE;
83 if((infoPtr->InvComb & HKCOMB_CA) &&
85 return TRUE;
86 if((infoPtr->InvComb & HKCOMB_SCA) &&
88 return TRUE;
89
90 TRACE("() Modifiers are valid\n");
91 return FALSE;
92}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IsOnlySet(flags)
Definition: hotkey.c:64
#define HKCOMB_SCA
Definition: commctrl.h:2234
#define HKCOMB_S
Definition: commctrl.h:2228
#define HKCOMB_A
Definition: commctrl.h:2230
#define HKCOMB_SA
Definition: commctrl.h:2232
#define HOTKEYF_SHIFT
Definition: commctrl.h:2223
#define HKCOMB_CA
Definition: commctrl.h:2233
#define HKCOMB_C
Definition: commctrl.h:2229
#define HOTKEYF_CONTROL
Definition: commctrl.h:2224
#define HKCOMB_SC
Definition: commctrl.h:2231
#define HKCOMB_NONE
Definition: commctrl.h:2227
#define HOTKEYF_ALT
Definition: commctrl.h:2225
BYTE CurrMod
Definition: hotkey.c:55
WORD InvComb
Definition: hotkey.c:53

Referenced by HOTKEY_KeyDown(), and HOTKEY_Refresh().

◆ HOTKEY_KeyDown()

static LRESULT HOTKEY_KeyDown ( HOTKEY_INFO infoPtr,
DWORD  key,
DWORD  flags 
)
static

Definition at line 284 of file hotkey.c.

285{
286 WORD wOldHotKey;
287 BYTE bOldMod;
288
290 return 0;
291
292 TRACE("() Key: %d\n", key);
293
294 wOldHotKey = infoPtr->HotKey;
295 bOldMod = infoPtr->CurrMod;
296
297 /* If any key is Pressed, we have to reset the hotkey in the control */
298 infoPtr->HotKey = 0;
299
300 switch (key)
301 {
302 case VK_RETURN:
303 case VK_TAB:
304 case VK_SPACE:
305 case VK_DELETE:
306 case VK_ESCAPE:
307 case VK_BACK:
308 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
309 return DefWindowProcW (infoPtr->hwndSelf, WM_KEYDOWN, key, flags);
310
311 case VK_SHIFT:
312 infoPtr->CurrMod |= HOTKEYF_SHIFT;
313 break;
314 case VK_CONTROL:
315 infoPtr->CurrMod |= HOTKEYF_CONTROL;
316 break;
317 case VK_MENU:
318 infoPtr->CurrMod |= HOTKEYF_ALT;
319 break;
320
321 default:
322 if(HOTKEY_IsCombInv(infoPtr))
323 infoPtr->HotKey = MAKEWORD(key, infoPtr->InvMod);
324 else
325 infoPtr->HotKey = MAKEWORD(key, infoPtr->CurrMod);
326 infoPtr->ScanCode = flags;
327 break;
328 }
329
330 if ((wOldHotKey != infoPtr->HotKey) || (bOldMod != infoPtr->CurrMod))
331 {
332 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
333
334 /* send EN_CHANGE notification */
337 (LPARAM)infoPtr->hwndSelf);
338 }
339
340 return 0;
341}
static BOOL HOTKEY_IsCombInv(const HOTKEY_INFO *infoPtr)
Definition: hotkey.c:67
unsigned short WORD
Definition: ntddk_ex.h:93
GLbitfield flags
Definition: glext.h:7161
Definition: copy.c:22
WORD InvMod
Definition: hotkey.c:54
DWORD ScanCode
Definition: hotkey.c:57
#define MAKEWORD(a, b)
Definition: typedefs.h:248
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define VK_TAB
Definition: winuser.h:2202
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define VK_SPACE
Definition: winuser.h:2222
#define WM_COMMAND
Definition: winuser.h:1743
#define VK_CONTROL
Definition: winuser.h:2206
#define VK_RETURN
Definition: winuser.h:2204
#define VK_BACK
Definition: winuser.h:2201
int WINAPI GetDlgCtrlID(_In_ HWND)
#define VK_SHIFT
Definition: winuser.h:2205
#define VK_DELETE
Definition: winuser.h:2236
#define WM_KEYDOWN
Definition: winuser.h:1718
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define VK_ESCAPE
Definition: winuser.h:2217
#define VK_MENU
Definition: winuser.h:2207
#define EN_CHANGE
Definition: winuser.h:2025
unsigned char BYTE
Definition: xxhash.c:193

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_KeyUp()

static LRESULT HOTKEY_KeyUp ( HOTKEY_INFO infoPtr,
DWORD  key 
)
static

Definition at line 345 of file hotkey.c.

346{
347 BYTE bOldMod;
348
350 return 0;
351
352 TRACE("() Key: %d\n", key);
353
354 bOldMod = infoPtr->CurrMod;
355
356 switch (key)
357 {
358 case VK_SHIFT:
359 infoPtr->CurrMod &= ~HOTKEYF_SHIFT;
360 break;
361 case VK_CONTROL:
362 infoPtr->CurrMod &= ~HOTKEYF_CONTROL;
363 break;
364 case VK_MENU:
365 infoPtr->CurrMod &= ~HOTKEYF_ALT;
366 break;
367 default:
368 return 1;
369 }
370
371 if (bOldMod != infoPtr->CurrMod)
372 {
373 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
374
375 /* send EN_CHANGE notification */
378 (LPARAM)infoPtr->hwndSelf);
379 }
380
381 return 0;
382}

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_KillFocus()

static LRESULT HOTKEY_KillFocus ( HOTKEY_INFO infoPtr)
static

Definition at line 386 of file hotkey.c.

387{
388 infoPtr->bFocus = FALSE;
389 DestroyCaret ();
390
391 return 0;
392}
BOOL bFocus
Definition: hotkey.c:50
BOOL WINAPI DestroyCaret(void)
Definition: caret.c:35

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_LButtonDown()

static LRESULT HOTKEY_LButtonDown ( const HOTKEY_INFO infoPtr)
static

Definition at line 396 of file hotkey.c.

397{
398 if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_DISABLED))
399 SetFocus (infoPtr->hwndSelf);
400
401 return 0;
402}
HWND WINAPI SetFocus(_In_opt_ HWND)

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_NCCreate()

static LRESULT HOTKEY_NCCreate ( HWND  hwnd,
const CREATESTRUCTW lpcs 
)
inlinestatic

Definition at line 406 of file hotkey.c.

407{
408 HOTKEY_INFO *infoPtr;
409 DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
411 dwExStyle | WS_EX_CLIENTEDGE);
412
413 /* allocate memory for info structure */
414 infoPtr = heap_alloc_zero (sizeof(*infoPtr));
415 SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
416
417 /* initialize info structure */
418 infoPtr->HotKey = infoPtr->InvComb = infoPtr->InvMod = infoPtr->CurrMod = 0;
420 infoPtr->hwndSelf = hwnd;
422
423 return DefWindowProcW (infoPtr->hwndSelf, WM_NCCREATE, 0, (LPARAM)lpcs);
424}
#define HKY_NONE
Definition: comctl32.h:106
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR strNone[15]
Definition: hotkey.c:58
uint32_t DWORD_PTR
Definition: typedefs.h:65
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define WM_NCCREATE
Definition: winuser.h:1686
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define GWL_EXSTYLE
Definition: winuser.h:854

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_Paint()

static void HOTKEY_Paint ( HOTKEY_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 188 of file hotkey.c.

189{
190 if (hdc)
191 HOTKEY_Refresh(infoPtr, hdc);
192 else {
193 PAINTSTRUCT ps;
194 hdc = BeginPaint (infoPtr->hwndSelf, &ps);
195 HOTKEY_Refresh (infoPtr, hdc);
196 EndPaint (infoPtr->hwndSelf, &ps);
197 }
198}
static void HOTKEY_Refresh(HOTKEY_INFO *infoPtr, HDC hdc)
Definition: hotkey.c:135
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_Refresh()

static void HOTKEY_Refresh ( HOTKEY_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 135 of file hotkey.c.

136{
137 WCHAR KeyName[64];
138 WORD NameLen = 0;
139 BYTE Modifier;
140
141 TRACE("(infoPtr=%p hdc=%p)\n", infoPtr, hdc);
142
143 if(!infoPtr->CurrMod && !infoPtr->HotKey) {
144 HOTKEY_DrawHotKey (infoPtr, hdc, infoPtr->strNone, lstrlenW(infoPtr->strNone));
145 return;
146 }
147
148 if(infoPtr->HotKey)
149 Modifier = HIBYTE(infoPtr->HotKey);
150 else if(HOTKEY_IsCombInv(infoPtr))
151 Modifier = infoPtr->InvMod;
152 else
153 Modifier = infoPtr->CurrMod;
154
155 if(Modifier & HOTKEYF_CONTROL) {
157 KeyName, 64);
158 NameLen = lstrlenW(KeyName);
159 memcpy(&KeyName[NameLen], HOTKEY_plussep, sizeof(HOTKEY_plussep));
160 NameLen += 3;
161 }
162 if(Modifier & HOTKEYF_SHIFT) {
164 &KeyName[NameLen], 64 - NameLen);
165 NameLen = lstrlenW(KeyName);
166 memcpy(&KeyName[NameLen], HOTKEY_plussep, sizeof(HOTKEY_plussep));
167 NameLen += 3;
168 }
169 if(Modifier & HOTKEYF_ALT) {
171 &KeyName[NameLen], 64 - NameLen);
172 NameLen = lstrlenW(KeyName);
173 memcpy(&KeyName[NameLen], HOTKEY_plussep, sizeof(HOTKEY_plussep));
174 NameLen += 3;
175 }
176
177 if(infoPtr->HotKey) {
178 GetKeyNameTextW(infoPtr->ScanCode, &KeyName[NameLen], 64 - NameLen);
179 NameLen = lstrlenW(KeyName);
180 }
181 else
182 KeyName[NameLen] = 0;
183
184 HOTKEY_DrawHotKey (infoPtr, hdc, KeyName, NameLen);
185}
static void HOTKEY_DrawHotKey(HOTKEY_INFO *infoPtr, HDC hdc, LPCWSTR KeyName, WORD NameLen)
Definition: hotkey.c:96
static const WCHAR HOTKEY_plussep[]
Definition: hotkey.c:61
#define lstrlenW
Definition: compat.h:750
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
UINT WINAPI MapVirtualKeyW(_In_ UINT, _In_ UINT)
int WINAPI GetKeyNameTextW(_In_ LONG lParam, _Out_writes_(cchSize) LPWSTR lpString, _In_ int cchSize)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by HOTKEY_Paint().

◆ HOTKEY_Register()

void HOTKEY_Register ( void  )

Definition at line 541 of file hotkey.c.

542{
543 WNDCLASSW wndClass;
544
545 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
546 wndClass.style = CS_GLOBALCLASS;
548 wndClass.cbClsExtra = 0;
549 wndClass.cbWndExtra = sizeof(HOTKEY_INFO *);
550 wndClass.hCursor = 0;
551 wndClass.hbrBackground = 0;
552 wndClass.lpszClassName = HOTKEY_CLASSW;
553
554 RegisterClassW (&wndClass);
555}
static LRESULT WINAPI HOTKEY_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hotkey.c:466
#define HOTKEY_CLASSW
Definition: commctrl.h:2241
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
#define ZeroMemory
Definition: winbase.h:1736
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CS_GLOBALCLASS
Definition: winuser.h:652

Referenced by DllMain().

◆ HOTKEY_SetFocus()

static LRESULT HOTKEY_SetFocus ( HOTKEY_INFO infoPtr)
static

Definition at line 427 of file hotkey.c.

428{
429 infoPtr->bFocus = TRUE;
430
431 CreateCaret (infoPtr->hwndSelf, NULL, 1, infoPtr->nHeight);
433 ShowCaret (infoPtr->hwndSelf);
434
435 return 0;
436}
INT nHeight
Definition: hotkey.c:51
BOOL WINAPI ShowCaret(_In_opt_ HWND)
BOOL WINAPI CreateCaret(_In_ HWND, _In_opt_ HBITMAP, _In_ int, _In_ int)

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_SetFont()

static LRESULT HOTKEY_SetFont ( HOTKEY_INFO infoPtr,
HFONT  hFont,
BOOL  redraw 
)
static

Definition at line 440 of file hotkey.c.

441{
443 HDC hdc;
444 HFONT hOldFont = 0;
445
446 infoPtr->hFont = hFont;
447
448 hdc = GetDC (infoPtr->hwndSelf);
449 if (infoPtr->hFont)
450 hOldFont = SelectObject (hdc, infoPtr->hFont);
451
453 infoPtr->nHeight = tm.tmHeight;
454
455 if (infoPtr->hFont)
456 SelectObject (hdc, hOldFont);
457 ReleaseDC (infoPtr->hwndSelf, hdc);
458
459 if (redraw)
460 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
461
462 return 0;
463}
HFONT hFont
Definition: main.c:53
static HDC
Definition: imagelist.c:88
void redraw(int x, int y, int cx, int cy)
Definition: qtewin.cpp:1248
Definition: time.h:68
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by HOTKEY_Create(), and HOTKEY_WindowProc().

◆ HOTKEY_SetHotKey()

static void HOTKEY_SetHotKey ( HOTKEY_INFO infoPtr,
WORD  hotKey 
)
static

Definition at line 209 of file hotkey.c.

210{
211 infoPtr->HotKey = hotKey;
212 infoPtr->ScanCode =
213 MAKELPARAM(0, MapVirtualKeyW(LOBYTE(infoPtr->HotKey), 0));
214 TRACE("(infoPtr=%p hotKey=%x) Modifiers: 0x%x, Virtual Key: %d\n", infoPtr,
215 hotKey, HIBYTE(infoPtr->HotKey), LOBYTE(infoPtr->HotKey));
216 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
217}

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_SetRules()

static void HOTKEY_SetRules ( HOTKEY_INFO infoPtr,
WORD  invComb,
WORD  invMod 
)
static

Definition at line 220 of file hotkey.c.

221{
222 infoPtr->InvComb = invComb;
223 infoPtr->InvMod = invMod;
224 TRACE("(infoPtr=%p) Invalid Modifiers: 0x%x, If Invalid: 0x%x\n", infoPtr,
225 infoPtr->InvComb, infoPtr->InvMod);
226}

Referenced by HOTKEY_WindowProc().

◆ HOTKEY_Unregister()

void HOTKEY_Unregister ( void  )

Definition at line 559 of file hotkey.c.

560{
562}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ HOTKEY_WindowProc()

static LRESULT WINAPI HOTKEY_WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 466 of file hotkey.c.

467{
469 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hwnd, uMsg, wParam, lParam);
470 if (!infoPtr && (uMsg != WM_NCCREATE))
471 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
472 switch (uMsg)
473 {
474 case HKM_GETHOTKEY:
475 return HOTKEY_GetHotKey (infoPtr);
476 case HKM_SETHOTKEY:
477 HOTKEY_SetHotKey (infoPtr, (WORD)wParam);
478 break;
479 case HKM_SETRULES:
480 HOTKEY_SetRules (infoPtr, (WORD)wParam, (WORD)lParam);
481 break;
482
483 case WM_CHAR:
484 case WM_SYSCHAR:
485 return HOTKEY_KeyDown (infoPtr, MapVirtualKeyW(LOBYTE(HIWORD(lParam)), 1), lParam);
486
487 case WM_CREATE:
488 return HOTKEY_Create (infoPtr, (LPCREATESTRUCTW)lParam);
489
490 case WM_DESTROY:
491 return HOTKEY_Destroy (infoPtr);
492
493 case WM_ERASEBKGND:
494 return HOTKEY_EraseBackground (infoPtr, (HDC)wParam);
495
496 case WM_GETDLGCODE:
498
499 case WM_GETFONT:
500 return HOTKEY_GetFont (infoPtr);
501
502 case WM_KEYDOWN:
503 case WM_SYSKEYDOWN:
504 return HOTKEY_KeyDown (infoPtr, wParam, lParam);
505
506 case WM_KEYUP:
507 case WM_SYSKEYUP:
508 return HOTKEY_KeyUp (infoPtr, wParam);
509
510 case WM_KILLFOCUS:
511 return HOTKEY_KillFocus (infoPtr);
512
513 case WM_LBUTTONDOWN:
514 return HOTKEY_LButtonDown (infoPtr);
515
516 case WM_NCCREATE:
518
519 case WM_PRINTCLIENT:
520 case WM_PAINT:
521 HOTKEY_Paint(infoPtr, (HDC)wParam);
522 return 0;
523
524 case WM_SETFOCUS:
525 return HOTKEY_SetFocus (infoPtr);
526
527 case WM_SETFONT:
528 return HOTKEY_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
529
530 default:
531 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
532 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
533 uMsg, wParam, lParam);
534 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
535 }
536 return 0;
537}
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1755
static void HOTKEY_Paint(HOTKEY_INFO *infoPtr, HDC hdc)
Definition: hotkey.c:188
static LRESULT HOTKEY_GetFont(const HOTKEY_INFO *infoPtr)
Definition: hotkey.c:278
static LRESULT HOTKEY_GetHotKey(const HOTKEY_INFO *infoPtr)
Definition: hotkey.c:201
static LRESULT HOTKEY_KeyDown(HOTKEY_INFO *infoPtr, DWORD key, DWORD flags)
Definition: hotkey.c:284
static LRESULT HOTKEY_LButtonDown(const HOTKEY_INFO *infoPtr)
Definition: hotkey.c:396
static LRESULT HOTKEY_KeyUp(HOTKEY_INFO *infoPtr, DWORD key)
Definition: hotkey.c:345
static LRESULT HOTKEY_EraseBackground(const HOTKEY_INFO *infoPtr, HDC hdc)
Definition: hotkey.c:251
static void HOTKEY_SetHotKey(HOTKEY_INFO *infoPtr, WORD hotKey)
Definition: hotkey.c:209
static LRESULT HOTKEY_NCCreate(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: hotkey.c:406
static LRESULT HOTKEY_Destroy(HOTKEY_INFO *infoPtr)
Definition: hotkey.c:241
static LRESULT HOTKEY_Create(HOTKEY_INFO *infoPtr, const CREATESTRUCTW *lpcs)
Definition: hotkey.c:230
static LRESULT HOTKEY_KillFocus(HOTKEY_INFO *infoPtr)
Definition: hotkey.c:386
static void HOTKEY_SetRules(HOTKEY_INFO *infoPtr, WORD invComb, WORD invMod)
Definition: hotkey.c:220
static LRESULT HOTKEY_SetFocus(HOTKEY_INFO *infoPtr)
Definition: hotkey.c:427
#define WM_APP
Definition: eventvwr.h:73
#define LOWORD(l)
Definition: pedump.c:82
#define HKM_SETHOTKEY
Definition: commctrl.h:2236
#define HKM_SETRULES
Definition: commctrl.h:2238
#define HKM_GETHOTKEY
Definition: commctrl.h:2237
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_PAINT
Definition: winuser.h:1623
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define WM_KEYUP
Definition: winuser.h:1719
#define WM_CREATE
Definition: winuser.h:1611
#define DLGC_WANTCHARS
Definition: winuser.h:2621
#define WM_SETFOCUS
Definition: winuser.h:1616
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_GETFONT
Definition: winuser.h:1654
#define WM_SYSCHAR
Definition: winuser.h:1724
#define WM_SETFONT
Definition: winuser.h:1653
#define DLGC_WANTARROWS
Definition: winuser.h:2613
#define WM_SYSKEYUP
Definition: winuser.h:1723
#define WM_CHAR
Definition: winuser.h:1720
#define WM_USER
Definition: winuser.h:1898
#define WM_DESTROY
Definition: winuser.h:1612
#define WM_KILLFOCUS
Definition: winuser.h:1617
#define WM_SYSKEYDOWN
Definition: winuser.h:1722
#define WM_GETDLGCODE
Definition: winuser.h:1692

Referenced by HOTKEY_Register().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( hotkey  )

Variable Documentation

◆ HOTKEY_plussep

const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' }
static

Definition at line 61 of file hotkey.c.

Referenced by HOTKEY_Refresh().