aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/ScintillaWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-03-18 19:22:38 +1100
committerNeil <nyamatongwe@gmail.com>2019-03-18 19:22:38 +1100
commit7e4bd49b1315de495ad37ed7d19897abdcf44b94 (patch)
tree8737893d8ce56a276bd673d4d236ed2ab66f3b9a /win32/ScintillaWin.cxx
parent0bc5b663b3166f562053413ce9381ad481e68a99 (diff)
downloadscintilla-mirror-7e4bd49b1315de495ad37ed7d19897abdcf44b94.tar.gz
Backport: Add some operators to Point to simplify client code.
Backport of changeset 7321:d488340e94c0.
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r--win32/ScintillaWin.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index d4f9a7a14..b1f0412bd 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -627,8 +627,9 @@ HWND ScintillaWin::MainHWND() const noexcept {
}
bool ScintillaWin::DragThreshold(Point ptStart, Point ptNow) {
- const int xMove = static_cast<int>(std::abs(ptStart.x - ptNow.x));
- const int yMove = static_cast<int>(std::abs(ptStart.y - ptNow.y));
+ const Point ptDifference = ptStart - ptNow;
+ const XYPOSITION xMove = std::trunc(std::abs(ptDifference.x));
+ const XYPOSITION yMove = std::trunc(std::abs(ptDifference.y));
return (xMove > ::GetSystemMetrics(SM_CXDRAG)) ||
(yMove > ::GetSystemMetrics(SM_CYDRAG));
}
@@ -1418,7 +1419,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
// Windows might send WM_MOUSEMOVE even though the mouse has not been moved:
// http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx
- if (ptMouseLast.x != pt.x || ptMouseLast.y != pt.y) {
+ if (ptMouseLast != pt) {
SetTrackMouseLeaveEvent(true);
ButtonMoveWithModifiers(pt, ::GetMessageTime(), MouseModifiers(wParam));
}