Author: dquintana
Date: Thu Jun 19 23:38:39 2014
New Revision: 63623

URL: http://svn.reactos.org/svn/reactos?rev=63623&view=rev
Log:
[EXPLORER-NEW]
* Use a struct like the comment suggested. May not fix anything, but it's one 
FIXME less in ReactOS.

Modified:
    branches/shell-experiments/base/shell/explorer-new/trayntfy.c

Modified: branches/shell-experiments/base/shell/explorer-new/trayntfy.c
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/explorer-new/trayntfy.c?rev=63623&r1=63622&r2=63623&view=diff
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/trayntfy.c       
[iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/explorer-new/trayntfy.c       
[iso-8859-1] Thu Jun 19 23:38:39 2014
@@ -44,6 +44,13 @@
     INT VisibleButtonCount;
 } SYS_PAGER_WND_DATA, *PSYS_PAGER_WND_DATA;
 
+// Data comes from shell32/systray.cpp -> TrayNotifyCDS_Dummy
+typedef struct _SYS_PAGER_COPY_DATA
+{
+    DWORD           cookie;
+    DWORD           notify_code;
+    NOTIFYICONDATA  nicon_data;
+} SYS_PAGER_COPY_DATA, *PSYS_PAGER_COPY_DATA;
 
 static PNOTIFY_ITEM
 SysPagerWnd_CreateNotifyItemData(IN OUT PSYS_PAGER_WND_DATA This)
@@ -418,7 +425,7 @@
     PCOPYDATASTRUCT cpData = (PCOPYDATASTRUCT)lParam;
     if (cpData->dwData == 1)
     {
-        DWORD trayCommand;
+        SYS_PAGER_COPY_DATA data;
         NOTIFYICONDATA *iconData;
         HWND parentHWND;
         RECT windowRect;
@@ -426,15 +433,21 @@
         parentHWND = GetParent(parentHWND);
         GetClientRect(parentHWND, &windowRect);
 
-        /* FIXME: ever heard of "struct"? */
-        trayCommand = *(DWORD *) (((BYTE *)cpData->lpData) + 4);
-        iconData = (NOTIFYICONDATA *) (((BYTE *)cpData->lpData) + 8);
-
-        switch (trayCommand)
+        ZeroMemory(&data, sizeof(data));
+        CopyMemory(
+            &data,
+            (PSYS_PAGER_COPY_DATA) cpData->lpData,
+            cpData->dwData);
+        iconData = &data.nicon_data;
+
+        switch (data.notify_code)
         {
             case NIM_ADD:
             {
                 PPNOTIFY_ITEM NotifyPointer;
+
+                DbgPrint("NotifyMessage received with NIM_ADD\n");
+
                 NotifyPointer = SysPagerWnd_FindPPNotifyItemByIconData(This,
                                                                        
iconData);
                 if (!NotifyPointer)
@@ -446,6 +459,9 @@
             case NIM_MODIFY:
             {
                 PPNOTIFY_ITEM NotifyPointer;
+
+                DbgPrint("NotifyMessage received with NIM_MODIFY\n");
+
                 NotifyPointer = SysPagerWnd_FindPPNotifyItemByIconData(This,
                                                                        
iconData);
                 if (!NotifyPointer)
@@ -460,9 +476,14 @@
             }
             case NIM_DELETE:
             {
+                DbgPrint("NotifyMessage received with NIM_DELETE\n");
+
                 SysPagerWnd_RemoveButton(This, iconData);
                 break;
             }
+            default:
+                DbgPrint("NotifyMessage received with unknown code %d.\n", 
data.notify_code);
+                break;
         }
         SendMessage(parentHWND,
                     WM_SIZE,


Reply via email to