Author: jimtabor
Date: Thu Jul 5 22:17:32 2012
New Revision: 56841
URL:
http://svn.reactos.org/svn/reactos?rev=56841&view=rev
Log:
[User32]
- Use zap command when ending dialogs. Check keyboard perfs and cues before sending change
GUI states.
Modified:
trunk/reactos/win32ss/user/user32/windows/dialog.c
trunk/reactos/win32ss/user/user32/windows/winpos.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 Jul 5 22:17:32
2012
@@ -46,7 +46,6 @@
#define GET_WORD(ptr) (*(WORD *)(ptr))
#define GET_DWORD(ptr) (*(DWORD *)(ptr))
#define DLG_ISANSI 2
-void WINAPI WinPosActivateOtherWindow(HWND hwnd);
/* INTERNAL STRUCTS **********************************************************/
@@ -1062,7 +1061,21 @@
return hwnd;
}
if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
- if( IsWindow(hwnd) ) DestroyWindow( hwnd );
+ IntNotifyWinEvent(EVENT_SYSTEM_DIALOGEND, hwnd, OBJID_WINDOW, CHILDID_SELF, 0);
+ if( IsWindow(hwnd) )
+ {
+ DestroyWindow( hwnd );
+ //// ReactOS
+ if (owner)
+ { ERR("DIALOG_CreateIndirect 1\n");
+ if ( NtUserGetThreadState(THREADSTATE_FOREGROUNDTHREAD) && // Rule #1.
+ !NtUserQueryWindow(owner, QUERY_WINDOW_FOREGROUND) )
+ { ERR("DIALOG_CreateIndirect SFW\n");
+ SetForegroundWindow(owner);
+ }
+ }
+ ////
+ }
return 0;
}
@@ -2001,7 +2014,7 @@
/*
- * @implemented
+ * @implemented Modified for ReactOS.
*/
BOOL
WINAPI
@@ -2012,6 +2025,7 @@
BOOL wasEnabled = TRUE;
DIALOGINFO * dlgInfo;
HWND owner;
+ BOOL wasActive;
TRACE("%p %ld\n", hwnd, retval );
@@ -2020,6 +2034,7 @@
ERR("got invalid window handle (%p); buggy app !?\n", hwnd);
return FALSE;
}
+ wasActive = (hwnd == GetActiveWindow());
dlgInfo->idResult = retval;
dlgInfo->flags |= DF_END;
wasEnabled = (dlgInfo->flags & DF_OWNERENABLED);
@@ -2030,7 +2045,7 @@
/* Windows sets the focus to the dialog itself in EndDialog */
- if (IsChild(hwnd, GetFocus()))
+ if (wasActive && IsChild(hwnd, GetFocus()))
SetFocus( hwnd );
/* Don't have to send a ShowWindow(SW_HIDE), just do
@@ -2039,15 +2054,16 @@
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
| SWP_NOZORDER | SWP_NOACTIVATE | SWP_HIDEWINDOW);
- if (hwnd == GetActiveWindow())
+ if (wasActive && owner)
{
/* If this dialog was given an owner then set the focus to that owner
even when the owner is disabled (normally when a window closes any
disabled windows cannot receive the focus). */
- if (owner)
- SetForegroundWindow( owner );
- else
- WinPosActivateOtherWindow( hwnd );
+ SetActiveWindow(owner);
+ }
+ else if (hwnd == GetActiveWindow()) // Check it again!
+ {
+ NtUserCallNoParam(NOPARAM_ROUTINE_ZAPACTIVEANDFOUS);
}
/* unblock dialog loop */
@@ -2593,13 +2609,15 @@
//// ReactOS
case WM_SYSKEYDOWN:
/* If the ALT key is being pressed display the keyboard cues */
- if (HIWORD(lpMsg->lParam) & KF_ALTDOWN)
+ if ( HIWORD(lpMsg->lParam) & KF_ALTDOWN &&
+ !(gpsi->dwSRVIFlags & SRVINFO_KBDPREF) &&
!(gpsi->PUSIFlags & PUSIF_KEYBOARDCUES) )
SendMessageW(hDlg, WM_CHANGEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEACCEL |
UISF_HIDEFOCUS), 0);
break;
case WM_SYSCOMMAND:
/* If the ALT key is being pressed display the keyboard cues */
- if (lpMsg->wParam == SC_KEYMENU)
+ if ( lpMsg->wParam == SC_KEYMENU &&
+ !(gpsi->dwSRVIFlags & SRVINFO_KBDPREF) &&
!(gpsi->PUSIFlags & PUSIF_KEYBOARDCUES) )
{
SendMessageW(hDlg, WM_CHANGEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEACCEL |
UISF_HIDEFOCUS), 0);
}
Modified: trunk/reactos/win32ss/user/user32/windows/winpos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/winpos.c [iso-8859-1] Thu Jul 5 22:17:32
2012
@@ -24,57 +24,6 @@
}
/* FUNCTIONS *****************************************************************/
-
-/*******************************************************************
- * can_activate_window
- *
- * Check if we can activate the specified window.
- */
-static BOOL can_activate_window( HWND hwnd )
-{
- LONG style;
-
- if (!hwnd) return FALSE;
- style = GetWindowLongPtrW( hwnd, GWL_STYLE );
- if (!(style & WS_VISIBLE)) return FALSE;
- if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
- return !(style & WS_DISABLED);
-}
-
-
-/*******************************************************************
- * WINPOS_ActivateOtherWindow
- *
- * Activates window other than pWnd.
- */
-void
-WINAPI
-WinPosActivateOtherWindow(HWND hwnd)
-{
- HWND hwndTo, fg;
-
- if ((GetWindowLongPtrW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo =
GetWindow( hwnd, GW_OWNER )))
- {
- hwndTo = GetAncestor( hwndTo, GA_ROOT );
- if (can_activate_window( hwndTo )) goto done;
- }
-
- hwndTo = hwnd;
- for (;;)
- {
- if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break;
- if (can_activate_window( hwndTo )) break;
- }
-
- done:
- fg = GetForegroundWindow();
- TRACE("win = %p fg = %p\n", hwndTo, fg);
- if (!fg || (hwnd == fg))
- {
- if (SetForegroundWindow( hwndTo )) return;
- }
- if (!SetActiveWindow( hwndTo )) SetActiveWindow(0);
-}
#define EMPTYPOINT(pt) ((pt).x == -1 && (pt).y == -1)