From 2fa8800e5e2e43ab386df5286f02e546bc946256 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 28 May 2017 18:31:48 +0000 Subject: [PATCH 1/1] [EXPLORER] -Implement the trick that makes the start button to get clicked when the user clicks on the corner of the screen. svn path=/trunk/; revision=74692 --- reactos/base/shell/explorer/precomp.h | 3 ++ reactos/base/shell/explorer/taskswnd.cpp | 3 -- reactos/base/shell/explorer/trayntfy.cpp | 3 -- reactos/base/shell/explorer/traywnd.cpp | 58 ++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/reactos/base/shell/explorer/precomp.h b/reactos/base/shell/explorer/precomp.h index fc5d23d9b73..a63c473ded5 100644 --- a/reactos/base/shell/explorer/precomp.h +++ b/reactos/base/shell/explorer/precomp.h @@ -58,6 +58,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 */ diff --git a/reactos/base/shell/explorer/taskswnd.cpp b/reactos/base/shell/explorer/taskswnd.cpp index 28ea46ca491..1dd2bf5ef2c 100644 --- a/reactos/base/shell/explorer/taskswnd.cpp +++ b/reactos/base/shell/explorer/taskswnd.cpp @@ -21,9 +21,6 @@ #include "precomp.h" #include -#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 */ #define DUMP_TASKS 0 diff --git a/reactos/base/shell/explorer/trayntfy.cpp b/reactos/base/shell/explorer/trayntfy.cpp index d91e2f5d4fd..6ece02d875f 100644 --- a/reactos/base/shell/explorer/trayntfy.cpp +++ b/reactos/base/shell/explorer/trayntfy.cpp @@ -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 */ diff --git a/reactos/base/shell/explorer/traywnd.cpp b/reactos/base/shell/explorer/traywnd.cpp index 4c3b6b29576..d4920552987 100644 --- a/reactos/base/shell/explorer/traywnd.cpp +++ b/reactos/base/shell/explorer/traywnd.cpp @@ -2446,6 +2446,63 @@ ChangePos: 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 @@ HandleTrayContextMenu: 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) -- 2.17.1