Ken Thomases : user32: Fix mouseRect computation for starting position when sizing window.

Alexandre Julliard julliard at winehq.org
Thu Sep 12 14:55:21 CDT 2013


Module: wine
Branch: master
Commit: c7d2bcfb6114fb13eeee8d0513f4587472d20019
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c7d2bcfb6114fb13eeee8d0513f4587472d20019

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Sep 11 23:45:52 2013 -0500

user32: Fix mouseRect computation for starting position when sizing window.

The mouseRect is the limit of the mouse position to keep the window between
its minimum and maximum sizes.  The computation was correct if the mouse
started precisely on the window border.  But if the mouse is not exactly at
the border, then the mouse limit has to account for that, because the window
will be resized based on the distance from the starting point.

---

 dlls/user32/winpos.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 308e7ea..22ee290 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -2677,23 +2677,23 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
 
     if (ON_LEFT_BORDER(hittest))
     {
-        mouseRect.left  = max( mouseRect.left, sizingRect.right-maxTrack.x );
-        mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x );
+        mouseRect.left  = max( mouseRect.left, sizingRect.right-maxTrack.x+capturePoint.x-sizingRect.left );
+        mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x+capturePoint.x-sizingRect.left );
     }
     else if (ON_RIGHT_BORDER(hittest))
     {
-        mouseRect.left  = max( mouseRect.left, sizingRect.left+minTrack.x );
-        mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x );
+        mouseRect.left  = max( mouseRect.left, sizingRect.left+minTrack.x+capturePoint.x-sizingRect.right );
+        mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x+capturePoint.x-sizingRect.right );
     }
     if (ON_TOP_BORDER(hittest))
     {
-        mouseRect.top    = max( mouseRect.top, sizingRect.bottom-maxTrack.y );
-        mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y);
+        mouseRect.top    = max( mouseRect.top, sizingRect.bottom-maxTrack.y+capturePoint.y-sizingRect.top );
+        mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y+capturePoint.y-sizingRect.top);
     }
     else if (ON_BOTTOM_BORDER(hittest))
     {
-        mouseRect.top    = max( mouseRect.top, sizingRect.top+minTrack.y );
-        mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y );
+        mouseRect.top    = max( mouseRect.top, sizingRect.top+minTrack.y+capturePoint.y-sizingRect.bottom );
+        mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y+capturePoint.y-sizingRect.bottom );
     }
 
     /* Retrieve a default cache DC (without using the window style) */




More information about the wine-cvs mailing list