From 4cb4ee6326d777dece6ff49361d45efe947464b0 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Fri, 6 Feb 2015 20:57:45 +0000 Subject: [PATCH] [User32] - Patch by Piotr Caban : Only store dialog focus when window is hidden or inactive. Only use DIALOGINFO-> hwndFocus to store last focus of inactive windows. svn path=/trunk/; revision=66182 --- reactos/win32ss/user/user32/windows/dialog.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/reactos/win32ss/user/user32/windows/dialog.c b/reactos/win32ss/user/user32/windows/dialog.c index 48304d1f4c1..4fb7c455b10 100644 --- a/reactos/win32ss/user/user32/windows/dialog.c +++ b/reactos/win32ss/user/user32/windows/dialog.c @@ -802,8 +802,7 @@ static void DEFDLG_RestoreFocus( HWND hwnd, BOOL justActivate ) else DEFDLG_SetFocus( infoPtr->hwndFocus ); - /* This used to set infoPtr->hwndFocus to NULL for no apparent reason, - sometimes losing focus when receiving WM_SETFOCUS messages. */ + infoPtr->hwndFocus = NULL; } /*********************************************************************** @@ -1047,13 +1046,14 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate, /* By returning TRUE, app has requested a default focus assignment. * WM_INITDIALOG may have changed the tab order, so find the first * tabstop control again. */ - dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE ); - if (!dlgInfo->hwndFocus) dlgInfo->hwndFocus = GetNextDlgGroupItem( hwnd, 0, FALSE ); - if( dlgInfo->hwndFocus ) - SetFocus( dlgInfo->hwndFocus ); + focus = GetNextDlgTabItem( hwnd, 0, FALSE ); + if (!focus) focus = GetNextDlgGroupItem( hwnd, 0, FALSE ); + if (focus) + SetFocus( focus ); } -//// ReactOS - DEFDLG_SaveFocus( hwnd ); +//// ReactOS see 43396, Fixes setting focus on Open and Close dialogs to the FileName edit control in OpenOffice. +//// This now breaks test_SaveRestoreFocus. + //DEFDLG_SaveFocus( hwnd ); //// } //// ReactOS Rev 30613 & 30644