mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 12:24:21 +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
2 changed files with 24 additions and 0 deletions
|
@ -163,6 +163,7 @@ CMenuFocusManager::CMenuFocusManager() :
|
||||||
m_isLButtonDown(FALSE),
|
m_isLButtonDown(FALSE),
|
||||||
m_movedSinceDown(FALSE),
|
m_movedSinceDown(FALSE),
|
||||||
m_windowAtDown(NULL),
|
m_windowAtDown(NULL),
|
||||||
|
m_PreviousForeground(NULL),
|
||||||
m_bandCount(0),
|
m_bandCount(0),
|
||||||
m_menuDepth(0)
|
m_menuDepth(0)
|
||||||
{
|
{
|
||||||
|
@ -704,7 +705,14 @@ HRESULT CMenuFocusManager::UpdateFocus()
|
||||||
m_current = NULL;
|
m_current = NULL;
|
||||||
|
|
||||||
if (!m_current || m_current->type != MenuPopupEntry)
|
if (!m_current || m_current->type != MenuPopupEntry)
|
||||||
|
{
|
||||||
SetMenuCapture(NULL);
|
SetMenuCapture(NULL);
|
||||||
|
if (old && old->type == MenuPopupEntry && m_PreviousForeground)
|
||||||
|
{
|
||||||
|
::SetForegroundWindow(m_PreviousForeground);
|
||||||
|
m_PreviousForeground = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_current && m_current->type != TrackedMenuEntry)
|
if (m_current && m_current->type != TrackedMenuEntry)
|
||||||
{
|
{
|
||||||
|
@ -771,10 +779,24 @@ HRESULT CMenuFocusManager::UpdateFocus()
|
||||||
hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider, &bandSite));
|
hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider, &bandSite));
|
||||||
hr = bandSite->QueryService(SID_SMenuBandParent, IID_PPV_ARG(IOleWindow, &deskBar));
|
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
|
// Get the HWND of the top-level window
|
||||||
HWND hWndSite;
|
HWND hWndSite;
|
||||||
hr = deskBar->GetWindow(&hWndSite);
|
hr = deskBar->GetWindow(&hWndSite);
|
||||||
SetMenuCapture(hWndSite);
|
SetMenuCapture(hWndSite);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_parent || m_parent->type == MenuBarEntry)
|
if (!m_parent || m_parent->type == MenuBarEntry)
|
||||||
|
|
|
@ -81,6 +81,8 @@ private:
|
||||||
BOOL m_movedSinceDown;
|
BOOL m_movedSinceDown;
|
||||||
HWND m_windowAtDown;
|
HWND m_windowAtDown;
|
||||||
|
|
||||||
|
HWND m_PreviousForeground;
|
||||||
|
|
||||||
// TODO: make dynamic
|
// TODO: make dynamic
|
||||||
#define MAX_RECURSE 20
|
#define MAX_RECURSE 20
|
||||||
StackEntry m_bandStack[MAX_RECURSE];
|
StackEntry m_bandStack[MAX_RECURSE];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue