From 905eb2bdcef8f1c118bc2828ea7ce307ccb3da18 Mon Sep 17 00:00:00 2001 From: David Quintana Date: Tue, 11 Mar 2014 17:40:18 +0000 Subject: [PATCH] [RSHELL] * Workaround for the exec issue. Ros currently seems to send a bogus WM_ACTIVATE message when clicking while the window is already active. Proper fix may come later if I can figure out why this happens. CORE-7586 svn path=/branches/shell-experiments/; revision=62475 --- base/shell/explorer-new/traywnd.c | 2 +- base/shell/rshell/CMenuDeskBar.cpp | 9 +++++++-- base/shell/rshell/CMenuToolbars.cpp | 11 ++++++++++- base/shell/rshell/CStartMenu.cpp | 2 ++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/base/shell/explorer-new/traywnd.c b/base/shell/explorer-new/traywnd.c index 7a107ac816b..0b77f4e32aa 100644 --- a/base/shell/explorer-new/traywnd.c +++ b/base/shell/explorer-new/traywnd.c @@ -2610,7 +2610,7 @@ HandleTrayContextMenu: } if (This->TrayBandSite == NULL || - !SUCCEEDED(ITrayBandSite_ProcessMessage(This->TrayBandSite, + FAILED(ITrayBandSite_ProcessMessage(This->TrayBandSite, hwnd, uMsg, wParam, diff --git a/base/shell/rshell/CMenuDeskBar.cpp b/base/shell/rshell/CMenuDeskBar.cpp index 6e310bc83a3..86a25c1b3aa 100644 --- a/base/shell/rshell/CMenuDeskBar.cpp +++ b/base/shell/rshell/CMenuDeskBar.cpp @@ -491,7 +491,7 @@ HRESULT CMenuDeskBar::_CloseBar() if (FAILED_UNEXPECTEDLY(hr)) return hr; - SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE); return UIActivateIO(FALSE, NULL); } @@ -609,8 +609,13 @@ LRESULT CMenuDeskBar::_OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bH LRESULT CMenuDeskBar::_OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { - if (wParam != 0) + DbgPrint("BaseBar %08p (de)activated (%08x, %08x).\n", m_hWnd, wParam, lParam); + + // BUG in ReactOS: WM_ACTIVATE/WA_INACTIVE makes no sense with lParam==hWnd + if (LOWORD(wParam) != 0 || reinterpret_cast(lParam) == m_hWnd) + { return 0; + } // HACK! I just want it to work !!! CComPtr db; diff --git a/base/shell/rshell/CMenuToolbars.cpp b/base/shell/rshell/CMenuToolbars.cpp index 08c26868842..9fb2ae62611 100644 --- a/base/shell/rshell/CMenuToolbars.cpp +++ b/base/shell/rshell/CMenuToolbars.cpp @@ -622,7 +622,10 @@ HRESULT CMenuToolbarBase::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theRe PopupItem(wParam); return S_FALSE; } - return m_menuBand->_MenuItemHotTrack(MPOS_EXECUTE); + HRESULT hr = m_menuBand->_MenuItemHotTrack(MPOS_EXECUTE); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + return S_OK; // filter out a possible S_FALSE from here. } HRESULT CMenuToolbarBase::ChangeHotItem(DWORD dwSelectType) @@ -938,7 +941,10 @@ HRESULT CMenuStaticToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *the // in case the clicked item has a submenu, we do not need to execute the item if (hr == S_FALSE) + { + DbgPrint("CMenuToolbarBase::OnCommand told us to cancel.\n"); return hr; + } return m_menuBand->_CallCBWithItemId(wParam, SMC_EXEC, 0, 0); } @@ -1102,7 +1108,10 @@ HRESULT CMenuSFToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResu // in case the clicked item has a submenu, we do not need to execute the item if (hr == S_FALSE) + { + DbgPrint("CMenuToolbarBase::OnCommand told us to cancel.\n"); return hr; + } DWORD_PTR data; GetDataFromId(wParam, NULL, &data); diff --git a/base/shell/rshell/CStartMenu.cpp b/base/shell/rshell/CStartMenu.cpp index fa10931a901..140ec1ec5b8 100644 --- a/base/shell/rshell/CStartMenu.cpp +++ b/base/shell/rshell/CStartMenu.cpp @@ -267,8 +267,10 @@ public: case SMC_GETOBJECT: return OnGetObject(psmd, *reinterpret_cast(wParam), reinterpret_cast(lParam)); case SMC_EXEC: + DbgPrint("SMC_EXEC\n"); return OnExec(psmd); case SMC_SFEXEC: + DbgPrint("SMC_SFEXEC\n"); m_pTrayPriv->Execute(psmd->psf, psmd->pidlItem); break; }