Changeset 323 for trunk/src


Ignore:
Timestamp:
Jul 17, 1999, 5:23:38 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

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

Legend:

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

    r322 r323  
    1 /* $Id: oslibwin.cpp,v 1.7 1999-07-17 12:49:40 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.8 1999-07-17 15:23:38 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    3838//******************************************************************************
    3939HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
    40                           char *pszName, ULONG x, ULONG y, ULONG cx, ULONG cy,
    41                           HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)
     40                          char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame)
    4241{
    4342 HWND  hwndClient;
    4443 RECTL rectl;
    4544
     45  if(pszName && *pszName == 0) {
     46        pszName = NULL;
     47  }
    4648  if(hwndParent == 0) {
    4749        hwndParent = HWND_DESKTOP;
    48   }
    49   if(WinQueryWindowRect(hwndParent, &rectl) == TRUE) {
    50         y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);
    5150  }
    5251  if(dwFrameStyle) {
     
    5958                        WinSetWindowText(*hwndFrame, pszName);
    6059                }
    61                 WinSetWindowPos(*hwndFrame, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP,
    62                                 x, y, cx, cy, SWP_SIZE | SWP_MOVE);
    63 
    6460                return hwndClient;
    6561        }
     
    6763        return 0;
    6864  }
    69   hwndClient = WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, x, y, cx, cy,
     65  hwndClient = WinCreateWindow(hwndParent, WIN32_STDCLASS, pszName, dwWinStyle, 0, 0, 0, 0,
    7066                               Owner, (fHWND_BOTTOM) ? HWND_BOTTOM :HWND_TOP, 0, NULL,
    7167                               NULL);
     
    8379  if(dwStyle & WINWS_MINIMIZE)
    8480        *OSWinStyle |= WS_MINIMIZED;
     81//Done explicitely in CreateWindowExA
     82#if 0
    8583  if(dwStyle & WINWS_VISIBLE)
    8684        *OSWinStyle |= WS_VISIBLE;
     85#endif
    8786  if(dwStyle & WINWS_DISABLED)
    8887        *OSWinStyle |= WS_DISABLED;
     
    178177                          LONG cy, ULONG fl)
    179178{
     179 RECTL rectl;
     180 HWND  hwndParent;
     181
     182  if(fl & SWP_MOVE) {
     183        hwndParent = WinQueryWindow(hwnd, QW_PARENT);
     184        if(WinQueryWindowRect(hwnd, &rectl)) {
     185                y = OS2TOWIN32POINT(rectl.yTop - rectl.yBottom, y);
     186        }
     187  }
    180188  return WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
    181189}
     
    184192BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
    185193{
    186   return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
     194 BOOL rc;
     195
     196  if(fl & SWP_SHOW) {
     197         rc = WinShowWindow(hwnd, TRUE);
     198  }
     199  if(rc == 0)
     200        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
     201  rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
     202  if(rc == 0)
     203        dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
     204  return rc;
    187205}
    188206//******************************************************************************
  • trunk/src/user32/new/oslibwin.h

    r322 r323  
    1 /* $Id: oslibwin.h,v 1.6 1999-07-17 12:49:41 cbratschi Exp $ */
     1/* $Id: oslibwin.h,v 1.7 1999-07-17 15:23:38 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    2020
    2121HWND  OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
    22                            char *pszName, ULONG x, ULONG y, ULONG cx, ULONG cy,
    23                            HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
     22                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
    2423
    2524BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle);
  • trunk/src/user32/new/pmwindow.cpp

    r319 r323  
    1 /* $Id: pmwindow.cpp,v 1.5 1999-07-17 09:17:58 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.6 1999-07-17 15:23:38 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    3535{
    3636  hab = WinInitialize(0);
     37  dprintf(("Winitialize returned %x", hab));
    3738  hmq = WinCreateMsgQueue(hab, 0);
    3839
    39   if(!hab || !hmq) {
     40  if(!hab || !hmq)
     41  {
    4042        UINT error;
    4143
     
    4446        if (!hab || error != PMERR_MSG_QUEUE_ALREADY_EXISTS)
    4547        {
    46           dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
    47           dprintf((" Error = %x",error));
    48           return(FALSE);
    49         } else
     48                dprintf(("WinInitialize or WinCreateMsgQueue failed %x %x", hab, hmq));
     49                dprintf((" Error = %x",error));
     50                return(FALSE);
     51        }
     52        else
    5053        {
    51           //CB: get queue handle (todo)
     54                if(!hab) {
     55                        hab = WinQueryAnchorBlock(HWND_DESKTOP);
     56                        dprintf(("WinQueryAnchorBlock returned %x", hab));
     57                }
     58                if(!hmq) {
     59                        hmq = HMQ_CURRENT;
     60                }
    5261        }
    5362  }
    5463  SetThreadHAB(hab);
     64  dprintf(("InitPM: hmq = %x", hmq));
    5565  SetThreadMessageQueue(hmq);
    5666
     
    113123    case WM_CREATE:
    114124        //Processing is done in after WinCreateWindow returns
    115         break;
     125        dprintf(("OS2: WM_CREATE %x", hwnd));
     126        RestoreOS2TIB();
     127        return (MRESULT)FALSE;
    116128
    117129    case WM_QUIT:
     130        dprintf(("OS2: WM_QUIT %x", hwnd));
    118131        if(win32wnd->MsgQuit()) {
    119132                goto RunDefWndProc;
     
    122135
    123136    case WM_CLOSE:
     137        dprintf(("OS2: WM_CLOSE %x", hwnd));
    124138        if(win32wnd->MsgClose()) {
    125139                goto RunDefWndProc;
     
    128142
    129143    case WM_DESTROY:
     144        dprintf(("OS2: WM_DESTROY %x", hwnd));
    130145        if(win32wnd->MsgDestroy()) {
    131146                goto RunDefWndProc;
     
    134149
    135150    case WM_ENABLE:
     151        dprintf(("OS2: WM_ENABLE %x", hwnd));
    136152        if(win32wnd->MsgEnable((ULONG)mp1)) {
    137153                goto RunDefWndProc;
     
    140156
    141157    case WM_SHOW:
     158        dprintf(("OS2: WM_SHOW %x", hwnd));
    142159        if(win32wnd->MsgShow((ULONG)mp1)) {
    143160                goto RunDefWndProc;
     
    152169     ULONG  xScreen, yScreen, yParent, xParent;
    153170
     171        dprintf(("OS2: WM_MOVE %x", hwnd));
    154172        rc = WinQueryWindowRect(hwnd, &rectl);
    155173        if(rc == TRUE) {
     
    169187                                break;
    170188                        }
    171                         yParent = point.x;
     189                        xParent = point.x;
    172190                        yParent = OS2TOWIN32POINT(rectl2.yTop - rectl2.yBottom, point.y);
    173191                }
     
    207225    case WM_ADJUSTWINDOWPOS:
    208226    {
    209 //      if(win32wnd->MsgWindowPosChanging(0, 0)) {
     227        dprintf(("OS2: WM_ADJUSTWINDOWPOS %x", hwnd));
     228//              if(win32wnd->MsgWindowPosChanging(0, 0)) {
     229                goto RunDefWndProc;
     230//      }
    210231        break;
    211232    }
     
    215236     HPS hps;
    216237
     238        dprintf(("OS2: WM_ERASEBACKGROUND %x", hwnd));
    217239        hps = WinGetPS(hwnd);
    218240        if(win32wnd->MsgEraseBackGround((ULONG)hps))
     
    232254     SWP swp;
    233255
     256        dprintf(("OS2: WM_SIZE %x", hwnd));
    234257        rc = WinQueryWindowPos(hwnd, &swp);
    235258        if(rc == FALSE) {
     
    251274      HWND hwndActivate = (HWND)mp1;
    252275
     276        dprintf(("OS2: WM_ACTIVATE %x", hwnd));
    253277        if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    254278                //another (non-win32) application's window
     
    268292      HWND hwndFocus = (HWND)mp1;
    269293
     294        dprintf(("OS2: WM_SETFOCUS %x", hwnd));
    270295        if(WinQueryWindowULong(hwndFocus, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) {
    271296                //another (non-win32) application's window
     
    360385
    361386    case WM_PAINT:
     387        dprintf(("OS2: WM_PAINT %x", hwnd));
    362388        if(win32wnd->MsgPaint(0, 0)) {
    363389                goto RunDefWndProc;
     
    393419        break;
    394420    default:
     421        dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
    395422        RestoreOS2TIB();
    396423        return WinDefWindowProc( hwnd, msg, mp1, mp2 );
     
    400427
    401428RunDefWndProc:
     429  dprintf(("OS2: RunDefWndProc msg %x for %x", msg, hwnd));
    402430  RestoreOS2TIB();
    403431  return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  • trunk/src/user32/new/win32wnd.cpp

    r321 r323  
    1 /* $Id: win32wnd.cpp,v 1.6 1999-07-17 11:52:23 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.7 1999-07-17 15:23:38 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    7272  Win32Hwnd        = 0;
    7373
    74   //CB: what does this code? Win32Hwnd is always 0!
    7574  if(HMHandleAllocate(&Win32Hwnd, (ULONG)this) != 0)
    7675  {
     
    335334  OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : 0,
    336335                                 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
    337                                  cs->x, cs->y, cs->cx, cs->cy,
    338336                                 (owner) ? owner->getOS2WindowHandle() : 0,
    339                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, &OS2HwndFrame);
     337                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     338                                 &OS2HwndFrame);
    340339
    341340  if(OS2Hwnd == 0) {
     
    351350        return FALSE;
    352351  }
     352#if 0
    353353  if(OS2Hwnd != OS2HwndFrame) {
    354354        if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
     
    361361        }
    362362  }
     363#endif
    363364  /* Set the window menu */
    364365  if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
     
    389390        if( (sendMessage(WM_CREATE, 0, (LPARAM)cs )) != -1 )
    390391        {
    391             /* Send the size messages */
    392             dprintf(("Sent WM_CREATE"));
    393 
    394             if (!(flags & WIN_NEED_SIZE))
    395             {
    396                 /* send it anyway */
    397                 if (((rectClient.right-rectClient.left) <0)
    398                     ||((rectClient.bottom-rectClient.top)<0))
    399                   dprintf(("sending bogus WM_SIZE message 0x%08lx\n",
    400                         MAKELONG(rectClient.right-rectClient.left,
    401                                  rectClient.bottom-rectClient.top)));
    402                 SendMessageA(WM_SIZE, SIZE_RESTORED,
    403                                 MAKELONG(rectClient.right-rectClient.left,
    404                                          rectClient.bottom-rectClient.top));
    405                 SendMessageA(WM_MOVE, 0,
    406                                 MAKELONG( rectClient.left,
    407                                           rectClient.top ) );
    408             }
    409 
    410 #if 0
    411             /* Show the window, maximizing or minimizing if needed */
    412 
    413             if (dwStyle & (WS_MINIMIZE | WS_MAXIMIZE))
    414             {
    415                 RECT16 newPos;
    416                 UINT16 swFlag = (dwStyle & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
    417                 dwStyle &= ~(WS_MAXIMIZE | WS_MINIMIZE);
    418                 WINPOS_MinMaximize(swFlag, &newPos );
    419                 swFlag = ((dwStyle & WS_CHILD) || GetActiveWindow())
    420                     ? SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED
    421                     : SWP_NOZORDER | SWP_FRAMECHANGED;
    422                 SetWindowPos(0, newPos.left, newPos.top,
    423                              newPos.right, newPos.bottom, swFlag );
    424             }
    425 #endif
    426 
    427             if( dwStyle & WS_CHILD && !(dwExStyle & WS_EX_NOPARENTNOTIFY) )
    428             {
    429                 /* Notify the parent window only */
    430 
    431                 NotifyParent(WM_CREATE, 0, 0);
    432                 if( !IsWindow() )
    433                 {
    434                     return FALSE;
    435                 }
    436             }
     392            SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,
     393                         rectClient.right-rectClient.left,
     394                         rectClient.bottom-rectClient.top,
     395                         SWP_NOACTIVATE);
    437396
    438397            if (cs->style & WS_VISIBLE) ShowWindow( sw );
     
    802761                if(win32wndproc(getWindowHandle(), WM_NCCREATE, 0, lParam) == 0) {
    803762                        dprintf(("WM_NCCREATE returned FALSE\n"));
    804                         return(0); //don't create window
     763                        return(-1); //don't create window
    805764                }
    806                 if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == 0) {
    807                         dprintf(("WM_CREATE returned FALSE\n"));
    808                         return(0); //don't create window
     765                if(win32wndproc(getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
     766                        dprintf(("WM_CREATE returned -1\n"));
     767                        return(-1); //don't create window
    809768                }
    810769                NotifyParent(Msg, wParam, lParam);
    811770
    812                 return(1);
     771                return(0);
    813772        }
    814773        case WM_LBUTTONDOWN:
     
    952911        case SW_SHOW:
    953912        case SW_SHOWDEFAULT: //todo
    954                 showstate = SWPOS_SHOW;
     913                showstate = SWPOS_SHOW | SWPOS_ACTIVATE;
    955914                break;
    956915        case SW_HIDE:
    957916                showstate = SWPOS_HIDE;
    958917                break;
     918        case SW_RESTORE:
     919                showstate = SWPOS_RESTORE | SWPOS_SHOW | SWPOS_ACTIVATE;
     920                break;
    959921        case SW_MINIMIZE:
    960922                showstate = SWPOS_MINIMIZE;
    961923                break;
    962924        case SW_SHOWMAXIMIZED:
    963                 showstate = SWPOS_MAXIMIZE | SWPOS_SHOW;
     925                showstate = SWPOS_MAXIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
    964926                break;
    965927        case SW_SHOWMINIMIZED:
     928                showstate = SWPOS_MINIMIZE | SWPOS_SHOW | SWPOS_ACTIVATE;
     929                break;
     930        case SW_SHOWMINNOACTIVE:
    966931                showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
    967932                break;
    968         case SW_SHOWMINNOACTIVE:  //TODO
    969                 showstate = SWPOS_MINIMIZE | SWPOS_SHOW;
    970                 break;
    971         case SW_SHOWNA: //TODO
     933        case SW_SHOWNA:
    972934                showstate = SWPOS_SHOW;
    973935                break;
    974         case SW_SHOWNOACTIVATE:  //TODO
     936        case SW_SHOWNOACTIVATE:
    975937                showstate = SWPOS_SHOW;
    976938                break;
    977939        case SW_SHOWNORMAL:
    978                 showstate = SWPOS_RESTORE;
    979                 break;
    980   }
    981   return OSLibWinShowWindow(OS2HwndFrame, showstate);
     940                showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
     941                break;
     942  }
     943  return OSLibWinShowWindow(OS2Hwnd, showstate);
    982944}
    983945//******************************************************************************
     
    1031993        setstate |= SWPOS_SHOW;
    1032994
    1033   return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate);
     995  return OSLibWinSetWindowPos(OS2Hwnd, hwndInsertAfter, x, y, cx, cy, setstate);
    1034996}
    1035997//******************************************************************************
     
    11101072BOOL Win32Window::IsIconic()
    11111073{
    1112   return OSLibWinIsIconic(OS2HwndFrame);
     1074  return OSLibWinIsIconic(OS2Hwnd);
    11131075}
    11141076//******************************************************************************
     
    11521114                else    return 0;
    11531115  }
    1154   hwndRelated = OSLibWinQueryWindow(OS2HwndFrame, getcmd);
     1116  hwndRelated = OSLibWinQueryWindow(OS2Hwnd, getcmd);
    11551117  if(hwndRelated)
    11561118  {
     
    11681130HWND Win32Window::SetActiveWindow()
    11691131{
    1170   return OSLibWinSetActiveWindow(OS2HwndFrame);
     1132  return OSLibWinSetActiveWindow(OS2Hwnd);
    11711133}
    11721134//******************************************************************************
     
    11751137BOOL Win32Window::EnableWindow(BOOL fEnable)
    11761138{
    1177   return OSLibWinEnableWindow(OS2HwndFrame, fEnable);
     1139  return OSLibWinEnableWindow(OS2Hwnd, fEnable);
    11781140}
    11791141//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.