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

File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.