Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/kernel/qeventdispatcher_win.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    4444#include "qcoreapplication.h"
    4545#include "qhash.h"
    46 #include "qlibrary.h"
     46#include
    4747#include "qpair.h"
    4848#include "qset.h"
     
    6666
    6767#ifndef QS_RAWINPUT
     68
     69
     70
    6871#  define QS_RAWINPUT 0x0400
     72
    6973#endif
    7074
     
    7276#  define WM_TOUCH 0x0240
    7377#endif
     78
    7479#ifndef WM_GESTURE
    7580#  define WM_GESTURE 0x0119
    7681#  define WM_GESTURENOTIFY 0x011A
    7782#endif
     83
    7884
    7985enum {
    8086    WM_QT_SOCKETNOTIFIER = WM_USER,
    8187    WM_QT_SENDPOSTEDEVENTS = WM_USER + 1,
    82     SendPostedEventsTimerId = ~1u
     88    SendPostedEventsTimerId = ~1u
    8389};
    8490
     
    309315static ptimeKillEvent qtimeKillEvent = 0;
    310316
    311 LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
     317LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
    312318
    313319static void resolveTimerAPI()
     
    322328        triedResolve = true;
    323329#if !defined(Q_OS_WINCE)
    324         qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("winmm"), "timeSetEvent");
    325         qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("winmm"), "timeKillEvent");
     330        qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("winmm"), "timeSetEvent");
     331        qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("winmm"), "timeKillEvent");
    326332#else
    327         qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent");
    328         qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent");
     333        qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent");
     334        qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent");
    329335#endif
    330336    }
     
    349355    // for controlling when to send posted events
    350356    QAtomicInt serialNumber;
    351     int lastSerialNumber;
     357    int lastSerialNumber;
    352358    QAtomicInt wakeUps;
    353359
     
    373379
    374380QEventDispatcherWin32Private::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)
    376383{
    377384    resolveTimerAPI();
     
    413420
    414421// 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*/)
     422void WINAPI CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, DWORD_PTR user, DWORD_PTR /*reserved*/, DWORD_PTR /*reserved*/)
    416423{
    417424    if (!timerId) // sanity check
     
    422429}
    423430
    424 LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
     431LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp)
    425432{
    426433    if (message == WM_NCCREATE)
     
    480487        }
    481488        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    ) {
    487494        int localSerialNumber = d->serialNumber;
    488495        if (localSerialNumber != d->lastSerialNumber) {
     
    491498        }
    492499        return 0;
     500
     501
     502
     503
    493504    }
    494505
     
    496507}
    497508
    498 LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
     509LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
    499510{
    500511    if (wp == PM_REMOVE) {
     
    502513        Q_ASSERT(q != 0);
    503514        if (q) {
     515
    504516            QEventDispatcherWin32Private *d = q->d_func();
    505517            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                }
    509525                (void) d->wakeUps.fetchAndStoreRelease(0);
    510                 MSG *msg = (MSG *) lp;
    511526                if (localSerialNumber != d->lastSerialNumber
    512527                    // if this message IS the one that triggers sendPostedEvents(), no need to post it again
     
    515530                    PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
    516531                }
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
    517545            }
    518546        }
     
    581609        ok = t->fastTimerId = qtimeSetEvent(t->interval, 1, qt_fast_timer_proc, (DWORD_PTR)t,
    582610                                            TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
    583         if (ok == 0) { // fall back to normal timer if no more multimedia timers avaiable
     611        if (ok == 0) { // fall back to normal timer if no more multimedia timers avaiable
    584612            ok = SetTimer(internalHwnd, t->timerId, (uint) t->interval, 0);
    585613        }
     
    724752                        || msg.message == WM_MOUSEHWHEEL
    725753                        || msg.message == WM_TOUCH
     754
    726755                        || msg.message == WM_GESTURE
    727756                        || msg.message == WM_GESTURENOTIFY
     757
    728758                        || msg.message == WM_CLOSE)) {
    729759                    // queue user input events for later processing
     
    756786                if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
    757787                    if (seenWM_QT_SENDPOSTEDEVENTS) {
     788
     789
    758790                        needWM_QT_SENDPOSTEDEVENTS = true;
    759791                        continue;
     
    800832
    801833            emit aboutToBlock();
    802             waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
     834            waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
    803835            emit awake();
    804836            if (waitRet >= WAIT_OBJECT_0 && waitRet < WAIT_OBJECT_0 + nCount) {
Note: See TracChangeset for help on using the changeset viewer.