Changeset 3388 for trunk/src


Ignore:
Timestamp:
Apr 15, 2000, 5:11:14 PM (25 years ago)
Author:
sandervl
Message:

EnableWindow fixes & don't send mouse messages to disabled windows

Location:
trunk/src/user32
Files:
4 edited

Legend:

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

    r3306 r3388  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.27 2000-04-02 15:11:50 cbratschi Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.28 2000-04-15 15:11:13 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    138138  POSTMSG_PACKET  *packet;
    139139  THDB            *thdb = (THDB *)pThdb;
     140  BOOL             fWasDisabled = FALSE;
    140141  int i;
    141142
     
    169170        winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    170171
     172        if(!win32wnd->IsWindowEnabled()) {
     173                if(win32wnd->getParent()) {
     174                        winMsg->hwnd = win32wnd->getParent()->getWindowHandle();
     175                }
     176                else    goto dummymessage; //don't send mouse messages to disabled windows
     177        }
    171178        return TRUE;
    172179
     
    182189        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    183190
     191        //if a window is disabled, it's parent receives the mouse messages
     192        if(!win32wnd->IsWindowEnabled()) {
     193                if(win32wnd->getParent()) {
     194                        win32wnd = win32wnd->getParent();
     195                }
     196                fWasDisabled = TRUE;
     197        }
     198
    184199        if (IsNCMouseMsg(win32wnd)) {
    185200            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
     
    203218            }
    204219        }
    205 
     220        if(fWasDisabled) {
     221                if(win32wnd) {
     222                        winMsg->hwnd = win32wnd->getWindowHandle();
     223                }
     224                else    goto dummymessage; //don't send mouse messages to disabled windows
     225        }
    206226        return TRUE;
    207227
     
    221241        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
    222242
     243        //if a window is disabled, it's parent receives the mouse messages
     244        if(!win32wnd->IsWindowEnabled()) {
     245                if(win32wnd->getParent()) {
     246                        win32wnd = win32wnd->getParent();
     247                }
     248                fWasDisabled = TRUE;
     249        }
    223250        if (IsNCMouseMsg(win32wnd))
    224251        {
     
    239266            }
    240267        }
     268        if(fWasDisabled) {
     269                if(win32wnd) {
     270                        winMsg->hwnd = win32wnd->getWindowHandle();
     271                }
     272                else    goto dummymessage; //don't send mouse messages to disabled windows
     273        }
    241274        //OS/2 Window coordinates -> Win32 Window coordinates
    242275        return TRUE;
     
    429462      winMsg->wParam  = 0;
    430463      winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
     464      if(!win32wnd->IsWindowEnabled()) {
     465                if(win32wnd->getParent()) {
     466                        winMsg->hwnd = win32wnd->getParent()->getWindowHandle();
     467                }
     468                else    goto dummymessage; //don't send mouse messages to disabled windows
     469      }
    431470      break;
    432471
     
    442481        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    443482
     483        //if a window is disabled, it's parent receives the mouse messages
     484        if(!win32wnd->IsWindowEnabled()) {
     485                if(win32wnd->getParent()) {
     486                        win32wnd = win32wnd->getParent();
     487                }
     488                fWasDisabled = TRUE;
     489        }
     490
    444491        if(IsNCMouseMsg(win32wnd)) {
    445492            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
     
    464511        }
    465512
     513        if(fWasDisabled) {
     514                if(win32wnd) {
     515                        winMsg->hwnd = win32wnd->getWindowHandle();
     516                }
     517                else    goto dummymessage; //don't send mouse messages to disabled windows
     518        }
    466519        break;
    467520
     
    481534        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
    482535
     536        //if a window is disabled, it's parent receives the mouse messages
     537        if(!win32wnd->IsWindowEnabled()) {
     538                if(win32wnd->getParent()) {
     539                        win32wnd = win32wnd->getParent();
     540                }
     541                fWasDisabled = TRUE;
     542        }
    483543        if(IsNCMouseMsg(win32wnd))
    484544        {
     
    499559            }
    500560        }
     561        if(fWasDisabled) {
     562                if(win32wnd) {
     563                        winMsg->hwnd = win32wnd->getWindowHandle();
     564                }
     565                else    goto dummymessage; //don't send mouse messages to disabled windows
     566        }
    501567        //OS/2 Window coordinates -> Win32 Window coordinates
    502568        break;
  • trunk/src/user32/pmframe.cpp

    r3366 r3388  
    1 /* $Id: pmframe.cpp,v 1.50 2000-04-10 19:43:15 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.51 2000-04-15 15:11:13 sandervl Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    168168    case WM_HITTEST:
    169169    {
    170         if (win32wnd->IsWindowCreated())
     170        if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {
     171                win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);
     172        }
     173        if(win32wnd && win32wnd->IsWindowCreated())
    171174        {
    172175          MRESULT rc;
     
    189192    case WM_BUTTON3DBLCLK:
    190193    {
    191         if (win32wnd->IsWindowCreated())
     194        if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {
     195                win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);
     196        }
     197        if(win32wnd && win32wnd->IsWindowCreated())
    192198        {
    193199          win32wnd->MsgButton(pWinMsg);
     
    211217    case WM_MOUSEMOVE:
    212218    {
    213         //OS/2 Window coordinates -> Win32 Window coordinates
    214         if (win32wnd->IsWindowCreated())
    215           win32wnd->MsgMouseMove(pWinMsg);
     219        if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {
     220                win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);
     221        }
     222        if(win32wnd && win32wnd->IsWindowCreated())
     223                win32wnd->MsgMouseMove(pWinMsg);
    216224        RestoreOS2TIB();
    217225        return (MRESULT)TRUE;
  • trunk/src/user32/pmwindow.cpp

    r3284 r3388  
    1 /* $Id: pmwindow.cpp,v 1.88 2000-03-31 14:42:48 cbratschi Exp $ */
     1/* $Id: pmwindow.cpp,v 1.89 2000-04-15 15:11:13 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    338338    //**************************************************************************
    339339    case WM_HITTEST:
    340         rc = win32wnd->MsgHitTest(pWinMsg);
     340        if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {
     341                win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);
     342        }
     343        if(win32wnd)
     344                rc = win32wnd->MsgHitTest(pWinMsg);
    341345        break;
    342346
     
    351355    case WM_BUTTON3UP:
    352356    case WM_BUTTON3DBLCLK:
    353         win32wnd->MsgButton(pWinMsg);
     357        if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {
     358                win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);
     359        }
     360        if(win32wnd)
     361                win32wnd->MsgButton(pWinMsg);
    354362        rc = TRUE;
    355363        break;
     
    369377    case WM_MOUSEMOVE:
    370378    {
    371         //OS/2 Window coordinates -> Win32 Window coordinates
    372         win32wnd->MsgMouseMove(pWinMsg);
     379        if(win32wnd->getWindowHandle() != pWinMsg->hwnd) {
     380                win32wnd = Win32BaseWindow::GetWindowFromHandle(pWinMsg->hwnd);
     381        }
     382        if(win32wnd)
     383                win32wnd->MsgMouseMove(pWinMsg);
    373384        break;
    374385    }
  • trunk/src/user32/win32wbase.cpp

    r3365 r3388  
    1 /* $Id: win32wbase.cpp,v 1.178 2000-04-10 19:40:45 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.179 2000-04-15 15:11:14 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    25982598BOOL Win32BaseWindow::EnableWindow(BOOL fEnable)
    25992599{
    2600   return OSLibWinEnableWindow(OS2HwndFrame, fEnable);
     2600 BOOL rc;
     2601
     2602  //return true if previous state was disabled, else false (sdk docs)
     2603  rc = (getStyle() & WS_DISABLED) != 0;
     2604  if(rc && !fEnable) {
     2605        SendMessageA(WM_CANCELMODE, 0, 0);
     2606  }
     2607  OSLibWinEnableWindow(OS2HwndFrame, fEnable);
     2608  return rc;
    26012609}
    26022610//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.