Ignore:
Timestamp:
Jan 8, 2000, 5:47:50 PM (26 years ago)
Author:
cbratschi
Message:

* empty log message *

File:
1 edited

Legend:

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

    r2353 r2377  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.6 2000-01-07 17:38:47 cbratschi Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.7 2000-01-08 16:47:46 cbratschi Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    102102//******************************************************************************
    103103//******************************************************************************
     104ULONG GetMouseKeyState()
     105{
     106  ULONG keystate;
     107
     108  if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
     109    keystate |= MK_LBUTTON_W;
     110  if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
     111    keystate |= MK_RBUTTON_W;
     112  if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
     113    keystate |= MK_MBUTTON_W;
     114  if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
     115    keystate |= MK_SHIFT_W;
     116  if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
     117    keystate |= MK_CONTROL_W;
     118
     119  return keystate;
     120}
     121//******************************************************************************
     122//******************************************************************************
     123LONG IsNCMouseMsg(Win32BaseWindow *win32wnd)
     124{
     125  return ((win32wnd->getLastHitTestVal() != HTCLIENT_W) && (WinQueryCapture(HWND_DESKTOP) != win32wnd->getOS2WindowHandle()));
     126}
     127//******************************************************************************
     128//******************************************************************************
    104129BOOL OS2ToWinMsgTranslate(void *pThdb, QMSG *os2Msg, MSG *winMsg, BOOL isUnicode, BOOL fMsgRemoved)
    105130{
     
    141166      case WM_BUTTON3DBLCLK:
    142167        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    143         if(win32wnd->lastHitTestVal != HTCLIENT_W) {
     168        if (IsNCMouseMsg(win32wnd)) {
    144169            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
    145170            winMsg->wParam  = win32wnd->lastHitTestVal;
     
    153178
    154179            winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
     180            winMsg->wParam  = GetMouseKeyState();
    155181            winMsg->lParam  = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
    156182        }
     
    171197      case WM_MOUSEMOVE:
    172198      {
    173         ULONG keystate = 0, setcursormsg = WINWM_MOUSEMOVE;
    174 
    175         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
    176             keystate |= MK_LBUTTON_W;
    177         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
    178             keystate |= MK_RBUTTON_W;
    179         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
    180             keystate |= MK_MBUTTON_W;
    181         if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
    182             keystate |= MK_SHIFT_W;
    183         if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
    184             keystate |= MK_CONTROL_W;
    185 
    186199        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
    187         if(win32wnd->lastHitTestVal != HTCLIENT_W)
    188         {
    189           setcursormsg  = WINWM_NCMOUSEMOVE;
    190           winMsg->wParam = (WPARAM)win32wnd->lastHitTestVal;
    191           winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
     200        if(IsNCMouseMsg(win32wnd))
     201        {
     202          winMsg->message = WINWM_NCMOUSEMOVE;
     203          winMsg->wParam  = (WPARAM)win32wnd->lastHitTestVal;
     204          winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    192205        } else
    193206        {
    194           winMsg->wParam = (WPARAM)keystate;
     207          winMsg->message = WINWM_MOUSEMOVE;
     208          winMsg->wParam  = GetMouseKeyState();
    195209          winMsg->lParam  = MAKELONG(SHORT1FROMMP(os2Msg->mp1),mapOS2ToWin32Y(win32wnd->getOS2FrameWindowHandle(),win32wnd->getOS2WindowHandle(),SHORT2FROMMP(os2Msg->mp1)));
    196210        }
    197211        //OS/2 Window coordinates -> Win32 Window coordinates
    198         winMsg->message = setcursormsg;
    199212        return TRUE;
    200213      }
     
    332345    case WM_BUTTON3DBLCLK:
    333346        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    334         if(win32wnd->lastHitTestVal != HTCLIENT_W) {
     347        if(IsNCMouseMsg(win32wnd)) {
    335348            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
    336349            winMsg->wParam  = win32wnd->lastHitTestVal;
     
    344357
    345358            winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
     359            winMsg->wParam  = GetMouseKeyState();
    346360            winMsg->lParam  = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
    347361        }
     
    362376    case WM_MOUSEMOVE:
    363377    {
    364         ULONG keystate = 0, setcursormsg = WINWM_MOUSEMOVE;
    365 
    366         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
    367             keystate |= MK_LBUTTON_W;
    368         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
    369             keystate |= MK_RBUTTON_W;
    370         if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
    371             keystate |= MK_MBUTTON_W;
    372         if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
    373             keystate |= MK_SHIFT_W;
    374         if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
    375             keystate |= MK_CONTROL_W;
    376 
    377378        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
    378         if(win32wnd->lastHitTestVal != HTCLIENT_W)
    379         {
    380           setcursormsg  = WINWM_NCMOUSEMOVE;
    381           winMsg->wParam = (WPARAM)win32wnd->lastHitTestVal;
    382           winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
     379        if(IsNCMouseMsg(win32wnd))
     380        {
     381          winMsg->message = WINWM_NCMOUSEMOVE;
     382          winMsg->wParam  = (WPARAM)win32wnd->lastHitTestVal;
     383          winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    383384        } else
    384385        {
    385           winMsg->wParam = (WPARAM)keystate;
     386          winMsg->message = WINWM_MOUSEMOVE;
     387          winMsg->wParam  = GetMouseKeyState();
    386388          winMsg->lParam  = MAKELONG(SHORT1FROMMP(os2Msg->mp1),mapY(win32wnd,SHORT2FROMMP(os2Msg->mp1)));
    387389        }
    388390        //OS/2 Window coordinates -> Win32 Window coordinates
    389         winMsg->message = setcursormsg;
    390391        break;
    391392    }
Note: See TracChangeset for help on using the changeset viewer.