Changeset 21955


Ignore:
Timestamp:
Jan 31, 2012, 10:25:42 PM (13 years ago)
Author:
dmik
Message:

Make sure GetQueueStatus() correctly reports QS_KEY state.

Due to a bug in WinQueryQueueStatus(), QS_KEY would be
always set on return if the associated window is active, even
if there were no WM_CHAR messages actually in the queue.
This broke the newer Flash (see Flash #39 for details).

GetInputState() was also affected by this problem; it would always
return TRUE for active windows.

Location:
trunk/src/user32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/user32/oslibmsg.cpp

    r21916 r21955  
    548548//TODO: QS_HOTKEY
    549549//******************************************************************************
    550 ULONG OSLibWinQueryQueueStatus()
     550ULONG OSLibWinQueryQueueStatus(ULONG flags)
    551551{
    552552    ULONG statusOS2, statusWin32 = 0;
    553553
    554554    statusOS2 = WinQueryQueueStatus(HWND_DESKTOP);
     555    dprintf(("*** 3 %x", statusOS2));
     556
     557    if (flags & QS_KEY)
     558    {
     559        // WinQueryQueueStatus() has a bug which causes it to always return
     560        // the QS_KEY bit set when the associated window is active, regardless
     561        // of whether thiere are WM_CHAR messages in the queue or not. We try to
     562        // fix this by looking up the queue ourselves if the caller actually
     563        // wants this state to be checked
     564        QMSG qmsg;
     565        BOOL haveKey = WinPeekMsg (0, &qmsg, 0, WM_CHAR, WM_CHAR, PM_NOREMOVE);
     566        if (haveKey)
     567        {
     568            // set the proper "summary" status
     569            statusOS2 |= (QS_KEY << 16);
     570        }
     571        else
     572        {
     573            statusOS2 &= ~(QS_KEY << 16);
     574            // according to PMREF, the "added" field is a subset of the
     575            // "summary" field, so it makes no sense to have it set when it is
     576            // reset in "summary"
     577            statusOS2 &= ~(QS_KEY);
     578        }
     579    }
    555580
    556581    // convert the flags since last call (low word)
  • TabularUnified trunk/src/user32/oslibmsg.h

    r21502 r21955  
    4949LONG  OSLibWinGetMessageTime();
    5050BOOL  OSLibWinReplyMessage(ULONG result);
    51 ULONG OSLibWinQueryQueueStatus();
     51ULONG OSLibWinQueryQueueStatus(ULONG flags);
    5252
    5353BOOL  OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode);
  • TabularUnified trunk/src/user32/windowmsg.cpp

    r21916 r21955  
    11151115//            queue since the last call to GetQueueStatus
    11161116//******************************************************************************
    1117 DWORD WIN32API GetQueueStatus( UINT flags)
     1117DWORD WIN32API GetQueueStatus(UINT flags)
    11181118{
    11191119 DWORD queueStatus;
    11201120
    1121     queueStatus = OSLibWinQueryQueueStatus();
     1121    queueStatus = OSLibWinQueryQueueStatus(flags);
    11221122
    11231123    dprintf(("USER32: GetQueueStatus %x returned %x", flags, queueStatus & MAKELONG(flags, flags)));
     
    11441144 BOOL  rc;
    11451145
    1146   queueStatus = OSLibWinQueryQueueStatus();
     1146  queueStatus = OSLibWinQueryQueueStatus(QS_INPUT);
    11471147
    11481148  rc = (queueStatus & (QS_KEY | QS_MOUSEBUTTON)) ? TRUE : FALSE;
Note: See TracChangeset for help on using the changeset viewer.