Ignore:
Timestamp:
Nov 26, 1999, 6:06:09 PM (26 years ago)
Author:
cbratschi
Message:

map rect, WM_ERASEBKGND and other fixes

File:
1 edited

Legend:

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

    r1297 r1849  
    1 /* $Id: oslibgdi.cpp,v 1.3 1999-10-14 18:27:57 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.4 1999-11-26 17:06:07 cbratschi Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    8585    }
    8686
    87     if(hwndParent != HWND_DESKTOP) 
     87    if(hwndParent != HWND_DESKTOP)
    8888    {
    89         window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndParent);
    90         if(window == NULL)
    91                 return FALSE;
    92         height = window->getWindowHeight();
     89        window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwndParent);
     90        if(window == NULL)
     91                return FALSE;
     92        height = window->getWindowHeight();
    9393    }
    9494    else height = OSLibQueryScreenHeight();
     
    106106//
    107107// Parameters:
     108//   hwnd:       OS/2 window handle
    108109//   rectOS2:    OS/2 child window RECTL
    109110//   rectWin32:  Win32 Child window RECT   (IN)
     
    113114//   FALSE:     Failures
    114115//******************************************************************************
    115 BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectOS2, PRECT rectWin32)
    116 {
    117  ULONG length = rectOS2->yTop - rectOS2->yBottom;
    118 
    119    rectWin32->bottom = length - rectOS2->yBottom;
    120    rectWin32->top    = length - rectOS2->yTop;
     116BOOL MapOS2ToWin32Rectl(HWND hwnd,PRECTLOS2 rectOS2, PRECT rectWin32)
     117{
     118   RECTL rect;
     119
     120   if (!WinQueryWindowRect(hwnd,&rect)) return FALSE;
     121
     122   rectWin32->bottom = rect.yTop-rectOS2->yBottom;
     123   rectWin32->top    = rect.yTop-rectOS2->yTop;
    121124   rectWin32->left   = rectOS2->xLeft;
    122125   rectWin32->right  = rectOS2->xRight;
     126
    123127   return TRUE;
    124128}
     
    128132//
    129133// Parameters:
     134//   hwnd:       OS/2 window handle
    130135//   rectWin32:  Win32 Child window RECT   (IN)
    131136//   rectOS2:    OS/2  Child window RECTL  (OUT)
     
    134139//   FALSE:      Failures
    135140//******************************************************************************
    136 BOOL MapWin32ToOS2Rectl(PRECT rectWin32, PRECTLOS2 rectOS2)
    137 {
    138  ULONG length = rectWin32->bottom - rectWin32->top;
    139 
    140     rectOS2->yBottom = length - rectWin32->bottom;
    141     rectOS2->yTop    = length - rectWin32->top;
     141BOOL MapWin32ToOS2Rectl(HWND hwnd,PRECT rectWin32, PRECTLOS2 rectOS2)
     142{
     143    RECTL rect;
     144
     145    if (!WinQueryWindowRect(hwnd,&rect)) return FALSE;
     146
     147    rectOS2->yBottom = rect.yTop-rectWin32->bottom;
     148    rectOS2->yTop    = rect.yTop-rectWin32->top;
    142149    rectOS2->xLeft   = rectWin32->left;
    143150    rectOS2->xRight  = rectWin32->right;
     151
    144152    return TRUE;
     153}
     154//******************************************************************************
     155//******************************************************************************
     156BOOL MapOS2ToWin32WindowRect(PRECTLOS2 rectOS2,PRECT rectWin32)
     157{
     158  rectWin32->bottom = rectOS2->yTop;
     159  rectWin32->top    = rectOS2->yBottom;
     160  rectWin32->left   = rectOS2->xLeft;
     161  rectWin32->right  = rectOS2->xRight;
     162
     163  return TRUE;
     164}
     165//******************************************************************************
     166//******************************************************************************
     167BOOL MapWin32ToOS2WindowRect(PRECT rectWin32,PRECTLOS2 rectOS2)
     168{
     169  rectOS2->yBottom = rectWin32->top;
     170  rectOS2->yTop    = rectWin32->bottom;
     171  rectOS2->xLeft   = rectWin32->left;
     172  rectOS2->xRight  = rectWin32->right;
     173
     174  return TRUE;
    145175}
    146176//******************************************************************************
     
    155185        return 0;
    156186    }
    157     MapOS2ToWin32Rectl((RECTLOS2 *)&rectl, rectWin32);
     187    MapOS2ToWin32Rectl(hwnd,(RECTLOS2 *)&rectl, rectWin32);
    158188    return WinBeginPaint(hwnd, NULLHANDLE, &rectl);
    159189}
     
    169199{
    170200  if(hwnd == OSLIB_HWND_DESKTOP)
    171         hwnd = HWND_DESKTOP;
     201        hwnd = HWND_DESKTOP;
    172202
    173203  return (HDC)WinGetPS(hwnd);
     
    186216
    187217    if(pRect) {
    188         MapWin32ToOS2Rectl(pRect, &rectl);
     218        MapWin32ToOS2Rectl(hwnd,pRect, &rectl);
    189219        return WinInvalidateRect(hwnd, (PRECTL)&rectl, fIncludeChildren);
    190220    }
     
    201231  rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
    202232  if(rc) {
    203         MapOS2ToWin32Rectl(&rectl, pRect);
     233        MapOS2ToWin32Rectl(hwnd,&rectl, pRect);
    204234  }
    205235  else  memset(pRect, 0, sizeof(RECT));
Note: See TracChangeset for help on using the changeset viewer.