Changeset 10091 for trunk/src


Ignore:
Timestamp:
May 15, 2003, 2:40:20 PM (22 years ago)
Author:
sandervl
Message:

Window creation: updated the coordinate fix code with the latest Rewind version

Location:
trunk/src/user32
Files:
3 edited

Legend:

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

    r10089 r10091  
    1 /* $Id: win32wbase.cpp,v 1.373 2003-05-14 11:40:17 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.374 2003-05-15 12:40:19 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    393393    fXDefault = FALSE;
    394394    fCXDefault = FALSE;
    395     if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))
    396     {
    397        /* Never believe Microsoft's documentation... CreateWindowEx doc says
    398         * that if an overlapped window is created with WS_VISIBLE style bit
    399         * set and the x parameter is set to CW_USEDEFAULT, the system ignores
    400         * the y parameter. However, looking at NT reveals that
    401         *
    402         * 1) not only if checks for CW_USEDEFAULT but also for CW_USEDEFAULT16
    403         * 2) it does not ignore the y parameter as the docs claim; instead, it
    404         *    uses it as second parameter to ShowWindow() unless y is either
    405         *    CW_USEDEFAULT or CW_USEDEFAULT16.
    406         *
    407         * The fact that we didn't do 2) caused bogus windows pop up when wine
    408         * was running apps that were using this obscure feature. Example -
    409         * calc.exe that comes with Win98 (only Win98, it's different from
    410         * the one that comes with Win95 and NT)
    411         */
    412         if ((cs->y != CW_USEDEFAULT) && (cs->y != CW_USEDEFAULT16)) sw = cs->y;
    413 
    414         /* We have saved cs->y, now we can trash it */
    415         cs->x = 0;
    416         cs->y = 0;
    417         fXDefault = TRUE;
    418     }
    419     if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))
    420     {
    421         cs->cx = 600; /* FIXME */
    422         cs->cy = 400;
    423         fCXDefault = TRUE;
    424     }
    425     if (cs->style & (WS_POPUP | WS_CHILD))
    426     {
    427         fXDefault = FALSE;
    428         if (fCXDefault)
    429         {
    430             fCXDefault = FALSE;
    431             cs->cx = cs->cy = 0;
    432         }
    433     }
    434     if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe)
    435 
     395    FixCoordinates(cs, &sw);
    436396
    437397    /* Correct the window style - stage 1
  • trunk/src/user32/win32wbase.h

    r10060 r10091  
    1 /* $Id: win32wbase.h,v 1.153 2003-05-02 15:33:17 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.154 2003-05-15 12:40:20 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    459459
    460460CREATESTRUCTA  *tmpcs; //temporary pointer to CREATESTRUCT used in CreateWindowEx
    461         ULONG   sw;    //set in CreateWindowExA, used in MsgCreate method
     461        int     sw;    //set in CreateWindowExA, used in MsgCreate method
    462462
    463463SCROLLBAR_INFO *vertScrollInfo;
     
    485485        LONG  HandleNCCalcSize(BOOL calcValidRects,RECT *winRect);
    486486        VOID  DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active);
     487        void  FixCoordinates( CREATESTRUCTA *cs, INT *sw);
    487488public:
    488489        VOID  GetInsideRect(RECT *rect);
  • trunk/src/user32/win32wbasepos.cpp

    r9866 r10091  
    1 /* $Id: win32wbasepos.cpp,v 1.30 2003-02-27 14:22:45 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.31 2003-05-15 12:40:20 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    371371    return swpFlags;
    372372}
     373/***********************************************************************
     374 *           WIN_FixCoordinates
     375 *
     376 * Fix the coordinates - Helper for WIN_CreateWindowEx.
     377 * returns default show mode in sw.
     378 * Note: the feature presented as undocumented *is* in the MSDN since 1993.
     379 */
     380void Win32BaseWindow::FixCoordinates( CREATESTRUCTA *cs, INT *sw)
     381{
     382    if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16 ||
     383        cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16)
     384    {
     385        if (cs->style & (WS_CHILD | WS_POPUP))
     386        {
     387            if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16) cs->x = cs->y = 0;
     388            if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16) cs->cx = cs->cy = 0;
     389        }
     390        else  /* overlapped window */
     391        {
     392            STARTUPINFOA info;
     393
     394            GetStartupInfoA( &info );
     395
     396            if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16)
     397            {
     398                /* Never believe Microsoft's documentation... CreateWindowEx doc says
     399                 * that if an overlapped window is created with WS_VISIBLE style bit
     400                 * set and the x parameter is set to CW_USEDEFAULT, the system ignores
     401                 * the y parameter. However, disassembling NT implementation (WIN32K.SYS)
     402                 * reveals that
     403                 *
     404                 * 1) not only it checks for CW_USEDEFAULT but also for CW_USEDEFAULT16
     405                 * 2) it does not ignore the y parameter as the docs claim; instead, it
     406                 *    uses it as second parameter to ShowWindow() unless y is either
     407                 *    CW_USEDEFAULT or CW_USEDEFAULT16.
     408                 *
     409                 * The fact that we didn't do 2) caused bogus windows pop up when wine
     410                 * was running apps that were using this obscure feature. Example -
     411                 * calc.exe that comes with Win98 (only Win98, it's different from
     412                 * the one that comes with Win95 and NT)
     413                 */
     414                if (cs->y != CW_USEDEFAULT && cs->y != CW_USEDEFAULT16) *sw = cs->y;
     415                cs->x = (info.dwFlags & STARTF_USEPOSITION) ? info.dwX : 0;
     416                cs->y = (info.dwFlags & STARTF_USEPOSITION) ? info.dwY : 0;
     417            }
     418
     419            if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16)
     420            {
     421                if (info.dwFlags & STARTF_USESIZE)
     422                {
     423                    cs->cx = info.dwXSize;
     424                    cs->cy = info.dwYSize;
     425                }
     426                else  /* if no other hint from the app, pick 3/4 of the screen real estate */
     427                {
     428                    RECT r;
     429                    SystemParametersInfoA( SPI_GETWORKAREA, 0, &r, 0);
     430                    cs->cx = (((r.right - r.left) * 3) / 4) - cs->x;
     431                    cs->cy = (((r.bottom - r.top) * 3) / 4) - cs->y;
     432                }
     433            }
     434        }
     435    }
     436    else
     437    {
     438        /* neither x nor cx are default. Check the y values .
     439         * In the trace we see Outlook and Outlook Express using
     440         * cy set to CW_USEDEFAULT when opening the address book.
     441         */
     442        if (cs->cy == CW_USEDEFAULT || cs->cy == CW_USEDEFAULT16) {
     443            RECT r;
     444            dprintf(("Strange use of CW_USEDEFAULT in nHeight\n"));
     445            SystemParametersInfoA( SPI_GETWORKAREA, 0, &r, 0);
     446            cs->cy = (((r.bottom - r.top) * 3) / 4) - cs->y;
     447        }
     448    }
     449}
    373450//******************************************************************************
    374451//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.