Ignore:
Timestamp:
Nov 24, 2000, 11:30:36 AM (25 years ago)
Author:
sandervl
Message:

Dialog message fixes

File:
1 edited

Legend:

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

    r4444 r4686  
    1 /* $Id: win32dlg.cpp,v 1.53 2000-10-06 15:15:00 sandervl Exp $ */
     1/* $Id: win32dlg.cpp,v 1.54 2000-11-24 10:30:36 sandervl Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    4949    idResult     = 0;
    5050    dialogFlags  = 0;
     51    fDialogInit  = FALSE;
    5152    memset(&dlgInfo, 0, sizeof(dlgInfo));
    5253
     
    7677    if (dlgInfo.style & DS_SETFONT)
    7778    {
    78           /* The font height must be negative as it is a point size */
    79           /* and must be converted to pixels first */
    80           /* (see CreateFont() documentation in the Windows SDK).   */
    81         HDC dc = GetDC(0);
    82         int pixels = dlgInfo.pointSize * GetDeviceCaps(dc , LOGPIXELSY)/72;
    83         ReleaseDC(0, dc);
     79        /* The font height must be negative as it is a point size */
     80        /* and must be converted to pixels first */
     81        /* (see CreateFont() documentation in the Windows SDK).   */
     82        HDC dc = GetDC(0);
     83        int pixels = dlgInfo.pointSize * GetDeviceCaps(dc , LOGPIXELSY)/72;
     84        ReleaseDC(0, dc);
    8485
    8586        hUserFont = CreateFontW(-pixels, 0, 0, 0,
     
    238239        dprintf(("dlg ctor: GetNextDlgTabItem returned %x, capture hwnd = %x", hwndFocus, GetCapture()));
    239240
    240         HWND hwndPreInitFocus = GetFocus();
     241        fDialogInit = TRUE; //WM_NCCALCSIZE can now be sent to dialog procedure
     242
     243        HWND hwndPreInitFocus = GetFocus();
    241244        if(SendInternalMessageA(WM_INITDIALOG, (WPARAM)hwndFocus, param)) {
    242                 SetFocus(hwndFocus);
    243         }
    244         else
    245         {
    246                 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
    247                    but the focus has not changed, set the focus where we expect it. */
    248                 if ( (getStyle() & WS_VISIBLE) && ( GetFocus() == hwndPreInitFocus ) )
    249                         SetFocus( hwndFocus );
    250         }
     245            SetFocus(hwndFocus);
     246        }
     247        else
     248        {
     249            /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
     250               but the focus has not changed, set the focus where we expect it. */
     251                if ( (getStyle() & WS_VISIBLE) && ( GetFocus() == hwndPreInitFocus ) )
     252                    SetFocus( hwndFocus );
     253        }
    251254
    252255        if (dlgInfo.style & WS_VISIBLE && !(getStyle() & WS_VISIBLE))
     
    255258            UpdateWindow( getWindowHandle() );
    256259        }
    257         SetLastError(0);
     260        SetLastError(ERROR_SUCCESS);
    258261        dprintf(("********* DIALOG CREATED ************"));
    259262        return TRUE;
     
    858861    msgResult = 0;
    859862
     863    //Dialogs never receive these messages
     864    if (Msg == WM_CREATE || Msg == WM_NCCREATE) {
     865        return (LRESULT)1;
     866    }
     867    //Never send a WM_NCCALCSIZE to a dialog before it has received it's WM_INITDIALOG message
     868    //(causes problems for sysinf32.exe)
     869    if(!fDialogInit && Msg == WM_NCCALCSIZE) {
     870        return DefWindowProcA(Msg, wParam, lParam );
     871    }
     872
    860873    if (Win32DlgProc) {      /* Call dialog procedure */
    861874        result = Win32DlgProc(getWindowHandle(), Msg, wParam, lParam);
     
    902915    msgResult = 0;
    903916
     917    //Dialogs never receive these messages
     918    if (Msg == WM_CREATE || Msg == WM_NCCREATE) {
     919        return (LRESULT)1;
     920    }
     921    //Never send a WM_NCCALCSIZE to a dialog before it has received it's WM_INITDIALOG message
     922    //(causes problems for sysinf32.exe)
     923    if(!fDialogInit && Msg == WM_NCCALCSIZE) {
     924        return DefWindowProcW(Msg, wParam, lParam );
     925    }
     926
    904927    if (Win32DlgProc) {      /* Call dialog procedure */
    905928        result = Win32DlgProc(getWindowHandle(), Msg, wParam, lParam);
     
    10691092    case DWL_DLGPROC:
    10701093    {
    1071         //Note: Type of SetWindowLong determines new window proc type
     1094    //Note: Type of SetWindowLong determines new window proc type
    10721095        //      UNLESS the new window proc has already been registered
    10731096        //      (use the old type in that case)
    10741097        //      (VERIFIED in NT 4, SP6)
    10751098        WINDOWPROCTYPE type = WINPROC_GetProcType((HWINDOWPROC)value);
    1076         if(type == WIN_PROC_INVALID) {
    1077                 type = (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A;
    1078         }
     1099    if(type == WIN_PROC_INVALID) {
     1100        type = (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A;
     1101    }
    10791102        oldval = (LONG)WINPROC_GetProc(Win32DlgProc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A);
    10801103        WINPROC_SetProc((HWINDOWPROC *)&Win32DlgProc, (WNDPROC)value, type, WIN_PROC_WINDOW);
Note: See TracChangeset for help on using the changeset viewer.