Changeset 340 for trunk/src


Ignore:
Timestamp:
Jul 19, 1999, 8:40:44 PM (26 years ago)
Author:
sandervl
Message:

Point/Rectangle bug fixes

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

Legend:

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

    r328 r340  
    1 /* $Id: oslibgdi.cpp,v 1.2 1999-07-18 14:39:35 sandervl Exp $ */
     1/* $Id: oslibgdi.cpp,v 1.3 1999-07-19 18:40:43 sandervl Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    1919#include <misc.h>
    2020#include <oslibgdi.h>
     21#include <oslibwin.h>
    2122
    22 //******************************************************************************
    23 //******************************************************************************
    24 inline PRECTL Win32ToOS2Rect(PVOID pRectl)
    25 {
    26  PRECTL pWinRect = (PRECTL)pRectl;
    27  ULONG  tmp;
    28 
    29   tmp = pWinRect->yBottom;
    30   pWinRect->yBottom = pWinRect->yTop;
    31   pWinRect->yTop = tmp;
    32   return pWinRect;
    33 }
    34 //******************************************************************************
    35 //******************************************************************************
    36 inline ULONG MAPWIN32POINT(RECTLOS2 *parent, RECTLOS2 *child, ULONG y)
    37 {
    38   return (parent->yTop - parent->yBottom - (child->yTop - child->yBottom) - y - 1);
    39 }
    4023//******************************************************************************
    4124//******************************************************************************
    4225inline ULONG MAPWIN32POINT(RECTLOS2 *parent, ULONG cy, ULONG y)
    4326{
    44   return (parent->yTop - parent->yBottom - cy - y - 1);
     27    return (parent->yTop - parent->yBottom - cy - y);
     28}
     29//******************************************************************************
     30//Map win32 y coordinate (in parent window coordinates) to OS/2 y coord. (in parent window coordinates)
     31//******************************************************************************
     32ULONG MapOS2ToWin32Y(HWND hwndParent, ULONG cy, ULONG y)
     33{
     34 RECTLOS2 rectParent = {0};
     35
     36    if(hwndParent == OSLIB_HWND_DESKTOP) {
     37        hwndParent = HWND_DESKTOP;
     38    }
     39    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
     40    return MAPWIN32POINT(&rectParent, cy, y);
    4541}
    4642//******************************************************************************
    4743//******************************************************************************
    48 ULONG MapOS2ToWin32Y(HWND hwndChild)
     44BOOL MapOS2ToWin32Point(HWND hwndParent, HWND hwndChild, OSLIBPOINT *point)
    4945{
    50  HWND     hwndParent;
    51  RECTLOS2 rectParent = {0}, rectChild = {0};
    52 
    53    WinQueryWindowRect(hwndChild, (PRECTL)&rectChild);
    54    hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    55    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    56    return MAPWIN32POINT(&rectParent, &rectChild, rectChild.yBottom);
    57 }
    58 //******************************************************************************
    59 //******************************************************************************
    60 ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG y)
    61 {
    62  HWND     hwndParent;
    63  RECTLOS2 rectParent = {0}, rectChild = {0};
    64 
    65    WinQueryWindowRect(hwndChild, (PRECTL)&rectChild);
    66    hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    67    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    68    return MAPWIN32POINT(&rectParent, &rectChild, y);
    69 }
    70 //******************************************************************************
    71 //******************************************************************************
    72 ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG cy, ULONG y)
    73 {
    74  HWND     hwndParent;
    7546 RECTLOS2 rectParent = {0};
    7647
    77    hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    78    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    79    return MAPWIN32POINT(&rectParent, cy, y);
    80 }
    81 //******************************************************************************
    82 //******************************************************************************
    83 ULONG MapOS2ToWin32Y(PRECTLOS2 rectParent, PRECTLOS2 rectChild, ULONG y)
    84 {
    85    return MAPWIN32POINT(rectParent, rectChild, y);
    86 }
    87 //******************************************************************************
    88 //******************************************************************************
    89 ULONG MapOS2ToWin32Y(PRECTLOS2 rectParent, HWND hwndChild, ULONG y)
    90 {
    91  RECTLOS2 rectChild = {0};
    92 
    93    WinQueryWindowRect(hwndChild, (PRECTL)&rectChild);
    94    return MAPWIN32POINT(rectParent, &rectChild, y);
    95 }
    96 //******************************************************************************
    97 //******************************************************************************
    98 ULONG MapOS2ToWin32Y(HWND hwndChild, PRECTLOS2 rectChild, ULONG y)
    99 {
    100  HWND     hwndParent;
    101  RECTLOS2 rectParent = {0};
    102 
    103    hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    104    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    105    return MAPWIN32POINT(&rectParent, rectChild, y);
     48    if(hwndParent == OSLIB_HWND_DESKTOP) {
     49        hwndParent = HWND_DESKTOP;
     50    }
     51    if(WinMapWindowPoints(hwndChild, hwndParent, (POINTL *)point, 1) != 0) {
     52        dprintf(("MapOS2ToWin32Point:WinMapWindowPoint %x %x returned false", hwndParent, hwndChild));
     53        return FALSE;
     54    }
     55    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
     56    point->y = rectParent.yTop - point->y;
     57    return TRUE;
    10658}
    10759//******************************************************************************
     
    11062//
    11163// Parameters:
    112 //   hwndChild: Child window handle
    113 //   rectChild: OS/2 child window RECTL
     64//   rectOS2:    OS/2 child window RECTL
     65//   rectWin32:  Win32 Child window RECT   (IN)
    11466//
    11567// Returns:
    116 //   rectChild: Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed)
    11768//   TRUE:      Success
    11869//   FALSE:     Failures
    11970//******************************************************************************
    120 BOOL MapOS2ToWin32Rectl(HWND hwndChild, PRECTLOS2 rectChild, PRECT rectWin32)
     71BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectOS2, PRECT rectWin32)
    12172{
    122  HWND     hwndParent;
    123  RECTLOS2 rectParent = {0};
     73 ULONG length = rectOS2->yTop - rectOS2->yBottom;
    12474
    125    hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    126    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    127 
    128    rectWin32->yTop    = MAPWIN32POINT(&rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yBottom);
    129    rectWin32->yBottom = MAPWIN32POINT(&rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yTop);
    130    rectWin32->xLeft   = rectChild->xLeft;
    131    rectWin32->xRight  = rectChild->xRight;
    132    return TRUE;
    133 }
    134 //******************************************************************************
    135 // MapOS2ToWin32Rectl
    136 //   Convert OS/2 to Win32 RECTL structure
    137 //
    138 // Parameters:
    139 //   rectParent: OS/2 Parent window RECTL
    140 //   rectChild:  OS/2 Child window RECTL
    141 //
    142 // Returns:
    143 //   rectChild:  Converted OS/2 rectange stored in Win32 RECTL (yTop & yBottom reversed)
    144 //   TRUE:       Success
    145 //   FALSE:      Failures
    146 //******************************************************************************
    147 BOOL MapOS2ToWin32Rectl(PRECTLOS2 rectParent, PRECTLOS2 rectChild, PRECT rectWin32)
    148 {
    149    rectWin32->yTop    = MAPWIN32POINT(rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yBottom);
    150    rectWin32->yBottom = MAPWIN32POINT(rectParent, rectChild->yTop - rectChild->yBottom, rectChild->yTop);
    151    rectWin32->xLeft   = rectChild->xLeft;
    152    rectWin32->xRight  = rectChild->xRight;
     75   rectWin32->bottom = length - rectOS2->yBottom;
     76   rectWin32->top    = length - rectOS2->yTop;
     77   rectWin32->left   = rectOS2->xLeft;
     78   rectWin32->right  = rectOS2->xRight;
    15379   return TRUE;
    15480}
     
    15884//
    15985// Parameters:
    160 //   hwndChild:  OS/2  Child window handle (IN)
    16186//   rectWin32:  Win32 Child window RECT   (IN)
    162 //   rectChild:  OS/2  Child window RECTL  (OUT)
     87//   rectOS2:    OS/2  Child window RECTL  (OUT)
    16388// Returns:
    16489//   TRUE:       Success
    16590//   FALSE:      Failures
    16691//******************************************************************************
    167 BOOL MapWin32ToOS2Rectl(HWND hwndChild, PRECT rectWin32, PRECTLOS2 rectChild)
     92BOOL MapWin32ToOS2Rectl(PRECT rectWin32, PRECTLOS2 rectOS2)
    16893{
    169  HWND     hwndParent;
    170  RECTLOS2 rectParent = {0};
     94 ULONG length = rectWin32->top - rectWin32->bottom;
    17195
    172    hwndParent = WinQueryWindow(hwndChild, QW_PARENT);
    173    WinQueryWindowRect(hwndParent, (PRECTL)&rectParent);
    174 
    175    rectChild->yTop    = MAPWIN32POINT(&rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yBottom);
    176    rectChild->yBottom = MAPWIN32POINT(&rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yTop);
    177    rectChild->xLeft   = rectWin32->xLeft;
    178    rectChild->xRight  = rectWin32->xRight;
    179    return TRUE;
    180 }
    181 //******************************************************************************
    182 // MapWin32ToOS2Rectl
    183 //   Convert Win32 to OS/2 RECTL structure
    184 //
    185 // Parameters:
    186 //   rectParent: OS/2  Parent window RECTL (IN)
    187 //   rectWin32:  Win32 Child window RECT   (IN)
    188 //   rectChild:  OS/2  Child window RECTL  (OUT)
    189 // Returns:
    190 //   TRUE:       Success
    191 //   FALSE:      Failures
    192 //******************************************************************************
    193 BOOL MapWin32ToOS2Rectl(PRECTLOS2 rectParent, PRECT rectWin32, PRECTLOS2 rectChild)
    194 {
    195    rectChild->yTop    = MAPWIN32POINT(rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yBottom);
    196    rectChild->yBottom = MAPWIN32POINT(rectParent, rectWin32->yBottom - rectWin32->yTop, rectWin32->yTop);
    197    rectChild->xLeft   = rectWin32->xLeft;
    198    rectChild->xRight  = rectWin32->xRight;
    199    return TRUE;
     96    rectOS2->yBottom = length - rectWin32->bottom;
     97    rectOS2->yTop    = length - rectWin32->top;
     98    rectOS2->xLeft   = rectWin32->left;
     99    rectOS2->xRight  = rectWin32->right;
     100    return TRUE;
    200101}
    201102//******************************************************************************
    202103//******************************************************************************
    203 HDC OSLibWinBeginPaint(HWND hwnd, PVOID pRectl)
     104HDC OSLibWinBeginPaint(HWND hwnd, RECT *rectWin32)
    204105{
    205  RECTLOS2 rectlOS2;
     106 RECTL rectl;
    206107
    207   MapWin32ToOS2Rectl(hwnd, (PRECT)pRectl, &rectlOS2);
    208   return WinBeginPaint(hwnd, NULLHANDLE, (PRECTL)&rectlOS2);
     108    if(WinQueryUpdateRect(hwnd, &rectl) == FALSE)
     109    {
     110        dprintf(("BeginPaint, NO update rectl"));
     111        return 0;
     112    }
     113    MapOS2ToWin32Rectl((RECTLOS2 *)&rectl, rectWin32);
     114    return WinBeginPaint(hwnd, NULLHANDLE, &rectl);
    209115}
    210116//******************************************************************************
  • trunk/src/user32/new/oslibgdi.h

    r325 r340  
    1 /* $Id: oslibgdi.h,v 1.1 1999-07-18 10:39:51 sandervl Exp $ */
     1/* $Id: oslibgdi.h,v 1.2 1999-07-19 18:40:43 sandervl Exp $ */
    22/*
    33 * Window GDI wrapper functions for OS/2
     
    1616#include "win32type.h"
    1717#endif
     18#include <win32wnd.h>
    1819
    1920typedef struct
     
    2526} RECTLOS2, *PRECTLOS2;
    2627
    27 HDC   OSLibWinBeginPaint(HWND hwnd, PVOID pRectl);
     28typedef struct
     29{
     30    LONG  x;
     31    LONG  y;
     32} OSLIBPOINT;
     33
     34HDC   OSLibWinBeginPaint(HWND hwnd, RECT *pRectl);
    2835BOOL  OSLibWinEndPaint(HDC hdc);
    2936
     
    3138BOOL  OSLibWinReleasePS(HDC hdc);
    3239
    33 ULONG MapOS2ToWin32Y(HWND hwndChild);
    34 ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG y);
    35 ULONG MapOS2ToWin32Y(HWND hwndChild, ULONG cy, ULONG y);
    36 ULONG MapOS2ToWin32Y(PRECTLOS2 rectParent, PRECTLOS2 rectChild, ULONG y);
    37 ULONG MapOS2ToWin32Y(PRECTLOS2 rectParent, HWND hwndChild, ULONG y);
    38 ULONG MapOS2ToWin32Y(HWND hwndChild, PRECTLOS2 rectChild, ULONG y);
    39 BOOL  MapOS2ToWin32Rectl(HWND hwndChild, PRECTLOS2 rectChild, PRECT rectWin32);
    40 BOOL  MapOS2ToWin32Rectl(PRECTLOS2 rectParent, PRECTLOS2 rectChild, PRECT rectWin32);
    41 BOOL  MapWin32ToOS2Rectl(HWND hwndChild, PRECTLOS2 rectChild, PRECT rectWin32);
    42 BOOL  MapWin32ToOS2Rectl(PRECTLOS2 rectParent, PRECTLOS2 rectChild, PRECT rectWin32);
     40//******************************************************************************
     41//Map win32 y coordinate (in window coordinates) to OS/2 y coord. (in window coordinates)
     42//******************************************************************************
     43inline ULONG MapOS2ToWin32Y(Win32Window *window, ULONG y)
     44{
     45    return window->getWindowHeight() - y;
     46}
     47
     48ULONG MapOS2ToWin32Y(HWND hwndParent, ULONG cy, ULONG y);
     49BOOL  MapOS2ToWin32Point(HWND hwndParent, HWND hwndChild, OSLIBPOINT *point);
     50
     51BOOL  MapOS2ToWin32Rectl(PRECTLOS2 rectOS2, PRECT rectWin32);
     52BOOL  MapWin32ToOS2Rectl(PRECT rectWin32, PRECTLOS2 rectOS2);
    4353
    4454#endif //__OSLIBGDI_H__
  • trunk/src/user32/new/oslibwin.cpp

    r332 r340  
    1 /* $Id: oslibwin.cpp,v 1.15 1999-07-18 18:04:29 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.16 1999-07-19 18:40:43 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    226226                          LONG cy, ULONG fl)
    227227{
     228 HWND hwndParent = hwndInsertBehind;
     229
    228230  if(fl & SWP_MOVE) {
    229         y = MapOS2ToWin32Y(hwnd, cy, y);
     231        switch(hwndParent)
     232        {
     233            case HWNDOS_TOP:
     234            case HWNDOS_BOTTOM:
     235                hwndParent = HWND_DESKTOP;
     236                break;
     237        }
     238        y = MapOS2ToWin32Y(hwndParent, cy, y);
    230239  }
    231240  dprintf(("WinSetWindowPos %x %x %d %d %d %d %x", hwnd, hwndInsertBehind, x, y, cx, cy, fl));
     
    255264}
    256265//******************************************************************************
     266//Returns rectangle in Win32 window coordinates
    257267//******************************************************************************
    258268BOOL OSLibWinQueryUpdateRect(HWND hwnd, PVOID pRect)
     
    263273  rc = WinQueryUpdateRect(hwnd, (PRECTL)&rectl);
    264274  if(rc) {
    265     MapOS2ToWin32Rectl(hwnd, &rectl, (PRECT)pRect);
    266   }
     275        MapOS2ToWin32Rectl(&rectl, (PRECT)pRect);
     276  }
     277  else  memset(pRect, 0, sizeof(RECT));
    267278  return rc;
    268279}
  • trunk/src/user32/new/pmwindow.cpp

    r338 r340  
    1 /* $Id: pmwindow.cpp,v 1.11 1999-07-19 13:58:38 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.12 1999-07-19 18:40:43 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    6969     (PSZ)WIN32_STDCLASS,               /* Window class name            */
    7070     (PFNWP)Win32WindowProc,            /* Address of window procedure  */
    71      CS_SIZEREDRAW | CS_MOVENOTIFY | CS_HITTEST,
     71     CS_SIZEREDRAW | CS_HITTEST,
    7272     8)) {
    7373        dprintf(("WinRegisterClass Win32Window failed"));
     
    8383{
    8484 POSTMSG_PACKET *postmsg;
    85  Win32Window  *win32wnd;
    86  APIRET        rc;
     85 OSLIBPOINT      point;
     86 Win32Window    *win32wnd;
     87 APIRET          rc;
    8788
    8889  //Restore our FS selector
     
    160161        break;
    161162
    162     case WM_MOVE:
     163    case WM_ADJUSTWINDOWPOS:
    163164    {
    164165      RECTLOS2 rectChild;
    165166      ULONG x, y;
    166167
    167         dprintf(("OS2: WM_MOVE %x", hwnd));
     168        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
    168169
    169170        WinQueryWindowRect(hwnd, (PRECTL)&rectChild);
     
    171172        //Calculate position relative to parent window (real window or desktop)
    172173        x = rectChild.xLeft;
    173         y = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
     174//        y = MapOS2ToWin32Y(hwnd, &rectChild, rectChild.yBottom);
    174175
    175176        if(win32wnd->MsgMove(x, y)) {
     
    182183    {
    183184        dprintf(("OS2: WM_WINDOWPOSCHANGED %x", hwnd));
    184     }
    185 
    186     case WM_ADJUSTWINDOWPOS:
    187     {
    188         dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
    189 //          if(win32wnd->MsgWindowPosChanging(0, 0)) {
    190                 goto RunDefWndProc;
    191 //  }
    192         break;
    193185    }
    194186
     
    269261    }
    270262    //**************************************************************************
    271     //Mouse messages
     263    //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen
    272264    //**************************************************************************
    273265    case WM_BUTTON1DOWN:
    274266        dprintf(("OS2: WM_BUTTON1DOWN %x", hwnd));
    275         if(win32wnd->MsgButton(BUTTON_LEFTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
    276                 goto RunDefWndProc;
    277         }
    278         break;
     267        point.x = (*(POINTS *)&mp1).x;
     268        point.y = (*(POINTS *)&mp1).y;
     269        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     270        if(win32wnd->MsgButton(BUTTON_LEFTDOWN, point.x, point.y)) {
     271                goto RunDefWndProc;
     272        }
     273        break;
     274
    279275    case WM_BUTTON1UP:
    280276        dprintf(("OS2: WM_BUTTON1UP %x", hwnd));
    281         if(win32wnd->MsgButton(BUTTON_LEFTUP, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     277        point.x = (*(POINTS *)&mp1).x;
     278        point.y = (*(POINTS *)&mp1).y;
     279        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     280        if(win32wnd->MsgButton(BUTTON_LEFTUP, point.x, point.y)) {
    282281                goto RunDefWndProc;
    283282        }
    284283        break;
    285284    case WM_BUTTON1DBLCLK:
    286         if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     285        point.x = (*(POINTS *)&mp1).x;
     286        point.y = (*(POINTS *)&mp1).y;
     287        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     288        if(win32wnd->MsgButton(BUTTON_LEFTDBLCLICK, point.x, point.y)) {
    287289                goto RunDefWndProc;
    288290        }
    289291        break;
    290292    case WM_BUTTON2DOWN:
    291         if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     293        point.x = (*(POINTS *)&mp1).x;
     294        point.y = (*(POINTS *)&mp1).y;
     295        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     296        if(win32wnd->MsgButton(BUTTON_RIGHTDOWN, point.x, point.y)) {
    292297                goto RunDefWndProc;
    293298        }
    294299        break;
    295300    case WM_BUTTON2UP:
    296         if(win32wnd->MsgButton(BUTTON_RIGHTUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     301        point.x = (*(POINTS *)&mp1).x;
     302        point.y = (*(POINTS *)&mp1).y;
     303        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     304        if(win32wnd->MsgButton(BUTTON_RIGHTUP, point.x, point.y)) {
    297305                goto RunDefWndProc;
    298306        }
    299307        break;
    300308    case WM_BUTTON2DBLCLK:
    301         if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     309        point.x = (*(POINTS *)&mp1).x;
     310        point.y = (*(POINTS *)&mp1).y;
     311        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     312        if(win32wnd->MsgButton(BUTTON_RIGHTDBLCLICK, point.x, point.y)) {
    302313                goto RunDefWndProc;
    303314        }
    304315        break;
    305316    case WM_BUTTON3DOWN:
    306         if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     317        point.x = (*(POINTS *)&mp1).x;
     318        point.y = (*(POINTS *)&mp1).y;
     319        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     320        if(win32wnd->MsgButton(BUTTON_MIDDLEDOWN, point.x, point.y)) {
    307321                goto RunDefWndProc;
    308322        }
    309323        break;
    310324    case WM_BUTTON3UP:
    311         if(win32wnd->MsgButton(BUTTON_MIDDLEUP, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     325        point.x = (*(POINTS *)&mp1).x;
     326        point.y = (*(POINTS *)&mp1).y;
     327        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     328        if(win32wnd->MsgButton(BUTTON_MIDDLEUP, point.x, point.y)) {
    312329                goto RunDefWndProc;
    313330        }
    314331        break;
    315332    case WM_BUTTON3DBLCLK:
    316         if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, (*(POINTS *)&mp1).x,MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     333        point.x = (*(POINTS *)&mp1).x;
     334        point.y = (*(POINTS *)&mp1).y;
     335        MapOS2ToWin32Point(OSLIB_HWND_DESKTOP, hwnd, &point);
     336        if(win32wnd->MsgButton(BUTTON_MIDDLEDBLCLICK, point.x, point.y)) {
    317337                goto RunDefWndProc;
    318338        }
     
    344364            keystate |= WMMOVE_CTRL;
    345365
    346         if(!win32wnd->MsgMouseMove(keystate, (*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     366        //OS/2 Window coordinates -> Win32 Window coordinates
     367        if(!win32wnd->MsgMouseMove(keystate, SHORT1FROMMP(mp1), MapOS2ToWin32Y(win32wnd, SHORT2FROMMP(mp1)))) {
    347368                goto RunDefWndProc;
    348369        }
     
    398419
    399420    case WM_HITTEST:
    400         if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(hwnd, (*(POINTS *)&mp1).y))) {
     421        if(win32wnd->MsgHitTest((*(POINTS *)&mp1).x, MapOS2ToWin32Y(OSLIB_HWND_DESKTOP, hwnd, (*(POINTS *)&mp1).y))) {
    401422                goto RunDefWndProc;
    402423        }
  • trunk/src/user32/new/win32wnd.cpp

    r338 r340  
    1 /* $Id: win32wnd.cpp,v 1.15 1999-07-19 13:58:38 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.16 1999-07-19 18:40:44 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    391391        OffsetRect(&rectWindow, maxPos.x - rectWindow.left,
    392392                                          maxPos.y - rectWindow.top);
    393     dprintf(("Sending WM_CREATE"));
     393        dprintf(("Sending WM_CREATE"));
    394394        if( (SendInternalMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
    395395        {
    396396            SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
    397              rectClient.right-rectClient.left,
    398              rectClient.bottom-rectClient.top,
    399              SWP_NOACTIVATE);
     397                         rectClient.right-rectClient.left,
     398                         rectClient.bottom-rectClient.top,
     399                         SWP_NOACTIVATE);
    400400
    401401            if (cs->style & WS_VISIBLE) ShowWindow( sw );
     
    12411241 RECT rect;
    12421242
    1243   if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
    1244   {//update region not empty
    1245     SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
    1246   }
    1247   return TRUE;
     1243    if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
     1244    {//update region not empty
     1245        SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
     1246    }
     1247    return TRUE;
    12481248}
    12491249//******************************************************************************
     
    12511251BOOL Win32Window::IsIconic()
    12521252{
    1253   return OSLibWinIsIconic(OS2Hwnd);
     1253    return OSLibWinIsIconic(OS2Hwnd);
    12541254}
    12551255//******************************************************************************
     
    12631263 HWND          hwndRelated;
    12641264
    1265   dprintf(("GetWindow %x %d NOT COMPLETE", getWindowHandle(), uCmd));
    1266   switch(uCmd)
    1267   {
    1268     case GW_CHILD:
    1269         getcmd = QWOS_TOP;
    1270         break;
    1271     case GW_HWNDFIRST:
    1272         if(getParent()) {
    1273             getcmd = QWOS_TOP; //top of child windows
    1274         }
    1275         else    getcmd = QWOS_TOP; //TODO
    1276         break;
    1277     case GW_HWNDLAST:
    1278         if(getParent()) {
    1279             getcmd = QWOS_BOTTOM; //bottom of child windows
    1280         }
    1281         else    getcmd = QWOS_BOTTOM; //TODO
    1282         break;
    1283     case GW_HWNDNEXT:
    1284         getcmd = QWOS_NEXT;
    1285         break;
    1286     case GW_HWNDPREV:
    1287         getcmd = QWOS_PREV;
    1288         break;
    1289     case GW_OWNER:
    1290         if(owner) {
    1291             return owner->getWindowHandle();
    1292         }
    1293         else    return 0;
    1294   }
    1295   hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd);
    1296   if(hwndRelated)
    1297   {
    1298     win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
    1299     magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
    1300     if(CheckMagicDword(magic) && win32wnd)
     1265    dprintf(("GetWindow %x %d NOT COMPLETE", getWindowHandle(), uCmd));
     1266    switch(uCmd)
    13011267    {
    1302         return win32wnd->getWindowHandle();
     1268        case GW_CHILD:
     1269            getcmd = QWOS_TOP;
     1270            break;
     1271        case GW_HWNDFIRST:
     1272            if(getParent()) {
     1273                    getcmd = QWOS_TOP; //top of child windows
     1274            }
     1275            else    getcmd = QWOS_TOP; //TODO
     1276            break;
     1277        case GW_HWNDLAST:
     1278            if(getParent()) {
     1279                    getcmd = QWOS_BOTTOM; //bottom of child windows
     1280            }
     1281            else    getcmd = QWOS_BOTTOM; //TODO
     1282            break;
     1283        case GW_HWNDNEXT:
     1284            getcmd = QWOS_NEXT;
     1285            break;
     1286        case GW_HWNDPREV:
     1287            getcmd = QWOS_PREV;
     1288            break;
     1289        case GW_OWNER:
     1290            if(owner) {
     1291                    return owner->getWindowHandle();
     1292            }
     1293            else    return 0;
    13031294    }
    1304   }
    1305   return 0;
     1295    hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd);
     1296    if(hwndRelated)
     1297    {
     1298        win32wnd = (Win32Window *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
     1299        magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
     1300        if(CheckMagicDword(magic) && win32wnd)
     1301        {
     1302            return win32wnd->getWindowHandle();
     1303        }
     1304    }
     1305    return 0;
    13061306}
    13071307//******************************************************************************
  • trunk/src/user32/new/win32wnd.h

    r338 r340  
    1 /* $Id: win32wnd.h,v 1.14 1999-07-19 13:58:39 sandervl Exp $ */
     1/* $Id: win32wnd.h,v 1.15 1999-07-19 18:40:44 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    8686        DWORD   getWindowId()                   { return windowId; };
    8787         void   setWindowId(DWORD id)           { windowId = id; };
     88         ULONG  getWindowHeight()               { return rectClient.bottom - rectClient.top; };
    8889
    8990         DWORD  getFlags()                      { return flags; };
  • trunk/src/user32/new/wingdi.cpp

    r328 r340  
    1 /* $Id: wingdi.cpp,v 1.3 1999-07-18 14:39:35 sandervl Exp $ */
     1/* $Id: wingdi.cpp,v 1.4 1999-07-19 18:40:44 sandervl Exp $ */
    22/*
    33 * Win32 Window graphics apis for OS/2
     
    2424  Win32Window *window;
    2525
    26    window = Win32Window::GetWindowFromHandle(hwnd);
    27    if(!window) {
    28         dprintf(("GetDC, window %x not found", hwnd));
    29         return 0;
    30    }
    31    dprintf(("BeginPaint %X\n", hwnd));
    32    if(OSLibWinQueryUpdateRect(window->getOS2WindowHandle(), &lps->rcPaint) == FALSE)
    33    {
    34         dprintf(("BeginPaint, NO update rectl"));
    35         return 0;
    36    }
    37    lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), (PVOID)&lps->rcPaint);
     26    window = Win32Window::GetWindowFromHandle(hwnd);
     27    if(!window) {
     28        dprintf(("GetDC, window %x not found", hwnd));
     29        return 0;
     30    }
     31    dprintf(("BeginPaint %X\n", hwnd));
     32    lps->hdc = OSLibWinBeginPaint(window->getOS2WindowHandle(), &lps->rcPaint);
    3833
    39    return lps->hdc;
     34    return lps->hdc;
    4035}
    4136//******************************************************************************
     
    5550   window = Win32Window::GetWindowFromHandle(hwnd);
    5651   if(!window) {
    57         dprintf(("GetDC, window %x not found", hwnd));
    58         return 0;
     52    dprintf(("GetDC, window %x not found", hwnd));
     53    return 0;
    5954   }
    6055   dprintf(("GetDC %x", hwnd));
Note: See TracChangeset for help on using the changeset viewer.