[PATCH] user32: Removed 16-bit windows position and size constraints
Kees Beets
kbeets68 at gmail.com
Sun Mar 12 05:20:30 CDT 2017
Fixes https://bugs.winehq.org/show_bug.cgi?id=38231
Removed 16-bit windows position and size constraints
introduced in 2006. Only kept truncation to 16-bit
in windows messaging to keep same behaviour as windows.
Tested on Ubuntu 16.04. 0 failures in win tests.
Signed-off-by: Kees Beets <kbeets68 at gmail.com>
---
dlls/user32/winpos.c | 47 ++++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index c2b35ec..832e43e 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1638,6 +1638,7 @@ static void dump_winpos_flags(UINT flags)
*/
static BOOL SWP_DoWinPosChanging( WINDOWPOS* pWinpos, RECT* pNewWindowRect, RECT* pNewClientRect )
{
+ int x, y;
WND *wndPtr;
RECT window_rect, client_rect;
@@ -1645,7 +1646,20 @@ static BOOL SWP_DoWinPosChanging( WINDOWPOS* pWinpos, RECT* pNewWindowRect, RECT
if (!(pWinpos->flags & SWP_NOSENDCHANGING)
&& !((pWinpos->flags & SWP_AGG_NOCLIENTCHANGE) && (pWinpos->flags & SWP_SHOWWINDOW)))
+ {
+ /* truncate x,y to 16-bit in WM_WINDOWPOSCHANGING message (only) */
+ x = pWinpos->x;
+ y = pWinpos->y;
+ if (pWinpos->x < -32768) pWinpos->x = -32768;
+ else if (pWinpos->x > 32767) pWinpos->x = 32767;
+ if (pWinpos->y < -32768) pWinpos->y = -32768;
+ else if (pWinpos->y > 32767) pWinpos->y = 32767;
+ if (pWinpos->cx < 0) pWinpos->cx = 0;
+ if (pWinpos->cy < 0) pWinpos->cy = 0;
SendMessageW( pWinpos->hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)pWinpos );
+ pWinpos->x = x;
+ pWinpos->y = y;
+ }
if (!(wndPtr = WIN_GetPtr( pWinpos->hwnd )) ||
wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return FALSE;
@@ -1921,15 +1935,8 @@ static BOOL fixup_flags( WINDOWPOS *winpos )
winpos->hwnd = wndPtr->obj.handle; /* make it a full handle */
/* Finally make sure that all coordinates are valid */
- if (winpos->x < -32768) winpos->x = -32768;
- else if (winpos->x > 32767) winpos->x = 32767;
- if (winpos->y < -32768) winpos->y = -32768;
- else if (winpos->y > 32767) winpos->y = 32767;
-
if (winpos->cx < 0) winpos->cx = 0;
- else if (winpos->cx > 32767) winpos->cx = 32767;
if (winpos->cy < 0) winpos->cy = 0;
- else if (winpos->cy > 32767) winpos->cy = 32767;
parent = GetAncestor( winpos->hwnd, GA_PARENT );
if (!IsWindowVisible( parent )) winpos->flags |= SWP_NOREDRAW;
@@ -2171,6 +2178,7 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
*/
BOOL USER_SetWindowPos( WINDOWPOS * winpos )
{
+ INT x, y;
RECT newWindowRect, newClientRect, valid_rects[2];
UINT orig_flags;
@@ -2197,22 +2205,6 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos )
}
}
- /* Make sure that coordinates are valid for WM_WINDOWPOSCHANGING */
- if (!(winpos->flags & SWP_NOMOVE))
- {
- if (winpos->x < -32768) winpos->x = -32768;
- else if (winpos->x > 32767) winpos->x = 32767;
- if (winpos->y < -32768) winpos->y = -32768;
- else if (winpos->y > 32767) winpos->y = 32767;
- }
- if (!(winpos->flags & SWP_NOSIZE))
- {
- if (winpos->cx < 0) winpos->cx = 0;
- else if (winpos->cx > 32767) winpos->cx = 32767;
- if (winpos->cy < 0) winpos->cy = 0;
- else if (winpos->cy > 32767) winpos->cy = 32767;
- }
-
if (!SWP_DoWinPosChanging( winpos, &newWindowRect, &newClientRect )) return FALSE;
/* Fix redundant flags */
@@ -2282,7 +2274,16 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos )
winpos->y = newWindowRect.top;
winpos->cx = newWindowRect.right - newWindowRect.left;
winpos->cy = newWindowRect.bottom - newWindowRect.top;
+ /* truncate x,y to 16-bit in WM_WINDOWPOSCHANGED message (only) */
+ x = winpos->x;
+ y = winpos->y;
+ if (winpos->x < -32768) winpos->x = -32768;
+ else if (winpos->x > 32767) winpos->x = 32767;
+ if (winpos->y < -32768) winpos->y = -32768;
+ else if (winpos->y > 32767) winpos->y = 32767;
SendMessageW( winpos->hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)winpos );
+ winpos->x = x;
+ winpos->y = y;
}
return TRUE;
}
--
2.7.4
More information about the wine-patches
mailing list