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

* empty log message *

File:
1 edited

Legend:

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

    r2291 r2292  
    1 /* $Id: pmframe.cpp,v 1.2 2000-01-01 17:07:42 cbratschi Exp $ */
     1/* $Id: pmframe.cpp,v 1.3 2000-01-02 19:30:43 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    1616#include <os2wrap.h>
    1717#include <stdlib.h>
     18#include <string.h>
    1819#include "win32type.h"
    1920#include <misc.h>
     
    2425#include "oslibwin.h"
    2526#include "caret.h"
     27#include "oslibmsg.h"
    2628
    2729#define PMFRAMELOG
     
    216218 MRESULT          rc;
    217219 THDB            *thdb;
    218  MSG             *pWinMsg;
     220 MSG             *pWinMsg,winMsg;
    219221
    220222  SetWin32TIB();
     
    228230    goto RunDefWndProc;
    229231  }
    230   pWinMsg = &thdb->msg;
     232
     233  if((thdb->msgstate & 1) == 0)
     234  {//message that was sent directly to our window proc handler; translate it here
     235        QMSG qmsg;
     236
     237        qmsg.msg  = msg;
     238        qmsg.hwnd = hwnd;
     239        qmsg.mp1  = mp1;
     240        qmsg.mp2  = mp2;
     241        qmsg.time = WinQueryMsgTime(thdb->hab);
     242        WinQueryMsgPos(thdb->hab, &qmsg.ptl);
     243        qmsg.reserved = 0;
     244
     245        if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE)
     246        {//message was not translated
     247            memset(&winMsg, 0, sizeof(MSG));
     248        }
     249        pWinMsg = &winMsg;
     250  }
     251  else {
     252        pWinMsg = &thdb->msg;
     253        thdb->msgstate++;
     254  }
    231255
    232256  OldFrameProc = (PFNWP)win32wnd->getOldFrameProc();
     
    236260    case WM_FORMATFRAME:
    237261    {
    238       RECTL *client;
    239 
     262      PSWP pswp = (PSWP)mp1,swpClient;
     263      RECTL *client = (PRECTL)mp2,rect;
     264      INT ccount;
     265
     266      if (!win32wnd->IsWindowCreated()) goto RunDefFrameProc;
    240267      dprintf(("PMFRAME: WM_FORMATFRAME %x",hwnd));
    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
    249       goto RunDefFrameProc;
    250 #endif
     268      RestoreOS2TIB();
     269      ccount = (INT)OldFrameProc(hwnd,msg,mp1,mp2);
     270      SetWin32TIB();
     271      mapWin32ToOS2Rect(WinQueryWindow(hwnd,QW_PARENT),win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
     272      WinMapWindowPoints(WinQueryWindow(hwnd,QW_PARENT),hwnd,(PPOINTL)&rect,2);
     273      swpClient = &pswp[ccount-1];
     274      swpClient->x = rect.xLeft;
     275      swpClient->y = rect.yBottom;
     276      swpClient->cx = rect.xRight-rect.xLeft;
     277      swpClient->cy = rect.yTop-rect.yBottom;
     278      RestoreOS2TIB();
     279      return (MRESULT)ccount;
    251280    }
    252281
     
    268297    case WM_BUTTON3UP:
    269298    case WM_BUTTON3DBLCLK:
    270         win32wnd->MsgButton(pWinMsg);
    271         RestoreOS2TIB();
     299        if (win32wnd->IsWindowCreated())
     300        {
     301          win32wnd->MsgButton(pWinMsg);
     302          RestoreOS2TIB();
     303        }
    272304        return (MRESULT)TRUE;
    273305
     
    287319    {
    288320        //OS/2 Window coordinates -> Win32 Window coordinates
    289         win32wnd->MsgMouseMove(pWinMsg);
     321        if (win32wnd->IsWindowCreated())
     322          win32wnd->MsgMouseMove(pWinMsg);
    290323        RestoreOS2TIB();
    291324        return (MRESULT)TRUE;
     
    297330
    298331      // Only send this message if the window is enabled
    299       if (!WinIsWindowEnabled(hwnd))
     332      if (!win32wnd->IsWindowCreated())
     333        res = HT_NORMAL;
     334      else if (!WinIsWindowEnabled(hwnd))
    300335        res = HT_ERROR;
    301336      else if (win32wnd->getIgnoreHitTest())
     
    315350
    316351    case WM_PAINT:
    317         win32wnd->DispatchMsgA(pWinMsg);
     352        dprintf(("PMFRAME: WM_PAINT"));
     353        if (win32wnd->IsWindowCreated())
     354          win32wnd->MsgNCPaint();
    318355        goto RunDefWndProc;
    319356
     
    430467      UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP;
    431468
    432       //CB: only used if CS_SIZEDRAW isn't set
    433       //    PM moves children -> fast, no flickering (if redraw flags not set)
     469//CB: todo: use WM_NCCALCSIZE
    434470      if (win32wnd->getWindowClass())
    435471      {
     
    456492        USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS);
    457493
    458         //CB: emulate WM_ACTIVATE -> no flickering
    459         hwndTitle = WinWindowFromID(hwnd,FID_TITLEBAR);
    460         if (hwndTitle) WinSendMsg(hwndTitle,TBM_SETHILITE,mp1,MPVOID);
    461 
    462         WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2);
    463         WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE));
    464 
    465         //CB: show owner behind the dialog
    466         if (win32wnd->IsModalDialog())
     494        if (win32wnd->IsWindowCreated())
    467495        {
    468           Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent();
    469 
    470           if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER);
     496          WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2);
     497          WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE));
     498
     499          //CB: show owner behind the dialog
     500          if (win32wnd->IsModalDialog())
     501          {
     502            Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent();
     503
     504            if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER);
     505          }
     506        } else
     507        {
     508          WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE));
    471509        }
    472510
Note: See TracChangeset for help on using the changeset viewer.