- Timestamp:
- Dec 3, 2010, 1:58:55 PM (15 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibmsg.cpp
r21340 r21502 129 129 WM_BUTTON3UP, WINWM_MBUTTONUP, 130 130 WM_BUTTON3DBLCLK, WINWM_MBUTTONDBLCLK, 131 WM_ BUTTON3DBLCLK,WINWM_MOUSEWHEEL, //WM_MOUSELAST131 WM_VSCROLL, WINWM_MOUSEWHEEL, //WM_MOUSELAST 132 132 999999999, 999999999, 133 133 }; … … 762 762 //****************************************************************************** 763 763 //****************************************************************************** 764 BOOL OSLibSendWinMessage(HWND hwnd, ULONG winmsg) 765 { 764 BOOL OSLibSendWinMessage(HWND hwnd, ULONG winmsg, ULONG extra /*= 0*/) 765 { 766 if (winmsg == WINWM_MOUSEWHEEL) 767 { 768 return (BOOL)WinSendMsg(Win32ToOS2Handle(hwnd), TranslateWinMsg(winmsg, TRUE), 769 0, MPFROM2SHORT(0, extra < 0 ? SB_LINEDOWN : SB_LINEUP)); 770 } 766 771 return (BOOL)WinSendMsg(Win32ToOS2Handle(hwnd), TranslateWinMsg(winmsg, TRUE), 0, 0); 767 772 } -
trunk/src/user32/oslibmsg.h
r10430 r21502 55 55 ULONG OSLibSendMessage(HWND hwndWin32, HWND hwndOS2, ULONG msg, ULONG wParam, ULONG lParam, BOOL fUnicode); 56 56 ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend); 57 BOOL OSLibSendWinMessage(HWND hwnd, ULONG winmsg );57 BOOL OSLibSendWinMessage(HWND hwnd, ULONG winmsg, ULONG extra = 0); 58 58 59 59 //Direct posting of messages that must remain invisible to the win32 app -
trunk/src/user32/winmouse.cpp
r10185 r21502 8 8 * 9 9 * Copyright 1993 Bob Amstadt 10 * Copyright 1996 Albrecht Kleine 10 * Copyright 1996 Albrecht Kleine 11 11 * Copyright 1997 David Faure 12 12 * Copyright 1998 Morten Welinder 13 13 * Copyright 1998 Ulrich Weigand 14 14 * 15 * TODO: SwapMouseButton: 15 * TODO: SwapMouseButton: 16 16 * We shouldn't let win32 apps change this for the whole system 17 17 * better to change mouse button message translation instead … … 130 130 if (0 == hwndWin32Capture) 131 131 hwndWin32Capture = OS2ToWin32Handle(OSLibWinQueryCapture()); 132 132 133 133 return hwndWin32Capture; 134 134 } … … 139 139 HWND hwndPrev = GetCapture(); 140 140 BOOL rc; 141 141 142 142 // invalidate capture "cache" 143 143 hwndWin32Capture = 0; 144 145 if(hwnd == 0) 144 145 if(hwnd == 0) 146 146 { 147 147 ReleaseCapture(); 148 148 return hwndPrev; 149 149 } 150 151 if(hwnd == hwndPrev) 150 151 if(hwnd == hwndPrev) 152 152 { 153 153 dprintf(("USER32: SetCapture %x; already set to that window; ignore", hwnd)); … … 156 156 return hwndPrev; 157 157 } 158 159 if(hwndPrev != NULL) 158 159 if(hwndPrev != NULL) 160 160 { 161 161 //SvL: WinSetCapture returns an error if mouse is already captured 162 162 OSLibWinSetCapture(0); 163 163 } 164 164 165 165 rc = OSLibWinSetCapture(Win32ToOS2Handle(hwnd)); 166 166 dprintf(("USER32: SetCapture %x (prev %x) returned %d", hwnd, hwndPrev, rc)); 167 if(hwndPrev) 167 if(hwndPrev) 168 168 { 169 169 SendMessageA(hwndPrev, WM_CAPTURECHANGED, 0L, hwnd); … … 179 179 180 180 hwndPrev = GetCapture(); 181 181 182 182 // invalidate capture "cache" 183 183 hwndWin32Capture = 0; 184 184 185 185 ret = OSLibWinSetCapture(0); 186 if(hwndPrev) 186 if(hwndPrev) 187 187 { 188 188 SendMessageA(hwndPrev, WM_CAPTURECHANGED, 0L, 0L); … … 255 255 { 256 256 INPUT i; 257 257 258 258 i.type = INPUT_MOUSE; 259 259 i.mi.dx = dx; … … 262 262 i.mi.dwFlags = dwFlags; 263 263 i.mi.dwExtraInfo = dwExtraInfo; 264 264 265 265 // forward to more modern API 266 266 SendInput(1, &i, sizeof(i) ); … … 270 270 /***************************************************************************** 271 271 * Name : UINT SendInput 272 * Purpose : The SendInput function synthesizes keystrokes, mouse motions, 272 * Purpose : The SendInput function synthesizes keystrokes, mouse motions, 273 273 * and button clicks 274 274 * Parameters: UINT nInputs // count if input events … … 288 288 { 289 289 dprintf(("not correctly implemented")); 290 290 291 291 // The simulated input is sent to the 292 292 // foreground thread's message queue. … … 297 297 298 298 HWND hwnd = GetForegroundWindow(); 299 299 300 300 LPINPUT piBase = pInputs; 301 301 for (int i = 0; … … 309 309 { 310 310 PMOUSEINPUT p = (PMOUSEINPUT)&piBase->mi; 311 MSG msg; 311 MSG msg; 312 312 HWND hwndCapture; 313 313 314 314 hwndCapture = GetCapture(); 315 315 if(hwndCapture) hwnd = hwndCapture; 316 317 if(p->dwFlags & MOUSEEVENTF_MOVE) 316 317 if(p->dwFlags & MOUSEEVENTF_MOVE) 318 318 { 319 319 if(!(p->dwFlags & MOUSEEVENTF_ABSOLUTE)) { … … 332 332 } 333 333 } 334 SetCursorPos(p->dx, p->dy); 334 SetCursorPos(p->dx, p->dy); 335 335 OSLibSendWinMessage(hwnd, WM_MOUSEMOVE); 336 336 } 337 337 338 if(p->dwFlags & MOUSEEVENTF_LEFTDOWN) 338 if(p->dwFlags & MOUSEEVENTF_LEFTDOWN) 339 339 { 340 340 KeySetOverlayKeyState(VK_LBUTTON, KEYOVERLAYSTATE_DOWN); 341 341 OSLibSendWinMessage(hwnd, WM_LBUTTONDOWN); 342 342 } 343 if(p->dwFlags & MOUSEEVENTF_LEFTUP) 343 if(p->dwFlags & MOUSEEVENTF_LEFTUP) 344 344 { 345 345 KeySetOverlayKeyState(VK_LBUTTON, KEYOVERLAYSTATE_DONTCARE); 346 346 OSLibSendWinMessage(hwnd, WM_LBUTTONUP); 347 347 } 348 if(p->dwFlags & MOUSEEVENTF_RIGHTDOWN) 348 if(p->dwFlags & MOUSEEVENTF_RIGHTDOWN) 349 349 { 350 350 KeySetOverlayKeyState(VK_RBUTTON, KEYOVERLAYSTATE_DOWN); 351 351 OSLibSendWinMessage(hwnd, WM_RBUTTONDOWN); 352 352 } 353 if(p->dwFlags & MOUSEEVENTF_RIGHTUP) 353 if(p->dwFlags & MOUSEEVENTF_RIGHTUP) 354 354 { 355 355 KeySetOverlayKeyState(VK_RBUTTON, KEYOVERLAYSTATE_DONTCARE); 356 356 OSLibSendWinMessage(hwnd, WM_RBUTTONUP); 357 357 } 358 if(p->dwFlags & MOUSEEVENTF_MIDDLEDOWN) 358 if(p->dwFlags & MOUSEEVENTF_MIDDLEDOWN) 359 359 { 360 360 KeySetOverlayKeyState(VK_MBUTTON, KEYOVERLAYSTATE_DOWN); 361 361 OSLibSendWinMessage(hwnd, WM_MBUTTONDOWN); 362 362 } 363 if(p->dwFlags & MOUSEEVENTF_MIDDLEUP) 363 if(p->dwFlags & MOUSEEVENTF_MIDDLEUP) 364 364 { 365 365 KeySetOverlayKeyState(VK_MBUTTON, KEYOVERLAYSTATE_DONTCARE); 366 366 OSLibSendWinMessage(hwnd, WM_MBUTTONUP); 367 367 } 368 } 368 if(p->dwFlags & MOUSEEVENTF_WHEEL) 369 { 370 OSLibSendWinMessage(hwnd, WM_MOUSEWHEEL, p->mouseData); 371 } 372 } 369 373 break; 370 374 371 375 // compose a keyboard input message 372 376 case INPUT_KEYBOARD: … … 380 384 // our existing code handle everything (WM_CHAR generation) 381 385 // This is a quick and dirty implementation. Not entirely correct. 382 386 383 387 // build keyboard message 384 388 msg.message = (p->dwFlags & KEYEVENTF_KEYUP) ? WM_KEYUP : WM_KEYDOWN; 385 389 386 390 if (p->dwFlags & KEYEVENTF_SCANCODE) 387 391 { … … 394 398 else 395 399 msg.wParam = p->wVk; 396 400 397 401 msg.lParam = 0x0000001 | // repeat count 398 402 ( (p->wScan & 0xff) << 16); // scan code 399 403 400 404 if (p->dwFlags & KEYEVENTF_EXTENDEDKEY) 401 405 msg.lParam |= (1 << 24); 402 406 403 407 // set additional message flags 404 408 if (msg.message == WM_KEYDOWN) … … 414 418 msg.lParam |= (1 << 31); 415 419 } 416 420 417 421 msg.time = p->time; 418 422 419 423 // @@@PH 420 424 // unknown: do we have to post or to send the message? … … 423 427 424 428 KeySetOverlayKeyState(msg.wParam, (msg.message == WM_KEYDOWN) ? KEYOVERLAYSTATE_DOWN : KEYOVERLAYSTATE_DONTCARE); 425 429 426 430 if (fUnicode) 427 431 SendMessageW(hwnd, msg.message, msg.wParam, msg.lParam); … … 442 446 SetMessageExtraInfo(extrainfo); 443 447 break; 444 } 445 448 } 449 446 450 case INPUT_HARDWARE: 447 451 { 448 452 PHARDWAREINPUT p = (PHARDWAREINPUT)&piBase->hi; 449 453 450 454 // @@@PH 451 455 // not supported for the time being 452 } 456 } 453 457 break; 454 458 455 459 default: 456 460 dprintf(("unsupported input packet type %d", … … 459 463 } 460 464 } 461 465 462 466 return 0; 463 467 } … … 490 494 POINT pos; /* center of hover rectangle */ 491 495 INT iHoverTime; /* elapsed time the cursor has been inside of the hover rect */ 492 } _TRACKINGLIST; 493 494 #define UINT_PTR UINT 496 } _TRACKINGLIST; 497 498 #define UINT_PTR UINT 495 499 static _TRACKINGLIST TrackingList[10]; 496 500 static int iTrackMax = 0; … … 529 533 if(TrackingList[i].tme.dwFlags & TME_HOVER) { 530 534 /* add the timer interval to the hovering time */ 531 TrackingList[i].iHoverTime+=iTimerInterval; 532 535 TrackingList[i].iHoverTime+=iTimerInterval; 536 533 537 /* has the cursor moved outside the rectangle centered around pos? */ 534 538 if((abs(pos.x - TrackingList[i].pos.x) > (hoverwidth / 2.0)) … … 559 563 } 560 564 } 561 565 562 566 /* stop the timer if the tracking list is empty */ 563 567 if(iTrackMax == 0) { … … 611 615 612 616 flags = ptme->dwFlags; 613 617 614 618 /* if HOVER_DEFAULT was specified replace this with the systems current value */ 615 619 if(ptme->dwHoverTime == HOVER_DEFAULT) … … 617 621 618 622 GetCursorPos(&pos); 619 hwnd = WindowFromPoint(pos); 623 hwnd = WindowFromPoint(pos); 620 624 621 625 if ( flags & TME_CANCEL ) { … … 623 627 cancel = 1; 624 628 } 625 629 626 630 if ( flags & TME_HOVER ) { 627 631 flags &= ~ TME_HOVER; 628 632 hover = 1; 629 633 } 630 634 631 635 if ( flags & TME_LEAVE ) { 632 636 flags &= ~ TME_LEAVE; … … 650 654 else 651 655 ptme->dwFlags = 0; 652 656 653 657 return TRUE; /* return here, TME_QUERY is retrieving information */ 654 658 } … … 673 677 { 674 678 TrackingList[i] = TrackingList[--iTrackMax]; 675 679 676 680 if(iTrackMax == 0) { 677 681 KillTimer(0, timer); … … 694 698 TrackingList[i].tme.dwHoverTime = ptme->dwHoverTime; 695 699 } 696 700 697 701 if(leave) 698 702 TrackingList[i].tme.dwFlags |= TME_LEAVE; 699 703 700 704 /* reset iHoverTime as per winapi specs */ 701 TrackingList[i].iHoverTime = 0; 702 705 TrackingList[i].iHoverTime = 0; 706 703 707 return TRUE; 704 708 } 705 } 709 } 706 710 707 711 /* if the tracking list is full return FALSE */
Note:
See TracChangeset
for help on using the changeset viewer.