- Update to trunk
[reactos.git] / dll / win32 / user32 / windows / input.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /*
20 * PROJECT: ReactOS user32.dll
21 * FILE: dll/win32/user32/windows/input.c
22 * PURPOSE: Input
23 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
24 * UPDATE HISTORY:
25 * 09-05-2001 CSH Created
26 */
27
28 /* INCLUDES ******************************************************************/
29
30 #include <user32.h>
31
32 #include <wine/debug.h>
33 WINE_DEFAULT_DEBUG_CHANNEL(user32);
34
35 /* GLOBALS *******************************************************************/
36
37
38
39 /* FUNCTIONS *****************************************************************/
40
41
42 /*
43 * @implemented
44 */
45 BOOL
46 WINAPI
47 DragDetect(
48 HWND hWnd,
49 POINT pt)
50 {
51 #if 0
52 return NtUserDragDetect(hWnd, pt);
53 #else
54 MSG msg;
55 RECT rect;
56 POINT tmp;
57 ULONG dx = GetSystemMetrics(SM_CXDRAG);
58 ULONG dy = GetSystemMetrics(SM_CYDRAG);
59
60 rect.left = pt.x - dx;
61 rect.right = pt.x + dx;
62 rect.top = pt.y - dy;
63 rect.bottom = pt.y + dy;
64
65 SetCapture(hWnd);
66
67 for (;;)
68 {
69 while (
70 PeekMessageW(&msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) ||
71 PeekMessageW(&msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE)
72 )
73 {
74 if (msg.message == WM_LBUTTONUP)
75 {
76 ReleaseCapture();
77 return FALSE;
78 }
79 if (msg.message == WM_MOUSEMOVE)
80 {
81 tmp.x = LOWORD(msg.lParam);
82 tmp.y = HIWORD(msg.lParam);
83 if (!PtInRect(&rect, tmp))
84 {
85 ReleaseCapture();
86 return TRUE;
87 }
88 }
89 if (msg.message == WM_KEYDOWN)
90 {
91 if (msg.wParam == VK_ESCAPE)
92 {
93 ReleaseCapture();
94 return TRUE;
95 }
96 }
97 }
98 WaitMessage();
99 }
100 return 0;
101 #endif
102 }
103
104
105 /*
106 * @implemented
107 */
108 BOOL WINAPI
109 EnableWindow(HWND hWnd,
110 BOOL bEnable)
111 {
112 // This will soon be moved to win32k.
113 BOOL Update;
114 LONG Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
115 /* check if updating is needed */
116 UINT bIsDisabled = (Style & WS_DISABLED);
117 Update = bIsDisabled;
118
119 if (bEnable)
120 {
121 Style &= ~WS_DISABLED;
122 }
123 else
124 {
125 Update = !bIsDisabled;
126
127 SendMessageW( hWnd, WM_CANCELMODE, 0, 0);
128
129 /* Remove keyboard focus from that window if it had focus */
130 if (hWnd == GetFocus())
131 {
132 SetFocus(NULL);
133 }
134 Style |= WS_DISABLED;
135 }
136
137 NtUserSetWindowLong(hWnd, GWL_STYLE, Style, FALSE);
138
139 if (Update)
140 {
141 IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, hWnd, OBJID_WINDOW, CHILDID_SELF, 0);
142 SendMessageW(hWnd, WM_ENABLE, (LPARAM)bEnable, 0);
143 }
144 // Return nonzero if it was disabled, or zero if it wasn't:
145 return bIsDisabled;
146 }
147
148
149 /*
150 * @implemented
151 */
152 SHORT WINAPI
153 GetAsyncKeyState(int vKey)
154 {
155 if (vKey < 0 || vKey > 256)
156 return 0;
157 return (SHORT) NtUserGetAsyncKeyState((DWORD) vKey);
158 }
159
160
161 /*
162 * @implemented
163 */
164 HKL WINAPI
165 GetKeyboardLayout(DWORD idThread)
166 {
167 return (HKL)NtUserCallOneParam((DWORD_PTR) idThread, ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT);
168 }
169
170
171 /*
172 * @implemented
173 */
174 UINT WINAPI
175 GetKBCodePage(VOID)
176 {
177 return GetOEMCP();
178 }
179
180
181 /*
182 * @implemented
183 */
184 int WINAPI
185 GetKeyNameTextA(LONG lParam,
186 LPSTR lpString,
187 int nSize)
188 {
189 LPWSTR intermediateString =
190 HeapAlloc(GetProcessHeap(),0,nSize * sizeof(WCHAR));
191 int ret = 0;
192 UINT wstrLen = 0;
193 BOOL defChar = FALSE;
194
195 if( !intermediateString ) return 0;
196 ret = GetKeyNameTextW(lParam,intermediateString,nSize);
197 if( ret == 0 ) { lpString[0] = 0; return 0; }
198
199 wstrLen = wcslen( intermediateString );
200 ret = WideCharToMultiByte(CP_ACP, 0,
201 intermediateString, wstrLen,
202 lpString, nSize, ".", &defChar );
203 lpString[ret] = 0;
204 HeapFree(GetProcessHeap(),0,intermediateString);
205
206 return ret;
207 }
208
209 /*
210 * @implemented
211 */
212 int WINAPI
213 GetKeyNameTextW(LONG lParam,
214 LPWSTR lpString,
215 int nSize)
216 {
217 return NtUserGetKeyNameText( lParam, lpString, nSize );
218 }
219
220
221 /*
222 * @implemented
223 */
224 SHORT WINAPI
225 GetKeyState(int nVirtKey)
226 {
227 return (SHORT) NtUserGetKeyState((DWORD) nVirtKey);
228 }
229
230
231 /*
232 * @implemented
233 */
234 BOOL WINAPI
235 GetKeyboardLayoutNameA(LPSTR pwszKLID)
236 {
237 WCHAR buf[KL_NAMELENGTH];
238
239 if (GetKeyboardLayoutNameW(buf))
240 return WideCharToMultiByte( CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH, NULL, NULL ) != 0;
241 return FALSE;
242 }
243
244
245 /*
246 * @implemented
247 */
248 BOOL WINAPI
249 GetKeyboardLayoutNameW(LPWSTR pwszKLID)
250 {
251 return NtUserGetKeyboardLayoutName( pwszKLID );
252 }
253
254
255 /*
256 * @implemented
257 */
258 int WINAPI
259 GetKeyboardType(int nTypeFlag)
260 {
261 return (int)NtUserCallOneParam((DWORD_PTR) nTypeFlag, ONEPARAM_ROUTINE_GETKEYBOARDTYPE);
262 }
263
264
265 /*
266 * @implemented
267 */
268 BOOL WINAPI
269 GetLastInputInfo(PLASTINPUTINFO plii)
270 {
271 return NtUserGetLastInputInfo(plii);
272 }
273
274
275 /*
276 * @implemented
277 */
278 HKL WINAPI
279 LoadKeyboardLayoutA(LPCSTR pwszKLID,
280 UINT Flags)
281 {
282 return NtUserLoadKeyboardLayoutEx( NULL, 0, NULL, NULL, NULL,
283 strtoul(pwszKLID, NULL, 16),
284 Flags);
285 }
286
287
288 /*
289 * @implemented
290 */
291 HKL WINAPI
292 LoadKeyboardLayoutW(LPCWSTR pwszKLID,
293 UINT Flags)
294 {
295 // Look at revision 25596 to see how it's done in windows.
296 // We will do things our own way. Also be compatible too!
297 return NtUserLoadKeyboardLayoutEx( NULL, 0, NULL, NULL, NULL,
298 wcstoul(pwszKLID, NULL, 16),
299 Flags);
300 }
301
302
303 /*
304 * @implemented
305 */
306 UINT WINAPI
307 MapVirtualKeyA(UINT uCode,
308 UINT uMapType)
309 {
310 return MapVirtualKeyExA( uCode, uMapType, GetKeyboardLayout( 0 ) );
311 }
312
313
314 /*
315 * @implemented
316 */
317 UINT WINAPI
318 MapVirtualKeyExA(UINT uCode,
319 UINT uMapType,
320 HKL dwhkl)
321 {
322 return MapVirtualKeyExW( uCode, uMapType, dwhkl );
323 }
324
325
326 /*
327 * @implemented
328 */
329 UINT WINAPI
330 MapVirtualKeyExW(UINT uCode,
331 UINT uMapType,
332 HKL dwhkl)
333 {
334 return NtUserMapVirtualKeyEx( uCode, uMapType, 0, dwhkl );
335 }
336
337
338 /*
339 * @implemented
340 */
341 UINT WINAPI
342 MapVirtualKeyW(UINT uCode,
343 UINT uMapType)
344 {
345 return MapVirtualKeyExW( uCode, uMapType, GetKeyboardLayout( 0 ) );
346 }
347
348
349 /*
350 * @implemented
351 */
352 DWORD WINAPI
353 OemKeyScan(WORD wOemChar)
354 {
355 WCHAR p;
356 SHORT Vk;
357 UINT Scan;
358
359 MultiByteToWideChar(CP_OEMCP, 0, (PCSTR)&wOemChar, 1, &p, 1);
360 Vk = VkKeyScanW(p);
361 Scan = MapVirtualKeyW((Vk & 0x00ff), 0);
362 if(!Scan) return -1;
363 /*
364 Page 450-1, MS W2k SuperBible by SAMS. Return, low word has the
365 scan code and high word has the shift state.
366 */
367 return ((Vk & 0xff00) << 8) | Scan;
368 }
369
370
371 /*
372 * @implemented
373 */
374 BOOL WINAPI
375 SetDoubleClickTime(UINT uInterval)
376 {
377 return (BOOL)NtUserSystemParametersInfo(SPI_SETDOUBLECLICKTIME,
378 uInterval,
379 NULL,
380 0);
381 }
382
383
384 /*
385 * @implemented
386 */
387 BOOL
388 WINAPI
389 SwapMouseButton(
390 BOOL fSwap)
391 {
392 return NtUserSwapMouseButton(fSwap);
393 }
394
395
396 /*
397 * @implemented
398 */
399 int WINAPI
400 ToAscii(UINT uVirtKey,
401 UINT uScanCode,
402 CONST BYTE *lpKeyState,
403 LPWORD lpChar,
404 UINT uFlags)
405 {
406 return ToAsciiEx(uVirtKey, uScanCode, lpKeyState, lpChar, uFlags, 0);
407 }
408
409
410 /*
411 * @implemented
412 */
413 int WINAPI
414 ToAsciiEx(UINT uVirtKey,
415 UINT uScanCode,
416 CONST BYTE *lpKeyState,
417 LPWORD lpChar,
418 UINT uFlags,
419 HKL dwhkl)
420 {
421 WCHAR UniChars[2];
422 int Ret, CharCount;
423
424 Ret = ToUnicodeEx(uVirtKey, uScanCode, lpKeyState, UniChars, 2, uFlags, dwhkl);
425 CharCount = (Ret < 0 ? 1 : Ret);
426 WideCharToMultiByte(CP_ACP, 0, UniChars, CharCount, (LPSTR) lpChar, 2, NULL, NULL);
427
428 return Ret;
429 }
430
431
432 /*
433 * @implemented
434 */
435 int WINAPI
436 ToUnicode(UINT wVirtKey,
437 UINT wScanCode,
438 CONST BYTE *lpKeyState,
439 LPWSTR pwszBuff,
440 int cchBuff,
441 UINT wFlags)
442 {
443 return ToUnicodeEx( wVirtKey, wScanCode, lpKeyState, pwszBuff, cchBuff,
444 wFlags, 0 );
445 }
446
447
448 /*
449 * @implemented
450 */
451 int WINAPI
452 ToUnicodeEx(UINT wVirtKey,
453 UINT wScanCode,
454 CONST BYTE *lpKeyState,
455 LPWSTR pwszBuff,
456 int cchBuff,
457 UINT wFlags,
458 HKL dwhkl)
459 {
460 return NtUserToUnicodeEx( wVirtKey, wScanCode, (PBYTE)lpKeyState, pwszBuff, cchBuff,
461 wFlags, dwhkl );
462 }
463
464
465
466 /*
467 * @implemented
468 */
469 SHORT WINAPI
470 VkKeyScanA(CHAR ch)
471 {
472 WCHAR wChar;
473
474 if (IsDBCSLeadByte(ch)) return -1;
475
476 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
477 return VkKeyScanW(wChar);
478 }
479
480
481 /*
482 * @implemented
483 */
484 SHORT WINAPI
485 VkKeyScanExA(CHAR ch,
486 HKL dwhkl)
487 {
488 WCHAR wChar;
489
490 if (IsDBCSLeadByte(ch)) return -1;
491
492 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wChar, 1);
493 return VkKeyScanExW(wChar, dwhkl);
494 }
495
496
497 /*
498 * @implemented
499 */
500 SHORT WINAPI
501 VkKeyScanExW(WCHAR ch,
502 HKL dwhkl)
503 {
504 return (SHORT) NtUserVkKeyScanEx(ch, dwhkl, TRUE);
505 }
506
507
508 /*
509 * @implemented
510 */
511 SHORT WINAPI
512 VkKeyScanW(WCHAR ch)
513 {
514 return (SHORT) NtUserVkKeyScanEx(ch, 0, FALSE);
515 }
516
517
518 /*
519 * @implemented
520 */
521 VOID
522 WINAPI
523 keybd_event(
524 BYTE bVk,
525 BYTE bScan,
526 DWORD dwFlags,
527 ULONG_PTR dwExtraInfo)
528
529
530 {
531 INPUT Input;
532
533 Input.type = INPUT_KEYBOARD;
534 Input.ki.wVk = bVk;
535 Input.ki.wScan = bScan;
536 Input.ki.dwFlags = dwFlags;
537 Input.ki.time = 0;
538 Input.ki.dwExtraInfo = dwExtraInfo;
539
540 NtUserSendInput(1, &Input, sizeof(INPUT));
541 }
542
543
544 /*
545 * @implemented
546 */
547 VOID
548 WINAPI
549 mouse_event(
550 DWORD dwFlags,
551 DWORD dx,
552 DWORD dy,
553 DWORD dwData,
554 ULONG_PTR dwExtraInfo)
555 {
556 INPUT Input;
557
558 Input.type = INPUT_MOUSE;
559 Input.mi.dx = dx;
560 Input.mi.dy = dy;
561 Input.mi.mouseData = dwData;
562 Input.mi.dwFlags = dwFlags;
563 Input.mi.time = 0;
564 Input.mi.dwExtraInfo = dwExtraInfo;
565
566 NtUserSendInput(1, &Input, sizeof(INPUT));
567 }
568
569
570 /***********************************************************************
571 * get_key_state
572 */
573 static WORD get_key_state(void)
574 {
575 WORD ret = 0;
576
577 if (GetSystemMetrics( SM_SWAPBUTTON ))
578 {
579 if (GetAsyncKeyState(VK_RBUTTON) & 0x80) ret |= MK_LBUTTON;
580 if (GetAsyncKeyState(VK_LBUTTON) & 0x80) ret |= MK_RBUTTON;
581 }
582 else
583 {
584 if (GetAsyncKeyState(VK_LBUTTON) & 0x80) ret |= MK_LBUTTON;
585 if (GetAsyncKeyState(VK_RBUTTON) & 0x80) ret |= MK_RBUTTON;
586 }
587 if (GetAsyncKeyState(VK_MBUTTON) & 0x80) ret |= MK_MBUTTON;
588 if (GetAsyncKeyState(VK_SHIFT) & 0x80) ret |= MK_SHIFT;
589 if (GetAsyncKeyState(VK_CONTROL) & 0x80) ret |= MK_CONTROL;
590 if (GetAsyncKeyState(VK_XBUTTON1) & 0x80) ret |= MK_XBUTTON1;
591 if (GetAsyncKeyState(VK_XBUTTON2) & 0x80) ret |= MK_XBUTTON2;
592 return ret;
593 }
594
595 static void CALLBACK TrackMouseEventProc(HWND hwndUnused, UINT uMsg, UINT_PTR idEvent,
596 DWORD dwTime)
597 {
598 POINT pos;
599 POINT posClient;
600 HWND hwnd;
601 INT hoverwidth = 0, hoverheight = 0;
602 RECT client;
603 PUSER32_TRACKINGLIST ptracking_info;
604
605 ptracking_info = & User32GetThreadData()->tracking_info;
606
607 GetCursorPos(&pos);
608 hwnd = WindowFromPoint(pos);
609
610 SystemParametersInfoW(SPI_GETMOUSEHOVERWIDTH, 0, &hoverwidth, 0);
611 SystemParametersInfoW(SPI_GETMOUSEHOVERHEIGHT, 0, &hoverheight, 0);
612
613 /* see if this tracking event is looking for TME_LEAVE and that the */
614 /* mouse has left the window */
615 if (ptracking_info->tme.dwFlags & TME_LEAVE)
616 {
617 if (ptracking_info->tme.hwndTrack != hwnd)
618 {
619 if (ptracking_info->tme.dwFlags & TME_NONCLIENT)
620 {
621 PostMessageW(ptracking_info->tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
622 }
623 else
624 {
625 PostMessageW(ptracking_info->tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
626 }
627
628 /* remove the TME_LEAVE flag */
629 ptracking_info->tme.dwFlags &= ~TME_LEAVE;
630 }
631 else
632 {
633 GetClientRect(hwnd, &client);
634 MapWindowPoints(hwnd, NULL, (LPPOINT)&client, 2);
635 if (PtInRect(&client, pos))
636 {
637 if (ptracking_info->tme.dwFlags & TME_NONCLIENT)
638 {
639 PostMessageW(ptracking_info->tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
640 /* remove the TME_LEAVE flag */
641 ptracking_info->tme.dwFlags &= ~TME_LEAVE;
642 }
643 }
644 else
645 {
646 if (!(ptracking_info->tme.dwFlags & TME_NONCLIENT))
647 {
648 PostMessageW(ptracking_info->tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
649 /* remove the TME_LEAVE flag */
650 ptracking_info->tme.dwFlags &= ~TME_LEAVE;
651 }
652 }
653 }
654 }
655
656 /* see if we are tracking hovering for this hwnd */
657 if (ptracking_info->tme.dwFlags & TME_HOVER)
658 {
659 /* has the cursor moved outside the rectangle centered around pos? */
660 if ((abs(pos.x - ptracking_info->pos.x) > (hoverwidth / 2.0)) ||
661 (abs(pos.y - ptracking_info->pos.y) > (hoverheight / 2.0)))
662 {
663 /* record this new position as the current position and reset */
664 /* the iHoverTime variable to 0 */
665 ptracking_info->pos = pos;
666 }
667 else
668 {
669 posClient.x = pos.x;
670 posClient.y = pos.y;
671 ScreenToClient(hwnd, &posClient);
672
673 if (ptracking_info->tme.dwFlags & TME_NONCLIENT)
674 {
675 PostMessageW(ptracking_info->tme.hwndTrack, WM_NCMOUSEHOVER,
676 get_key_state(), MAKELPARAM( posClient.x, posClient.y ));
677 }
678 else
679 {
680 PostMessageW(ptracking_info->tme.hwndTrack, WM_MOUSEHOVER,
681 get_key_state(), MAKELPARAM( posClient.x, posClient.y ));
682 }
683
684 /* stop tracking mouse hover */
685 ptracking_info->tme.dwFlags &= ~TME_HOVER;
686 }
687 }
688
689 /* stop the timer if the tracking list is empty */
690 if (!(ptracking_info->tme.dwFlags & (TME_HOVER | TME_LEAVE)))
691 {
692 KillTimer(0, ptracking_info->timer);
693 RtlZeroMemory(ptracking_info,sizeof(USER32_TRACKINGLIST));
694 }
695 }
696
697
698 /***********************************************************************
699 * TrackMouseEvent [USER32]
700 *
701 * Requests notification of mouse events
702 *
703 * During mouse tracking WM_MOUSEHOVER or WM_MOUSELEAVE events are posted
704 * to the hwnd specified in the ptme structure. After the event message
705 * is posted to the hwnd, the entry in the queue is removed.
706 *
707 * If the current hwnd isn't ptme->hwndTrack the TME_HOVER flag is completely
708 * ignored. The TME_LEAVE flag results in a WM_MOUSELEAVE message being posted
709 * immediately and the TME_LEAVE flag being ignored.
710 *
711 * PARAMS
712 * ptme [I,O] pointer to TRACKMOUSEEVENT information structure.
713 *
714 * RETURNS
715 * Success: non-zero
716 * Failure: zero
717 *
718 */
719 /*
720 * @implemented
721 */
722 BOOL
723 WINAPI
724 TrackMouseEvent(
725 LPTRACKMOUSEEVENT ptme)
726 {
727 HWND hwnd;
728 POINT pos;
729 DWORD hover_time;
730 PUSER32_TRACKINGLIST ptracking_info;
731
732 TRACE("%lx, %lx, %p, %lx\n", ptme->cbSize, ptme->dwFlags, ptme->hwndTrack, ptme->dwHoverTime);
733
734 if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) {
735 WARN("wrong TRACKMOUSEEVENT size from app\n");
736 SetLastError(ERROR_INVALID_PARAMETER);
737 return FALSE;
738 }
739
740 ptracking_info = & User32GetThreadData()->tracking_info;
741
742 /* fill the TRACKMOUSEEVENT struct with the current tracking for the given hwnd */
743 if (ptme->dwFlags & TME_QUERY )
744 {
745 *ptme = ptracking_info->tme;
746 ptme->cbSize = sizeof(TRACKMOUSEEVENT);
747
748 return TRUE; /* return here, TME_QUERY is retrieving information */
749 }
750
751 if (!IsWindow(ptme->hwndTrack))
752 {
753 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
754 return FALSE;
755 }
756
757 hover_time = ptme->dwHoverTime;
758
759 /* if HOVER_DEFAULT was specified replace this with the systems current value */
760 if (hover_time == HOVER_DEFAULT || hover_time == 0)
761 {
762 SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hover_time, 0);
763 }
764
765 GetCursorPos(&pos);
766 hwnd = WindowFromPoint(pos);
767
768 if (ptme->dwFlags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_NONCLIENT))
769 {
770 FIXME("Unknown flag(s) %08lx\n", ptme->dwFlags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_NONCLIENT));
771 }
772
773 if (ptme->dwFlags & TME_CANCEL)
774 {
775 if (ptracking_info->tme.hwndTrack == ptme->hwndTrack)
776 {
777 ptracking_info->tme.dwFlags &= ~(ptme->dwFlags & ~TME_CANCEL);
778
779 /* if we aren't tracking on hover or leave remove this entry */
780 if (!(ptracking_info->tme.dwFlags & (TME_HOVER | TME_LEAVE)))
781 {
782 KillTimer(0, ptracking_info->timer);
783 RtlZeroMemory(ptracking_info,sizeof(USER32_TRACKINGLIST));
784 }
785 }
786 } else {
787 if (ptme->hwndTrack == hwnd)
788 {
789 /* Adding new mouse event to the tracking list */
790 ptracking_info->tme = *ptme;
791 ptracking_info->tme.dwHoverTime = hover_time;
792
793 /* Initialize HoverInfo variables even if not hover tracking */
794 ptracking_info->pos = pos;
795
796 if (!ptracking_info->timer)
797 {
798 ptracking_info->timer = SetTimer(0, 0, hover_time, TrackMouseEventProc);
799 }
800 }
801 }
802
803 return TRUE;
804
805 }
806
807 /* EOF */