Changeset 4825 for trunk/src/user32


Ignore:
Timestamp:
Dec 17, 2000, 4:04:14 PM (25 years ago)
Author:
sandervl
Message:

hook, mdi & focus fixes

Location:
trunk/src/user32
Files:
10 edited

Legend:

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

    r3873 r4825  
    1 /* $Id: caret.cpp,v 1.13 2000-07-20 18:08:12 sandervl Exp $ */
     1/* $Id: caret.cpp,v 1.14 2000-12-17 15:04:09 sandervl Exp $ */
    22
    33/*
    44 * Caret functions for USER32
     5 *
     6 *
     7 * TODO: Getting height of window instead of checking whether it needs
     8 *       to be window or client appears to be wrong....
    59 *
    610 * Project Odin Software License can be found in LICENSE.TXT
  • trunk/src/user32/oslibwin.cpp

    r4551 r4825  
    1 /* $Id: oslibwin.cpp,v 1.84 2000-11-04 16:28:25 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.85 2000-12-17 15:04:10 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    8888
    8989  return WinCreateWindow (hwndParent,
    90                           WIN32_STDFRAMECLASS,
     90                          hwndParent == HWND_DESKTOP ? WIN32_STDFRAMECLASS : WIN32_STDCLASS,
    9191                          pszName, dwWinStyle, 0, 0, 0, 0,
    9292                          Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP,
  • trunk/src/user32/pmwindow.cpp

    r4658 r4825  
    1 /* $Id: pmwindow.cpp,v 1.108 2000-11-21 11:36:09 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.109 2000-12-17 15:04:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    956956        switch(fsCmd) {
    957957        case QFC_NEXTINCHAIN:
    958                 break;
     958                goto RunDefWndProc;
    959959        case QFC_ACTIVE:
    960960        case QFC_FRAME:
     
    965965                break;
    966966        case QFC_SELECTACTIVE:
    967                 break;
     967                goto RunDefWndProc;
    968968        case QFC_PARTOFCHAIN:
    969                 return (MRESULT)TRUE;
     969                goto RunDefWndProc;
    970970        }
    971971        break;
  • trunk/src/user32/text.cpp

    r2873 r4825  
    1 /* $Id: text.cpp,v 1.9 2000-02-23 17:05:17 cbratschi Exp $ */
     1/* $Id: text.cpp,v 1.10 2000-12-17 15:04:11 sandervl Exp $ */
    22
    33/*
     
    2222INT WIN32API DrawTextA(HDC hDC,LPCSTR lpString,INT nCount,PRECT lpRect,UINT nFormat)
    2323{
    24  int bla;
    25 
    2624  dprintf(("USER32: DrawTextA %x %s %d (%d,%d)(%d,%d) %x",hDC, lpString, nCount, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, nFormat));
    2725
    28   if(nFormat == 0x828) {
    29         bla = 1;
    30   }
    3126  return InternalDrawTextExA(hDC,lpString,nCount,lpRect,nFormat,NULL,FALSE);
    3227}
  • trunk/src/user32/user32rsrc.orc

    r4579 r4825  
    1 /* $Id: user32rsrc.orc,v 1.5 2000-11-09 20:20:32 sandervl Exp $ */
     1/* $Id: user32rsrc.orc,v 1.6 2000-12-17 15:04:11 sandervl Exp $ */
    22/* converted from WINE */
    33
    44#include "winuser.h"
     5#include "winnls.h"
    56#include "odinrsrc.h"
    6 
    7 /* System Menu */
    8 
    9 SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
    10 {
    11  MENUITEM "&Restore", 61728
    12  MENUITEM "&Move", 61456
    13  MENUITEM "&Size", 61440
    14  MENUITEM "Mi&nimize", 61472
    15  MENUITEM "Ma&ximize", 61488
    16  MENUITEM SEPARATOR
    17  MENUITEM "&Close\tAlt-F4", 61536
    18  MENUITEM SEPARATOR
    19  MENUITEM "&Switch to ...\tCtrl-Esc", 61744
    20  MENUITEM SEPARATOR
    21  MENUITEM "&About Odin ...", 61761
    22  MENUITEM SEPARATOR
    23  MENUITEM "&Put mark in debug log", 61762
    24  MENUITEM "&DebugInt3", 61763
    25 }
     7#include "mdi.h"
    268
    279/* Frame */
     
    796778#define EM_SETSEL            0x00b1
    797779
    798 EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE
    799 {
    800         POPUP ""
    801         BEGIN
    802                 MENUITEM "&Undo", EM_UNDO
    803                 MENUITEM SEPARATOR
    804                 MENUITEM "Cu&t", WM_CUT
    805                 MENUITEM "&Copy", WM_COPY
    806                 MENUITEM "&Paste", WM_PASTE
    807                 MENUITEM "&Delete", WM_CLEAR
    808                 MENUITEM SEPARATOR
    809                 MENUITEM "Select &All", EM_SETSEL
    810         END
    811 }
    812 
    813780/* Icons */
    814781
     
    899866#define OCR_HELP            32651  /* only defined in Odin */
    900867
    901 
    902 MSGBOX DIALOG 100, 80, 216, 168
    903 STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    904 BEGIN
    905         ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
    906         LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
    907         PUSHBUTTON "&OK", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
    908         PUSHBUTTON "&Cancel", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
    909         PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
    910         PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
    911         PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
    912         PUSHBUTTON "&Yes", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
    913         PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
    914 END
    915868
    916869
     
    950903    END
    951904END
     905
     906/*
     907 * Everything specific to any language goes
     908 * in one of the specific files.
     909 * Note that you can and may override resources
     910 * which also have a neutral version. This is to
     911 * get localized bitmaps for example.
     912 */
     913#include "resources\user32_Ca.orc"
     914#include "resources\user32_Cs.orc"
     915#include "resources\user32_Da.orc"
     916#include "resources\user32_De.orc"
     917#include "resources\user32_En.orc"
     918#include "resources\user32_Eo.orc"
     919#include "resources\user32_Es.orc"
     920#include "resources\user32_Fi.orc"
     921#include "resources\user32_Fr.orc"
     922#include "resources\user32_Hu.orc"
     923#include "resources\user32_It.orc"
     924#include "resources\user32_Ko.orc"
     925#include "resources\user32_Nl.orc"
     926#include "resources\user32_No.orc"
     927#include "resources\user32_Pl.orc"
     928#include "resources\user32_Pt.orc"
     929#include "resources\user32_Ru.orc"
     930#include "resources\user32_Sk.orc"
     931#include "resources\user32_Sv.orc"
     932#include "resources\user32_Wa.orc"
     933#include "resources\user32_Ja.orc"
  • trunk/src/user32/win32wbase.cpp

    r4658 r4825  
    1 /* $Id: win32wbase.cpp,v 1.224 2000-11-21 11:36:09 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.225 2000-12-17 15:04:11 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    194194    }
    195195
     196    /* Decrement class window counter */
     197    if(windowClass) {
     198        windowClass->DecreaseWindowCount();
     199    }
     200
    196201    if(isOwnDC())
    197202        releaseOwnDC(ownDC);
     
    290295    }
    291296
    292   /* Find the window class */
    293   windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom);
    294   if (!windowClass)
    295   {
     297    /* Find the window class */
     298    windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom);
     299    if (!windowClass)
     300    {
    296301        GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
    297302        dprintf(("Bad class '%s'\n", buffer ));
    298303        SetLastError(ERROR_INVALID_PARAMETER);
    299304        return 0;
    300   }
     305    }
     306    /* Increment class window counter */
     307    windowClass->IncreaseWindowCount();
     308
    301309#ifdef DEBUG
    302   if(HIWORD(cs->lpszClass))
    303   {
     310    if(HIWORD(cs->lpszClass))
     311    {
    304312        char *astring;
    305313
     
    309317        dprintf(("Window class %s", astring));
    310318        if(isUnicode) FreeAsciiString(astring);
    311   }
    312   else dprintf(("Window class %x", cs->lpszClass));
     319    }
     320    else dprintf(("Window class %x", cs->lpszClass));
    313321#endif
    314322
    315   /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX
    316    * with an atom as the class name, put some programs expect to have a *REAL* string in
    317    * lpszClass when the CREATESTRUCT is sent with WM_CREATE
    318    */
    319   if (!HIWORD(cs->lpszClass) ) {
     323    /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX
     324     * with an atom as the class name, put some programs expect to have a *REAL* string in
     325     * lpszClass when the CREATESTRUCT is sent with WM_CREATE
     326     */
     327    if (!HIWORD(cs->lpszClass) ) {
    320328        if (isUnicode) {
    321329                GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );
     
    325333        }
    326334        cs->lpszClass = buffer;
    327   }
    328 
    329   /* Fix the coordinates */
    330   fXDefault = FALSE;
    331   fCXDefault = FALSE;
    332   if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))
    333   {
     335    }
     336
     337    /* Fix the coordinates */
     338    fXDefault = FALSE;
     339    fCXDefault = FALSE;
     340    if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))
     341    {
    334342       /* Never believe Microsoft's documentation... CreateWindowEx doc says
    335343        * that if an overlapped window is created with WS_VISIBLE style bit
     
    354362        cs->y = 0;
    355363        fXDefault = TRUE;
    356   }
    357   if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))
    358   {
     364    }
     365    if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))
     366    {
    359367        cs->cx = 600; /* FIXME */
    360368        cs->cy = 400;
    361369        fCXDefault = TRUE;
    362   }
    363   if (cs->style & (WS_POPUP | WS_CHILD))
    364   {
    365     fXDefault = FALSE;
    366     if (fCXDefault)
    367     {
    368       fCXDefault = FALSE;
    369       cs->cx = cs->cy = 0;
    370     }
    371   }
    372   if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe)
    373 
    374   if (cs->x < 0) cs->x = 0;
    375   if (cs->y < 0) cs->y = 0;
    376 
    377   //Allocate window words
    378   nrUserWindowLong = windowClass->getExtraWndWords();
    379   if(nrUserWindowLong) {
     370    }
     371    if (cs->style & (WS_POPUP | WS_CHILD))
     372    {
     373        fXDefault = FALSE;
     374        if (fCXDefault)
     375        {
     376        fCXDefault = FALSE;
     377        cs->cx = cs->cy = 0;
     378        }
     379    }
     380    if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe)
     381
     382    if (cs->x < 0) cs->x = 0;
     383    if (cs->y < 0) cs->y = 0;
     384
     385    //Allocate window words
     386    nrUserWindowLong = windowClass->getExtraWndWords();
     387    if(nrUserWindowLong) {
    380388        userWindowLong = (ULONG *)_smalloc(nrUserWindowLong);
    381389        memset(userWindowLong, 0, nrUserWindowLong);
    382   }
    383 
    384   if ((cs->style & WS_CHILD) && cs->hwndParent)
    385   {
     390    }
     391
     392    if ((cs->style & WS_CHILD) && cs->hwndParent)
     393    {
    386394        SetParent(cs->hwndParent);
    387395//        owner = GetWindowFromHandle(cs->hwndParent);
    388     owner = 0;
     396        owner = 0;
    389397/*        if(owner == NULL)
    390398        {
     
    395403        //SvL: Shell positioning shouldn't be done for child windows! (breaks Notes)
    396404        fXDefault = fCXDefault = FALSE;
    397   }
    398   else
    399   {
     405    }
     406    else
     407    {
    400408        SetParent(0);
    401409        if (!cs->hwndParent || (cs->hwndParent == windowDesktop->getWindowHandle())) {
     
    412420            }
    413421        }
    414   }
    415 
    416   WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW);
    417   hInstance = cs->hInstance;
    418   dwStyle   = cs->style & ~WS_VISIBLE;
    419   dwExStyle = cs->dwExStyle;
    420 
    421   hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
    422 
    423   /* Increment class window counter */
    424   windowClass->IncreaseWindowCount();
    425 
    426   if (HOOK_IsHooked( WH_CBT ))
    427   {
     422    }
     423
     424    WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW);
     425    hInstance = cs->hInstance;
     426    dwStyle   = cs->style & ~WS_VISIBLE;
     427    dwExStyle = cs->dwExStyle;
     428
     429    hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
     430
     431    /* Correct the window style */
     432    if (!(cs->style & WS_CHILD))
     433    {
     434        dwStyle |= WS_CLIPSIBLINGS;
     435        if (!(cs->style & WS_POPUP))
     436        {
     437            dwStyle |= WS_CAPTION;
     438            flags |= WIN_NEED_SIZE;
     439        }
     440    }
     441    if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
     442
     443    //copy pointer of CREATESTRUCT for usage in MsgCreate method
     444    tmpcs = cs;
     445
     446    //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
     447    TEB *teb = GetThreadTEB();
     448    if(teb == NULL) {
     449        dprintf(("Window creation failed - teb == NULL")); //this is VERY bad
     450        ExitProcess(666);
     451        return FALSE;
     452    }
     453
     454    teb->o.odin.newWindow = (ULONG)this;
     455
     456    DWORD dwOSWinStyle;
     457
     458    OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle);
     459
     460    OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
     461                                   dwOSWinStyle,(char *)windowNameA,
     462                                   (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP),
     463                                   (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     464                                   0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle());
     465    if(OS2Hwnd == 0) {
     466        dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError()));
     467        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     468        return FALSE;
     469    }
     470    OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE);
     471    SetLastError(0);
     472    return TRUE;
     473}
     474//******************************************************************************
     475//******************************************************************************
     476BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2)
     477{
     478 CREATESTRUCTA  *cs = tmpcs;  //pointer to CREATESTRUCT used in CreateWindowExA method
     479 POINT maxSize, maxPos, minTrack, maxTrack;
     480
     481    OS2Hwnd      = hwndOS2;
     482
     483    fNoSizeMsg = TRUE;
     484
     485    if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
     486        dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
     487        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     488        return FALSE;
     489    }
     490    if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
     491        dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
     492        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     493        return FALSE;
     494    }
     495
     496    if (HOOK_IsHooked( WH_CBT ))
     497    {
    428498        CBT_CREATEWNDA cbtc;
    429499        LRESULT ret;
     
    431501        cbtc.lpcs = cs;
    432502        cbtc.hwndInsertAfter = hwndLinkAfter;
    433         ret = HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc);
     503        ret = (isUnicode) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc)
     504                          : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc);
    434505        if(ret)
    435506        {
     
    438509            return FALSE;
    439510        }
    440   }
    441 
    442   /* Correct the window style */
    443   if (!(cs->style & WS_CHILD))
    444   {
    445         dwStyle |= WS_CLIPSIBLINGS;
    446         if (!(cs->style & WS_POPUP))
    447         {
    448             dwStyle |= WS_CAPTION;
    449             flags |= WIN_NEED_SIZE;
    450         }
    451   }
    452   if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
    453 
    454   if (cs->style & WS_HSCROLL)
    455   {
     511        //todo: if hook changes parent, we need to do so too!!!!!!!!!!
     512    }
     513
     514    if (cs->style & WS_HSCROLL)
     515    {
    456516        horzScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
    457517        horzScrollInfo->MinVal = horzScrollInfo->CurVal = horzScrollInfo->Page = 0;
    458518        horzScrollInfo->MaxVal = 100;
    459519        horzScrollInfo->flags  = ESB_ENABLE_BOTH;
    460   }
    461 
    462   if (cs->style & WS_VSCROLL)
    463   {
     520    }
     521
     522    if (cs->style & WS_VSCROLL)
     523    {
    464524        vertScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
    465525        vertScrollInfo->MinVal = vertScrollInfo->CurVal = vertScrollInfo->Page = 0;
    466526        vertScrollInfo->MaxVal = 100;
    467527        vertScrollInfo->flags  = ESB_ENABLE_BOTH;
    468   }
    469 
    470   if(HIWORD(cs->lpszName))
    471   {
    472     if (!isUnicode)
    473     {
    474         wndNameLength = strlen(cs->lpszName);
    475         windowNameA = (LPSTR)_smalloc(wndNameLength+1);
    476         strcpy(windowNameA,cs->lpszName);
    477         windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    478         lstrcpyAtoW(windowNameW,windowNameA);
    479         windowNameA[wndNameLength] = 0;
    480         windowNameW[wndNameLength] = 0;
    481     }
    482     else
    483     {
    484         wndNameLength = lstrlenW((LPWSTR)cs->lpszName);
    485         windowNameA = (LPSTR)_smalloc(wndNameLength+1);
    486         lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName);
    487         windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    488         lstrcpyW(windowNameW,(LPWSTR)cs->lpszName);
    489         windowNameA[wndNameLength] = 0;
    490         windowNameW[wndNameLength] = 0;
    491     }
    492   }
    493 
    494   //copy pointer of CREATESTRUCT for usage in MsgCreate method
    495   tmpcs = cs;
    496 
    497   //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
    498   TEB *teb = GetThreadTEB();
    499 
    500   if(teb == NULL) {
    501         dprintf(("Window creation failed - teb == NULL")); //this is VERY bad
    502         ExitProcess(666);
    503         return FALSE;
    504   }
    505 
    506   teb->o.odin.newWindow = (ULONG)this;
    507 
    508   DWORD dwOSWinStyle;
    509 
    510   OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle);
    511 
    512   OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    513                                  dwOSWinStyle,(char *)windowNameA,
    514                                  (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP),
    515                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    516                                  0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle());
    517   if(OS2Hwnd == 0) {
    518         dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError()));
    519         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    520         return FALSE;
    521   }
    522   OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE);
    523   SetLastError(0);
    524   return TRUE;
    525 }
    526 //******************************************************************************
    527 //******************************************************************************
    528 BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2)
    529 {
    530  CREATESTRUCTA  *cs = tmpcs;  //pointer to CREATESTRUCT used in CreateWindowExA method
    531  POINT maxSize, maxPos, minTrack, maxTrack;
    532 
    533   OS2Hwnd      = hwndOS2;
    534 
    535   fNoSizeMsg = TRUE;
    536 
    537   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
    538         dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
    539         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    540         return FALSE;
    541   }
    542   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
    543         dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
    544         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    545         return FALSE;
    546   }
     528    }
     529
     530    if(HIWORD(cs->lpszName))
     531    {
     532        if (!isUnicode)
     533        {
     534            wndNameLength = strlen(cs->lpszName);
     535            windowNameA = (LPSTR)_smalloc(wndNameLength+1);
     536            strcpy(windowNameA,cs->lpszName);
     537            windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
     538            lstrcpyAtoW(windowNameW,windowNameA);
     539            windowNameA[wndNameLength] = 0;
     540            windowNameW[wndNameLength] = 0;
     541        }
     542        else
     543        {
     544            wndNameLength = lstrlenW((LPWSTR)cs->lpszName);
     545            windowNameA = (LPSTR)_smalloc(wndNameLength+1);
     546            lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName);
     547            windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
     548            lstrcpyW(windowNameW,(LPWSTR)cs->lpszName);
     549            windowNameA[wndNameLength] = 0;
     550            windowNameW[wndNameLength] = 0;
     551        }
     552    }
     553
    547554
    548555//SvL: This completely messes up MS Word 97 (no button bar, no menu)
     
    573580#endif
    574581
    575   fakeWinBase.hwndThis     = OS2Hwnd;
    576   fakeWinBase.pWindowClass = windowClass;
    577 
    578   //Set icon from window or class
    579   if (hIcon)
    580     OSLibWinSetIcon(OS2Hwnd,hIcon);
    581   else if (windowClass->getIcon())
    582     OSLibWinSetIcon(OS2Hwnd,windowClass->getIcon());
    583 
    584   /* Get class or window DC if needed */
    585   if(windowClass->getStyle() & CS_OWNDC) {
     582    fakeWinBase.hwndThis     = OS2Hwnd;
     583    fakeWinBase.pWindowClass = windowClass;
     584
     585    //Set icon from window or class
     586    if (hIcon)
     587        OSLibWinSetIcon(OS2Hwnd,hIcon);
     588    else
     589    if (windowClass->getIcon())
     590        OSLibWinSetIcon(OS2Hwnd,windowClass->getIcon());
     591
     592    /* Get class or window DC if needed */
     593    if(windowClass->getStyle() & CS_OWNDC) {
    586594        dprintf(("Class with CS_OWNDC style"));
    587595        ownDC = GetDCEx(getWindowHandle(), NULL, DCX_USESTYLE);
    588   }
    589   else
    590   if (windowClass->getStyle() & CS_PARENTDC)  {
     596    }
     597    else
     598    if (windowClass->getStyle() & CS_PARENTDC)  {
    591599        fParentDC = TRUE;
    592600        ownDC = 0;
    593   }
    594   else
    595   if (windowClass->getStyle() & CS_CLASSDC)  {
     601    }
     602    else
     603    if (windowClass->getStyle() & CS_CLASSDC)  {
    596604        dprintf(("WARNING: Class with CS_CLASSDC style!"));
    597605        ownDC = 0;
    598   }
    599   /* Set the window menu */
    600   if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
    601   {
     606    }
     607    /* Set the window menu */
     608    if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
     609    {
    602610        if (cs->hMenu) {
    603611            ::SetMenu(getWindowHandle(), cs->hMenu);
     
    612620                }
    613621        }
    614   }
    615   else
    616   {
     622    }
     623    else
     624    {
    617625        setWindowId((DWORD)cs->hMenu);
    618   }
    619   hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0;
    620 
    621   /* Send the WM_GETMINMAXINFO message and fix the size if needed */
    622   if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
    623   {
    624         GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
     626    }
     627    hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0;
     628
     629    /* Send the WM_GETMINMAXINFO message and fix the size if needed */
     630    if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
     631    {
     632         GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
    625633        if (maxSize.x < cs->cx) cs->cx = maxSize.x;
    626634        if (maxSize.y < cs->cy) cs->cy = maxSize.y;
    627635        if (cs->cx < minTrack.x) cs->cx = minTrack.x;
    628636        if (cs->cy < minTrack.y) cs->cy = minTrack.y;
    629   }
    630 
    631   if(cs->style & WS_CHILD)
    632   {
     637    }
     638
     639    if(cs->style & WS_CHILD)
     640    {
    633641        if(cs->cx < 0) cs->cx = 0;
    634642        if(cs->cy < 0) cs->cy = 0;
    635   }
    636   else
    637   {
     643    }
     644    else
     645    {
    638646        if (cs->cx <= 0) cs->cx = 1;
    639647        if (cs->cy <= 0) cs->cy = 1;
    640   }
    641 
    642   //set client & window rectangles from CreateWindowEx CREATESTRUCT
    643   rectWindow.left = cs->x;
    644   rectWindow.right = cs->x+cs->cx;
    645   rectWindow.top = cs->y;
    646   rectWindow.bottom = cs->y+cs->cy;
    647   rectClient = rectWindow;
    648   OffsetRect(&rectClient, -rectClient.left, -rectClient.top);
    649 
    650   /* Send the WM_CREATE message
    651    * Perhaps we shouldn't allow width/height changes as well.
    652    * See p327 in "Internals".
    653    */
    654   maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
    655 
    656   //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE
    657   fCreated = TRUE;
    658 
    659   if(fTaskList) {
    660     hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);
    661   }
    662 
    663   //cs is ascii version of create structure. so use SendInternalMessageA
    664   if(SendInternalMessageA(WM_NCCREATE,0,(LPARAM)cs))
    665   {
     648    }
     649
     650    //set client & window rectangles from CreateWindowEx CREATESTRUCT
     651    rectWindow.left = cs->x;
     652    rectWindow.right = cs->x+cs->cx;
     653    rectWindow.top = cs->y;
     654    rectWindow.bottom = cs->y+cs->cy;
     655    rectClient = rectWindow;
     656    OffsetRect(&rectClient, -rectClient.left, -rectClient.top);
     657
     658    /* Send the WM_CREATE message
     659     * Perhaps we shouldn't allow width/height changes as well.
     660     * See p327 in "Internals".
     661     */
     662    maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
     663
     664    //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE
     665    fCreated = TRUE;
     666
     667    if(fTaskList) {
     668        hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);
     669    }
     670
     671    //cs is ascii version of create structure. so use SendInternalMessageA
     672    if(SendInternalMessageA(WM_NCCREATE,0,(LPARAM)cs))
     673    {
    666674        RECT tmpRect;
    667675
     
    722730            return TRUE;
    723731        }
    724   }
    725   dprintf(("Window creation FAILED (NCCREATE cancelled creation)"));
    726   SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     732    }
     733    dprintf(("Window creation FAILED (NCCREATE cancelled creation)"));
     734    SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    727735end:
    728   return FALSE;
     736    return FALSE;
    729737}
    730738//******************************************************************************
     
    23672375{
    23682376    MsgFormatFrame(NULL);
    2369     if(RECT_WIDTH(rectClient) != RECT_WIDTH(*oldClientRect) || 
    2370        RECT_HEIGHT(rectClient) != RECT_HEIGHT(*oldClientRect)) 
     2377    if(RECT_WIDTH(rectClient) != RECT_WIDTH(*oldClientRect) ||
     2378       RECT_HEIGHT(rectClient) != RECT_HEIGHT(*oldClientRect))
    23712379    {
    23722380         wpos->flags &= ~SWP_NOSIZE;
     
    28242832    {
    28252833    case GW_HWNDFIRST:
    2826         if(getParent()) {
    2827              window = (Win32BaseWindow *)getParent();
    2828              hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP);
    2829              window = GetWindowFromOS2Handle(hwndRelated);
    2830          if(window) {
     2834        if(getParent())
     2835        {
     2836            window = (Win32BaseWindow *)getParent();
     2837            hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP);
     2838            window = GetWindowFromOS2Handle(hwndRelated);
     2839            if(window) {
    28312840                  hwndRelated = window->getWindowHandle();
    2832              }
    2833              else hwndRelated = 0;
    2834         }
    2835     else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
     2841            }
     2842            else hwndRelated = 0;
     2843        }
     2844        else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
    28362845        break;
    28372846
    28382847    case GW_HWNDLAST:
    28392848        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_BOTTOM);
    2840     window = GetWindowFromOS2Handle(hwndRelated);
    2841     if(window) {
     2849        window = GetWindowFromOS2Handle(hwndRelated);
     2850        if(window) {
    28422851             hwndRelated = window->getWindowHandle();
    28432852        }
    2844     else hwndRelated = 0;
     2853        else hwndRelated = 0;
    28452854        break;
    28462855
    28472856    case GW_HWNDNEXT:
    28482857        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_NEXT);
    2849     window = GetWindowFromOS2Handle(hwndRelated);
    2850     if(window) {
     2858        window = GetWindowFromOS2Handle(hwndRelated);
     2859        if(window) {
    28512860             hwndRelated = window->getWindowHandle();
    28522861        }
    2853     else hwndRelated = 0;
     2862        else hwndRelated = 0;
    28542863        break;
    28552864
    28562865    case GW_HWNDPREV:
    28572866        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_PREV);
    2858     window = GetWindowFromOS2Handle(hwndRelated);
    2859     if(window) {
     2867        window = GetWindowFromOS2Handle(hwndRelated);
     2868        if(window) {
    28602869             hwndRelated = window->getWindowHandle();
    28612870        }
    2862     else hwndRelated = 0;
     2871        else hwndRelated = 0;
    28632872        break;
    28642873
     
    28712880    case GW_CHILD:
    28722881        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP);
    2873     window = GetWindowFromOS2Handle(hwndRelated);
    2874     if(window) {
     2882        window = GetWindowFromOS2Handle(hwndRelated);
     2883        if(window) {
    28752884             hwndRelated = window->getWindowHandle();
    28762885        }
    2877     else hwndRelated = 0;
     2886        else hwndRelated = 0;
    28782887        break;
    28792888    }
     
    29832992 BOOL rc;
    29842993
     2994  dprintf(("Win32BaseWindow::EnableWindow %x %d", getWindowHandle(), fEnable));
    29852995  //return true if previous state was disabled, else false (sdk docs)
    29862996  rc = (getStyle() & WS_DISABLED) != 0;
  • trunk/src/user32/win32wmdiclient.cpp

    r4463 r4825  
    1 /* $Id: win32wmdiclient.cpp,v 1.30 2000-10-09 17:26:54 sandervl Exp $ */
     1/* $Id: win32wmdiclient.cpp,v 1.31 2000-12-17 15:04:12 sandervl Exp $ */
    22/*
    33 * Win32 MDI Client Window Class for OS/2
     
    541541    HMENU oldFrameMenu = ::GetMenu(hwndFrame);
    542542
     543    if (hmenuFrame && !IsMenu(hmenuFrame))
     544    {
     545        dprintf(("Win32MDIClientWindow::setMDIMenu: hmenuFrame is not a menu handle\n"));
     546        return 0L;
     547    }
     548       
     549    if (hmenuWindow && !IsMenu(hmenuWindow))
     550    {
     551        dprintf(("Win32MDIClientWindow::setMDIMenu: hmenuWindow is not a menu handle\n"));
     552        return 0L;
     553    }
     554
    543555    if( maximizedChild && hmenuFrame && hmenuFrame!=oldFrameMenu )
    544556        restoreFrameMenu(maximizedChild);
     
    556568        if( nActiveChildren )
    557569        {
    558             INT j = i - nActiveChildren + 1;
    559             char buffer[100];
    560             UINT id,state;
     570            INT j;
     571            LPWSTR buffer = NULL;
     572            MENUITEMINFOW mii;
     573            INT nbWindowsMenuItems; /* num of documents shown + "More Windows..." if present */
     574
     575            if (nActiveChildren <= MDI_MOREWINDOWSLIMIT)
     576                nbWindowsMenuItems = nActiveChildren;
     577            else
     578                nbWindowsMenuItems = MDI_MOREWINDOWSLIMIT + 1;
     579
     580            j = i - nbWindowsMenuItems + 1;
    561581
    562582            for( ; i >= j ; i-- )
    563583            {
    564                 id = GetMenuItemID(hWindowMenu,i );
    565                 state = GetMenuState(hWindowMenu,i,MF_BYPOSITION);
    566 
    567                 GetMenuStringA(hWindowMenu, i, buffer, 100, MF_BYPOSITION);
    568 
    569                 DeleteMenu(hWindowMenu, i , MF_BYPOSITION);
    570                 InsertMenuA(hmenuWindow, pos, MF_BYPOSITION | MF_STRING,
    571                               id, buffer);
    572                 CheckMenuItem(hmenuWindow ,pos , MF_BYPOSITION | (state & MF_CHECKED));
     584                memset(&mii, 0, sizeof(mii));
     585                mii.cbSize = sizeof(mii);
     586                mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE
     587                  | MIIM_SUBMENU | MIIM_TYPE | MIIM_BITMAP;
     588
     589                GetMenuItemInfoW(hWindowMenu, i, TRUE, &mii);
     590                if(mii.cch) { /* Menu is MFT_STRING */
     591                    mii.cch++; /* add room for '\0' */
     592                    buffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
     593                                               mii.cch * sizeof(WCHAR));
     594                    mii.dwTypeData = buffer;
     595                    GetMenuItemInfoW(hWindowMenu, i, TRUE, &mii);
     596                }
     597                DeleteMenu(hWindowMenu, i, MF_BYPOSITION);
     598                InsertMenuItemW(hmenuWindow, pos, TRUE, &mii);
     599                if(buffer) {
     600                    HeapFree(GetProcessHeap(), 0, buffer);
     601                    buffer = NULL;
     602                }
    573603            }
    574604        }
     
    580610    }
    581611
    582     if( hmenuFrame && hmenuFrame!=oldFrameMenu)
     612    if (hmenuFrame)
    583613    {
    584614        ::SetMenu(hwndFrame, hmenuFrame);
    585615
    586         if (maximizedChild)
    587           augmentFrameMenu(maximizedChild);
    588 
    589         return oldFrameMenu;
     616        if( hmenuFrame!=oldFrameMenu )
     617        {
     618          if (maximizedChild)
     619            augmentFrameMenu(maximizedChild);
     620
     621          return oldFrameMenu;
     622        }
     623    }
     624    else
     625    {
     626        INT nItems = GetMenuItemCount(oldFrameMenu) - 1;
     627        UINT iId = GetMenuItemID(oldFrameMenu,nItems) ;
     628
     629        if( !(iId == SC_RESTORE || iId == SC_CLOSE) )
     630        {
     631            /* SetMenu() may already have been called, meaning that this window
     632             * already has its menu. But they may have done a SetMenu() on
     633             * an MDI window, and called MDISetMenu() after the fact, meaning
     634             * that the "if" to this "else" wouldn't catch the need to
     635             * augment the frame menu.
     636             */
     637            if( maximizedChild )
     638                augmentFrameMenu(maximizedChild);
     639        }
    590640    }
    591641    return 0;
  • trunk/src/user32/windlg.cpp

    r4421 r4825  
    1 /* $Id: windlg.cpp,v 1.18 2000-10-04 19:35:31 sandervl Exp $ */
     1/* $Id: windlg.cpp,v 1.19 2000-12-17 15:04:13 sandervl Exp $ */
    22/*
    33 * Win32 dialog apis for OS/2
     
    4141  HANDLE hrsrc = FindResourceA( hInst, lpszTemplate, RT_DIALOGA );
    4242
    43     if (!hrsrc)
    44         return 0;
     43    if (!hrsrc) {
     44        dprintf(("WARNING: CreateDialogParamA: Dialog %x not found!!", lpszTemplate));
     45        return 0;
     46    }
    4547
    4648    return CreateDialogIndirectParamA(hInst, (LPCDLGTEMPLATEA)LoadResource(hInst, hrsrc),
     
    5557  HANDLE hrsrc = FindResourceW( hInst, lpszTemplate, RT_DIALOGW );
    5658
    57     if (!hrsrc)
    58         return 0;
    59 
     59    if (!hrsrc) {
     60        dprintf(("WARNING: CreateDialogParamW: Dialog %x not found!!", lpszTemplate));
     61        return 0;
     62    }
    6063    return CreateDialogIndirectParamW(hInst, (LPCDLGTEMPLATEW)LoadResource(hInst, hrsrc),
    6164                                      hwndOwner, dlgproc, lParamInit);
  • trunk/src/user32/window.cpp

    r4585 r4825  
    1 /* $Id: window.cpp,v 1.84 2000-11-11 18:39:31 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.85 2000-12-17 15:04:13 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    13911391        }
    13921392
    1393 
    13941393        // get first child
    13951394        hWnd = GetWindow (hwndParent, GW_CHILD);
    13961395
    1397         while (hWnd != NULL) {
    1398 
     1396        while (hWnd != NULL)
     1397        {
    13991398                // do I need to skip this window?
    14001399                if (((uFlags & CWP_SKIPINVISIBLE) &&
     
    14041403                    ((uFlags & CWP_SKIPTRANSPARENT) &&
    14051404                     (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
    1406 
    14071405                {
    14081406                        hWnd = GetWindow (hWnd, GW_HWNDNEXT);
     
    14211419                return hWnd;
    14221420        }
    1423 
    14241421        // the point is in the parentwindow but the parentwindow has no child
    14251422        // at this coordinate
    1426             dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent));
     1423        dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent));
    14271424        return hwndParent;
    14281425}
     
    14471444HWND WIN32API WindowFromPoint( POINT point)
    14481445{
     1446#if 0
     1447    INT     hittest = HTERROR;
     1448    HWND    retvalue = 0;
     1449    HWND    hwnd = GetDesktopWindow();
     1450    DWORD   dwStyle;
     1451    RECT    rectWindow, rectClient;
     1452    Win32BaseWindow *window;
     1453
     1454    dprintf(("WindowFromPoint (%d,%d)", point.x, point.y));
     1455
     1456    while(hwnd)
     1457    {
     1458        window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     1459
     1460        /* If point is in window, and window is visible, and it  */
     1461        /* is enabled (or it's a top-level window), then explore */
     1462        /* its children. Otherwise, go to the next window.       */
     1463        dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     1464
     1465        if ((dwStyle & WS_VISIBLE) && (!(dwStyle & WS_DISABLED) ||
     1466           ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)))
     1467        {
     1468            GetWindowRect(hwnd, &rectWindow);
     1469            if(PtInRect(&rectWindow, point) == TRUE)
     1470            {
     1471                /* If window is minimized or disabled, return at once */
     1472                if(dwStyle & WS_MINIMIZE)
     1473                {
     1474                    break;
     1475                }
     1476                if(dwStyle & WS_DISABLED)
     1477                {
     1478                    break;
     1479                }
     1480                retvalue = hwnd;
     1481
     1482                GetClientRect(hwnd, &rectClient);
     1483                InflateRect(&rectClient, rectWindow.left, rectWindow.top);
     1484
     1485                /* If point is not in client area, ignore the children */
     1486                if(PtInRect(&rectClient, point) == FALSE) {
     1487                    break;
     1488                }
     1489                if(window->getFirstChild()) {
     1490                     hwnd = ((Win32BaseWindow *)window->getFirstChild())->getWindowHandle();
     1491                }
     1492                else break;
     1493            }
     1494            else
     1495            {
     1496                if(window->getNextChild()) {
     1497                     hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle();
     1498                }
     1499                else hwnd = 0;
     1500            }
     1501        }
     1502        else
     1503        {
     1504            if(window->getNextChild()) {
     1505                 hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle();
     1506            }
     1507            else hwnd = 0;
     1508        }
     1509    }
     1510
     1511    dprintf(("WindowFromPoint (%d,%d) -> %x", point.x, point.y, hwnd));
     1512    return retvalue;
     1513#else
    14491514    HWND  hwndOS2, hwnd;
    14501515    POINT wPoint;
     
    14641529    dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2));
    14651530    return windowDesktop->getWindowHandle();
     1531#endif
    14661532}
    14671533//******************************************************************************
  • trunk/src/user32/winicon.cpp

    r4689 r4825  
    1 /* $Id: winicon.cpp,v 1.18 2000-11-24 13:16:26 sandervl Exp $ */
     1/* $Id: winicon.cpp,v 1.19 2000-12-17 15:04:14 sandervl Exp $ */
    22/*
    33 * Win32 Icon Code for OS/2
     
    597597                if (DoStretch)
    598598                {
    599                     //TODO: rearrange mask if and & xor mask present!!!!!
    600                     if(cbSize - size - colorsize - bwsize == bwsize)
    601                     {
    602                         dprintf(("TODO: rearrange mask because and & xor mask present!!!!!"));
    603                     }
    604599                    if ((hAndBits = CreateBitmap(width, height, 1, 1, NULL)))
    605600                    {
Note: See TracChangeset for help on using the changeset viewer.