[EXPLORER-NEW]
authorDavid Quintana <gigaherz@gmail.com>
Fri, 31 Oct 2014 15:57:56 +0000 (15:57 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Fri, 31 Oct 2014 15:57:56 +0000 (15:57 +0000)
* Some nitpicking.

[STOBJECT]
* Fix the notification not having an assigned callback message id.

svn path=/branches/shell-experiments/; revision=65151

base/shell/explorer-new/tbsite.c
base/shell/explorer-new/trayntfy.c
dll/shellext/stobject/csystray.cpp
dll/shellext/stobject/precomp.h
dll/shellext/stobject/volume.cpp

index cbcd042..b29879d 100644 (file)
@@ -135,22 +135,18 @@ ITrayBandSiteImpl_QueryInterface(IN OUT ITrayBandSite *iface,
 
     This = ITrayBandSiteImpl_from_ITrayBandSite(iface);
 
 
     This = ITrayBandSiteImpl_from_ITrayBandSite(iface);
 
-    if (IsEqualIID(riid,
-                   &IID_IUnknown) ||
-        IsEqualIID(riid,
-                   &IID_IBandSiteStreamCallback))
+    if (IsEqualIID(riid, &IID_IUnknown) ||
+        IsEqualIID(riid, &IID_IBandSiteStreamCallback))
     {
         /* NOTE: IID_IBandSiteStreamCallback is queried by the shell, we
                  implement this interface directly */
         *ppvObj = IUnknown_from_ITrayBandSiteImpl(This);
     }
     {
         /* NOTE: IID_IBandSiteStreamCallback is queried by the shell, we
                  implement this interface directly */
         *ppvObj = IUnknown_from_ITrayBandSiteImpl(This);
     }
-    else if (IsEqualIID(riid,
-                        &IID_IBandSite))
+    else if (IsEqualIID(riid, &IID_IBandSite))
     {
         *ppvObj = IBandSite_from_ITrayBandSiteImpl(This);
     }
     {
         *ppvObj = IBandSite_from_ITrayBandSiteImpl(This);
     }
-    else if (IsEqualIID(riid,
-                        &IID_IWinEventHandler))
+    else if (IsEqualIID(riid, &IID_IWinEventHandler))
     {
         TRACE("ITaskBandSite: IWinEventHandler queried!\n");
         *ppvObj = NULL;
     {
         TRACE("ITaskBandSite: IWinEventHandler queried!\n");
         *ppvObj = NULL;
index 1ce1dc4..49d4687 100644 (file)
@@ -1671,22 +1671,17 @@ TrayNotifyWnd_Size(IN OUT PTRAY_NOTIFY_WND_DATA This,
     }
 }
 
     }
 }
 
-static LRESULT
+static VOID
 TrayNotifyWnd_DrawBackground(IN HWND hwnd,
 TrayNotifyWnd_DrawBackground(IN HWND hwnd,
-                             IN UINT uMsg,
-                             IN WPARAM wParam,
-                             IN LPARAM lParam)
+                             IN HDC hdc)
 {
     PTRAY_NOTIFY_WND_DATA This = (PTRAY_NOTIFY_WND_DATA)GetWindowLongPtr(hwnd, 0);
     RECT rect;
 {
     PTRAY_NOTIFY_WND_DATA This = (PTRAY_NOTIFY_WND_DATA)GetWindowLongPtr(hwnd, 0);
     RECT rect;
-    HDC hdc = (HDC)wParam;
 
     GetClientRect(hwnd, &rect);
 
     DrawThemeParentBackground(hwnd, hdc, &rect);
     DrawThemeBackground(This->TrayTheme, hdc, TNP_BACKGROUND, 0, &rect, 0);
 
     GetClientRect(hwnd, &rect);
 
     DrawThemeParentBackground(hwnd, hdc, &rect);
     DrawThemeBackground(This->TrayTheme, hdc, TNP_BACKGROUND, 0, &rect, 0);
-
-    return 0;
 }
 
 VOID
 }
 
 VOID
@@ -1724,8 +1719,7 @@ TrayNotifyWndProc(IN HWND hwnd,
 
     if (uMsg != WM_NCCREATE)
     {
 
     if (uMsg != WM_NCCREATE)
     {
-        This = (PTRAY_NOTIFY_WND_DATA)GetWindowLongPtr(hwnd,
-                                                       0);
+        This = (PTRAY_NOTIFY_WND_DATA)GetWindowLongPtr(hwnd, 0);
     }
 
     if (This != NULL || uMsg == WM_NCCREATE)
     }
 
     if (This != NULL || uMsg == WM_NCCREATE)
@@ -1738,7 +1732,8 @@ TrayNotifyWndProc(IN HWND hwnd,
             case WM_ERASEBKGND:
                 if (!This->TrayTheme)
                     break;
             case WM_ERASEBKGND:
                 if (!This->TrayTheme)
                     break;
-                return TrayNotifyWnd_DrawBackground(hwnd, uMsg, wParam, lParam);
+                TrayNotifyWnd_DrawBackground(hwnd, (HDC) wParam);
+                return 0;
             case TNWM_GETMINIMUMSIZE:
             {
                 return (LRESULT) TrayNotifyWnd_GetMinimumSize(This, (BOOL) wParam, (PSIZE) lParam);
             case TNWM_GETMINIMUMSIZE:
             {
                 return (LRESULT) TrayNotifyWnd_GetMinimumSize(This, (BOOL) wParam, (PSIZE) lParam);
@@ -1761,8 +1756,7 @@ TrayNotifyWndProc(IN HWND hwnd,
                 szClient.cx = LOWORD(lParam);
                 szClient.cy = HIWORD(lParam);
 
                 szClient.cx = LOWORD(lParam);
                 szClient.cy = HIWORD(lParam);
 
-                TrayNotifyWnd_Size(This,
-                                   &szClient);
+                TrayNotifyWnd_Size(This, &szClient);
                 return 0;
             }
 
                 return 0;
             }
 
index 1aec9fa..ac7ae7e 100644 (file)
@@ -22,6 +22,7 @@ CSysTray::~CSysTray() {}
 
 HRESULT CSysTray::InitIcons()
 {
 
 HRESULT CSysTray::InitIcons()
 {
+    TRACE("Initializing Notification icons...\n");
     for (int i = 0; i < g_NumIcons; i++)
     {
         HRESULT hr = g_IconHandlers[i].pfnInit(this);
     for (int i = 0; i < g_NumIcons; i++)
     {
         HRESULT hr = g_IconHandlers[i].pfnInit(this);
@@ -34,6 +35,7 @@ HRESULT CSysTray::InitIcons()
 
 HRESULT CSysTray::ShutdownIcons()
 {
 
 HRESULT CSysTray::ShutdownIcons()
 {
+    TRACE("Shutting down Notification icons...\n");
     for (int i = 0; i < g_NumIcons; i++)
     {
         HRESULT hr = g_IconHandlers[i].pfnShutdown(this);
     for (int i = 0; i < g_NumIcons; i++)
     {
         HRESULT hr = g_IconHandlers[i].pfnShutdown(this);
@@ -46,6 +48,7 @@ HRESULT CSysTray::ShutdownIcons()
 
 HRESULT CSysTray::UpdateIcons()
 {
 
 HRESULT CSysTray::UpdateIcons()
 {
+    TRACE("Updating Notification icons...\n");
     for (int i = 0; i < g_NumIcons; i++)
     {
         HRESULT hr = g_IconHandlers[i].pfnUpdate(this);
     for (int i = 0; i < g_NumIcons; i++)
     {
         HRESULT hr = g_IconHandlers[i].pfnUpdate(this);
@@ -73,9 +76,12 @@ HRESULT CSysTray::ProcessIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 HRESULT CSysTray::NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip)
 {
 
 HRESULT CSysTray::NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip)
 {
-    NOTIFYICONDATA nim;
+    NOTIFYICONDATA nim = { 0 };
+
+    TRACE("NotifyIcon code=%d, uId=%d, hIcon=%p, szTip=%S\n", code, uId, hIcon, szTip);
+
     nim.cbSize = sizeof(NOTIFYICONDATA);
     nim.cbSize = sizeof(NOTIFYICONDATA);
-    nim.uFlags = NIF_ICON | NIF_STATE | NIF_TIP;
+    nim.uFlags = NIF_MESSAGE | NIF_ICON | NIF_STATE | NIF_TIP;
     nim.hIcon = hIcon;
     nim.uID = uId;
     nim.uCallbackMessage = uId;
     nim.hIcon = hIcon;
     nim.uID = uId;
     nim.uCallbackMessage = uId;
index e74b988..bd639f1 100644 (file)
@@ -36,7 +36,7 @@
 
 extern HINSTANCE g_hInstance;
 
 
 extern HINSTANCE g_hInstance;
 
-#define ID_ICON_VOLUME 0x4CB
+#define ID_ICON_VOLUME (WM_APP + 0x4CB)
 
 #include "csystray.h"
 
 
 #include "csystray.h"
 
index d7c041d..844bdd0 100644 (file)
@@ -163,8 +163,7 @@ HRESULT STDMETHODCALLTYPE Volume_Init(_In_ CSysTray * pSysTray)
     else
         icon = g_hIconVolume;
 
     else
         icon = g_hIconVolume;
 
-    pSysTray->NotifyIcon(NIM_ADD, ID_ICON_VOLUME, icon, L"Placeholder");
-    return pSysTray->NotifyIcon(NIM_MODIFY, ID_ICON_VOLUME, icon, L"Placeholder");
+    return pSysTray->NotifyIcon(NIM_ADD, ID_ICON_VOLUME, icon, L"Volume Control");
 }
 
 HRESULT STDMETHODCALLTYPE Volume_Update(_In_ CSysTray * pSysTray)
 }
 
 HRESULT STDMETHODCALLTYPE Volume_Update(_In_ CSysTray * pSysTray)
@@ -200,11 +199,13 @@ HRESULT STDMETHODCALLTYPE Volume_Message(_In_ CSysTray * pSysTray, UINT uMsg, WP
         return Volume_OnDeviceChange(pSysTray, wParam, lParam);
 
     if (uMsg != ID_ICON_VOLUME)
         return Volume_OnDeviceChange(pSysTray, wParam, lParam);
 
     if (uMsg != ID_ICON_VOLUME)
+    {
+        TRACE("Volume_Message received for unknown ID %d, ignoring.\n");
         return S_FALSE;
         return S_FALSE;
+    }
 
 
-    TRACE("Volume_Message\n");
+    TRACE("Volume_Message uMsg=%d, w=%x, l=%x\n", uMsg, wParam, lParam);
 
 
-    TRACE("Calling update...\n");
     Volume_Update(pSysTray);
 
     switch (lParam)
     Volume_Update(pSysTray);
 
     switch (lParam)