[BROWSEUI] Ensure menu dock site is visible when parent ShowDW is called (#7045)

Addendum to 674136b (PR #7035)

CORE-19659
This commit is contained in:
Whindmar Saksit 2024-06-24 23:51:57 +02:00 committed by GitHub
parent 2cdd5eca7b
commit df5affedce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 28 deletions

View File

@ -160,6 +160,7 @@ public:
~CDockSite();
HRESULT Initialize(IUnknown *containedBand, CInternetToolbar *browser, HWND hwnd, int bandID, int flags);
HRESULT GetRBBandInfo(REBARBANDINFOW &bandInfo);
IUnknown* GetContainedBand() const { return fContainedBand.p; } // Not ref. counted
private:
// *** IOleWindow methods ***
@ -287,7 +288,7 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
bandInfo.cyMaxChild = fDeskBandInfo.ptMaxSize.y;
bandInfo.cyIntegral = fDeskBandInfo.ptIntegral.y;
bandInfo.cxIdeal = fDeskBandInfo.ptActual.x;
bandInfo.lParam = reinterpret_cast<LPARAM>(this);
bandInfo.lParam = reinterpret_cast<LPARAM>(static_cast<CDockSite*>(this));
return S_OK;
}
@ -642,6 +643,21 @@ void CInternetToolbar::AddDockItem(IUnknown *newItem, int bandID, int flags)
newSite->Initialize(newItem, this, fMainReBar, bandID, flags);
}
HRESULT CInternetToolbar::EnumBands(UINT Index, int *pBandId, IUnknown **ppUnkBand)
{
REBARBANDINFOW rbbi;
rbbi.cbSize = sizeof(rbbi);
rbbi.fMask = RBBIM_ID | RBBIM_LPARAM;
rbbi.cch = 0;
if (!::SendMessageW(fMainReBar, RB_GETBANDINFOW, Index, (LPARAM)&rbbi))
return HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS);
*pBandId = rbbi.wID;
if (!rbbi.lParam)
return E_UNEXPECTED;
*ppUnkBand = ((CDockSite*)(rbbi.lParam))->GetContainedBand(); // Not ref. counted
return *ppUnkBand ? S_OK : S_FALSE;
}
HRESULT CInternetToolbar::ReserveBorderSpace(LONG maxHeight)
{
CComPtr<IDockingWindowSite> dockingWindowSite;
@ -907,33 +923,17 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::ShowDW(BOOL fShow)
return hResult;
}
#if 0 // Why should showing the IDockingWindow change all bands? Related to CORE-17236
if (fMenuBar)
// TODO: Why should showing the IDockingWindow change all bands? Related to CORE-17236 and CORE-19659.
int id;
IUnknown *pUnk;
for (UINT i = 0; SUCCEEDED(EnumBands(i, &id, &pUnk)); ++i)
{
hResult = IUnknown_ShowDW(fMenuBar, fShow);
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
if (!pUnk)
continue;
BOOL visible = fShow && IsBandVisible(id) != S_FALSE;
hResult = IUnknown_ShowDW(pUnk, visible);
FAILED_UNEXPECTEDLY(hResult);
}
if (fControlsBar)
{
hResult = IUnknown_ShowDW(fControlsBar, fShow);
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
if (fNavigationBar)
{
hResult = IUnknown_ShowDW(fNavigationBar, fShow);
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
if (fLogoBar)
{
hResult = IUnknown_ShowDW(fLogoBar, fShow);
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
}
#endif
return S_OK;
}
@ -1504,8 +1504,14 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::AddBand(IUnknown *punk)
HRESULT STDMETHODCALLTYPE CInternetToolbar::EnumBands(UINT uBand, DWORD *pdwBandID)
{
UNIMPLEMENTED;
return E_NOTIMPL;
if (uBand == ~0ul)
return ::SendMessage(fMainReBar, RB_GETBANDCOUNT, 0, 0);
int id;
IUnknown *pUnkUnused;
HRESULT hr = EnumBands(uBand, &id, &pUnkUnused);
if (SUCCEEDED(hr))
*pdwBandID = id;
return hr;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryBand(DWORD dwBandID,

View File

@ -102,6 +102,7 @@ public:
CInternetToolbar();
virtual ~CInternetToolbar();
void AddDockItem(IUnknown *newItem, int bandID, int flags);
HRESULT EnumBands(UINT Index, int *pBandId, IUnknown **ppUnkBand);
HRESULT ReserveBorderSpace(LONG maxHeight = -1);
HRESULT CreateMenuBar(IShellMenu **menuBar);
HRESULT CreateToolsBar(IUnknown **toolsBar);