* Notify the parent menu popup when the deskbar is closing.

[EXPLORER-NEW]
* Set the button pressed when the start menu gets displayed.
* Set the button released when the start menu notifies it was closed.

svn path=/branches/shell-experiments/; revision=63710
This commit is contained in:
David Quintana 2014-07-12 02:43:06 +00:00
parent e1b309d6de
commit 88f0fb5a47
4 changed files with 127 additions and 0 deletions

View file

@ -455,4 +455,7 @@ HWND
CreateTaskSwitchWnd(IN HWND hWndParent,
IN OUT ITrayWindow *Tray);
HRESULT
Tray_OnStartMenuDismissed();
#endif /* _EXPLORER_PRECOMP__H_ */

View file

@ -291,6 +291,7 @@ static const IStartMenuSiteVtbl IStartMenuSiteImpl_Vtbl;
static const IServiceProviderVtbl IServiceProviderImpl_Vtbl;
static const ITrayPrivVtbl ITrayPrivImpl_Vtbl;
static const IOleCommandTargetVtbl IOleCommandTargetImpl_Vtbl;
static const IMenuPopupVtbl IMenuPopupImpl_Vtbl;
typedef struct
{
@ -298,9 +299,12 @@ typedef struct
const IServiceProviderVtbl *lpServiceProviderVtbl;
const ITrayPrivVtbl *lpStartMenuCallbackVtbl;
const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
const IMenuPopupVtbl *lpMenuPopupVtbl;
LONG Ref;
ITrayWindow *Tray;
IMenuPopup * StartMenuPopup;
} IStartMenuSiteImpl;
static IUnknown *
@ -313,6 +317,8 @@ IMPL_CASTS(IStartMenuSite, IStartMenuSite, lpVtbl)
IMPL_CASTS(IServiceProvider, IStartMenuSite, lpServiceProviderVtbl)
IMPL_CASTS(ITrayPriv, IStartMenuSite, lpStartMenuCallbackVtbl)
IMPL_CASTS(IOleCommandTarget, IStartMenuSite, lpOleCommandTargetVtbl)
IMPL_CASTS(IDeskBar, IStartMenuSite, lpMenuPopupVtbl)
IMPL_CASTS(IMenuPopup, IStartMenuSite, lpMenuPopupVtbl)
/*******************************************************************/
@ -380,6 +386,16 @@ IStartMenuSiteImpl_QueryInterface(IN OUT IStartMenuSite *iface,
{
*ppvObj = IOleCommandTarget_from_IStartMenuSiteImpl(This);
}
else if (IsEqualIID(riid,
&IID_IDeskBar))
{
*ppvObj = IDeskBar_from_IStartMenuSiteImpl(This);
}
else if (IsEqualIID(riid,
&IID_IMenuPopup))
{
*ppvObj = IMenuPopup_from_IStartMenuSiteImpl(This);
}
else
{
DbgPrint("IStartMenuSite::QueryInterface queried unsupported interface: "
@ -774,6 +790,89 @@ static const IOleCommandTargetVtbl IOleCommandTargetImpl_Vtbl =
IStartMenuSiteImpl_Exec
};
/*******************************************************************/
METHOD_IUNKNOWN_INHERITED_ADDREF(IMenuPopup, IStartMenuSite)
METHOD_IUNKNOWN_INHERITED_RELEASE(IMenuPopup, IStartMenuSite)
METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE(IMenuPopup, IStartMenuSite)
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_IMenuPopup_GetWindow(IN OUT IMenuPopup *iface, OUT HWND *phwnd)
{
IStartMenuSiteImpl * This = IStartMenuSiteImpl_from_IMenuPopup(iface);
ITrayPriv * tp = ITrayPriv_from_IStartMenuSiteImpl(This);
return IStartMenuSiteImpl_GetWindow(tp, phwnd);
}
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_IMenuPopup_ContextSensitiveHelp(IN OUT IMenuPopup *iface, IN BOOL fEnterMode)
{
IStartMenuSiteImpl * This = IStartMenuSiteImpl_from_IMenuPopup(iface);
ITrayPriv * tp = ITrayPriv_from_IStartMenuSiteImpl(This);
return IStartMenuSiteImpl_ContextSensitiveHelp(tp, fEnterMode);
}
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_SetClient(IN OUT IMenuPopup *iface, IUnknown *punkClient)
{
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_GetClient(IN OUT IMenuPopup *iface, IUnknown ** ppunkClient)
{
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_OnPosRectChangeDB(IN OUT IMenuPopup *iface, RECT *prc)
{
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_Popup(IN OUT IMenuPopup *iface, POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
{
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_OnSelect(IN OUT IMenuPopup *iface, DWORD dwSelectType)
{
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
IStartMenuSiteImpl_SetSubMenu(IN OUT IMenuPopup *iface, IMenuPopup *pmp, BOOL fSet)
{
if (!fSet)
{
return Tray_OnStartMenuDismissed();
}
return S_OK;
}
static const IMenuPopupVtbl IMenuPopupImpl_Vtbl =
{
/*** IUnknown methods ***/
METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE_NAME(IMenuPopup, IStartMenuSite),
METHOD_IUNKNOWN_INHERITED_ADDREF_NAME(IMenuPopup, IStartMenuSite),
METHOD_IUNKNOWN_INHERITED_RELEASE_NAME(IMenuPopup, IStartMenuSite),
/*** IOleWindow methods ***/
IStartMenuSiteImpl_IMenuPopup_GetWindow,
IStartMenuSiteImpl_IMenuPopup_ContextSensitiveHelp,
/*** IDeskBar methods ***/
IStartMenuSiteImpl_SetClient,
IStartMenuSiteImpl_GetClient,
IStartMenuSiteImpl_OnPosRectChangeDB,
/*** IMenuPopup ***/
IStartMenuSiteImpl_Popup,
IStartMenuSiteImpl_OnSelect,
IStartMenuSiteImpl_SetSubMenu
};
/*******************************************************************/
static IStartMenuSiteImpl*
@ -791,6 +890,7 @@ IStartMenuSiteImpl_Construct(IN ITrayWindow *Tray)
This->lpServiceProviderVtbl = &IServiceProviderImpl_Vtbl;
This->lpStartMenuCallbackVtbl = &ITrayPrivImpl_Vtbl;
This->lpOleCommandTargetVtbl = &IOleCommandTargetImpl_Vtbl;
This->lpMenuPopupVtbl = &IMenuPopupImpl_Vtbl;
This->Ref = 1;
This->Tray = Tray;

View file

@ -101,6 +101,8 @@ typedef struct
HDPA hdpaShellServices;
} ITrayWindowImpl;
static ITrayWindowImpl * g_TrayWindow;
BOOL LaunchCPanel(HWND hwnd, LPCTSTR applet)
{
TCHAR szParams[MAX_PATH];
@ -2122,6 +2124,8 @@ static void PopupStartMenu(IN ITrayWindowImpl *This)
&pt,
&rcExclude,
dwFlags);
SendMessageW(This->hwndStart, BM_SETSTATE, TRUE, 0);
}
}
}
@ -2870,6 +2874,8 @@ CreateTrayWindow(VOID)
ITrayWindowImpl_Open(TrayWindow);
g_TrayWindow = This;
return TrayWindow;
}
@ -3040,3 +3046,16 @@ static const IShellDesktopTrayVtbl IShellDesktopTrayImpl_Vtbl =
ITrayWindowImpl_IShellDesktopTray_RegisterDesktopWindow,
ITrayWindowImpl_IShellDesktopTray_Unknown
};
HRESULT
ITrayWindowImpl_RaiseStartButton(ITrayWindowImpl * This)
{
SendMessageW(This->hwndStart, BM_SETSTATE, FALSE, 0);
return S_OK;
}
HRESULT
Tray_OnStartMenuDismissed()
{
return ITrayWindowImpl_RaiseStartButton(g_TrayWindow);
}

View file

@ -495,6 +495,11 @@ HRESULT CMenuDeskBar::_CloseBar()
m_Shown = false;
if (m_SubMenuParent)
{
m_SubMenuParent->SetSubMenu(this, FALSE);
}
if (m_SubMenuChild)
{
hr = m_SubMenuChild->OnSelect(MPOS_CANCELLEVEL);