Author: jimtabor
Date: Thu Aug 16 21:59:50 2012
New Revision: 57088
URL: http://svn.reactos.org/svn/reactos?rev=57088&view=rev
Log:
[User32]
- Patch by Alex Henrie : Correct dialog focus behavior. See wine bug http://bugs.winehq.org/show_bug.cgi?id=31386 and I hope someone noticed.
Modified:
trunk/reactos/win32ss/user/user32/windows/dialog.c
Modified: trunk/reactos/win32ss/user/user32/windows/dialog.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/dialog.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/dialog.c [iso-8859-1] Thu Aug 16 21:59:50 2012
@@ -751,9 +751,9 @@
* DEFDLG_SetFocus
*
* Set the focus to a control of the dialog, selecting the text if
- * the control is an edit dialog.
- */
-static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
+ * the control is an edit dialog that has DLGC_HASSETSEL.
+ */
+static void DEFDLG_SetFocus( HWND hwndCtrl )
{
if (SendMessageW( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
SendMessageW( hwndCtrl, EM_SETSEL, 0, -1 );
@@ -779,7 +779,7 @@
/***********************************************************************
* DEFDLG_RestoreFocus
*/
-static void DEFDLG_RestoreFocus( HWND hwnd )
+static void DEFDLG_RestoreFocus( HWND hwnd, BOOL justActivate )
{
DIALOGINFO *infoPtr;
@@ -788,12 +788,19 @@
/* Don't set the focus back to controls if EndDialog is already called.*/
if (infoPtr->flags & DF_END) return;
if (!IsWindow(infoPtr->hwndFocus) || infoPtr->hwndFocus == hwnd) {
+ if (justActivate) return;
/* If no saved focus control exists, set focus to the first visible,
non-disabled, WS_TABSTOP control in the dialog */
infoPtr->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
+ /* If there are no WS_TABSTOP controls, set focus to the first visible,
+ non-disabled control in the dialog */
+ if (!infoPtr->hwndFocus) infoPtr->hwndFocus = GetNextDlgGroupItem( hwnd, 0, FALSE );
if (!IsWindow( infoPtr->hwndFocus )) return;
}
- DEFDLG_SetFocus( hwnd, infoPtr->hwndFocus );
+ if (justActivate)
+ SetFocus( infoPtr->hwndFocus );
+ 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. */
@@ -1229,12 +1236,12 @@
dwSetFlag = wParam ? DF_DIALOGACTIVE : 0;
if (hwndparent != hwnd) NtUserSetThreadState(dwSetFlag, DF_DIALOGACTIVE);
}
- if (wParam) DEFDLG_RestoreFocus( hwnd );
+ if (wParam) DEFDLG_RestoreFocus( hwnd, TRUE );
else DEFDLG_SaveFocus( hwnd );
return 0;
case WM_SETFOCUS:
- DEFDLG_RestoreFocus( hwnd );
+ DEFDLG_RestoreFocus( hwnd, FALSE );
return 0;
case DM_SETDEFID:
@@ -1259,7 +1266,7 @@
HWND hwndDest = (HWND)wParam;
if (!lParam)
hwndDest = GetNextDlgTabItem(hwnd, GetFocus(), wParam);
- if (hwndDest) DEFDLG_SetFocus( hwnd, hwndDest );
+ if (hwndDest) DEFDLG_SetFocus( hwndDest );
DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest );
}
return 0;
Author: akhaldi
Date: Thu Aug 16 15:39:40 2012
New Revision: 57086
URL: http://svn.reactos.org/svn/reactos?rev=57086&view=rev
Log:
[KERNEL32]
* Fix a comment and a last error value. By Hermes Belusca.
See issue #7240 for more details.
Modified:
trunk/reactos/dll/win32/kernel32/client/proc.c
Modified: trunk/reactos/dll/win32/kernel32/client/proc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Thu Aug 16 15:39:40 2012
@@ -2976,7 +2976,11 @@
IMAGE_SUBSYSTEM_WINDOWS_CUI != SectionImageInfo.SubSystemType)
{
DPRINT1("Invalid subsystem %d\n", SectionImageInfo.SubSystemType);
- SetLastError(ERROR_BAD_EXE_FORMAT);
+ /*
+ * Despite the name of the error code suggests, it corresponds to the
+ * well-known "The %1 application cannot be run in Win32 mode" message.
+ */
+ SetLastError(ERROR_CHILD_NOT_COMPLETE);
goto Cleanup;
}
@@ -3269,7 +3273,7 @@
if (hSection) NtClose(hSection);
if (hThread)
{
- /* We don't know any more details then this */
+ /* We don't know any more details than this */
NtTerminateProcess(hProcess, STATUS_UNSUCCESSFUL);
NtClose(hThread);
}