Commit 15c58c42 authored by Abey George's avatar Abey George Committed by Alexandre Julliard

Set focus to the dialog in EndDialog.

parent acc19d32
......@@ -53,7 +53,11 @@ static BOOL DEFDLG_RestoreFocus( HWND hwnd, DIALOGINFO *infoPtr )
{
if (!infoPtr->hwndFocus || IsIconic(hwnd)) return FALSE;
if (!IsWindow( infoPtr->hwndFocus )) return FALSE;
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
/* Don't set the focus back to controls if EndDialog is already called.*/
if (!(infoPtr->flags & DF_END))
DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
/* This used to set infoPtr->hwndFocus to NULL for no apparent reason,
sometimes losing focus when receiving WM_SETFOCUS messages. */
return TRUE;
......
......@@ -1073,6 +1073,11 @@ BOOL WINAPI EndDialog( HWND hwnd, INT retval )
dlgInfo->flags |= DF_END;
}
/* Windows sets the focus to the dialog itself first in EndDialog */
if (IsChild(hwnd, GetFocus()))
SetFocus(wndPtr->hwndSelf);
/* Paint Shop Pro 4.14 calls EndDialog for a CreateDialog* dialog,
* which isn't "normal". Only DialogBox* dialogs may be EndDialog()ed.
* Just hide the window
......@@ -1163,6 +1168,7 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0);
}
RetVal = TRUE;
WIN_ReleaseWndPtr(wndPtr);
break;
}
}
......@@ -1182,6 +1188,10 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
hwndControl = GetParent( hwndControl );
if (hwndControl == hwndDlg)
{
if(hwnd==hwndDlg){ /* prevent endless loop */
hwndNext=hwnd;
break;
}
hwndNext = GetWindow( hwndDlg, GW_CHILD );
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment