Ignore:
Timestamp:
Jan 9, 2000, 3:38:30 PM (26 years ago)
Author:
sandervl
Message:

Several updates/bug fixes

File:
1 edited

Legend:

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

    r2378 r2383  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.10 2000-01-08 16:53:38 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.11 2000-01-09 14:37:09 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    77 * Copyright 1999      Daniela Engert (dani@ngrt.de)
    88 * Copyright 1999      Rene Pronk (R.Pronk@twi.tudelft.nl)
     9 *
     10 * NOTE: WM_NCHITTEST messages are sent whenever the mouse cursor moves or a mouse button is clicked/released
     11 *       (directly when receiving those messages)
    912 *
    1013 * Project Odin Software License can be found in LICENSE.TXT
     
    119122            fIsFrameControl = (win32wnd != 0);
    120123        }
    121         //NOTE: We only translate WM_PAINT/WM_HITTEST & mouse messages; the rest must not be seen by win32 apps
     124        //NOTE: We only translate WM_PAINT, WM_ACTIVATE & mouse messages; the rest must not be seen by win32 apps
    122125  }
    123126  //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle
     
    226229        //     this message
    227230        if(lpRect->right == thdb->wp.x+thdb->wp.cx && lpRect->bottom == thdb->wp.y+thdb->wp.cy) {
    228                 winMsg->message    = WINWM_WINDOWPOSCHANGED;
    229                 winMsg->lParam = (LPARAM)&thdb->wp;
     231                winMsg->message = WINWM_WINDOWPOSCHANGED;
     232                winMsg->lParam  = (LPARAM)&thdb->wp;
    230233        }
    231234        else {
     
    252255        }
    253256
    254         winMsg->message = WINWM_ACTIVATE;
    255         winMsg->wParam  = MAKELONG((SHORT1FROMMP(os2Msg->mp1)) ? WA_ACTIVE_W : WA_INACTIVE_W, fMinimized);
    256         winMsg->lParam  = (LPARAM)hwndActivate;
     257        if(fIsFrameControl) {
     258            fTranslateFrameControlMsg = TRUE; //we want a win32 app to see this msg for a frame control
     259            winMsg->message = WINWM_NCACTIVATE;
     260            winMsg->wParam  = SHORT1FROMMP(os2Msg->mp1);
     261        }
     262        else
     263        {
     264            winMsg->message = WINWM_ACTIVATE;
     265            winMsg->wParam  = MAKELONG((SHORT1FROMMP(os2Msg->mp1)) ? WA_ACTIVE_W : WA_INACTIVE_W, fMinimized);
     266            winMsg->lParam  = (LPARAM)hwndActivate;
     267        }
    257268        break;
    258269    }
     
    292303    case WM_BUTTON3UP:
    293304    case WM_BUTTON3DBLCLK:
     305    {
     306     ULONG hittest;
     307
    294308        if(fIsFrameControl) {
    295309            fTranslateFrameControlMsg = TRUE; //we want a win32 app to see this msg for a frame control
    296310        }
    297311
     312        hittest = win32wnd->MsgHitTest(winMsg->pt.x, winMsg->pt.y);
     313
    298314        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    299         if(win32wnd->lastHitTestVal != HTCLIENT_W) {
     315        if(hittest != HTCLIENT_W) {
    300316            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
    301             winMsg->wParam  = win32wnd->lastHitTestVal;
     317            winMsg->wParam  = hittest;
    302318            winMsg->lParam  = MAKELONG(winMsg->pt.x, winMsg->pt.y); //screen coordinates
    303319        }
     
    311327            winMsg->lParam  = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
    312328        }
    313 
    314         break;
     329        break;
     330    }
    315331
    316332    case WM_BUTTON2MOTIONSTART:
     
    327343    case WM_MOUSEMOVE:
    328344    {
    329         ULONG keystate = 0, setcursormsg = WINWM_MOUSEMOVE;
     345        ULONG keystate = 0, setcursormsg = WINWM_MOUSEMOVE, hittest;
    330346
    331347        if(fIsFrameControl) {
     
    344360            keystate |= MK_CONTROL_W;
    345361
     362        hittest = win32wnd->MsgHitTest(winMsg->pt.x, winMsg->pt.y);
     363
    346364        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
    347         if(win32wnd->lastHitTestVal != HTCLIENT_W)
     365        if(hittest != HTCLIENT_W)
    348366        {
    349367          setcursormsg   = WINWM_NCMOUSEMOVE;
    350           winMsg->wParam = (WPARAM)win32wnd->lastHitTestVal;
     368          winMsg->wParam = (WPARAM)hittest;
    351369          winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    352370        }
     
    546564
    547565        if(wndParams->fsStatus & WPM_TEXT) {
    548             win32wnd->MsgSetText(wndParams->pszText, wndParams->cchText);
     566            winMsg->message = WINWM_SETTEXT;
     567            winMsg->lParam  = (LPARAM)wndParams->pszText;
    549568            break;
    550569        }
     
    585604        }
    586605        else    winMsg->message = WINWM_PAINT;
    587         break;
    588     }
    589 
    590     case WM_HITTEST:
    591     {
    592         OSLIBPOINT pt;
    593 
    594         fTranslateFrameControlMsg = TRUE; //we want a win32 app to see this msg for a frame control
    595 
    596         pt.x = (*(POINTS *)&os2Msg->mp1).x;
    597         pt.y = (*(POINTS *)&os2Msg->mp1).y;
    598 
    599         mapOS2ToWin32Point(os2Msg->hwnd,OSLIB_HWND_DESKTOP,&pt);
    600         winMsg->message  = WINWM_NCHITTEST;
    601         winMsg->wParam  = 0;
    602         winMsg->lParam  = MAKELONG((USHORT)pt.x, (USHORT)pt.y);
    603606        break;
    604607    }
Note: See TracChangeset for help on using the changeset viewer.