[EXPLORER_NEW]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 20 Apr 2013 19:34:32 +0000 (19:34 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 20 Apr 2013 19:34:32 +0000 (19:34 +0000)
- Open Date and Time Properties on double-click on the tray clock. Based on patch by Edijs Kolesnikovičs and Grégori Macário Harbs.
CORE-6860 #resolve

svn path=/trunk/; revision=58794

reactos/base/shell/explorer-new/precomp.h
reactos/base/shell/explorer-new/trayntfy.c
reactos/base/shell/explorer-new/traywnd.c

index 56e4a4b..3ccceb1 100644 (file)
@@ -424,6 +424,10 @@ TrayNotify_NotifyMsg(IN HWND hwnd,
                      IN WPARAM wParam,
                      IN LPARAM lParam);
 
+BOOL
+TrayNotify_GetClockRect(IN HWND hwnd,
+                        OUT PRECT rcClock);
+
 /*
  * taskswnd.c
  */
index 2f156d4..ec6e9ad 100644 (file)
@@ -1683,6 +1683,17 @@ TrayNotify_NotifyMsg(IN HWND hwnd,
     }
 }
 
+BOOL
+TrayNotify_GetClockRect(IN HWND hwnd,
+                        OUT PRECT rcClock)
+{
+    PTRAY_NOTIFY_WND_DATA This = (PTRAY_NOTIFY_WND_DATA)GetWindowLongPtr(hwnd, 0);
+    if (!IsWindowVisible(This->hWndTrayClock))
+        return FALSE;
+
+    return GetWindowRect(This->hWndTrayClock, rcClock);
+}
+
 static LRESULT CALLBACK
 TrayNotifyWndProc(IN HWND hwnd,
                   IN UINT uMsg,
index c5cd756..0cfdb21 100644 (file)
@@ -2494,9 +2494,23 @@ HandleTrayContextMenu:
             }
 
             case WM_NCLBUTTONDBLCLK:
+            {
                 /* We "handle" this message so users can't cause a weird maximize/restore
                    window animation when double-clicking the tray window! */
+
+                /* We should forward mouse messages to child windows here.
+                   Right now, this is only clock double-click */
+                RECT rcClock;
+                if (TrayNotify_GetClockRect(This->hwndTrayNotify, &rcClock))
+                {
+                    POINT ptClick;
+                    ptClick.x = MAKEPOINTS(lParam).x;
+                    ptClick.y = MAKEPOINTS(lParam).y;
+                    if (PtInRect(&rcClock, ptClick))
+                        LaunchCPanel(NULL, TEXT("timedate.cpl"));
+                }
                 break;
+            }
 
             case WM_NCCREATE:
             {