Ignore:
Timestamp:
Feb 5, 2000, 8:45:19 PM (26 years ago)
Author:
cbratschi
Message:

several fixes -> changelog

File:
1 edited

Legend:

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

    r2663 r2666  
    1 /* $Id: win32wbase.cpp,v 1.153 2000-02-05 16:24:59 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.154 2000-02-05 19:45:17 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    124124  userData         = 0;
    125125  contextHelpId    = 0;
     126  hotkey           = 0;
    126127
    127128  pOldFrameProc = NULL;
     
    236237 char  buffer[256];
    237238 POINT maxSize, maxPos, minTrack, maxTrack;
     239 BOOL  xDefault = FALSE,cxDefault = FALSE;
    238240
    239241#ifdef DEBUG
     
    308310  if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))
    309311  {
    310 //        PDB *pdb = PROCESS_Current();
    311 
    312312       /* Never believe Microsoft's documentation... CreateWindowEx doc says
    313313        * that if an overlapped window is created with WS_VISIBLE style bit
     
    329329
    330330        /* We have saved cs->y, now we can trash it */
    331 #if 0
    332         if (   !(cs->style & (WS_CHILD | WS_POPUP))
    333             &&  (pdb->env_db->startup_info->dwFlags & STARTF_USEPOSITION) )
    334         {
    335             cs->x = pdb->env_db->startup_info->dwX;
    336             cs->y = pdb->env_db->startup_info->dwY;
    337         }
    338 #endif
    339             cs->x = 0;
    340             cs->y = 0;
    341 //        }
     331        cs->x = 0;
     332        cs->y = 0;
     333        xDefault = TRUE;
    342334  }
    343335  if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))
    344336  {
    345 #if 0
    346         PDB *pdb = PROCESS_Current();
    347         if (   !(cs->style & (WS_CHILD | WS_POPUP))
    348             &&  (pdb->env_db->startup_info->dwFlags & STARTF_USESIZE) )
    349         {
    350             cs->cx = pdb->env_db->startup_info->dwXSize;
    351             cs->cy = pdb->env_db->startup_info->dwYSize;
    352         }
    353         else
    354         {
    355 #endif
    356             cs->cx = 600; /* FIXME */
    357             cs->cy = 400;
    358 //        }
     337        cs->cx = 600; /* FIXME */
     338        cs->cy = 400;
     339        cxDefault = TRUE;
    359340  }
    360341
     
    459440        vertScrollInfo->MaxVal = 100;
    460441        vertScrollInfo->flags  = ESB_ENABLE_BOTH;
     442  }
     443
     444  if(HIWORD(cs->lpszName))
     445  {
     446    if (!isUnicode)
     447    {
     448        wndNameLength = strlen(cs->lpszName);
     449        windowNameA = (LPSTR)_smalloc(wndNameLength+1);
     450        strcpy(windowNameA,cs->lpszName);
     451        windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
     452        lstrcpyAtoW(windowNameW,windowNameA);
     453        windowNameA[wndNameLength] = 0;
     454        windowNameW[wndNameLength] = 0;
     455    }
     456    else
     457    {
     458        wndNameLength = lstrlenW((LPWSTR)cs->lpszName);
     459        windowNameA = (LPSTR)_smalloc(wndNameLength+1);
     460        lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName);
     461        windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
     462        lstrcpyW(windowNameW,(LPWSTR)cs->lpszName);
     463        windowNameA[wndNameLength] = 0;
     464        windowNameW[wndNameLength] = 0;
     465    }
     466  }
     467
     468  //copy pointer of CREATESTRUCT for usage in MsgCreate method
     469  tmpcs = cs;
     470
     471  //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
     472  THDB *thdb = GetThreadTHDB();
     473
     474  if(thdb == NULL) {
     475        dprintf(("Window creation failed - thdb == NULL")); //this is VERY bad
     476        ExitProcess(666);
     477        return FALSE;
     478  }
     479
     480  thdb->newWindow = (ULONG)this;
     481
     482  DWORD dwOSWinStyle;
     483
     484  OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle);
     485  if (((dwStyle & (WS_CAPTION | WS_SYSMENU | 0xC0000000)) == (WS_CAPTION | WS_SYSMENU))) fTaskList = TRUE;
     486
     487  OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
     488                                 dwOSWinStyle,(char *)windowNameA,
     489                                 (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
     490                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     491                                 &OS2HwndFrame, 0, fTaskList,xDefault | cxDefault,windowClass->getStyle() & CS_SAVEBITS);
     492  if(OS2Hwnd == 0) {
     493        dprintf(("Window creation failed!!"));
     494        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     495        return FALSE;
     496  }
     497
     498  //adjust CW_USEDEFAULT position
     499  if (xDefault | cxDefault)
     500  {
     501    RECT rect;
     502
     503    OSLibWinQueryWindowRect(OS2HwndFrame,&rect,RELATIVE_TO_SCREEN);
     504    if (getParent()) mapWin32Rect(OSLIB_HWND_DESKTOP,getParent()->getOS2FrameWindowHandle(),&rect);
     505    if (xDefault)
     506    {
     507      cs->x = rect.left;
     508      cs->y = rect.top;
     509    }
     510    if (cxDefault)
     511    {
     512      cs->cx = rect.right-rect.left;
     513      cs->cy = rect.bottom-rect.top;
     514    }
    461515  }
    462516
     
    480534        if (cs->cx <= 0) cs->cx = 1;
    481535        if (cs->cy <= 0) cs->cy = 1;
    482   }
    483 
    484   if(((dwStyle & 0xC0000000) == WS_OVERLAPPED) && ((dwStyle & WS_CAPTION) == WS_CAPTION) && owner == NULL
    485      && dwStyle & WS_SYSMENU)
    486   {
    487         fTaskList = TRUE;
    488   }
    489 
    490   DWORD dwOSWinStyle;
    491 
    492   OSLibWinConvertStyle(dwStyle, &dwExStyle, &dwOSWinStyle);
    493 
    494   if(HIWORD(cs->lpszName))
    495   {
    496     if (!isUnicode)
    497     {
    498         wndNameLength = strlen(cs->lpszName);
    499         windowNameA = (LPSTR)_smalloc(wndNameLength+1);
    500         strcpy(windowNameA,cs->lpszName);
    501         windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    502         lstrcpyAtoW(windowNameW,windowNameA);
    503         windowNameA[wndNameLength] = 0;
    504         windowNameW[wndNameLength] = 0;
    505     }
    506     else
    507     {
    508         wndNameLength = lstrlenW((LPWSTR)cs->lpszName);
    509         windowNameA = (LPSTR)_smalloc(wndNameLength+1);
    510         lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName);
    511         windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    512         lstrcpyW(windowNameW,(LPWSTR)cs->lpszName);
    513         windowNameA[wndNameLength] = 0;
    514         windowNameW[wndNameLength] = 0;
    515     }
    516   }
    517 
    518   //copy pointer of CREATESTRUCT for usage in MsgCreate method
    519   tmpcs = cs;
    520 
    521   //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
    522   THDB *thdb = GetThreadTHDB();
    523 
    524   if(thdb == NULL) {
    525         dprintf(("Window creation failed - thdb == NULL")); //this is VERY bad
    526         ExitProcess(666);
    527         return FALSE;
    528   }
    529 
    530   thdb->newWindow = (ULONG)this;
    531 
    532   OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    533                                  dwOSWinStyle,(char *)windowNameA,
    534                                  (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    535                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    536                                  &OS2HwndFrame, 0, fTaskList,windowClass->getStyle() & CS_SAVEBITS);
    537   if(OS2Hwnd == 0) {
    538         dprintf(("Window creation failed!!"));
    539         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    540         return FALSE;
    541536  }
    542537
     
    15991594    }
    16001595
     1596    case WM_SETHOTKEY:
     1597        hotkey = wParam;
     1598        return 1; //CB: always successful
     1599
     1600    case WM_GETHOTKEY:
     1601        return hotkey;
     1602
     1603    case WM_CONTEXTMENU:
     1604        if ((dwStyle & WS_CHILD) && getParent())
     1605          getParent()->SendInternalMessageA(WM_CONTEXTMENU,wParam,lParam);
     1606        return 0;
     1607
    16011608    case WM_SHOWWINDOW:
    16021609        if (!lParam) return 0; /* sent from ShowWindow */
     
    16161623
    16171624    case WM_QUERYDROPOBJECT:
    1618         if (dwExStyle & WS_EX_ACCEPTFILES) return 1;
    1619         return 0;
     1625        return (dwExStyle & WS_EX_ACCEPTFILES) ? 1:0;
    16201626
    16211627    case WM_QUERYDRAGICON:
     
    16391645
    16401646    case WM_NOTIFYFORMAT:
    1641         if (IsWindowUnicode()) return NFR_UNICODE;
    1642         else return NFR_ANSI;
     1647        return IsWindowUnicode() ? NFR_UNICODE:NFR_ANSI;
    16431648
    16441649    case WM_SETICON:
Note: See TracChangeset for help on using the changeset viewer.