Changeset 846 for trunk/src/corelib/kernel/qeventdispatcher_win.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/corelib/kernel/qeventdispatcher_win.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 44 44 #include "qcoreapplication.h" 45 45 #include "qhash.h" 46 #include "qlibrary.h"46 #include 47 47 #include "qpair.h" 48 48 #include "qset.h" … … 66 66 67 67 #ifndef QS_RAWINPUT 68 69 70 68 71 # define QS_RAWINPUT 0x0400 72 69 73 #endif 70 74 … … 72 76 # define WM_TOUCH 0x0240 73 77 #endif 78 74 79 #ifndef WM_GESTURE 75 80 # define WM_GESTURE 0x0119 76 81 # define WM_GESTURENOTIFY 0x011A 77 82 #endif 83 78 84 79 85 enum { 80 86 WM_QT_SOCKETNOTIFIER = WM_USER, 81 87 WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, 82 SendPostedEvents TimerId = ~1u88 SendPostedEventsTimerId = ~1u 83 89 }; 84 90 … … 309 315 static ptimeKillEvent qtimeKillEvent = 0; 310 316 311 LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);317 LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); 312 318 313 319 static void resolveTimerAPI() … … 322 328 triedResolve = true; 323 329 #if !defined(Q_OS_WINCE) 324 qtimeSetEvent = (ptimeSetEvent)Q Library::resolve(QLatin1String("winmm"), "timeSetEvent");325 qtimeKillEvent = (ptimeKillEvent)Q Library::resolve(QLatin1String("winmm"), "timeKillEvent");330 qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("winmm"), "timeSetEvent"); 331 qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("winmm"), "timeKillEvent"); 326 332 #else 327 qtimeSetEvent = (ptimeSetEvent)Q Library::resolve(QLatin1String("Mmtimer"), "timeSetEvent");328 qtimeKillEvent = (ptimeKillEvent)Q Library::resolve(QLatin1String("Mmtimer"), "timeKillEvent");333 qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent"); 334 qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent"); 329 335 #endif 330 336 } … … 349 355 // for controlling when to send posted events 350 356 QAtomicInt serialNumber; 351 int lastSerialNumber ;357 int lastSerialNumber; 352 358 QAtomicInt wakeUps; 353 359 … … 373 379 374 380 QEventDispatcherWin32Private::QEventDispatcherWin32Private() 375 : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) 381 : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), 382 serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0) 376 383 { 377 384 resolveTimerAPI(); … … 413 420 414 421 // This function is called by a workerthread 415 void WINAPI CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_PTR user, DWORD_PTR /*reserved*/, DWORD_PTR /*reserved*/)422 void WINAPI CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_PTR user, DWORD_PTR /*reserved*/, DWORD_PTR /*reserved*/) 416 423 { 417 424 if (!timerId) // sanity check … … 422 429 } 423 430 424 LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)431 LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) 425 432 { 426 433 if (message == WM_NCCREATE) … … 480 487 } 481 488 return 0; 482 } else if (message == WM_ TIMER) {483 Q_ASSERT(d != 0);484 d->sendTimerEvent(wp);485 return 0;486 } else if (message == WM_QT_SENDPOSTEDEVENTS) {489 } else if (message == WM_ 490 491 492 493 ) { 487 494 int localSerialNumber = d->serialNumber; 488 495 if (localSerialNumber != d->lastSerialNumber) { … … 491 498 } 492 499 return 0; 500 501 502 503 493 504 } 494 505 … … 496 507 } 497 508 498 LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)509 LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) 499 510 { 500 511 if (wp == PM_REMOVE) { … … 502 513 Q_ASSERT(q != 0); 503 514 if (q) { 515 504 516 QEventDispatcherWin32Private *d = q->d_func(); 505 517 int localSerialNumber = d->serialNumber; 506 if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0) { 507 // no more input or timer events in the message queue, we can allow posted events to be 508 // sent now 518 if (HIWORD(GetQueueStatus(QS_TIMER | QS_INPUT | QS_RAWINPUT)) == 0) { 519 // no more input or timer events in the message queue, we can allow posted events to be sent normally now 520 if (d->sendPostedEventsWindowsTimerId != 0) { 521 // stop the timer to send posted events, since we now allow the WM_QT_SENDPOSTEDEVENTS message 522 KillTimer(d->internalHwnd, d->sendPostedEventsWindowsTimerId); 523 d->sendPostedEventsWindowsTimerId = 0; 524 } 509 525 (void) d->wakeUps.fetchAndStoreRelease(0); 510 MSG *msg = (MSG *) lp;511 526 if (localSerialNumber != d->lastSerialNumber 512 527 // if this message IS the one that triggers sendPostedEvents(), no need to post it again … … 515 530 PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0); 516 531 } 532 533 534 535 536 537 538 539 540 541 542 543 544 517 545 } 518 546 } … … 581 609 ok = t->fastTimerId = qtimeSetEvent(t->interval, 1, qt_fast_timer_proc, (DWORD_PTR)t, 582 610 TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS); 583 if (ok == 0) { // fall back to normal timer if no more multimedia timers avai able611 if (ok == 0) { // fall back to normal timer if no more multimedia timers avaiable 584 612 ok = SetTimer(internalHwnd, t->timerId, (uint) t->interval, 0); 585 613 } … … 724 752 || msg.message == WM_MOUSEHWHEEL 725 753 || msg.message == WM_TOUCH 754 726 755 || msg.message == WM_GESTURE 727 756 || msg.message == WM_GESTURENOTIFY 757 728 758 || msg.message == WM_CLOSE)) { 729 759 // queue user input events for later processing … … 756 786 if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { 757 787 if (seenWM_QT_SENDPOSTEDEVENTS) { 788 789 758 790 needWM_QT_SENDPOSTEDEVENTS = true; 759 791 continue; … … 800 832 801 833 emit aboutToBlock(); 802 waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE );834 waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE); 803 835 emit awake(); 804 836 if (waitRet >= WAIT_OBJECT_0 && waitRet < WAIT_OBJECT_0 + nCount) {
Note:
See TracChangeset
for help on using the changeset viewer.