mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 17:31:31 +00:00
[RSHELL]
* Make the shell menus focus the parent before displaying themselves. Fixes keyboard focus when opening the start menu with the windows key. NOTE: I put this in the focus manager for lack of a better place, but it may not be how Windows does it. svn path=/trunk/; revision=65769
This commit is contained in:
parent
2dc90d89b4
commit
cb546b4121
|
@ -163,6 +163,7 @@ CMenuFocusManager::CMenuFocusManager() :
|
|||
m_isLButtonDown(FALSE),
|
||||
m_movedSinceDown(FALSE),
|
||||
m_windowAtDown(NULL),
|
||||
m_PreviousForeground(NULL),
|
||||
m_bandCount(0),
|
||||
m_menuDepth(0)
|
||||
{
|
||||
|
@ -704,7 +705,14 @@ HRESULT CMenuFocusManager::UpdateFocus()
|
|||
m_current = NULL;
|
||||
|
||||
if (!m_current || m_current->type != MenuPopupEntry)
|
||||
{
|
||||
SetMenuCapture(NULL);
|
||||
if (old && old->type == MenuPopupEntry && m_PreviousForeground)
|
||||
{
|
||||
::SetForegroundWindow(m_PreviousForeground);
|
||||
m_PreviousForeground = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_current && m_current->type != TrackedMenuEntry)
|
||||
{
|
||||
|
@ -771,10 +779,24 @@ HRESULT CMenuFocusManager::UpdateFocus()
|
|||
hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider, &bandSite));
|
||||
hr = bandSite->QueryService(SID_SMenuBandParent, IID_PPV_ARG(IOleWindow, &deskBar));
|
||||
|
||||
CComPtr<IOleWindow> deskBarSite;
|
||||
hr = IUnknown_GetSite(deskBar, IID_PPV_ARG(IOleWindow, &deskBarSite));
|
||||
|
||||
// FIXME: Find the correct place for this
|
||||
HWND hWndOwner;
|
||||
deskBarSite->GetWindow(&hWndOwner);
|
||||
|
||||
m_PreviousForeground = ::GetForegroundWindow();
|
||||
if (m_PreviousForeground != hWndOwner)
|
||||
::SetForegroundWindow(hWndOwner);
|
||||
else
|
||||
m_PreviousForeground = NULL;
|
||||
|
||||
// Get the HWND of the top-level window
|
||||
HWND hWndSite;
|
||||
hr = deskBar->GetWindow(&hWndSite);
|
||||
SetMenuCapture(hWndSite);
|
||||
|
||||
}
|
||||
|
||||
if (!m_parent || m_parent->type == MenuBarEntry)
|
||||
|
|
|
@ -81,6 +81,8 @@ private:
|
|||
BOOL m_movedSinceDown;
|
||||
HWND m_windowAtDown;
|
||||
|
||||
HWND m_PreviousForeground;
|
||||
|
||||
// TODO: make dynamic
|
||||
#define MAX_RECURSE 20
|
||||
StackEntry m_bandStack[MAX_RECURSE];
|
||||
|
|
Loading…
Reference in a new issue