Ignore:
Timestamp:
Jan 1, 2000, 6:07:42 PM (26 years ago)
Author:
cbratschi
Message:

first few changes

File:
1 edited

Legend:

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

    r2290 r2291  
    1 /* $Id: pmframe.cpp,v 1.1 2000-01-01 14:57:21 cbratschi Exp $ */
     1/* $Id: pmframe.cpp,v 1.2 2000-01-01 17:07:42 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    215215 PFNWP            OldFrameProc;
    216216 MRESULT          rc;
     217 THDB            *thdb;
     218 MSG             *pWinMsg;
    217219
    218220  SetWin32TIB();
    219221
     222  thdb = GetThreadTHDB();
    220223  win32wnd = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd);
    221224
    222   if(win32wnd == NULL || !win32wnd->getOldFrameProc())
     225  if (!thdb || (win32wnd == NULL) || !win32wnd->getOldFrameProc())
    223226  {
    224227    dprintf(("Invalid win32wnd pointer for frame %x!!", hwnd));
    225228    goto RunDefWndProc;
    226229  }
     230  pWinMsg = &thdb->msg;
    227231
    228232  OldFrameProc = (PFNWP)win32wnd->getOldFrameProc();
     
    231235  {
    232236    case WM_FORMATFRAME:
     237    {
     238      RECTL *client;
     239
    233240      dprintf(("PMFRAME: WM_FORMATFRAME %x",hwnd));
    234       //CB: call WM_NCCALCSIZE and set client pos
    235       //    WM_PAINT -> WM_NCPAINT
    236       //    WM_HITTEST -> MsgHitTest()
    237       //    mouse messages -> MsgButton()
     241      client = (PRECTL)mp2;
     242#if 0
     243//CB: todo: client rect is wrong/not set with WM_NCCALCSIZE
     244      mapWin32ToOS2Rect(hwnd,win32wnd->getClientRectPtr(),(PRECTLOS2)client);
     245
     246      RestorOS2TIB();
     247      return (MRESULT)1;
     248#else
    238249      goto RunDefFrameProc;
     250#endif
     251    }
     252
     253    case WM_MINMAXFRAME:
     254      dprintf(("PMFRAME: WM_MINMAXFRAME %x",hwnd));
     255      //CB: todo
     256      goto RunDefFrameProc;
    239257
    240258    case WM_QUERYBORDERSIZE:
    241       //CB: todo: set to 0
    242259      goto RunDefFrameProc;
    243260
     261    case WM_BUTTON1DOWN:
     262    case WM_BUTTON1UP:
     263    case WM_BUTTON1DBLCLK:
     264    case WM_BUTTON2DOWN:
     265    case WM_BUTTON2UP:
     266    case WM_BUTTON2DBLCLK:
     267    case WM_BUTTON3DOWN:
     268    case WM_BUTTON3UP:
     269    case WM_BUTTON3DBLCLK:
     270        win32wnd->MsgButton(pWinMsg);
     271        RestoreOS2TIB();
     272        return (MRESULT)TRUE;
     273
     274    case WM_BUTTON2MOTIONSTART:
     275    case WM_BUTTON2MOTIONEND:
     276    case WM_BUTTON2CLICK:
     277    case WM_BUTTON1MOTIONSTART:
     278    case WM_BUTTON1MOTIONEND:
     279    case WM_BUTTON1CLICK:
     280    case WM_BUTTON3MOTIONSTART:
     281    case WM_BUTTON3MOTIONEND:
     282    case WM_BUTTON3CLICK:
     283        RestoreOS2TIB();
     284        return (MRESULT)TRUE;
     285
     286    case WM_MOUSEMOVE:
     287    {
     288        //OS/2 Window coordinates -> Win32 Window coordinates
     289        win32wnd->MsgMouseMove(pWinMsg);
     290        RestoreOS2TIB();
     291        return (MRESULT)TRUE;
     292    }
     293
     294    case WM_HITTEST:
     295    {
     296      DWORD res;
     297
     298      // Only send this message if the window is enabled
     299      if (!WinIsWindowEnabled(hwnd))
     300        res = HT_ERROR;
     301      else if (win32wnd->getIgnoreHitTest())
     302        res = HT_NORMAL;
     303      else
     304      {
     305        dprintf(("USER32: WM_HITTEST %x (%d,%d)",hwnd,(*(POINTS *)&mp1).x,(*(POINTS *)&mp1).y));
     306
     307        //CB: WinWindowFromPoint: PM sends WM_HITTEST -> loop -> stack overflow
     308        win32wnd->setIgnoreHitTest(TRUE);
     309        res = win32wnd->MsgHitTest(pWinMsg);
     310        win32wnd->setIgnoreHitTest(FALSE);
     311      }
     312      RestoreOS2TIB();
     313      return (MRESULT)res;
     314    }
     315
     316    case WM_PAINT:
     317        win32wnd->DispatchMsgA(pWinMsg);
     318        goto RunDefWndProc;
     319
     320//CB: not yet checked
    244321    case WM_ADJUSTWINDOWPOS:
    245322    {
     
    399476
    400477    case WM_DESTROY:
    401       #ifdef PMFRAMELOG
    402        dprintf(("PMFRAME: WM_DESTROY"));
    403       #endif
     478      dprintf(("PMFRAME: WM_DESTROY %x",hwnd));
    404479      WinSubclassWindow(hwnd,OldFrameProc);
    405480      win32wnd->setOldFrameProc(NULL);
    406481      goto RunDefFrameProc;
    407 
    408     case WM_MOUSEMOVE:
    409       if (InSizeBox(win32wnd,(POINTS*)&mp1))
    410       {
    411         WinSetPointer(HWND_DESKTOP,WinQuerySysPointer(HWND_DESKTOP,SPTR_SIZENWSE,FALSE));
    412         RestoreOS2TIB();
    413         return (MRESULT)TRUE;
    414       }
    415       else if (win32wnd->isChild()) goto RunDefWndProc;
    416       else goto RunDefFrameProc;
    417 
    418     case WM_BUTTON1DOWN:
    419       #ifdef PMFRAMELOG
    420        dprintf(("PMFRAME: WM_BUTTON1DOWN"));
    421       #endif
    422 
    423       if (InSizeBox(win32wnd,(POINTS*)&mp1))
    424       {
    425         WinSetActiveWindow(HWND_DESKTOP,hwnd);
    426         WinSendMsg(hwnd,WM_TRACKFRAME,(MPARAM)(TF_RIGHT | TF_BOTTOM),(MPARAM)0);
    427         RestoreOS2TIB();
    428         return (MRESULT)TRUE;
    429       }
    430       else if (win32wnd->isChild()) goto RunDefWndProc;
    431       else goto RunDefFrameProc;
    432 
    433     case WM_BUTTON2DOWN:
    434     case WM_BUTTON3DOWN:
    435       #ifdef PMFRAMELOG
    436        dprintf(("PMFRAME: WM_BUTTON2/3DOWN"));
    437       #endif
    438       if (win32wnd->isChild()) goto RunDefWndProc;
    439       else goto RunDefFrameProc;
    440 
    441     case WM_PAINT:
    442       #ifdef PMFRAMELOG
    443        dprintf(("PMFRAME: WM_PAINT %x",hwnd));
    444       #endif
    445       if (!win32wnd->isChild())
    446       {
    447         if (CanDrawSizeBox(win32wnd))
    448         {
    449           MRESULT res;
    450           HPS hps;
    451           RECTL rect;
    452 
    453           RestoreOS2TIB();
    454           res = OldFrameProc(hwnd,msg,mp1,mp2);
    455           SetWin32TIB();
    456 
    457           GetSizeBox(win32wnd,&rect);
    458           hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS);
    459           DrawSizeBox(hps,rect);
    460           WinReleasePS(hps);
    461 
    462           RestoreOS2TIB();
    463           return res;
    464         }
    465         else goto RunDefFrameProc;
    466       }
    467       else
    468       {
    469         RECTL rect;
    470         HPS hps;
    471 
    472         RestoreOS2TIB();
    473         OldFrameProc(hwnd,msg,mp1,mp2);
    474         SetWin32TIB();
    475 
    476         WinQueryWindowRect(hwnd,&rect);
    477         rect.xRight = rect.xRight-rect.xLeft;
    478         rect.yTop = rect.yTop-rect.yBottom;
    479         rect.xLeft = rect.yBottom = 0;
    480         hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS);
    481         DrawFrame(hps,&rect,win32wnd);
    482         WinReleasePS(hps);
    483 
    484         RestoreOS2TIB();
    485         return (MRESULT)0;
    486       }
    487482
    488483    default:
Note: See TracChangeset for help on using the changeset viewer.