Author: gadamopoulos
Date: Sun May 28 18:31:48 2017
New Revision: 74692

URL: http://svn.reactos.org/svn/reactos?rev=74692&view=rev
Log:
[EXPLORER] -Implement the trick that makes the start button to get clicked when 
the user clicks on the corner of the screen.

Modified:
    trunk/reactos/base/shell/explorer/precomp.h
    trunk/reactos/base/shell/explorer/taskswnd.cpp
    trunk/reactos/base/shell/explorer/trayntfy.cpp
    trunk/reactos/base/shell/explorer/traywnd.cpp

Modified: trunk/reactos/base/shell/explorer/precomp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precomp.h?rev=74692&r1=74691&r2=74692&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Sun May 28 
18:31:48 2017
@@ -57,6 +57,9 @@
 extern HINSTANCE hExplorerInstance;
 extern HANDLE hProcessHeap;
 extern HKEY hkExplorer;
+
+#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
+#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
 
 /*
  * explorer.c

Modified: trunk/reactos/base/shell/explorer/taskswnd.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskswnd.cpp?rev=74692&r1=74691&r2=74692&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/taskswnd.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskswnd.cpp      [iso-8859-1] Sun May 28 
18:31:48 2017
@@ -20,9 +20,6 @@
 
 #include "precomp.h"
 #include <commoncontrols.h>
-
-#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
-#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
 
 /* Set DUMP_TASKS to 1 to enable a dump of the tasks and task groups every
    5 seconds */

Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/trayntfy.cpp?rev=74692&r1=74691&r2=74692&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/trayntfy.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/trayntfy.cpp      [iso-8859-1] Sun May 28 
18:31:48 2017
@@ -20,9 +20,6 @@
 
 #include "precomp.h"
 
-#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
-#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
-
 /*
  * SysPagerWnd
  */

Modified: trunk/reactos/base/shell/explorer/traywnd.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywnd.cpp?rev=74692&r1=74691&r2=74692&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/traywnd.cpp       [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/traywnd.cpp       [iso-8859-1] Sun May 28 
18:31:48 2017
@@ -2446,6 +2446,63 @@
         return TRUE;
     }
 
+    LRESULT OnNcLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& 
bHandled)
+    {
+        /* This handler implements the trick that makes  the start button to 
+           get pressed when the user clicked left or below the button */
+
+        POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
+        WINDOWINFO wi = {sizeof(WINDOWINFO)};
+        RECT rcStartBtn;
+
+        bHandled = FALSE;
+
+        m_StartButton.GetWindowRect(&rcStartBtn);
+        GetWindowInfo(m_hWnd, &wi);
+
+        switch (m_Position)
+        {
+            case ABE_TOP:
+            case ABE_LEFT:
+            {
+                if (pt.x > rcStartBtn.right || pt.y > rcStartBtn.bottom)
+                    return 0;
+                break;
+            }
+            case ABE_RIGHT:
+            {
+                if (pt.x < rcStartBtn.left || pt.y > rcStartBtn.bottom)
+                    return 0;
+
+                if (rcStartBtn.right + (int)wi.cxWindowBorders * 2 + 1 < 
wi.rcWindow.right &&
+                    pt.x > rcStartBtn.right)
+                {
+                    return 0;
+                }
+                break;
+            }
+            case ABE_BOTTOM:
+            {
+                if (pt.x > rcStartBtn.right || pt.y < rcStartBtn.top)
+                {
+                    return 0;
+                }
+
+                if (rcStartBtn.bottom + (int)wi.cyWindowBorders * 2 + 1 < 
wi.rcWindow.bottom &&
+                    pt.y > rcStartBtn.bottom)
+                {
+                    return 0;
+                }
+
+                break;
+            }
+        }
+
+        bHandled = TRUE;
+        PopupStartMenu();
+        return 0;
+    }
+
     LRESULT OnNcRButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& 
bHandled)
     {
         /* We want the user to be able to get a context menu even on the 
nonclient
@@ -2798,6 +2855,7 @@
         MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChange)
         MESSAGE_HANDLER(WM_ENTERSIZEMOVE, OnEnterSizeMove)
         MESSAGE_HANDLER(WM_EXITSIZEMOVE, OnExitSizeMove)
+        MESSAGE_HANDLER(WM_NCLBUTTONDOWN, OnNcLButtonDown)
         MESSAGE_HANDLER(WM_SYSCHAR, OnSysChar)
         MESSAGE_HANDLER(WM_NCRBUTTONUP, OnNcRButtonUp)
         MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClick)


Reply via email to