Author: dquintana
Date: Sat Jul 12 02:43:06 2014
New Revision: 63710
URL: 
http://svn.reactos.org/svn/reactos?rev=63710&view=rev
Log:
[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.
Modified:
    branches/shell-experiments/base/shell/explorer-new/precomp.h
    branches/shell-experiments/base/shell/explorer-new/startmnu.c
    branches/shell-experiments/base/shell/explorer-new/traywnd.c
    branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
Modified: branches/shell-experiments/base/shell/explorer-new/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/precomp.h        [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/explorer-new/precomp.h        [iso-8859-1] Sat
Jul 12 02:43:06 2014
@@ -455,4 +455,7 @@
 CreateTaskSwitchWnd(IN HWND hWndParent,
                     IN OUT ITrayWindow *Tray);
+HRESULT
+Tray_OnStartMenuDismissed();
+
 #endif /* _EXPLORER_PRECOMP__H_ */
Modified: branches/shell-experiments/base/shell/explorer-new/startmnu.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/startmnu.c       [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/explorer-new/startmnu.c       [iso-8859-1] Sat
Jul 12 02:43:06 2014
@@ -291,6 +291,7 @@
 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 @@
     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(IServiceProvider, IStartMenuSite, lpServiceProviderVtbl)
 IMPL_CASTS(ITrayPriv, IStartMenuSite, lpStartMenuCallbackVtbl)
 IMPL_CASTS(IOleCommandTarget, IStartMenuSite, lpOleCommandTargetVtbl)
+IMPL_CASTS(IDeskBar, IStartMenuSite, lpMenuPopupVtbl)
+IMPL_CASTS(IMenuPopup, IStartMenuSite, lpMenuPopupVtbl)
 /*******************************************************************/
@@ -379,6 +385,16 @@
                         &IID_IOleCommandTarget))
     {
         *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
     {
@@ -776,6 +792,89 @@
 /*******************************************************************/
+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*
 IStartMenuSiteImpl_Construct(IN ITrayWindow *Tray)
 {
@@ -791,6 +890,7 @@
     This->lpServiceProviderVtbl = &IServiceProviderImpl_Vtbl;
     This->lpStartMenuCallbackVtbl = &ITrayPrivImpl_Vtbl;
     This->lpOleCommandTargetVtbl = &IOleCommandTargetImpl_Vtbl;
+    This->lpMenuPopupVtbl = &IMenuPopupImpl_Vtbl;
     This->Ref = 1;
     This->Tray = Tray;
Modified: branches/shell-experiments/base/shell/explorer-new/traywnd.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/traywnd.c        [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/explorer-new/traywnd.c        [iso-8859-1] Sat
Jul 12 02:43:06 2014
@@ -101,6 +101,8 @@
     HDPA hdpaShellServices;
 } ITrayWindowImpl;
+static ITrayWindowImpl * g_TrayWindow;
+
 BOOL LaunchCPanel(HWND hwnd, LPCTSTR applet)
 {
     TCHAR szParams[MAX_PATH];
@@ -2122,6 +2124,8 @@
                 &pt,
                 &rcExclude,
                 dwFlags);
+
+            SendMessageW(This->hwndStart, BM_SETSTATE, TRUE, 0);
         }
     }
 }
@@ -2870,6 +2874,8 @@
         ITrayWindowImpl_Open(TrayWindow);
+        g_TrayWindow = This;
+
         return TrayWindow;
     }
@@ -3040,3 +3046,16 @@
     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);
+}
Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp       [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp       [iso-8859-1] Sat
Jul 12 02:43:06 2014
@@ -495,6 +495,11 @@
     m_Shown = false;
+    if (m_SubMenuParent)
+    {
+        m_SubMenuParent->SetSubMenu(this, FALSE);
+    }
+
     if (m_SubMenuChild)
     {
         hr = m_SubMenuChild->OnSelect(MPOS_CANCELLEVEL);