Changeset 2291 for trunk/src


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

first few changes

Location:
trunk/src/user32/new
Files:
5 edited

Legend:

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

    r2290 r2291  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.1 2000-01-01 14:57:19 cbratschi Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.2 2000-01-01 17:07:41 cbratschi Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    123123    winMsg->hwnd = win32wnd->getWindowHandle();
    124124
     125  if (win32wnd && (os2Msg->hwnd == win32wnd->getOS2FrameWindowHandle()))
     126  {
     127    //special frame messages
     128
     129    switch (os2Msg->msg)
     130    {
     131      case WM_BUTTON1DOWN:
     132      case WM_BUTTON1UP:
     133      case WM_BUTTON1DBLCLK:
     134      case WM_BUTTON2DOWN:
     135      case WM_BUTTON2UP:
     136      case WM_BUTTON2DBLCLK:
     137      case WM_BUTTON3DOWN:
     138      case WM_BUTTON3UP:
     139      case WM_BUTTON3DBLCLK:
     140        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
     141        if(win32wnd->lastHitTestVal != HTCLIENT_W) {
     142            winMsg->message = WINWM_NCLBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
     143            winMsg->wParam  = win32wnd->lastHitTestVal;
     144            winMsg->lParam  = MAKELONG(winMsg->pt.x, winMsg->pt.y); //screen coordinates
     145        }
     146        else {
     147            point.x         = (*(POINTS *)&os2Msg->mp1).x;
     148            point.y         = (*(POINTS *)&os2Msg->mp1).y;
     149            ClientPoint.x   = point.x;
     150            ClientPoint.y   = mapOS2ToWin32Y(os2Msg->hwnd,win32wnd->getOS2WindowHandle(),point.y);
     151
     152            winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
     153            winMsg->lParam  = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
     154        }
     155
     156        return TRUE;
     157
     158      case WM_BUTTON2MOTIONSTART:
     159      case WM_BUTTON2MOTIONEND:
     160      case WM_BUTTON2CLICK:
     161      case WM_BUTTON1MOTIONSTART:
     162      case WM_BUTTON1MOTIONEND:
     163      case WM_BUTTON1CLICK:
     164      case WM_BUTTON3MOTIONSTART:
     165      case WM_BUTTON3MOTIONEND:
     166      case WM_BUTTON3CLICK:
     167        goto dummymessage;
     168
     169      case WM_MOUSEMOVE:
     170      {
     171        ULONG keystate = 0, setcursormsg = WINWM_MOUSEMOVE;
     172
     173        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)
     174            keystate |= MK_LBUTTON_W;
     175        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
     176            keystate |= MK_RBUTTON_W;
     177        if(WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
     178            keystate |= MK_MBUTTON_W;
     179        if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
     180            keystate |= MK_SHIFT_W;
     181        if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
     182            keystate |= MK_CONTROL_W;
     183
     184        //WM_NCMOUSEMOVE is posted when the cursor moves into a non-client area of the window
     185        if(win32wnd->lastHitTestVal != HTCLIENT_W)
     186        {
     187          setcursormsg   = WINWM_NCMOUSEMOVE;
     188          winMsg->wParam = (WPARAM)win32wnd->lastHitTestVal;
     189          winMsg->lParam = MAKELONG(winMsg->pt.x,winMsg->pt.y);
     190        } else
     191        {
     192          winMsg->wParam = (WPARAM)keystate;
     193          winMsg->lParam  = MAKELONG(SHORT1FROMMP(os2Msg->mp1),mapOS2ToWin32Y(win32wnd->getOS2FrameWindowHandle(),win32wnd->getOS2WindowHandle(),SHORT2FROMMP(os2Msg->mp1)));
     194        }
     195        //OS/2 Window coordinates -> Win32 Window coordinates
     196        winMsg->message = setcursormsg;
     197        return TRUE;
     198      }
     199
     200      case WM_PAINT:
     201      {
     202        winMsg->message = WINWM_NCPAINT;
     203        return TRUE;
     204      }
     205
     206      case WM_HITTEST:
     207      {
     208        OSLIBPOINT pt;
     209
     210        pt.x = (*(POINTS *)&os2Msg->mp1).x;
     211        pt.y = (*(POINTS *)&os2Msg->mp1).y;
     212
     213        mapOS2ToWin32Point(os2Msg->hwnd,OSLIB_HWND_DESKTOP,&pt);
     214        winMsg->message  = WINWM_NCHITTEST;
     215        winMsg->wParam  = 0;
     216        winMsg->lParam  = MAKELONG((USHORT)pt.x, (USHORT)pt.y);
     217        return TRUE;
     218      }
     219    }
     220    //do normal translation for all other messages
     221  }
     222
    125223  switch(os2Msg->msg)
    126224  {
  • trunk/src/user32/new/oslibwin.cpp

    r2290 r2291  
    1 /* $Id: oslibwin.cpp,v 1.29 2000-01-01 14:57:20 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.30 2000-01-01 17:07:41 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    9090
    9191  *hwndFrame = WinCreateWindow (hwndParent,
    92                                 TopLevel ? WC_FRAME : WIN32_INNERFRAME,
     92                                WC_FRAME,
    9393                                pszName, dwWinStyle, 0, 0, 50, 30,
    9494                                hwndParent, HWND_TOP,
  • 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:
  • trunk/src/user32/new/pmwindow.cpp

    r2290 r2291  
    1 /* $Id: pmwindow.cpp,v 1.31 2000-01-01 14:57:21 cbratschi Exp $ */
     1/* $Id: pmwindow.cpp,v 1.32 2000-01-01 17:07:42 cbratschi Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    5454BOOL InitPM()
    5555{
    56   CLASSINFO FrameClassInfo;
    57 
    5856  hab = WinInitialize(0);
    5957  dprintf(("Winitialize returned %x", hab));
     
    9391     (PSZ)WIN32_STDCLASS,               /* Window class name            */
    9492     (PFNWP)Win32WindowProc,            /* Address of window procedure  */
    95 //     CS_SIZEREDRAW | CS_HITTEST | CS_MOVENOTIFY,
    96      //CS_SIZEREDRAW | CS_HITTEST,
    9793     CS_HITTEST,
    9894     NROF_WIN32WNDBYTES)) {
     
    10096        return(FALSE);
    10197   }
     98  if(!WinRegisterClass(                 /* Register window class        */
     99     hab,                               /* Anchor block handle          */
     100     (PSZ)WIN32_STDCLASS2,              /* Window class name            */
     101     (PFNWP)Win32WindowProc,            /* Address of window procedure  */
     102     CS_HITTEST | CS_SAVEBITS,
     103     NROF_WIN32WNDBYTES)) {
     104        dprintf(("WinRegisterClass Win32BaseWindow failed"));
     105        return(FALSE);
     106   }
     107/* //CB: perhaps reuse it for own frame
    102108   if (!WinQueryClassInfo (hab, WC_FRAME, &FrameClassInfo)) {
    103109     dprintf (("WinQueryClassInfo WC_FRAME failed"));
     
    113119     return (FALSE);
    114120   }
    115 
     121*/
    116122   WinQueryWindowRect(HWND_DESKTOP, &desktopRectl);
    117123   ScreenWidth  = desktopRectl.xRight;
  • trunk/src/user32/new/pmwindow.h

    r2290 r2291  
    1 /* $Id: pmwindow.h,v 1.3 2000-01-01 14:54:54 cbratschi Exp $ */
     1/* $Id: pmwindow.h,v 1.4 2000-01-01 17:07:42 cbratschi Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    1010
    1111#define WIN32_STDCLASS   "Win32WindowClass"
    12 #define WIN32_INNERFRAME "Win32InnerFrameClass"
     12#define WIN32_STDCLASS2  "Win32WindowClass2"
    1313
    1414BOOL InitPM();
Note: See TracChangeset for help on using the changeset viewer.