mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
fixed treenew using CPU time unnecessarily during drag selection
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@4355 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -567,6 +567,12 @@ VOID PhTnpProcessScroll(
|
||||
__in LONG DeltaX
|
||||
);
|
||||
|
||||
BOOLEAN PhTnpCanScroll(
|
||||
__in PPH_TREENEW_CONTEXT Context,
|
||||
__in BOOLEAN Horizontal,
|
||||
__in BOOLEAN Positive
|
||||
);
|
||||
|
||||
// Drawing
|
||||
|
||||
VOID PhTnpPaint(
|
||||
|
||||
@@ -4424,6 +4424,35 @@ VOID PhTnpProcessScroll(
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN PhTnpCanScroll(
|
||||
__in PPH_TREENEW_CONTEXT Context,
|
||||
__in BOOLEAN Horizontal,
|
||||
__in BOOLEAN Positive
|
||||
)
|
||||
{
|
||||
SCROLLINFO scrollInfo;
|
||||
|
||||
scrollInfo.cbSize = sizeof(SCROLLINFO);
|
||||
scrollInfo.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
|
||||
|
||||
if (!Horizontal)
|
||||
GetScrollInfo(Context->VScrollHandle, SB_CTL, &scrollInfo);
|
||||
else
|
||||
GetScrollInfo(Context->HScrollHandle, SB_CTL, &scrollInfo);
|
||||
|
||||
if (Positive)
|
||||
{
|
||||
if (scrollInfo.nPage != 0)
|
||||
scrollInfo.nMax -= scrollInfo.nPage - 1;
|
||||
|
||||
return scrollInfo.nPos < scrollInfo.nMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
return scrollInfo.nPos > scrollInfo.nMin;
|
||||
}
|
||||
}
|
||||
|
||||
VOID PhTnpPaint(
|
||||
__in HWND hwnd,
|
||||
__in PPH_TREENEW_CONTEXT Context,
|
||||
@@ -5732,7 +5761,8 @@ VOID PhTnpDragSelect(
|
||||
leftOrRight = cursorPoint.x < windowRect.left || cursorPoint.x >= windowRect.right;
|
||||
aboveOrBelow = cursorPoint.y < windowRect.top || cursorPoint.y >= windowRect.bottom;
|
||||
|
||||
if ((Context->VScrollVisible && aboveOrBelow) || (Context->HScrollVisible && leftOrRight))
|
||||
if ((Context->VScrollVisible && aboveOrBelow && PhTnpCanScroll(Context, FALSE, cursorPoint.y >= windowRect.bottom)) ||
|
||||
(Context->HScrollVisible && leftOrRight && PhTnpCanScroll(Context, FALSE, cursorPoint.x >= windowRect.right)))
|
||||
{
|
||||
SetCursorPos(cursorPoint.x, cursorPoint.y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user