mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 10:46:58 +00:00
[EXPLORER] 'Show Desktop' button should work on button up (#4718)
Follow-up of PR #4715. CORE-15369 - The 'Show Desktop' button of taskbar works on button up instead of button down. - Add NULL checks for m_ShowDesktopButton. - Fix hung-up in rebooting.
This commit is contained in:
parent
26efda4d8d
commit
ba2cead8a2
1 changed files with 12 additions and 8 deletions
|
@ -310,7 +310,7 @@ public:
|
|||
return 0;
|
||||
|
||||
// Show/Hide Desktop
|
||||
::SendMessageW(::GetParent(m_hWnd), WM_COMMAND, TRAYCMD_TOGGLE_DESKTOP, 0);
|
||||
GetParent().SendMessage(WM_COMMAND, TRAYCMD_TOGGLE_DESKTOP, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ public:
|
|||
PostMessage(TSDB_CLICK, 0, 0);
|
||||
}
|
||||
|
||||
LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
Click(); // Left-click
|
||||
return 0;
|
||||
|
@ -357,6 +357,8 @@ public:
|
|||
|
||||
BOOL PtInButton(POINT pt)
|
||||
{
|
||||
if (!IsWindow())
|
||||
return FALSE;
|
||||
RECT rc;
|
||||
GetWindowRect(&rc);
|
||||
INT cxEdge = ::GetSystemMetrics(SM_CXEDGE), cyEdge = ::GetSystemMetrics(SM_CYEDGE);
|
||||
|
@ -375,7 +377,7 @@ public:
|
|||
m_bHovering = TRUE;
|
||||
SetTimer(SHOW_DESKTOP_TIMER_ID, SHOW_DESKTOP_TIMER_INTERVAL, NULL);
|
||||
InvalidateRect(NULL, TRUE);
|
||||
::SendMessageW(::GetParent(m_hWnd), WM_NCPAINT, 0, 0);
|
||||
GetParent().PostMessage(WM_NCPAINT, 0, 0);
|
||||
}
|
||||
|
||||
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
|
@ -396,7 +398,7 @@ public:
|
|||
m_bHovering = FALSE;
|
||||
KillTimer(SHOW_DESKTOP_TIMER_ID);
|
||||
InvalidateRect(NULL, TRUE);
|
||||
::SendMessageW(::GetParent(m_hWnd), WM_NCPAINT, 0, 0);
|
||||
GetParent().PostMessage(WM_NCPAINT, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -413,7 +415,7 @@ public:
|
|||
}
|
||||
|
||||
BEGIN_MSG_MAP(CTrayShowDesktopButton)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
|
||||
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChanged)
|
||||
MESSAGE_HANDLER(WM_THEMECHANGED, OnSettingChanged)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
|
@ -2605,13 +2607,15 @@ ChangePos:
|
|||
// We have to draw non-client area because the 'Show Desktop' button is beyond client area.
|
||||
void DrawShowDesktopButton()
|
||||
{
|
||||
if (!m_ShowDesktopButton.IsWindow())
|
||||
return;
|
||||
// Get the rectangle in window coordinates
|
||||
RECT rcButton, rcWnd;
|
||||
GetWindowRect(&rcWnd);
|
||||
m_ShowDesktopButton.GetWindowRect(&rcButton);
|
||||
::OffsetRect(&rcButton, -rcWnd.left, -rcWnd.top);
|
||||
|
||||
HDC hdc = GetDCEx(NULL, DCX_WINDOW | DCX_CACHE | DCX_NORESETATTRS);
|
||||
HDC hdc = GetDCEx(NULL, DCX_WINDOW | DCX_CACHE);
|
||||
m_ShowDesktopButton.OnDraw(hdc, &rcButton); // Draw the button
|
||||
ReleaseDC(hdc);
|
||||
}
|
||||
|
@ -3232,10 +3236,10 @@ HandleTrayContextMenu:
|
|||
|
||||
LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
DefWindowProc(uMsg, wParam, lParam);
|
||||
LRESULT ret = DefWindowProc(uMsg, wParam, lParam);
|
||||
DrawShowDesktopButton(); // We have to draw non-client area
|
||||
bHandled = TRUE;
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
LRESULT OnNcCalcSize(INT code, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
|
|
Loading…
Reference in a new issue