mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 14:10:32 +00:00
Allocate the dialog info in DIALOG_CreateIndirect if this wasn't
already done by the dialog procedure.
This commit is contained in:
parent
5288361f52
commit
218c478d24
@ -134,11 +134,7 @@ typedef struct
|
|||||||
/* offset of DIALOGINFO ptr in dialog extra bytes */
|
/* offset of DIALOGINFO ptr in dialog extra bytes */
|
||||||
#define DWL_WINE_DIALOGINFO (DWL_USER+sizeof(ULONG_PTR))
|
#define DWL_WINE_DIALOGINFO (DWL_USER+sizeof(ULONG_PTR))
|
||||||
|
|
||||||
inline static DIALOGINFO *DIALOG_get_info( HWND hwnd )
|
extern DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create );
|
||||||
{
|
|
||||||
return (DIALOGINFO *)GetWindowLongW( hwnd, DWL_WINE_DIALOGINFO );
|
|
||||||
}
|
|
||||||
|
|
||||||
extern BOOL DIALOG_GetCharSize( HDC hdc, HFONT hFont, SIZE * pSize );
|
extern BOOL DIALOG_GetCharSize( HDC hdc, HFONT hFont, SIZE * pSize );
|
||||||
extern void DIALOG_EnableOwner( HWND hOwner );
|
extern void DIALOG_EnableOwner( HWND hOwner );
|
||||||
extern BOOL DIALOG_DisableOwner( HWND hOwner );
|
extern BOOL DIALOG_DisableOwner( HWND hOwner );
|
||||||
|
@ -139,7 +139,7 @@ static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
|
|||||||
static BOOL DIALOG_CreateControls16( HWND hwnd, LPCSTR template,
|
static BOOL DIALOG_CreateControls16( HWND hwnd, LPCSTR template,
|
||||||
const DLG_TEMPLATE *dlgTemplate, HINSTANCE16 hInst )
|
const DLG_TEMPLATE *dlgTemplate, HINSTANCE16 hInst )
|
||||||
{
|
{
|
||||||
DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd );
|
DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd, TRUE );
|
||||||
DLG_CONTROL_INFO info;
|
DLG_CONTROL_INFO info;
|
||||||
HWND hwndCtrl, hwndDefButton = 0;
|
HWND hwndCtrl, hwndDefButton = 0;
|
||||||
INT items = dlgTemplate->nbItems;
|
INT items = dlgTemplate->nbItems;
|
||||||
|
@ -81,7 +81,7 @@ static void DEFDLG_SaveFocus( HWND hwnd )
|
|||||||
HWND hwndFocus = GetFocus();
|
HWND hwndFocus = GetFocus();
|
||||||
|
|
||||||
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
|
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
|
||||||
if (!(infoPtr = DIALOG_get_info( hwnd ))) return;
|
if (!(infoPtr = DIALOG_get_info( hwnd, FALSE ))) return;
|
||||||
infoPtr->hwndFocus = hwndFocus;
|
infoPtr->hwndFocus = hwndFocus;
|
||||||
/* Remove default button */
|
/* Remove default button */
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ static void DEFDLG_RestoreFocus( HWND hwnd )
|
|||||||
DIALOGINFO *infoPtr;
|
DIALOGINFO *infoPtr;
|
||||||
|
|
||||||
if (IsIconic( hwnd )) return;
|
if (IsIconic( hwnd )) return;
|
||||||
if (!(infoPtr = DIALOG_get_info( hwnd ))) return;
|
if (!(infoPtr = DIALOG_get_info( hwnd, FALSE ))) return;
|
||||||
if (!IsWindow( infoPtr->hwndFocus )) return;
|
if (!IsWindow( infoPtr->hwndFocus )) return;
|
||||||
/* Don't set the focus back to controls if EndDialog is already called.*/
|
/* Don't set the focus back to controls if EndDialog is already called.*/
|
||||||
if (!(infoPtr->flags & DF_END))
|
if (!(infoPtr->flags & DF_END))
|
||||||
@ -284,16 +284,17 @@ static LRESULT DEFDLG_Epilog(HWND hwnd, UINT msg, BOOL fResult)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DEFDLG_InitDlgInfo
|
* DIALOG_get_info
|
||||||
*
|
*
|
||||||
* Allocate memory for DIALOGINFO structure and store in DWL_DIALOGINFO
|
* Get the DIALOGINFO structure of a window, allocating it if needed
|
||||||
* structure. Also flag the window as a dialog type.
|
* and 'create' is TRUE.
|
||||||
*/
|
*/
|
||||||
static DIALOGINFO* DEFDLG_InitDlgInfo(HWND hwnd)
|
DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
|
||||||
{
|
{
|
||||||
WND* wndPtr;
|
WND* wndPtr;
|
||||||
DIALOGINFO* dlgInfo = DIALOG_get_info( hwnd );
|
DIALOGINFO* dlgInfo = (DIALOGINFO *)GetWindowLongW( hwnd, DWL_WINE_DIALOGINFO );
|
||||||
if(!dlgInfo)
|
|
||||||
|
if(!dlgInfo && create)
|
||||||
{
|
{
|
||||||
if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return NULL;
|
if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return NULL;
|
||||||
dlgInfo->hwndFocus = 0;
|
dlgInfo->hwndFocus = 0;
|
||||||
@ -332,7 +333,7 @@ LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
|
|||||||
BOOL result = FALSE;
|
BOOL result = FALSE;
|
||||||
|
|
||||||
/* Perform DIALOGINFO intialization if not done */
|
/* Perform DIALOGINFO intialization if not done */
|
||||||
if(!(dlgInfo = DEFDLG_InitDlgInfo(hwnd32))) return -1;
|
if(!(dlgInfo = DIALOG_get_info(hwnd32, TRUE))) return -1;
|
||||||
|
|
||||||
SetWindowLongW( hwnd32, DWL_MSGRESULT, 0 );
|
SetWindowLongW( hwnd32, DWL_MSGRESULT, 0 );
|
||||||
|
|
||||||
@ -389,7 +390,7 @@ LRESULT WINAPI DefDlgProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|||||||
BOOL result = FALSE;
|
BOOL result = FALSE;
|
||||||
|
|
||||||
/* Perform DIALOGINFO initialization if not done */
|
/* Perform DIALOGINFO initialization if not done */
|
||||||
if(!(dlgInfo = DEFDLG_InitDlgInfo(hwnd))) return -1;
|
if(!(dlgInfo = DIALOG_get_info( hwnd, TRUE ))) return -1;
|
||||||
|
|
||||||
SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
|
SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
|
||||||
|
|
||||||
@ -446,7 +447,7 @@ LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|||||||
WNDPROC dlgproc;
|
WNDPROC dlgproc;
|
||||||
|
|
||||||
/* Perform DIALOGINFO intialization if not done */
|
/* Perform DIALOGINFO intialization if not done */
|
||||||
if(!(dlgInfo = DEFDLG_InitDlgInfo(hwnd))) return -1;
|
if(!(dlgInfo = DIALOG_get_info( hwnd, TRUE ))) return -1;
|
||||||
|
|
||||||
SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
|
SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
|
|||||||
static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPLATE *dlgTemplate,
|
static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPLATE *dlgTemplate,
|
||||||
HINSTANCE hInst, BOOL unicode )
|
HINSTANCE hInst, BOOL unicode )
|
||||||
{
|
{
|
||||||
DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd );
|
DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd, TRUE );
|
||||||
DLG_CONTROL_INFO info;
|
DLG_CONTROL_INFO info;
|
||||||
HWND hwndCtrl, hwndDefButton = 0;
|
HWND hwndCtrl, hwndDefButton = 0;
|
||||||
INT items = dlgTemplate->nbItems;
|
INT items = dlgTemplate->nbItems;
|
||||||
@ -633,7 +633,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
|
|||||||
/* moved this from the top of the method to here as DIALOGINFO structure
|
/* moved this from the top of the method to here as DIALOGINFO structure
|
||||||
will be valid only after WM_CREATE message has been handled in DefDlgProc
|
will be valid only after WM_CREATE message has been handled in DefDlgProc
|
||||||
All the members of the structure get filled here using temp variables */
|
All the members of the structure get filled here using temp variables */
|
||||||
dlgInfo = DIALOG_get_info(hwnd);
|
dlgInfo = DIALOG_get_info( hwnd, TRUE );
|
||||||
dlgInfo->hwndFocus = 0;
|
dlgInfo->hwndFocus = 0;
|
||||||
dlgInfo->hUserFont = hUserFont;
|
dlgInfo->hUserFont = hUserFont;
|
||||||
dlgInfo->hMenu = hMenu;
|
dlgInfo->hMenu = hMenu;
|
||||||
@ -764,7 +764,7 @@ INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
|
|||||||
INT retval;
|
INT retval;
|
||||||
HWND ownerMsg = GetAncestor( owner, GA_ROOT );
|
HWND ownerMsg = GetAncestor( owner, GA_ROOT );
|
||||||
|
|
||||||
if (!(dlgInfo = DIALOG_get_info( hwnd ))) return -1;
|
if (!(dlgInfo = DIALOG_get_info( hwnd, FALSE ))) return -1;
|
||||||
|
|
||||||
if (!(dlgInfo->flags & DF_END)) /* was EndDialog called in WM_INITDIALOG ? */
|
if (!(dlgInfo->flags & DF_END)) /* was EndDialog called in WM_INITDIALOG ? */
|
||||||
{
|
{
|
||||||
@ -876,7 +876,7 @@ BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval )
|
|||||||
|
|
||||||
TRACE("%p %d\n", hwnd, retval );
|
TRACE("%p %d\n", hwnd, retval );
|
||||||
|
|
||||||
if (!(dlgInfo = DIALOG_get_info( hwnd )))
|
if (!(dlgInfo = DIALOG_get_info( hwnd, FALSE )))
|
||||||
{
|
{
|
||||||
ERR("got invalid window handle (%p); buggy app !?\n", hwnd);
|
ERR("got invalid window handle (%p); buggy app !?\n", hwnd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1455,7 +1455,7 @@ DWORD WINAPI GetDialogBaseUnits(void)
|
|||||||
BOOL WINAPI MapDialogRect( HWND hwnd, LPRECT rect )
|
BOOL WINAPI MapDialogRect( HWND hwnd, LPRECT rect )
|
||||||
{
|
{
|
||||||
DIALOGINFO * dlgInfo;
|
DIALOGINFO * dlgInfo;
|
||||||
if (!(dlgInfo = DIALOG_get_info( hwnd ))) return FALSE;
|
if (!(dlgInfo = DIALOG_get_info( hwnd, FALSE ))) return FALSE;
|
||||||
rect->left = MulDiv(rect->left, dlgInfo->xBaseUnit, 4);
|
rect->left = MulDiv(rect->left, dlgInfo->xBaseUnit, 4);
|
||||||
rect->right = MulDiv(rect->right, dlgInfo->xBaseUnit, 4);
|
rect->right = MulDiv(rect->right, dlgInfo->xBaseUnit, 4);
|
||||||
rect->top = MulDiv(rect->top, dlgInfo->yBaseUnit, 8);
|
rect->top = MulDiv(rect->top, dlgInfo->yBaseUnit, 8);
|
||||||
|
Loading…
Reference in New Issue
Block a user