mirror of
https://github.com/reactos/reactos.git
synced 2025-06-22 18:50:17 +00:00
[RSHELL]
* Fix shell menus closing when clicking on the frame/banner. CORE-7586 svn path=/branches/shell-experiments/; revision=63312
This commit is contained in:
parent
389001ca69
commit
2caa76f93d
2 changed files with 45 additions and 10 deletions
|
@ -212,13 +212,13 @@ void CMenuFocusManager::SetCapture(HWND child)
|
||||||
{
|
{
|
||||||
::SetCapture(child);
|
::SetCapture(child);
|
||||||
m_captureHwnd = child;
|
m_captureHwnd = child;
|
||||||
TRACE("MouseTrack is now capturing %p\n", child);
|
DbgPrint("MouseTrack is now capturing %p\n", child);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::ReleaseCapture();
|
::ReleaseCapture();
|
||||||
m_captureHwnd = NULL;
|
m_captureHwnd = NULL;
|
||||||
TRACE("MouseTrack is now off\n");
|
DbgPrint("MouseTrack is now off\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -250,6 +250,40 @@ HRESULT CMenuFocusManager::IsTrackedWindow(HWND hWnd, StackEntry ** pentry)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CMenuFocusManager::IsTrackedWindowOrParent(HWND hWnd)
|
||||||
|
{
|
||||||
|
for (int i = m_bandCount; --i >= 0;)
|
||||||
|
{
|
||||||
|
StackEntry& entry = m_bandStack[i];
|
||||||
|
|
||||||
|
if (entry.type != TrackedMenuEntry)
|
||||||
|
{
|
||||||
|
HRESULT hr = entry.mb->IsWindowOwner(hWnd);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
if (hr == S_OK)
|
||||||
|
return S_OK;
|
||||||
|
if (entry.mb->_IsPopup() == S_OK)
|
||||||
|
{
|
||||||
|
CComPtr<IUnknown> site;
|
||||||
|
CComPtr<IOleWindow> pw;
|
||||||
|
hr = entry.mb->GetSite(IID_PPV_ARG(IUnknown, &site));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
continue;
|
||||||
|
hr = IUnknown_QueryService(site, SID_SMenuBandParent, IID_PPV_ARG(IOleWindow, &pw));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
HWND hParent;
|
||||||
|
if (pw->GetWindow(&hParent) == S_OK && hParent == hWnd)
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
||||||
{
|
{
|
||||||
HWND child;
|
HWND child;
|
||||||
|
@ -284,7 +318,7 @@ LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
|
||||||
|
|
||||||
if (SendMessage(child, WM_USER_ISTRACKEDITEM, iHitTestResult, 0) == S_FALSE)
|
if (SendMessage(child, WM_USER_ISTRACKEDITEM, iHitTestResult, 0) == S_FALSE)
|
||||||
{
|
{
|
||||||
TRACE("Hot item tracking detected a change (capture=%p)...\n", m_captureHwnd);
|
DbgPrint("Hot item tracking detected a change (capture=%p / cCapture=%p)...\n", m_captureHwnd, cCapture);
|
||||||
DisableMouseTrack(NULL, FALSE);
|
DisableMouseTrack(NULL, FALSE);
|
||||||
if (isTracking && iHitTestResult>=0 && m_current->type == TrackedMenuEntry)
|
if (isTracking && iHitTestResult>=0 && m_current->type == TrackedMenuEntry)
|
||||||
SendMessage(entry->hwnd, WM_CANCELMODE, 0, 0);
|
SendMessage(entry->hwnd, WM_CANCELMODE, 0, 0);
|
||||||
|
@ -359,13 +393,13 @@ LRESULT CMenuFocusManager::MsgFilterHook(INT nCode, WPARAM hookWParam, LPARAM ho
|
||||||
callNext = ProcessMouseMove(msg);
|
callNext = ProcessMouseMove(msg);
|
||||||
break;
|
break;
|
||||||
case WM_INITMENUPOPUP:
|
case WM_INITMENUPOPUP:
|
||||||
TRACE("WM_INITMENUPOPUP %p %p\n", msg->wParam, msg->lParam);
|
DbgPrint("WM_INITMENUPOPUP %p %p\n", msg->wParam, msg->lParam);
|
||||||
m_selectedMenu = reinterpret_cast<HMENU>(msg->lParam);
|
m_selectedMenu = reinterpret_cast<HMENU>(msg->lParam);
|
||||||
m_selectedItem = -1;
|
m_selectedItem = -1;
|
||||||
m_selectedItemFlags = 0;
|
m_selectedItemFlags = 0;
|
||||||
break;
|
break;
|
||||||
case WM_MENUSELECT:
|
case WM_MENUSELECT:
|
||||||
TRACE("WM_MENUSELECT %p %p\n", msg->wParam, msg->lParam);
|
DbgPrint("WM_MENUSELECT %p %p\n", msg->wParam, msg->lParam);
|
||||||
m_selectedMenu = reinterpret_cast<HMENU>(msg->lParam);
|
m_selectedMenu = reinterpret_cast<HMENU>(msg->lParam);
|
||||||
m_selectedItem = GET_X_LPARAM(msg->wParam);
|
m_selectedItem = GET_X_LPARAM(msg->wParam);
|
||||||
m_selectedItemFlags = HIWORD(msg->wParam);
|
m_selectedItemFlags = HIWORD(msg->wParam);
|
||||||
|
@ -415,7 +449,7 @@ LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM hookWParam, LPARAM hookL
|
||||||
{
|
{
|
||||||
HWND child = WindowFromPoint(pt);
|
HWND child = WindowFromPoint(pt);
|
||||||
|
|
||||||
if (IsTrackedWindow(child) != S_OK)
|
if (IsTrackedWindowOrParent(child) != S_OK)
|
||||||
{
|
{
|
||||||
SetCapture(NULL);
|
SetCapture(NULL);
|
||||||
m_current->mb->_MenuItemHotTrack(MPOS_FULLCANCEL);
|
m_current->mb->_MenuItemHotTrack(MPOS_FULLCANCEL);
|
||||||
|
@ -476,12 +510,12 @@ HRESULT CMenuFocusManager::PlaceHooks()
|
||||||
{
|
{
|
||||||
if (m_current->type == TrackedMenuEntry)
|
if (m_current->type == TrackedMenuEntry)
|
||||||
{
|
{
|
||||||
TRACE("Entering MSGFILTER hook...\n");
|
DbgPrint("Entering MSGFILTER hook...\n");
|
||||||
m_hMsgFilterHook = SetWindowsHookEx(WH_MSGFILTER, s_MsgFilterHook, NULL, m_threadId);
|
m_hMsgFilterHook = SetWindowsHookEx(WH_MSGFILTER, s_MsgFilterHook, NULL, m_threadId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRACE("Entering GETMESSAGE hook...\n");
|
DbgPrint("Entering GETMESSAGE hook...\n");
|
||||||
m_hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE, s_GetMsgHook, NULL, m_threadId);
|
m_hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE, s_GetMsgHook, NULL, m_threadId);
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -489,7 +523,7 @@ HRESULT CMenuFocusManager::PlaceHooks()
|
||||||
|
|
||||||
HRESULT CMenuFocusManager::RemoveHooks()
|
HRESULT CMenuFocusManager::RemoveHooks()
|
||||||
{
|
{
|
||||||
TRACE("Removing all hooks...\n");
|
DbgPrint("Removing all hooks...\n");
|
||||||
if (m_hMsgFilterHook)
|
if (m_hMsgFilterHook)
|
||||||
UnhookWindowsHookEx(m_hMsgFilterHook);
|
UnhookWindowsHookEx(m_hMsgFilterHook);
|
||||||
if (m_hGetMsgHook)
|
if (m_hGetMsgHook)
|
||||||
|
@ -627,7 +661,7 @@ HRESULT CMenuFocusManager::PushTrackedPopup(HMENU popup)
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
TRACE("PushTrackedPopup %p\n", popup);
|
DbgPrint("PushTrackedPopup %p\n", popup);
|
||||||
m_selectedMenu = popup;
|
m_selectedMenu = popup;
|
||||||
m_selectedItem = -1;
|
m_selectedItem = -1;
|
||||||
m_selectedItemFlags = 0;
|
m_selectedItemFlags = 0;
|
||||||
|
|
|
@ -103,6 +103,7 @@ private:
|
||||||
HRESULT RemoveHooks();
|
HRESULT RemoveHooks();
|
||||||
HRESULT UpdateFocus();
|
HRESULT UpdateFocus();
|
||||||
HRESULT IsTrackedWindow(HWND hWnd, StackEntry ** pentry = NULL);
|
HRESULT IsTrackedWindow(HWND hWnd, StackEntry ** pentry = NULL);
|
||||||
|
HRESULT IsTrackedWindowOrParent(HWND hWnd);
|
||||||
|
|
||||||
void DisableMouseTrack(HWND parent, BOOL disableThis);
|
void DisableMouseTrack(HWND parent, BOOL disableThis);
|
||||||
void SetCapture(HWND child);
|
void SetCapture(HWND child);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue