Changeset 728 for trunk/src


Ignore:
Timestamp:
Aug 28, 1999, 7:24:45 PM (26 years ago)
Author:
dengert
Message:

reposition child windows when parent height is changed

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

Legend:

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

    r715 r728  
    1 /* $Id: pmwindow.cpp,v 1.22 1999-08-27 17:50:56 dengert Exp $ */
     1/* $Id: pmwindow.cpp,v 1.23 1999-08-28 17:24:45 dengert Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    212212      ULONG     parentHeight = 0;
    213213      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
     214      LONG      yDelta = pswp->cy - pswpo->cy;
     215      ULONG     classStyle;
    214216
    215217        dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     
    234236           wp.hwndInsertAfter = wndAfter->getWindowHandle();
    235237        }
     238        classStyle = win32wnd->getClass()->getStyle();
     239//        if (yDelta != 0)
     240        if ((yDelta != 0) && ((classStyle & CS_VREDRAW_W) ||
     241           ((classStyle & CS_HREDRAW_W) && (pswp->cx != pswpo->cx))))
     242        {
     243            HENUM henum = WinBeginEnumWindows(pswp->hwnd);
     244            SWP swp[10];
     245            int i = 0;
     246            HWND hwnd;
     247
     248            dprintf(("move children"));
     249            while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
     250            {
     251#if 0
     252               /* Do not move MDI clients.  MDI clients are a special case,
     253                * even though they are bottom aligned they are always supposed
     254                * to be the same size as their parent.  This code is an
     255                * optimization and will not work correctly if the this
     256                * assumption is incorrect.
     257                */
     258               WinBase *pBase = (WinBase *)WinQueryDAXData( hwnd );
     259               if ( pBase && pBase->typeOf() == mdiClient )
     260               {
     261                  continue;
     262               }
     263#endif
     264               // We don't know how many children we have so we'll move ten
     265               // at a time.  Not very nice, I know.
     266               WinQueryWindowPos(hwnd, &(swp[i]));
     267
     268               // The SWP flags are all set but PM will ignore any
     269               // superflous ones, so keep them as they contain useful
     270               // minimise and maximise flags.
     271               swp[i].y += yDelta;
     272
     273               if (i == 9)
     274               {
     275                  WinSetMultWindowPos(GetThreadHAB(), swp, 10);
     276                  i = 0;
     277               }
     278               else
     279               {
     280                  i++;
     281               }
     282            }
     283
     284            WinEndEnumWindows(henum);
     285
     286            // Any remaining windows?
     287            if (i)
     288               WinSetMultWindowPos(GetThreadHAB(), swp, i);
     289        }
    236290        win32wnd->MsgPosChanged((LPARAM)&wp);
     291
    237292        break;
    238293    }
     
    240295    case WM_ERASEBACKGROUND:
    241296    {
    242         return (MRESULT) FALSE;
     297        break;
    243298    }
    244299    case WM_SIZE:
    245300    {
    246      SWP swp;
    247 
    248         rc = WinQueryWindowPos(hwnd, &swp);
    249         if(rc == FALSE) {
    250                 dprintf(("WM_SIZE: WinQueryWindowPos failed!"));
    251                 break;
    252         }
    253         dprintf(("OS2: WM_SIZE %x %x (%d,%d) (%d,%d) (%d,%d)", hwnd, swp.fl, swp.x, swp.y, swp.cx, swp.cy, SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)));
    254 #if 0
    255         if(win32wnd->MsgSize(SHORT1FROMMP(mp2), SHORT2FROMMP(mp2),
    256                                 (swp.fl & SWP_MINIMIZE) != 0,
    257                                 (swp.fl & SWP_MAXIMIZE) != 0))
    258         {
    259                 goto RunDefWndProc;
    260         }
    261 #endif
    262301        break;
    263302    }
  • trunk/src/user32/new/win32class.cpp

    r724 r728  
    1 /* $Id: win32class.cpp,v 1.8 1999-08-28 14:09:30 sandervl Exp $ */
     1/* $Id: win32class.cpp,v 1.9 1999-08-28 17:24:45 dengert Exp $ */
    22/*
    33 * Win32 Window Class Managment Code for OS/2
     
    8080  nrExtraClassWords     = wndclass->cbClsExtra;
    8181  nrExtraWindowWords    = wndclass->cbWndExtra;
    82   backgroundBrush       = wndclass->hbrBackground;      //TODO: fErase of PAINSTRUCT in WM_PAINT if == NULL
     82  backgroundBrush       = wndclass->hbrBackground;
    8383  hCursor               = wndclass->hCursor;
    8484  hIcon                 = wndclass->hIcon;
     
    137137
    138138  if(wndclass == NULL) {
    139         leaveMutex(OBJTYPE_CLASS);
    140         return(NULL);
     139        leaveMutex(OBJTYPE_CLASS);
     140        return(NULL);
    141141  }
    142142
     
    144144//CB: read comment below!
    145145        if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
    146                 leaveMutex(OBJTYPE_CLASS);
     146                leaveMutex(OBJTYPE_CLASS);
    147147                return(wndclass);
    148148        }
     
    151151                while(wndclass != NULL) {
    152152                        if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
    153                                 leaveMutex(OBJTYPE_CLASS);
     153                                leaveMutex(OBJTYPE_CLASS);
    154154                                return(wndclass);
    155155                        }
     
    162162//CB: need more code to compare instance; convert 0 to exe module handle
    163163        if(wndclass->classAtom == (DWORD)id /*&& wndclass->hInstance == hInstance*/) {
    164                 leaveMutex(OBJTYPE_CLASS);
     164                leaveMutex(OBJTYPE_CLASS);
    165165                return(wndclass);
    166166        }
     
    169169                while(wndclass != NULL) {
    170170                        if(wndclass->classAtom == (DWORD)id/* && wndclass->hInstance == hInstance*/) {
    171                                 leaveMutex(OBJTYPE_CLASS);
    172                                 return(wndclass);
     171                                leaveMutex(OBJTYPE_CLASS);
     172                                return(wndclass);
    173173                        }
    174174                        wndclass = (Win32WndClass *)wndclass->GetNext();
  • trunk/src/user32/new/win32class.h

    r724 r728  
    1 /* $Id: win32class.h,v 1.5 1999-08-28 14:09:30 sandervl Exp $ */
     1/* $Id: win32class.h,v 1.6 1999-08-28 17:24:45 dengert Exp $ */
    22/*
    33 * Win32 Window Class Managment Code for OS/2
     
    1515{
    1616public:
    17         Win32WndClass(WNDCLASSEXA *wndclass, BOOL isUnicode = FALSE);
     17        Win32WndClass(WNDCLASSEXA *wndclass, BOOL isUnicode = FALSE);
    1818       ~Win32WndClass();
    1919
    20          ULONG  getClassLongA(int index, BOOL isUnicode = FALSE);
    21          ULONG  getClassLongW(int index)
    22          {
    23                 return getClassLongA(index, TRUE);
    24         };
    25          WORD   getClassWord(int index);
     20         ULONG  getClassLongA(int index, BOOL isUnicode = FALSE);
     21         ULONG  getClassLongW(int index)
     22         {
     23                return getClassLongA(index, TRUE);
     24        };
     25         WORD   getClassWord(int index);
    2626
    27          ULONG  setClassLongA(int index, LONG lNewVal, BOOL isUnicode = FALSE);
    28          ULONG  setClassLongW(int index, LONG lNewVal)
    29         {
    30                 return setClassLongA(index, lNewVal, TRUE);
    31         }
    32          WORD   setClassWord(int index, WORD wNewVal);
     27         ULONG  setClassLongA(int index, LONG lNewVal, BOOL isUnicode = FALSE);
     28         ULONG  setClassLongW(int index, LONG lNewVal)
     29        {
     30                return setClassLongA(index, lNewVal, TRUE);
     31        }
     32         WORD   setClassWord(int index, WORD wNewVal);
    3333
    34          ATOM   getAtom()       { return (ATOM) classAtom; };
    35         BOOL   getClassInfo(WNDCLASSEXA *wndclass);
    36         BOOL   getClassInfo(WNDCLASSEXW *wndclass);
     34         ATOM   getAtom()       { return (ATOM) classAtom; };
     35        BOOL   getClassInfo(WNDCLASSEXA *wndclass);
     36        BOOL   getClassInfo(WNDCLASSEXW *wndclass);
    3737
    38         ULONG  getClassName(LPSTR  lpszClassName, ULONG cchClassName);
    39         ULONG  getClassName(LPWSTR lpszClassName, ULONG cchClassName);
     38        ULONG  getClassName(LPSTR  lpszClassName, ULONG cchClassName);
     39        ULONG  getClassName(LPWSTR lpszClassName, ULONG cchClassName);
    4040
    41        WNDPROC  getWindowProc()         { return windowProc; };
    42          LPSTR  getMenuNameA()          { return menuNameA; };
    43          DWORD  getExtraWndWords()      { return nrExtraWindowWords; };
     41       WNDPROC  getWindowProc()         { return windowProc; };
     42         LPSTR  getMenuNameA()          { return menuNameA; };
     43         DWORD  getExtraWndWords()      { return nrExtraWindowWords; };
    4444
    45          HICON  getIcon()               { return hIcon; };
     45         HICON  getIcon()               { return hIcon; };
    4646
    4747        HBRUSH  getBackgroundBrush()    { return backgroundBrush; };
     48         ULONG  getStyle()              { return windowStyle; };
    4849
    49           void  setMenuName(LPSTR newMenuName);
     50          void  setMenuName(LPSTR newMenuName);
    5051
    51           void  IncreaseWindowCount()   { cWindows++; };
    52           void  DecreaseWindowCount()   { cWindows--; };
    53           DWORD GetWindowCount()        { return cWindows; };
     52          void  IncreaseWindowCount()   { cWindows++; };
     53          void  DecreaseWindowCount()   { cWindows--; };
     54          DWORD GetWindowCount()        { return cWindows; };
    5455
    5556          BOOL  hasClassName(LPSTR classname, BOOL fUnicode = 0);
    56          
    57  static  void   UnregisterClassA(HINSTANCE hinst, LPSTR id);
     57         
     58 static  void   UnregisterClassA(HINSTANCE hinst, LPSTR id);
    5859
    5960 static Win32WndClass *FindClass(HINSTANCE hinst, LPSTR id);
     
    6364
    6465 //Standard class words/longs
    65  ULONG          nrExtraClassWords;      //GCL_CBCLSEXTRA
    66  ULONG          nrExtraWindowWords;     //GCL_CBWNDEXTRA
    67  HBRUSH         backgroundBrush;        //GCL_HBRBACKGROUND
    68  HCURSOR        hCursor;                //GCL_HCURSOR
    69  HICON          hIcon;                  //GCL_HICON
    70  HINSTANCE      hInstance;              //GCL_HMODULE
    71  PCHAR          menuNameA;              //GCL_MENUNAME
    72  WCHAR         *menuNameW;              //GCL_MENUNAME
    73  ULONG          windowStyle;            //GCL_STYLE
    74  WNDPROC        windowProc;             //GCL_WNDPROC
    75  ULONG          classAtom;              //GCW_ATOM
     66 ULONG          nrExtraClassWords;      //GCL_CBCLSEXTRA
     67 ULONG          nrExtraWindowWords;     //GCL_CBWNDEXTRA
     68 HBRUSH         backgroundBrush;        //GCL_HBRBACKGROUND
     69 HCURSOR        hCursor;                //GCL_HCURSOR
     70 HICON          hIcon;                  //GCL_HICON
     71 HINSTANCE      hInstance;              //GCL_HMODULE
     72 PCHAR          menuNameA;              //GCL_MENUNAME
     73 WCHAR         *menuNameW;              //GCL_MENUNAME
     74 ULONG          windowStyle;            //GCL_STYLE
     75 WNDPROC        windowProc;             //GCL_WNDPROC
     76 ULONG          classAtom;              //GCW_ATOM
    7677
    7778 PCHAR          classNameA;
    7879 WCHAR         *classNameW;
    79  HICON          hIconSm;
     80 HICON          hIconSm;
    8081
    8182 //User data class words/longs
    82  ULONG         *userClassLong;
     83 ULONG         *userClassLong;
    8384
    8485 //nr of windows created with this class
    8586 ULONG          cWindows;
    86  
     87
    8788 static GenericObject *wndclasses;
    8889};
  • trunk/src/user32/new/win32wnd.cpp

    r724 r728  
    1 /* $Id: win32wnd.cpp,v 1.32 1999-08-28 14:09:30 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.33 1999-08-28 17:24:45 dengert Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    972972ULONG Win32Window::MsgEraseBackGround(HDC hdc)
    973973{
    974     if(isIcon) {
    975             return SendInternalMessageA(WM_ICONERASEBKGND, hdc, 0);
    976     }
    977     else    return SendInternalMessageA(WM_ERASEBKGND, hdc, 0);
     974    ULONG rc;
     975    HDC   hdcErase = hdc;
     976
     977    if (hdcErase == 0)
     978        hdcErase = O32_GetDC(OS2Hwnd);
     979
     980    if(isIcon)
     981        rc = SendInternalMessageA(WM_ICONERASEBKGND, hdcErase, 0);
     982    else
     983        rc = SendInternalMessageA(WM_ERASEBKGND, hdcErase, 0);
     984    if (hdc == 0)
     985        O32_ReleaseDC(OS2Hwnd, hdcErase);
     986    return (rc);
    978987}
    979988//******************************************************************************
     
    16581667    if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
    16591668    {//update region not empty
    1660         SendInternalMessageA((isIcon) ? WM_PAINTICON : WM_PAINT, 0, 0);
     1669        HDC hdc;
     1670
     1671        hdc = O32_GetDC(OS2Hwnd);
     1672        if (isIcon)
     1673        {
     1674            SendInternalMessageA(WM_ICONERASEBKGND, (WPARAM)hdc, 0);
     1675            SendInternalMessageA(WM_PAINTICON, 0, 0);
     1676        } else
     1677        {
     1678            SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);
     1679            SendInternalMessageA(WM_PAINT, 0, 0);
     1680        }
     1681        O32_ReleaseDC(OS2Hwnd, hdc);
    16611682    }
    16621683    return TRUE;
Note: See TracChangeset for help on using the changeset viewer.