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

user32: Obey return value from WM_MOUSEACTIVATE.

That is, hide the mouse button press message from the window
if the return value is WM_ACTIVATEANDEAT or WM_NOACTIVATEANDEAT
(to conform to MSDN).

File:
1 edited

Legend:

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

    r21987 r21988  
    10771077ULONG Win32BaseWindow::MsgButton(MSG *msg)
    10781078{
    1079  BOOL  fClick = FALSE;
     1079    BOOL  eatMsg = FALSE;
     1080    BOOL  fClick = FALSE;
    10801081
    10811082    dprintf(("MsgButton %d at (%d,%d) %X %X", msg->message, msg->pt.x, msg->pt.y, msg->wParam, msg->lParam));
     
    11171118    if(fClick)
    11181119    {
    1119       HWND hwndTop;
     1120        HWND hwndTop;
    11201121
    11211122        /* Activate the window if needed */
     
    11251126        if (hwndTop && (getWindowHandle() != hwndActive))
    11261127        {
    1127                 LONG ret = SendMessageA(getWindowHandle(),WM_MOUSEACTIVATE, hwndTop,
    1128                                         MAKELONG( lastHitTestVal, msg->message) );
    1129 
    1130                 //SendMessageA(getWindowHandle(), msg->message, msg->wParam, msg->lParam);
    1131                 dprintf2(("WM_MOUSEACTIVATE returned %d foreground %x top %x", ret, GetForegroundWindow(), hwndTop));
    1132 #if 0
    1133                 if ((ret == MA_ACTIVATEANDEAT) || (ret == MA_NOACTIVATEANDEAT))
    1134                          eatMsg = TRUE;
    1135 #endif
    1136                 //SvL: 0 is not documented, but experiments in NT4 show that
    1137                 //     the window will get activated when it returns this.
    1138                 //     (FreeCell is an example)
    1139                 if(((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT) || (ret == 0))
    1140                    && (hwndTop != GetForegroundWindow()) )
    1141                 {
    1142                     Win32BaseWindow *win32top = Win32BaseWindow::GetWindowFromHandle(hwndTop);
    1143 
    1144                     //SvL: Calling OSLibSetActiveWindow(hwndTop); causes focus problems
    1145                     if (win32top) {
    1146                         //Must use client window handle (not frame!!)
    1147                         SetFocus(win32top->getWindowHandle());
    1148                         RELEASE_WNDOBJ(win32top);
    1149                     }
     1128            LONG ret = SendMessageA(getWindowHandle(),WM_MOUSEACTIVATE, hwndTop,
     1129                                    MAKELONG( lastHitTestVal, msg->message) );
     1130
     1131            //SendMessageA(getWindowHandle(), msg->message, msg->wParam, msg->lParam);
     1132            dprintf2(("WM_MOUSEACTIVATE returned %d foreground %x top %x", ret, GetForegroundWindow(), hwndTop));
     1133
     1134            if ((ret == MA_ACTIVATEANDEAT) || (ret == MA_NOACTIVATEANDEAT))
     1135                eatMsg = TRUE;
     1136
     1137            //SvL: 0 is not documented, but experiments in NT4 show that
     1138            //     the window will get activated when it returns this.
     1139            //     (FreeCell is an example)
     1140            if(((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT) || (ret == 0))
     1141               && (hwndTop != GetForegroundWindow()) )
     1142            {
     1143                Win32BaseWindow *win32top = Win32BaseWindow::GetWindowFromHandle(hwndTop);
     1144
     1145                //SvL: Calling OSLibSetActiveWindow(hwndTop); causes focus problems
     1146                if (win32top) {
     1147                    //Must use client window handle (not frame!!)
     1148                    SetFocus(win32top->getWindowHandle());
     1149                    RELEASE_WNDOBJ(win32top);
    11501150                }
     1151            }
    11511152        }
    11521153    }
     
    11541155    SendMessageA(getWindowHandle(),WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
    11551156
    1156     return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
     1157    return eatMsg ? 0 : SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
    11571158}
    11581159//******************************************************************************
     
    22412242        if(window->getStyle() & WS_CHILD && !(window->getExStyle() & WS_EX_NOPARENTNOTIFY) )
    22422243        {
    2243                 /* Notify the parent window only */
    2244                 parentwindow = window->getParent();
    2245                 if(parentwindow) {
    2246                     /* PF We should map points for each window accordingly! */
    2247                     if (Msg == WM_LBUTTONDOWN || Msg == WM_MBUTTONDOWN || Msg == WM_RBUTTONDOWN ||
    2248                         Msg == WM_LBUTTONUP || Msg == WM_MBUTTONUP || Msg == WM_RBUTTONUP)
    2249                     {
    2250                       POINTS pt = MAKEPOINTS(lParam);
    2251                       POINT point;
    2252 
    2253                       point.x = pt.x;
    2254                       point.y = pt.y;
    2255 
    2256                       MapWindowPoints(getWindowHandle(),parentwindow->getWindowHandle(), &point, 1);
    2257                       lParam = MAKELPARAM(point.x, point.y);
    2258                       wParam = MAKEWPARAM(Msg, 0 /* undefined according to MSDN, 0 under XP */);
    2259                     }
    2260                     else
    2261                     {
    2262                       lParam = getWindowHandle();
    2263                       wParam = MAKEWPARAM(Msg, getWindowId());
    2264                     }
    2265                     SendMessageA(parentwindow->getWindowHandle(), WM_PARENTNOTIFY, wParam, lParam);
     2244            /* Notify the parent window only */
     2245            parentwindow = window->getParent();
     2246            if(parentwindow) {
     2247                /* PF We should map points for each window accordingly! */
     2248                if (Msg == WM_LBUTTONDOWN || Msg == WM_MBUTTONDOWN || Msg == WM_RBUTTONDOWN ||
     2249                    Msg == WM_LBUTTONUP || Msg == WM_MBUTTONUP || Msg == WM_RBUTTONUP)
     2250                {
     2251                    POINTS pt = MAKEPOINTS(lParam);
     2252                    POINT point;
     2253
     2254                    point.x = pt.x;
     2255                    point.y = pt.y;
     2256
     2257                    MapWindowPoints(getWindowHandle(),parentwindow->getWindowHandle(), &point, 1);
     2258                    lParam = MAKELPARAM(point.x, point.y);
     2259                    wParam = MAKEWPARAM(Msg, 0 /* undefined according to MSDN, 0 under XP */);
    22662260                }
     2261                else
     2262                {
     2263                    lParam = getWindowHandle();
     2264                    wParam = MAKEWPARAM(Msg, getWindowId());
     2265                }
     2266                SendMessageA(parentwindow->getWindowHandle(), WM_PARENTNOTIFY, wParam, lParam);
     2267            }
    22672268
    22682269        }
Note: See TracChangeset for help on using the changeset viewer.