From 88f0fb5a4746c65b442e4e5432de13cd24bb7610 Mon Sep 17 00:00:00 2001 From: David Quintana Date: Sat, 12 Jul 2014 02:43:06 +0000 Subject: [PATCH] [RSHELL] * 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 --- base/shell/explorer-new/precomp.h | 3 + base/shell/explorer-new/startmnu.c | 100 +++++++++++++++++++++++++++++ base/shell/explorer-new/traywnd.c | 19 ++++++ base/shell/rshell/CMenuDeskBar.cpp | 5 ++ 4 files changed, 127 insertions(+) diff --git a/base/shell/explorer-new/precomp.h b/base/shell/explorer-new/precomp.h index c96cbd7393d..81588d78a49 100644 --- a/base/shell/explorer-new/precomp.h +++ b/base/shell/explorer-new/precomp.h @@ -455,4 +455,7 @@ HWND CreateTaskSwitchWnd(IN HWND hWndParent, IN OUT ITrayWindow *Tray); +HRESULT +Tray_OnStartMenuDismissed(); + #endif /* _EXPLORER_PRECOMP__H_ */ diff --git a/base/shell/explorer-new/startmnu.c b/base/shell/explorer-new/startmnu.c index 48fc30ffa77..87d720a1b7c 100644 --- a/base/shell/explorer-new/startmnu.c +++ b/base/shell/explorer-new/startmnu.c @@ -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; diff --git a/base/shell/explorer-new/traywnd.c b/base/shell/explorer-new/traywnd.c index 66559ef8ed2..3d4c2a358ff 100644 --- a/base/shell/explorer-new/traywnd.c +++ b/base/shell/explorer-new/traywnd.c @@ -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); +} \ No newline at end of file diff --git a/base/shell/rshell/CMenuDeskBar.cpp b/base/shell/rshell/CMenuDeskBar.cpp index 4c3cbadd2ed..91088f5b5e8 100644 --- a/base/shell/rshell/CMenuDeskBar.cpp +++ b/base/shell/rshell/CMenuDeskBar.cpp @@ -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);