mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:22:57 +00:00
[EXPLORER] Simplify how autohide is implemented
Do not change m_TrayRects when m_AutoHideOffset is changed. m_AutoHideOffset will be taken into account only while WM_WINDOWPOSCHANGING is processed
This commit is contained in:
parent
840320cbd1
commit
4238f22396
1 changed files with 18 additions and 86 deletions
|
@ -1090,13 +1090,6 @@ GetPrimaryScreenRect:
|
||||||
szTray.cy = rcPos.bottom - rcPos.top;
|
szTray.cy = rcPos.bottom - rcPos.top;
|
||||||
|
|
||||||
GetTrayRectFromScreenRect(Pos, &rcScreen, &szTray, pRect);
|
GetTrayRectFromScreenRect(Pos, &rcScreen, &szTray, pRect);
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
pRect->left += m_AutoHideOffset.cx;
|
|
||||||
pRect->right += m_AutoHideOffset.cx;
|
|
||||||
pRect->top += m_AutoHideOffset.cy;
|
|
||||||
pRect->bottom += m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
hMon = hMonNew;
|
hMon = hMonNew;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1104,13 +1097,6 @@ GetPrimaryScreenRect:
|
||||||
/* The user is dragging the tray window on the same monitor. We don't need
|
/* The user is dragging the tray window on the same monitor. We don't need
|
||||||
to recalculate the rectangle */
|
to recalculate the rectangle */
|
||||||
*pRect = rcPos;
|
*pRect = rcPos;
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
pRect->left += m_AutoHideOffset.cx;
|
|
||||||
pRect->right += m_AutoHideOffset.cx;
|
|
||||||
pRect->top += m_AutoHideOffset.cy;
|
|
||||||
pRect->bottom += m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*phMonitor = hMon;
|
*phMonitor = hMon;
|
||||||
|
@ -1146,13 +1132,6 @@ GetPrimaryScreenRect:
|
||||||
rcTray.top = pwp->y;
|
rcTray.top = pwp->y;
|
||||||
rcTray.right = rcTray.left + pwp->cx;
|
rcTray.right = rcTray.left + pwp->cx;
|
||||||
rcTray.bottom = rcTray.top + pwp->cy;
|
rcTray.bottom = rcTray.top + pwp->cy;
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
rcTray.left -= m_AutoHideOffset.cx;
|
|
||||||
rcTray.right -= m_AutoHideOffset.cx;
|
|
||||||
rcTray.top -= m_AutoHideOffset.cy;
|
|
||||||
rcTray.bottom -= m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!EqualRect(&rcTray,
|
if (!EqualRect(&rcTray,
|
||||||
&m_TrayRects[m_DraggingPosition]))
|
&m_TrayRects[m_DraggingPosition]))
|
||||||
|
@ -1204,13 +1183,6 @@ GetPrimaryScreenRect:
|
||||||
MakeTrayRectWithSize(m_Position, &szWnd, &rcTray);
|
MakeTrayRectWithSize(m_Position, &szWnd, &rcTray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
rcTray.left -= m_AutoHideOffset.cx;
|
|
||||||
rcTray.right -= m_AutoHideOffset.cx;
|
|
||||||
rcTray.top -= m_AutoHideOffset.cy;
|
|
||||||
rcTray.bottom -= m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
m_TrayRects[m_Position] = rcTray;
|
m_TrayRects[m_Position] = rcTray;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1219,20 +1191,21 @@ GetPrimaryScreenRect:
|
||||||
new size or position is valid. this is to prevent changes to the window
|
new size or position is valid. this is to prevent changes to the window
|
||||||
without user interaction. */
|
without user interaction. */
|
||||||
rcTray = m_TrayRects[m_Position];
|
rcTray = m_TrayRects[m_Position];
|
||||||
|
|
||||||
|
if (AutoHide)
|
||||||
|
{
|
||||||
|
rcTray.left += m_AutoHideOffset.cx;
|
||||||
|
rcTray.right += m_AutoHideOffset.cx;
|
||||||
|
rcTray.top += m_AutoHideOffset.cy;
|
||||||
|
rcTray.bottom += m_AutoHideOffset.cy;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangePos:
|
ChangePos:
|
||||||
m_TraySize.cx = rcTray.right - rcTray.left;
|
m_TraySize.cx = rcTray.right - rcTray.left;
|
||||||
m_TraySize.cy = rcTray.bottom - rcTray.top;
|
m_TraySize.cy = rcTray.bottom - rcTray.top;
|
||||||
|
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
rcTray.left += m_AutoHideOffset.cx;
|
|
||||||
rcTray.right += m_AutoHideOffset.cx;
|
|
||||||
rcTray.top += m_AutoHideOffset.cy;
|
|
||||||
rcTray.bottom += m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
|
|
||||||
pwp->flags &= ~(SWP_NOMOVE | SWP_NOSIZE);
|
pwp->flags &= ~(SWP_NOMOVE | SWP_NOSIZE);
|
||||||
pwp->x = rcTray.left;
|
pwp->x = rcTray.left;
|
||||||
pwp->y = rcTray.top;
|
pwp->y = rcTray.top;
|
||||||
|
@ -1332,18 +1305,7 @@ ChangePos:
|
||||||
|
|
||||||
VOID CheckTrayWndPosition()
|
VOID CheckTrayWndPosition()
|
||||||
{
|
{
|
||||||
RECT rcTray;
|
/* Force the rebar bands to resize */
|
||||||
|
|
||||||
rcTray = m_TrayRects[m_Position];
|
|
||||||
|
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
rcTray.left += m_AutoHideOffset.cx;
|
|
||||||
rcTray.right += m_AutoHideOffset.cx;
|
|
||||||
rcTray.top += m_AutoHideOffset.cy;
|
|
||||||
rcTray.bottom += m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
|
|
||||||
IUnknown_Exec(m_TrayBandSite,
|
IUnknown_Exec(m_TrayBandSite,
|
||||||
IID_IDeskBand,
|
IID_IDeskBand,
|
||||||
DBID_BANDINFOCHANGED,
|
DBID_BANDINFOCHANGED,
|
||||||
|
@ -1351,19 +1313,14 @@ ChangePos:
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
FitToRebar(&rcTray);
|
/* Calculate the size of the taskbar based on the rebar */
|
||||||
m_TrayRects[m_Position] = rcTray;
|
FitToRebar(&m_TrayRects[m_Position]);
|
||||||
|
|
||||||
/* Move the tray window */
|
/* Move the tray window */
|
||||||
SetWindowPos(NULL,
|
/* The handler of WM_WINDOWPOSCHANGING will override whatever size
|
||||||
rcTray.left,
|
*and position we use here with m_TrayRects */
|
||||||
rcTray.top,
|
SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||||
rcTray.right - rcTray.left,
|
|
||||||
rcTray.bottom - rcTray.top,
|
|
||||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
|
||||||
|
|
||||||
ResizeWorkArea();
|
ResizeWorkArea();
|
||||||
|
|
||||||
ApplyClipping(TRUE);
|
ApplyClipping(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1788,12 +1745,9 @@ ChangePos:
|
||||||
|
|
||||||
void ProcessAutoHide()
|
void ProcessAutoHide()
|
||||||
{
|
{
|
||||||
RECT rc = m_TrayRects[m_Position];
|
|
||||||
INT w = m_TraySize.cx - GetSystemMetrics(SM_CXBORDER) * 2 - 1;
|
INT w = m_TraySize.cx - GetSystemMetrics(SM_CXBORDER) * 2 - 1;
|
||||||
INT h = m_TraySize.cy - GetSystemMetrics(SM_CYBORDER) * 2 - 1;
|
INT h = m_TraySize.cy - GetSystemMetrics(SM_CYBORDER) * 2 - 1;
|
||||||
|
|
||||||
TRACE("AutoHide Timer received for %u, rc=(%d, %d, %d, %d), w=%d, h=%d.\n", m_AutoHideState, rc.left, rc.top, rc.right, rc.bottom, w, h);
|
|
||||||
|
|
||||||
switch (m_AutoHideState)
|
switch (m_AutoHideState)
|
||||||
{
|
{
|
||||||
case AUTOHIDE_HIDING:
|
case AUTOHIDE_HIDING:
|
||||||
|
@ -1899,13 +1853,7 @@ ChangePos:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.left += m_AutoHideOffset.cx;
|
SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER);
|
||||||
rc.right += m_AutoHideOffset.cx;
|
|
||||||
rc.top += m_AutoHideOffset.cy;
|
|
||||||
rc.bottom += m_AutoHideOffset.cy;
|
|
||||||
|
|
||||||
TRACE("AutoHide Changing position to (%d, %d, %d, %d) and state=%u.\n", rc.left, rc.top, rc.right, rc.bottom, m_AutoHideState);
|
|
||||||
SetWindowPos(NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_NOZORDER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2367,14 +2315,6 @@ ChangePos:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pRect = m_TrayRects[m_Position];
|
*pRect = m_TrayRects[m_Position];
|
||||||
|
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
pRect->left += m_AutoHideOffset.cx;
|
|
||||||
pRect->right += m_AutoHideOffset.cx;
|
|
||||||
pRect->top += m_AutoHideOffset.cy;
|
|
||||||
pRect->bottom += m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -2390,19 +2330,11 @@ ChangePos:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pRect = m_TrayRects[m_Position];
|
*pRect = m_TrayRects[m_Position];
|
||||||
|
|
||||||
if (AutoHide)
|
|
||||||
{
|
|
||||||
pRect->left += m_AutoHideOffset.cx;
|
|
||||||
pRect->right += m_AutoHideOffset.cx;
|
|
||||||
pRect->top += m_AutoHideOffset.cy;
|
|
||||||
pRect->bottom += m_AutoHideOffset.cy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT OnWindowPosChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||||
{
|
{
|
||||||
ChangingWinPos((LPWINDOWPOS) lParam);
|
ChangingWinPos((LPWINDOWPOS) lParam);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2925,7 +2857,7 @@ HandleTrayContextMenu:
|
||||||
MESSAGE_HANDLER(WM_CTLCOLORBTN, OnCtlColorBtn)
|
MESSAGE_HANDLER(WM_CTLCOLORBTN, OnCtlColorBtn)
|
||||||
MESSAGE_HANDLER(WM_MOVING, OnMoving)
|
MESSAGE_HANDLER(WM_MOVING, OnMoving)
|
||||||
MESSAGE_HANDLER(WM_SIZING, OnSizing)
|
MESSAGE_HANDLER(WM_SIZING, OnSizing)
|
||||||
MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChange)
|
MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging)
|
||||||
MESSAGE_HANDLER(WM_ENTERSIZEMOVE, OnEnterSizeMove)
|
MESSAGE_HANDLER(WM_ENTERSIZEMOVE, OnEnterSizeMove)
|
||||||
MESSAGE_HANDLER(WM_EXITSIZEMOVE, OnExitSizeMove)
|
MESSAGE_HANDLER(WM_EXITSIZEMOVE, OnExitSizeMove)
|
||||||
MESSAGE_HANDLER(WM_NCLBUTTONDOWN, OnNcLButtonDown)
|
MESSAGE_HANDLER(WM_NCLBUTTONDOWN, OnNcLButtonDown)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue