Ignore:
Timestamp:
Jul 26, 1999, 10:03:49 PM (26 years ago)
Author:
sandervl
Message:

Lots of changes: Solitaire now displays cards correctly

File:
1 edited

Legend:

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

    r397 r398  
    1 /* $Id: win32wnd.cpp,v 1.23 1999-07-26 09:01:34 sandervl Exp $ */
     1/* $Id: win32wnd.cpp,v 1.24 1999-07-26 20:03:49 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    4444    ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle))
    4545
     46#define IS_OVERLAPPED(style) \
     47    !(style & (WS_CHILD | WS_POPUP))
     48
    4649//******************************************************************************
    4750//******************************************************************************
     
    6568  isUnicode        = FALSE;
    6669  fCreated         = FALSE;
     70  fFirstShow       = TRUE;
    6771
    6872  memset(windowNameA, 0, MAX_WINDOW_NAMELENGTH);
     
    431435  maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
    432436
     437  fCreated = TRUE; //Allow WM_SIZE messages now
    433438  if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) )
    434439  {
    435   //doesn't work right, messes up client rectangle
     440        //doesn't work right, messes up client rectangle
    436441#if 0
    437442        SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient );
     
    455460                HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
    456461#endif
    457             fCreated = TRUE;
    458462            SetLastError(0);
    459463            return TRUE;
    460464        }
    461465  }
     466  fCreated = FALSE;
    462467  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0);
    463468  OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0);
     
    473478 * state.
    474479 */
    475 UINT Win32Window::MinMaximize(UINT16 cmd, LPRECT16 lpRect )
     480UINT Win32Window::MinMaximize(UINT cmd, LPRECT lpRect )
    476481{
    477482    UINT swpFlags = 0;
     
    516521
    517522        case SW_MAXIMIZE:
    518                 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
    519523                WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
    520                 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
    521524
    522525         if( dwStyle & WS_MINIMIZE )
     
    779782ULONG Win32Window::MsgActivate(BOOL fActivate, HWND hwnd)
    780783{
     784    if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE)
     785    {
     786        if(!fActivate) {
     787            return 1;
     788        }
     789    }
    781790    return SendInternalMessageA(WM_ACTIVATE, (fActivate) ? WA_ACTIVE : WA_INACTIVE, hwnd);
    782791}
     
    815824ULONG Win32Window::MsgSetFocus(HWND hwnd)
    816825{
     826    if(hwnd == 0) {
     827        //other app lost focus
     828        SendInternalMessageA(WM_ACTIVATEAPP, TRUE, 0); //TODO: Need thread id from hwnd app
     829    }
    817830    return SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
    818831}
     
    821834ULONG Win32Window::MsgKillFocus(HWND hwnd)
    822835{
     836    if(hwnd == 0) {
     837        //other app lost focus
     838        SendInternalMessageA(WM_ACTIVATEAPP, FALSE, 0); //TODO: Need thread id from hwnd app
     839    }
    823840    return SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
    824841}
     
    872889                return 1;
    873890    }
     891    if(win32msg == WM_MBUTTONDBLCLK || win32msg == WM_RBUTTONDBLCLK || win32msg == WM_LBUTTONDBLCLK) {
     892        if(!(windowClass->getClassLongA(GCL_STYLE) & CS_DBLCLKS)) {
     893            return 1;
     894        }
     895    }
    874896    SendInternalMessageA(win32ncmsg, lastHitTestVal, MAKELONG(x, y)); //TODO:
    875897    return SendInternalMessageA(win32msg, 0, MAKELONG(x, y));
     
    13431365 ULONG showstate = 0;
    13441366
    1345   dprintf(("ShowWindow %x", nCmdShow));
    1346   switch(nCmdShow)
    1347   {
     1367    dprintf(("ShowWindow %x", nCmdShow));
     1368    if(fFirstShow) {
     1369        if(isFrameWindow() && IS_OVERLAPPED(getStyle())) {
     1370                SendMessageA(WM_SIZE, SIZE_RESTORED,
     1371                                MAKELONG(rectClient.right-rectClient.left,
     1372                                         rectClient.bottom-rectClient.top));
     1373                SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
     1374
     1375        }
     1376        fFirstShow = FALSE;
     1377    }
     1378    switch(nCmdShow)
     1379    {
    13481380    case SW_SHOW:
    13491381    case SW_SHOWDEFAULT: //todo
     
    13771409        showstate = SWPOS_RESTORE | SWPOS_ACTIVATE | SWPOS_SHOW;
    13781410        break;
    1379   }
    1380   return OSLibWinShowWindow(OS2HwndFrame, showstate);
     1411    }
     1412    return OSLibWinShowWindow(OS2HwndFrame, showstate);
    13811413}
    13821414//******************************************************************************
     
    13911423        hwndInsertAfter = HWNDOS_BOTTOM;
    13921424        break;
    1393     case HWND_TOPMOST: //TODO:
     1425    case HWND_TOPMOST: //TODO
    13941426    case HWND_NOTOPMOST: //TODO:
    13951427    case HWND_TOP:
     
    14021434            PRECT clientRect = window->getClientRect();
    14031435
    1404 #if 0
     1436#if 1
    14051437            if(x+cx > clientRect->right - clientRect->left) {
     1438                dprintf(("Adjusting cx from %d to %d", cx, (clientRect->right - clientRect->left) - x));
    14061439                cx = (clientRect->right - clientRect->left) - x;
    14071440            }
    14081441            if(y+cy > clientRect->bottom - clientRect->top) {
     1442                dprintf(("Adjusting cy from %d to %d", cy, (clientRect->bottom - clientRect->top) - y));
    14091443                cy = (clientRect->bottom - clientRect->top) - y;
    14101444            }
    14111445#endif
     1446            //Correct coordinates if parent is a frame window (border adjustment)
    14121447            //TODO: Not quite right (Solitaire child window placement slightly wrong)
    1413             if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() ))
    1414             {
    1415                 x += GetSystemMetrics(SM_CXDLGFRAME);
    1416                 y -= GetSystemMetrics(SM_CYDLGFRAME);
    1417             }
    1418             else
    1419             {
    1420                 if (HAS_THICKFRAME(window->getStyle()))
     1448            if (window->isFrameWindow() && !(fuFlags & SWP_NOMOVE)) {
     1449                if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() ))
    14211450                {
    1422                     x += GetSystemMetrics(SM_CXFRAME);
    1423                     y -= GetSystemMetrics(SM_CYFRAME);
     1451                    x += GetSystemMetrics(SM_CXDLGFRAME);
     1452                    y -= GetSystemMetrics(SM_CYDLGFRAME);
    14241453                }
    1425                 if (window->getStyle() & WS_BORDER)
     1454                else
    14261455                {
    1427                     x += GetSystemMetrics(SM_CXBORDER);
    1428                     y -= GetSystemMetrics(SM_CYBORDER);
     1456                    if (HAS_THICKFRAME(window->getStyle()))
     1457                    {
     1458                        x += GetSystemMetrics(SM_CXFRAME);
     1459                        y -= GetSystemMetrics(SM_CYFRAME);
     1460                    }
     1461                    else
     1462                    if (window->getStyle() & WS_BORDER)
     1463                    {
     1464                        x += GetSystemMetrics(SM_CXBORDER);
     1465                        y -= GetSystemMetrics(SM_CYBORDER);
     1466                    }
    14291467                }
    14301468            }
     
    16151653//******************************************************************************
    16161654//******************************************************************************
    1617 BOOL Win32Window::BringWindowToTop()
    1618 {
    1619   return SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE );
    1620 }
    1621 //******************************************************************************
    1622 //******************************************************************************
    16231655HWND Win32Window::GetActiveWindow()
    16241656{
Note: See TracChangeset for help on using the changeset viewer.