Ignore:
Timestamp:
Jul 31, 2003, 5:58:58 PM (22 years ago)
Author:
sandervl
Message:

KOMH: DBCS updates/fixes

File:
1 edited

Legend:

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

    r10134 r10190  
    1 /* $Id: win32wbase.cpp,v 1.375 2003-06-03 09:51:05 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.376 2003-07-31 15:56:45 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    8686//******************************************************************************
    8787//******************************************************************************
    88 Win32BaseWindow::Win32BaseWindow() 
     88Win32BaseWindow::Win32BaseWindow()
    8989                     : GenericObject(&windows, &critsect), ChildWindow(&critsect)
    9090{
     
    126126  windowNameA      = NULL;
    127127  windowNameW      = NULL;
    128   windowNameLength = 0;
    129  
     128  windowNameLengthA = 0;
     129  windowNameLengthW = 0;
     130
    130131  userWindowBytes  = NULL;;
    131132  nrUserWindowBytes= 0;
     
    228229    {
    229230        //if we're the last child that's being destroyed and our
    230         //parent window was also destroyed, then we 
     231        //parent window was also destroyed, then we
    231232        if(getParent()->IsWindowDestroyed())
    232233        {
     
    236237        }
    237238    }
    238     else 
     239    else
    239240    {
    240241        Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild();
     
    340341            }
    341342            if (window->getExStyle() & WS_EX_TOPMOST)
    342                  cs->dwExStyle |= WS_EX_TOPMOST;         
     343                 cs->dwExStyle |= WS_EX_TOPMOST;
    343344
    344345            RELEASE_WNDOBJ(window);
     
    389390        cs->lpszClass = buffer;
    390391    }
    391 
    392392    /* Fix the coordinates */
    393393    fXDefault = FALSE;
     
    446446                 RELEASE_WNDOBJ(wndparent);
    447447            }
    448             else owner = NULL;       
     448            else owner = NULL;
    449449
    450450            if(owner == NULL)
     
    582582        vertScrollInfo->flags  = ESB_ENABLE_BOTH;
    583583    }
    584  
     584
    585585    // initially allocate the window name fields
    586586    if(HIWORD(cs->lpszName))
     
    588588        if (!isUnicode)
    589589        {
    590             windowNameLength = strlen(cs->lpszName);
    591             windowNameA = (LPSTR)_smalloc(windowNameLength+1);
    592             memcpy(windowNameA,cs->lpszName,windowNameLength+1);
    593             windowNameW = (LPWSTR)_smalloc((windowNameLength+1)*sizeof(WCHAR));
    594             lstrcpynAtoW(windowNameW,windowNameA,windowNameLength+1);
    595             windowNameA[windowNameLength] = 0;
    596             windowNameW[windowNameLength] = 0;
     590            windowNameLengthA = strlen(cs->lpszName);
     591            windowNameA = (LPSTR)_smalloc(windowNameLengthA+1);
     592            strcpy(windowNameA,cs->lpszName);
     593
     594            windowNameLengthW = lstrlenAtoW( windowNameA, -1 );
     595            windowNameW = (LPWSTR)_smalloc(( windowNameLengthW + 1 ) * sizeof( WCHAR ) );
     596            lstrcpyAtoW( windowNameW, windowNameA );
    597597        }
    598598        else
    599599        {
    600600            // Wide
    601             windowNameLength = lstrlenW((LPWSTR)cs->lpszName);
    602             windowNameW = (LPWSTR)_smalloc( (windowNameLength+1)*sizeof(WCHAR) );
    603             memcpy(windowNameW,(LPWSTR)cs->lpszName, (windowNameLength+1)*sizeof(WCHAR) );
    604          
     601            windowNameLengthW = lstrlenW((LPWSTR)cs->lpszName);
     602            windowNameW = (LPWSTR)_smalloc((windowNameLengthW+1)*sizeof(WCHAR));
     603            strcpyW(windowNameW,(LPWSTR)cs->lpszName);
     604
    605605            // windowNameW[lstrlenW((LPWSTR)cs->lpszName)] = 0; // need ?
    606          
     606
    607607            // Ascii
    608             windowNameA = (LPSTR)_smalloc(windowNameLength+1);
    609             WideCharToMultiByte(CP_ACP,
    610                                 0,
    611                                 windowNameW,
    612                                 windowNameLength,
    613                                 windowNameA,
    614                                 windowNameLength + 1,
    615                                 0,
    616                                 NULL);
    617             windowNameA[windowNameLength] = 0;
    618         }
    619      
     608            windowNameLengthA = lstrlenWtoA( windowNameW, -1 );
     609            windowNameA = (LPSTR)_smalloc( windowNameLengthA + 1 );
     610            lstrcpyWtoA( windowNameA, windowNameW );
     611        }
     612
     613        dprintf(("windowNameA 0x%lx to 0x%lx windowNameW : 0x%lx to 0x%lx",
     614                windowNameA, windowNameA + windowNameLengthA,
     615                windowNameW, windowNameW + windowNameLengthW ));
     616
    620617        if(fOS2Look) {
    621618            OSLibWinSetTitleBarText(OS2HwndFrame, windowNameA);
     
    752749        //@@PF Popup children of inactive windows can thus bring inactive window
    753750        //on top, this is not correct, popup windows can be on top only if their owner
    754         //is in foreground, otherwise they are linked after owner. 
     751        //is in foreground, otherwise they are linked after owner.
    755752        if (((dwStyle & (WS_CHILD|WS_POPUP)) == WS_POPUP) && getOwner() && (getOwner()->getWindowHandle() != GetForegroundWindow()))
    756753        {
     
    10661063
    10671064    dprintf(("MsgButton %d at (%d,%d)", msg->message, msg->pt.x, msg->pt.y));
    1068     switch(msg->message) 
     1065    switch(msg->message)
    10691066    {
    10701067        case WM_LBUTTONDBLCLK:
     
    11321129    SendMessageA(getWindowHandle(),WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
    11331130
    1134     switch(msg->message) 
     1131    switch(msg->message)
    11351132    {
    11361133        case WM_LBUTTONDOWN:
     
    11551152}
    11561153//******************************************************************************
    1157 // 
     1154//
    11581155// Win32BaseWindow::saveAndValidateUpdateRegion
    11591156//
    1160 //   If an application doesn't validate the update region while processing 
     1157//   If an application doesn't validate the update region while processing
    11611158//   WM_PAINT, then we must remember it for the next time. Also validates
    11621159//   the current update region.
     
    11921189}
    11931190//******************************************************************************
    1194 // 
     1191//
    11951192// Win32BaseWindow::checkForDirtyUpdateRegion
    11961193//
    1197 //   If an application doesn't validate the update region while processing 
     1194//   If an application doesn't validate the update region while processing
    11981195//   WM_PAINT, then we must remember it for the next time. If the window has
    11991196//   a dirty update region, then invalidate that region.
     
    12501247ULONG Win32BaseWindow::MsgChar(MSG *msg)
    12511248{
    1252     return DispatchMsgA(msg);
     1249    return IsWindowUnicode() ? DispatchMsgW( msg ) : DispatchMsgA( msg );
    12531250}
    12541251//******************************************************************************
     
    12761273    //Send WM_PAINTICON here if minimized, because client window will
    12771274    //not receive a (valid) WM_PAINT message
    1278     if (getStyle() & WS_MINIMIZE) 
     1275    if (getStyle() & WS_MINIMIZE)
    12791276    {
    12801277        rc = SendMessageA(getWindowHandle(),WM_PAINTICON, 1, 0);
     
    13471344#endif
    13481345  //WS_EX_TOOLWINDOW is incompatible with the OS2Look (titlebar thinner + smaller font)
    1349   if(fOS2Look && ((dwStyle & WS_CAPTION) == WS_CAPTION) && !(dwExStyle & WS_EX_TOOLWINDOW)) 
     1346  if(fOS2Look && ((dwStyle & WS_CAPTION) == WS_CAPTION) && !(dwExStyle & WS_EX_TOOLWINDOW))
    13501347  {
    13511348      RECT rect = {0};
     
    13621359      rect.top    = rect.bottom - rect.top;
    13631360      rect.right  = rectWindow.right - rectWindow.left - rect.right;
    1364  
     1361
    13651362      rectOS2.xLeft   = rect.left;
    13661363      rectOS2.xRight  = rect.right;
     
    13681365      rectOS2.yTop    = height - rect.bottom;
    13691366
    1370       //@@PF Disable close button as well when needed by application 
     1367      //@@PF Disable close button as well when needed by application
    13711368      OSLibChangeCloseButtonState(getOS2FrameWindowHandle(), fCloseButton);
    13721369      OSLibWinPositionFrameControls(getOS2FrameWindowHandle(), &rectOS2,
    13731370                                    dwStyle, dwExStyle, IconForWindow(ICON_SMALL),
    1374                                     fCloseButton, windowClass->getIcon() != NULL);
     1371                    fCloseButton, windowClass->getIcon() != NULL);
    13751372  }
    13761373  return rc;
     
    15621559
    15631560    case WM_GETTEXTLENGTH:
    1564         return windowNameLength;
     1561        return windowNameLengthA;
    15651562
    15661563    case WM_GETTEXT:
    1567         if (!lParam || !wParam) 
     1564        if (!lParam || !wParam)
    15681565          return 0;
    1569         if (!windowNameA) 
     1566        if (!windowNameA)
    15701567          ((LPSTR)lParam)[0] = 0;
    1571         else 
    1572           memcpy((LPSTR)lParam, windowNameA, min(windowNameLength+1, wParam) );
    1573         return min(windowNameLength, wParam);
     1568        else
     1569          lstrcpynA(( LPSTR )lParam, windowNameA, wParam );
     1570        return strlen(( LPSTR )lParam );
    15741571
    15751572    case WM_SETTEXT:
    15761573    {
    15771574        LPCSTR lpsz = (LPCSTR)lParam;
    1578      
     1575
    15791576        // reallocate if new buffer is larger
    15801577        if (!lParam)
     
    15821579          free(windowNameA);
    15831580          free(windowNameW);
    1584           windowNameLength = 0;
     1581          windowNameLengthA = 0;
     1582          windowNameLengthW = 0;
    15851583          windowNameA      = NULL;
    15861584          windowNameW      = NULL;
     
    15901588          // determine length of new text
    15911589          int iTextLength = strlen(lpsz);
    1592          
    1593           if (windowNameLength < iTextLength)
     1590
     1591          if (windowNameLengthA < iTextLength)
    15941592          {
    15951593            if (windowNameA)
     
    15981596              windowNameA = NULL;
    15991597            }
    1600          
     1598
    16011599            if (windowNameW)
    16021600            {
     
    16051603            }
    16061604          }
    1607      
    1608           windowNameLength = iTextLength;
     1605
     1606          windowNameLengthA = iTextLength;
    16091607          if(!windowNameA)
    1610             windowNameA = (LPSTR)_smalloc(windowNameLength+1);
    1611           memcpy(windowNameA, lpsz, windowNameLength+1);
     1608            windowNameA = (LPSTR)_smalloc(windowNameLengthA+1);
     1609          strcpy(windowNameA, lpsz);
     1610          windowNameLengthW = lstrlenAtoW( windowNameA, -1 );
    16121611          if(!windowNameW)
    1613             windowNameW = (LPWSTR)_smalloc((windowNameLength+1)*sizeof(WCHAR));
    1614           lstrcpynAtoW(windowNameW, windowNameA, windowNameLength+1);
    1615         }
    1616      
     1612            windowNameW = (LPWSTR)_smalloc(( windowNameLengthW + 1 )*sizeof(WCHAR));
     1613          lstrcpyAtoW( windowNameW, windowNameA );
     1614        }
     1615
    16171616        dprintf(("WM_SETTEXT of %x to %s\n", Win32Hwnd, lParam));
    16181617        if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     
    16751674        dprintf(("DefWndProc: WM_MOUSEACTIVATE for %x Msg %s", Win32Hwnd, GetMsgText(HIWORD(lParam))));
    16761675        if (::GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD)
    1677         {
    1678             LONG ret = ::SendMessageW( ::GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam );
    1679             if (ret) return ret;
    1680         }
    1681 
    1682         /* Caption clicks are handled by the NC_HandleNCLButtonDown() */
     1676    {
     1677        LONG ret = ::SendMessageW( ::GetParent(hwnd), WM_MOUSEACTIVATE, wParam, lParam );
     1678        if (ret) return ret;
     1679    }
     1680
     1681    /* Caption clicks are handled by the NC_HandleNCLButtonDown() */
    16831682        return (LOWORD(lParam) >= HTCLIENT) ? MA_ACTIVATE : MA_NOACTIVATE;
    16841683    }
     
    17541753        if (::GetWindowLongA( getWindowHandle(), GWL_STYLE ) & WS_CHILD)
    17551754            return ::SendMessageA( ::GetParent(getWindowHandle()), WM_MOUSEWHEEL, wParam, lParam );
    1756         break;
     1755    break;
    17571756
    17581757    case WM_WINDOWPOSCHANGED:
     
    17891788      RECT   rect;
    17901789      int    rc;
    1791      
    1792         if (!windowClass || (!windowClass->getBackgroundBrush() 
     1790
     1791        if (!windowClass || (!windowClass->getBackgroundBrush()
    17931792                              && !(getStyle() & WS_MINIMIZE))) return 0;
    17941793
     
    18041803                hBrush = GetSysColorBrush(hBrush-1);
    18051804        }
    1806              
     1805
    18071806
    18081807        rc = GetClipBox( (HDC)wParam, &rect );
     
    19051904
    19061905    case WM_KEYDOWN:
    1907         if(wParam == VK_F10) iF10Key = VK_F10;
    1908         break;
     1906    if(wParam == VK_F10) iF10Key = VK_F10;
     1907    break;
    19091908
    19101909    case WM_SYSKEYDOWN:
    19111910    {
    1912         if( HIWORD(lParam) & KEYDATA_ALT )
    1913         {
    1914             /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
    1915               if( wParam == VK_MENU && !iMenuSysKey )
    1916                 iMenuSysKey = 1;
    1917               else
    1918                 iMenuSysKey = 0;
    1919            
    1920             iF10Key = 0;
    1921 
    1922             if( wParam == VK_F4 )       /* try to close the window */
    1923             {
     1911    if( HIWORD(lParam) & KEYDATA_ALT )
     1912    {
     1913        /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
     1914          if( wParam == VK_MENU && !iMenuSysKey )
     1915        iMenuSysKey = 1;
     1916          else
     1917        iMenuSysKey = 0;
     1918
     1919        iF10Key = 0;
     1920
     1921        if( wParam == VK_F4 )   /* try to close the window */
     1922        {
    19241923                HWND top = GetTopParent();
    19251924                if (!(GetClassLongW( top, GCL_STYLE ) & CS_NOCLOSE))
    19261925                    PostMessageW( top, WM_SYSCOMMAND, SC_CLOSE, 0 );
    1927             }
     1926        }
    19281927
    19291928            //Default OS/2 app behaviour for system keys
    19301929            if(fOS2Look)
    19311930            {
    1932                     if( wParam == VK_F5 )       /* try to restore the window */
    1933                     {
    1934                         HWND top = GetTopParent();
     1931            if( wParam == VK_F5 )   /* try to restore the window */
     1932            {
     1933                    HWND top = GetTopParent();
    19351934                        /* No checks needed SC_RESTORE handler does them */
    1936                         PostMessageW( top, WM_SYSCOMMAND, SC_RESTORE, 0 );
    1937                     }
    1938 
    1939                     if( wParam == VK_F7 )       /* size the window */
    1940                     {
    1941                         HWND top = GetTopParent();
    1942                         PostMessageW( top, WM_SYSCOMMAND, SC_MOVE, 0 );
    1943                     }
    1944 
    1945                     if( wParam == VK_F8 )       /* move the window */
    1946                     {
    1947                         HWND top = GetTopParent();
    1948                         if ( GetWindowLongA(top, GWL_STYLE) & WS_SIZEBOX)
    1949                         PostMessageW( top, WM_SYSCOMMAND, SC_SIZE, 0 );
    1950                     }
    1951 
    1952                     if( wParam == VK_F9 )       /* try to minimize the window */
    1953                     {
    1954                         HWND top = GetTopParent();
    1955                         if ( GetWindowLongA(top, GWL_STYLE) & WS_MINIMIZEBOX)
    1956                             PostMessageW( top, WM_SYSCOMMAND, SC_MINIMIZE, 0 );
    1957                     }
    1958 
    1959                     if( wParam == VK_F10 )      /* try to maximize the window */
    1960                     {
    1961                         HWND top = GetTopParent();
    1962                         if ( GetWindowLongA(top, GWL_STYLE) & WS_MAXIMIZEBOX)
    1963                             PostMessageW( top, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
    1964                     }
    1965             }
    1966 
    1967         }
    1968         else if( wParam == VK_F10 )
    1969                 iF10Key = 1;
    1970              else
    1971                 if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
     1935                    PostMessageW( top, WM_SYSCOMMAND, SC_RESTORE, 0 );
     1936            }
     1937
     1938            if( wParam == VK_F7 )   /* size the window */
     1939            {
     1940                    HWND top = GetTopParent();
     1941                    PostMessageW( top, WM_SYSCOMMAND, SC_MOVE, 0 );
     1942            }
     1943
     1944            if( wParam == VK_F8 )   /* move the window */
     1945            {
     1946                    HWND top = GetTopParent();
     1947                    if ( GetWindowLongA(top, GWL_STYLE) & WS_SIZEBOX)
     1948                    PostMessageW( top, WM_SYSCOMMAND, SC_SIZE, 0 );
     1949            }
     1950
     1951            if( wParam == VK_F9 )   /* try to minimize the window */
     1952            {
     1953                    HWND top = GetTopParent();
     1954                    if ( GetWindowLongA(top, GWL_STYLE) & WS_MINIMIZEBOX)
     1955                        PostMessageW( top, WM_SYSCOMMAND, SC_MINIMIZE, 0 );
     1956            }
     1957
     1958            if( wParam == VK_F10 )  /* try to maximize the window */
     1959            {
     1960                    HWND top = GetTopParent();
     1961                    if ( GetWindowLongA(top, GWL_STYLE) & WS_MAXIMIZEBOX)
     1962                        PostMessageW( top, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
     1963            }
     1964            }
     1965
     1966    }
     1967    else if( wParam == VK_F10 )
     1968            iF10Key = 1;
     1969         else
     1970            if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
    19721971                    SendMessageW(getWindowHandle(), WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );
    19731972        return 0;
     
    19791978        // no break;
    19801979    case WM_SYSKEYUP:
    1981         /* Press and release F10 or ALT */
    1982         if (((wParam == VK_MENU) && iMenuSysKey) ||
     1980    /* Press and release F10 or ALT */
     1981    if (((wParam == VK_MENU) && iMenuSysKey) ||
    19831982            ((wParam == VK_F10) && iF10Key))
    19841983              ::SendMessageW( GetTopParent(), WM_SYSCOMMAND, SC_KEYMENU, 0L );
    1985         iMenuSysKey = iF10Key = 0;
     1984    iMenuSysKey = iF10Key = 0;
    19861985        break;
    19871986
     
    20202019    case WM_RBUTTONUP:
    20212020        {
    2022             POINT pt;
    2023             pt.x = SLOWORD(lParam);
    2024             pt.y = SHIWORD(lParam);
    2025             ClientToScreen(getWindowHandle(), &pt);
     2021        POINT pt;
     2022        pt.x = SLOWORD(lParam);
     2023        pt.y = SHIWORD(lParam);
     2024        ClientToScreen(getWindowHandle(), &pt);
    20262025            SendMessageA( getWindowHandle(), WM_CONTEXTMENU, getWindowHandle(),MAKELPARAM(pt.x, pt.y) );
    20272026        }
     
    21362135    {
    21372136    case WM_GETTEXTLENGTH:
    2138         return windowNameLength;
     2137        return windowNameLengthW;
    21392138
    21402139    case WM_GETTEXT:
    2141         if (!lParam || !wParam) 
     2140        if (!lParam || !wParam)
    21422141          return 0;
    21432142        if (!windowNameW)
    21442143          ((LPWSTR)lParam)[0] = 0;
    2145         else
    2146           memcpy((LPSTR)lParam, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), wParam) );
    2147         return min(windowNameLength, wParam);
     2144        else
     2145          lstrcpynW(( LPWSTR )lParam, windowNameW, wParam );
     2146
     2147        return strlenW(( LPWSTR )lParam );
    21482148
    21492149    case WM_SETTEXT:
    21502150    {
    21512151        LPWSTR lpsz = (LPWSTR)lParam;
    2152      
     2152
    21532153        // reallocate if new buffer is larger
    21542154        if (!lParam)
     
    21562156          free(windowNameA);
    21572157          free(windowNameW);
    2158           windowNameLength = 0;
     2158          windowNameLengthA = 0;
     2159          windowNameLengthW = 0;
    21592160          windowNameA      = NULL;
    21602161          windowNameW      = NULL;
     
    21642165          // determine length of new text
    21652166          int iTextLength = lstrlenW(lpsz);
    2166          
    2167           if (windowNameLength < iTextLength)
     2167
     2168          if (windowNameLengthW < iTextLength)
    21682169          {
    21692170            if (windowNameA)
     
    21722173              windowNameA = NULL;
    21732174            }
    2174          
     2175
    21752176            if (windowNameW)
    21762177            {
     
    21792180            }
    21802181          }
    2181      
    2182           windowNameLength = iTextLength;
     2182
     2183          windowNameLengthW = iTextLength;
    21832184          if(!windowNameW)
    2184             windowNameW = (LPWSTR)_smalloc((windowNameLength+1)*sizeof(WCHAR));
    2185           memcpy(windowNameW, lpsz, (windowNameLength+1) * sizeof(WCHAR));
     2185            windowNameW = (LPWSTR)_smalloc((windowNameLengthW+1)*sizeof(WCHAR));
     2186          strcpyW(windowNameW, lpsz);
     2187          windowNameLengthA = lstrlenWtoA( windowNameW, -1 );
    21862188          if(!windowNameA)
    2187             windowNameA = (LPSTR)_smalloc(windowNameLength+1);
    2188           lstrcpynWtoA(windowNameA, windowNameW, windowNameLength+1);
    2189         }
    2190 
    2191         dprintf(("WM_SETTEXT of %x\n",Win32Hwnd));
     2189            windowNameA = (LPSTR)_smalloc( windowNameLengthA + 1 );
     2190          lstrcpyWtoA( windowNameA, windowNameW );
     2191        }
     2192
     2193        dprintf(("WM_SETTEXT of %x to %s\n", Win32Hwnd, windowNameA));
    21922194        if ((dwStyle & WS_CAPTION) == WS_CAPTION)
    21932195        {
     
    22592261        hWndIcon = windowClass->getIcon();
    22602262    else
    2261     if (!(dwStyle & DS_MODALFRAME)) 
     2263    if (!(dwStyle & DS_MODALFRAME))
    22622264    {//SvL: load it as shared or else we'll leak icons
    22632265         hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR|LR_SHARED);
     
    22792281        hWndIcon = windowClass->getIcon();
    22802282    else
    2281     if (!(dwStyle & DS_MODALFRAME)) 
     2283    if (!(dwStyle & DS_MODALFRAME))
    22822284    {//SvL: load it as shared or else we'll leak icons
    22832285         hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR|LR_SHARED);
     
    23102312        dprintf(("ShowWindow: GetProcessDword(0, GPD_STARTF_SHOWWINDOW) -> %x", nCmdShow));
    23112313    }
    2312  
     2314
    23132315
    23142316    switch(nCmdShow)
     
    24332435//******************************************************************************
    24342436//******************************************************************************
    2435 BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, 
     2437BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx,
    24362438                                   int cy, UINT fuFlags, BOOL fShowWindow)
    24372439{
     
    25382540        OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld);
    25392541    }
    2540     if((dwOldStyle & WS_MINIMIZE) && (getStyle() & WS_MINIMIZE)) 
     2542    if((dwOldStyle & WS_MINIMIZE) && (getStyle() & WS_MINIMIZE))
    25412543    {//don't allow size changes if the window is minimized
    25422544     //we will update the restore position at the end of this method
     
    25892591    //SvL: Must also deactivate the window when hiding it or else focus won't
    25902592    //     change. (NOTE: make sure this doesn't cause regressions (01-02-2003)
    2591     if((swp.fl & (SWPOS_HIDE|SWPOS_DEACTIVATE)) == (SWPOS_HIDE|SWPOS_DEACTIVATE)) 
     2593    if((swp.fl & (SWPOS_HIDE|SWPOS_DEACTIVATE)) == (SWPOS_HIDE|SWPOS_DEACTIVATE))
    25922594    {
    25932595        //we must make sure the owner is not disabled or else the focus will
     
    26872689         wpos->y      = rectWindow.top;
    26882690    }
    2689    
     2691
    26902692    WINDOWPOS wpOld = *wpos;
    26912693    if(!(wpos->flags & SWP_NOSENDCHANGING))
     
    28232825        return FALSE;
    28242826    }
    2825  
     2827
    28262828    if(!(getStyle() & WS_CHILD) && getOwner() == NULL)
    28272829    {
     
    28542856    }
    28552857    dprintf(("DestroyWindow %x -> HIDDEN", hwnd));
    2856  
     2858
    28572859    // check the handle for the last active popup window
    28582860    Win32BaseWindow* owner = getOwner();
     
    28702872        //     (MFC created modeless dialog)
    28712873        //TODO: This might be the wrong place to do it. EndDialog is called,
    2872         //      so perhaps it should be done there. (although Wine only 
     2874        //      so perhaps it should be done there. (although Wine only
    28732875        //      enables the owner if the dialog is modal)
    28742876        ::EnableWindow(owner->getWindowHandle(), 1);
    28752877    }
    2876  
     2878
    28772879    fDestroyWindowCalled = TRUE;
    28782880
     
    29292931  Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::getParentOfChild();
    29302932
    2931     if(getStyle() & WS_CHILD) 
     2933    if(getStyle() & WS_CHILD)
    29322934    {
    29332935        if(wndparent) {
     
    29382940        return 0;
    29392941    }
    2940     else 
     2942    else
    29412943    if(getStyle() & WS_POPUP)
    29422944         return (getOwner()) ? getOwner()->getWindowHandle() : 0;
     
    30273029    // in release build.
    30283030    Win32BaseWindow *_parent = getParent();
    3029    
    3030     if(_parent) 
     3031
     3032    if(_parent)
    30313033    {
    30323034        if(_parent->getWindowHandle() == hwndParent)
    30333035            return TRUE;
    3034    
     3036
    30353037        return _parent->IsChild(hwndParent);
    30363038    }
    3037     else 
     3039    else
    30383040        return 0;
    30393041}
     
    32083210    dprintf(("EnumWindows %x %x", lpfn, lParam));
    32093211
    3210     for(int i=0;i<MAX_WINDOW_HANDLES;i++) 
     3212    for(int i=0;i<MAX_WINDOW_HANDLES;i++)
    32113213    {
    32123214        window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     
    34403442             if(window->state >= STATE_POST_WMNCCREATE) {
    34413443                 hwndRelated = window->getWindowHandle();
    3442                  RELEASE_WNDOBJ(window); 
     3444                 RELEASE_WNDOBJ(window);
    34433445             }
    34443446             else {
    34453447                 hwndRelated = window->GetWindow(GW_HWNDNEXT);
    3446                  RELEASE_WNDOBJ(window); 
     3448                 RELEASE_WNDOBJ(window);
    34473449             }
    34483450        }
     
    34973499//******************************************************************************
    34983500PRECT Win32BaseWindow::getWindowRect()
    3499 { 
    3500     return &rectWindow; 
     3501{
     3502    return &rectWindow;
    35013503}
    35023504//******************************************************************************
     
    36683670{
    36693671    //if the destination window is created by this process, send message
    3670     if(dwProcessId == currentProcessId) 
     3672    if(dwProcessId == currentProcessId)
    36713673    {
    36723674        if(fUnicode) {
     
    36773679    //else get data directory from window structure
    36783680    //TODO: must lock window structure.... (TODO)
    3679     return windowNameLength;
     3681    return fUnicode ? windowNameLengthW : windowNameLengthA;
    36803682}
    36813683//******************************************************************************
     
    36893691        return SendMessageA(getWindowHandle(),WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
    36903692    }
    3691  
     3693
    36923694    //else get data directory from window structure
    36933695    if (!lpsz || !cch) return 0;
    36943696    if (!windowNameA) lpsz[0] = 0;
    3695     else memcpy(lpsz, windowNameA, min(windowNameLength + 1, cch) );
    3696     return min(windowNameLength, cch);
     3697    else lstrcpynA( lpsz, windowNameA, cch );
     3698    return strlen( lpsz );
    36973699}
    36983700//******************************************************************************
     
    37073709    }
    37083710    //else get data directory from window structure
    3709     if (!lpsz || !cch) 
     3711    if (!lpsz || !cch)
    37103712        return 0;
    3711     if (!windowNameW) 
     3713    if (!windowNameW)
    37123714        lpsz[0] = 0;
    3713     else 
    3714         memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch));
    3715            
    3716     return min(windowNameLength, cch);
     3715    else
     3716        lstrcpynW( lpsz, windowNameW, cch );
     3717
     3718    return strlenW( lpsz );
    37173719}
    37183720//******************************************************************************
     
    37513753                SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
    37523754
    3753                 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), 
     3755                OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(),
    37543756                                    getStyle(), getExStyle(),ss.styleOld);
    37553757
     
    37603762        {
    37613763                STYLESTRUCT ss;
    3762  
     3764
    37633765                //SvL: TODO: Can you change minimize or maximize status here too?
    37643766
     
    37683770                }
    37693771                dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x (%x)", getWindowHandle(), dwStyle, value));
    3770                
     3772
    37713773                //Changing WS_CHILD style is allowed
    37723774                ss.styleOld = getStyle();
     
    37763778                SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
    37773779
    3778                  OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), 
     3780                 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(),
    37793781                                    getStyle(), getExStyle(),ss.styleOld);
    37803782
     
    39413943    switch(index)
    39423944    {
    3943     case GWW_ID:         
    3944         if(HIWORD(getWindowId()))
     3945    case GWW_ID:
     3946        if(HIWORD(getWindowId()))
    39453947            dprintf(("WARNING: GWW_ID: discards high bits of 0x%08x!\n", getWindowId()));
    39463948        return (WORD)getWindowId();
    39473949
    3948     case GWW_HWNDPARENT: 
     3950    case GWW_HWNDPARENT:
    39493951        dprintf(("WARNING: GWW_HWNDPARENT: discards high bits of 0x%08x!\n", GetParent()));
    3950         return (WORD) GetParent();
    3951 
    3952     case GWW_HINSTANCE: 
    3953         if (HIWORD(hInstance))
     3952        return (WORD) GetParent();
     3953
     3954    case GWW_HINSTANCE:
     3955        if (HIWORD(hInstance))
    39543956            dprintf(("WARNING: GWW_HINSTANCE: discards high bits of 0x%08x!\n", hInstance));
    39553957        return (WORD)hInstance;
     
    39693971//    VISRGN_NOTIFY_PROC lpNotifyProc    - notification handler
    39703972//    DWORD              dwUserData      - caller supplied parameter for handler invocations
    3971 // 
     3973//
    39723974// Returns:
    39733975//    TRUE              - Success
     
    39893991// Parameters:
    39903992//    BOOL   fDrawingAllowed    - drawing is allowed or not
    3991 // 
     3993//
    39923994// Returns:
    39933995//    TRUE              - Success
     
    39953997//
    39963998//******************************************************************************
    3997 void Win32BaseWindow::callVisibleRgnNotifyProc(BOOL fDrawingAllowed) 
     3999void Win32BaseWindow::callVisibleRgnNotifyProc(BOOL fDrawingAllowed)
    39984000{
    39994001    if(fDrawingAllowed) {
     
    40164018//    int  chdcWindow   - size of HDC array       (IN)
    40174019//    int *pnrdcs       - number of HDCs returned (OUT)
    4018 // 
     4020//
    40194021// Returns:
    40204022//    TRUE              - Success
     
    40504052// Parameters:
    40514053//    HDC hdc            - HDC to be added to our list of open DCs
    4052 // 
     4054//
    40534055// Returns:
    40544056//
     
    40834085// Parameters:
    40844086//    HDC hdc            - HDC to be removed from our list of open DCs
    4085 // 
     4087//
    40864088// Returns:
    40874089//
     
    41414143{
    41424144 DWORD            magic;
    4143  HWND             hwnd; 
     4145 HWND             hwnd;
    41444146
    41454147    if(hwndOS2 == OSLIB_HWND_DESKTOP)
     
    41574159//  dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwndOS2));
    41584160
    4159     //Now check if it's a fake window 
     4161    //Now check if it's a fake window
    41604162    Win32FakeWindow *window = Win32FakeWindow::GetWindowFromOS2Handle(hwndOS2);
    41614163    if(window) {
Note: See TracChangeset for help on using the changeset viewer.