[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(); ~CDockSite();
HRESULT Initialize(IUnknown *containedBand, CInternetToolbar *browser, HWND hwnd, int bandID, int flags); HRESULT Initialize(IUnknown *containedBand, CInternetToolbar *browser, HWND hwnd, int bandID, int flags);
HRESULT GetRBBandInfo(REBARBANDINFOW &bandInfo); HRESULT GetRBBandInfo(REBARBANDINFOW &bandInfo);
IUnknown* GetContainedBand() const { return fContainedBand.p; } // Not ref. counted
private: private:
// *** IOleWindow methods *** // *** IOleWindow methods ***
@ -287,7 +288,7 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
bandInfo.cyMaxChild = fDeskBandInfo.ptMaxSize.y; bandInfo.cyMaxChild = fDeskBandInfo.ptMaxSize.y;
bandInfo.cyIntegral = fDeskBandInfo.ptIntegral.y; bandInfo.cyIntegral = fDeskBandInfo.ptIntegral.y;
bandInfo.cxIdeal = fDeskBandInfo.ptActual.x; bandInfo.cxIdeal = fDeskBandInfo.ptActual.x;
bandInfo.lParam = reinterpret_cast<LPARAM>(this); bandInfo.lParam = reinterpret_cast<LPARAM>(static_cast<CDockSite*>(this));
return S_OK; return S_OK;
} }
@ -642,6 +643,21 @@ void CInternetToolbar::AddDockItem(IUnknown *newItem, int bandID, int flags)
newSite->Initialize(newItem, this, fMainReBar, bandID, 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) HRESULT CInternetToolbar::ReserveBorderSpace(LONG maxHeight)
{ {
CComPtr<IDockingWindowSite> dockingWindowSite; CComPtr<IDockingWindowSite> dockingWindowSite;
@ -907,33 +923,17 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::ShowDW(BOOL fShow)
return hResult; return hResult;
} }
#if 0 // Why should showing the IDockingWindow change all bands? Related to CORE-17236 // TODO: Why should showing the IDockingWindow change all bands? Related to CORE-17236 and CORE-19659.
if (fMenuBar) int id;
IUnknown *pUnk;
for (UINT i = 0; SUCCEEDED(EnumBands(i, &id, &pUnk)); ++i)
{ {
hResult = IUnknown_ShowDW(fMenuBar, fShow); if (!pUnk)
if (FAILED_UNEXPECTEDLY(hResult)) continue;
return hResult; 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; return S_OK;
} }
@ -1504,8 +1504,14 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::AddBand(IUnknown *punk)
HRESULT STDMETHODCALLTYPE CInternetToolbar::EnumBands(UINT uBand, DWORD *pdwBandID) HRESULT STDMETHODCALLTYPE CInternetToolbar::EnumBands(UINT uBand, DWORD *pdwBandID)
{ {
UNIMPLEMENTED; if (uBand == ~0ul)
return E_NOTIMPL; 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, HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryBand(DWORD dwBandID,

View file

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