Ignore:
Timestamp:
Mar 30, 2012, 12:35:24 AM (13 years ago)
Author:
dmik
Message:

user32: Fix WM_MOUSEACTIVATE and WM_PARENTNOTIFY behavior.

In particular:

  • Don't send these messages on mouse button release.
  • Send WM_PARENTNOTIFY before WM_MOUSEACTIVATE.

Both changes reflect the actual behavior of Windows XP.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32wbase.cpp

    r21916 r21987  
    10801080
    10811081    dprintf(("MsgButton %d at (%d,%d) %X %X", msg->message, msg->pt.x, msg->pt.y, msg->wParam, msg->lParam));
     1082
    10821083    switch(msg->message)
    10831084    {
     
    10851086        case WM_RBUTTONDBLCLK:
    10861087        case WM_MBUTTONDBLCLK:
    1087                 if (!(windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS))
    1088                 {
    1089                     msg->message = msg->message - (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); //dblclick -> down
    1090                     return MsgButton(msg);
    1091                 }
    1092                 break;
     1088            if (!(windowClass && windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS))
     1089            {
     1090                msg->message = msg->message - (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN); //dblclick -> down
     1091                return MsgButton(msg);
     1092            }
     1093            break;
    10931094        case WM_NCLBUTTONDBLCLK:
    10941095        case WM_NCRBUTTONDBLCLK:
    10951096        case WM_NCMBUTTONDBLCLK:
    1096                 //Docs say CS_DBLCLKS style doesn't matter for non-client double clicks
    1097                 fClick = TRUE;
    1098                 break;
     1097            //Docs say CS_DBLCLKS style doesn't matter for non-client double clicks
     1098            fClick = TRUE;
     1099            break;
    10991100
    11001101        case WM_LBUTTONDOWN:
    11011102        case WM_RBUTTONDOWN:
    11021103        case WM_MBUTTONDOWN:
     1104            if (getParent())
     1105            {
     1106                dprintf(("notifying parent: %X %X", msg->wParam, msg->lParam));
     1107                NotifyParent(msg->message, msg->wParam, /*0*/msg->lParam);
     1108            }
     1109            // fall through to set fClick
    11031110        case WM_NCLBUTTONDOWN:
    11041111        case WM_NCRBUTTONDOWN:
    11051112        case WM_NCMBUTTONDOWN:
    1106         case WM_LBUTTONUP:
    1107         case WM_MBUTTONUP:
    1108         case WM_RBUTTONUP:
    1109                 fClick = TRUE;
    1110                 break;
     1113            fClick = TRUE;
     1114            break;
    11111115    }
    11121116
     
    11501154    SendMessageA(getWindowHandle(),WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
    11511155
    1152     switch(msg->message)
    1153     {
    1154         case WM_LBUTTONDOWN:
    1155         case WM_MBUTTONDOWN:
    1156         case WM_RBUTTONDOWN:
    1157         case WM_LBUTTONUP:
    1158         case WM_MBUTTONUP:
    1159         case WM_RBUTTONUP:
    1160         {
    1161             if (getParent())
    1162             {
    1163                 dprintf(("notifying parent: %X %X", msg->wParam, msg->lParam));
    1164                 NotifyParent(msg->message, msg->wParam, /*0*/msg->lParam);
    1165             }
    1166             break;
    1167         }
    1168     }
    11691156    return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
    11701157}
     
    22692256                      MapWindowPoints(getWindowHandle(),parentwindow->getWindowHandle(), &point, 1);
    22702257                      lParam = MAKELPARAM(point.x, point.y);
     2258                      wParam = MAKEWPARAM(Msg, 0 /* undefined according to MSDN, 0 under XP */);
    22712259                    }
    2272                     SendMessageA(parentwindow->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );
     2260                    else
     2261                    {
     2262                      lParam = getWindowHandle();
     2263                      wParam = MAKEWPARAM(Msg, getWindowId());
     2264                    }
     2265                    SendMessageA(parentwindow->getWindowHandle(), WM_PARENTNOTIFY, wParam, lParam);
    22732266                }
    22742267
Note: See TracChangeset for help on using the changeset viewer.