Window resizing (resend)

Duane Clark dclark at akamail.com
Tue Feb 18 11:30:14 CST 2003


This fixes bug 1263.

The least significant 4 bits of wParam of a WM_SYSCOMMAND, SC_SIZE 
message are supposed to be private, and are used internally in both 
Windows and Wine to send an encoded hit test value.

An application that sends this message is supposed to only set wParam to 
one of the SC_* values. Visual Foxpro however in addition sets the least 
significant 4 bits, using the same encoding as used by Windows. In Wine, 
this causes the wrong edge of a window to be moved.

This patch makes Wine use the same internal encoding for the bits as 
Windows.

Changelog:
	Correctly encode wParam for WM_SYSCOMMAND,SC_SIZE messages.

-------------- next part --------------
Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.63
diff -u -r1.63 winpos.c
--- dlls/x11drv/winpos.c	8 Jan 2003 21:09:26 -0000	1.63
+++ dlls/x11drv/winpos.c	8 Feb 2003 22:44:11 -0000
@@ -1901,7 +1903,8 @@
     else  /* SC_SIZE */
     {
         if (!thickframe) return;
-        if ( hittest && hittest != HTSYSMENU ) hittest += 2;
+        if ( hittest && ((wParam & 0xfff0) != SC_MOUSEMENU) )
+            hittest += (HTLEFT - WMSZ_LEFT);
         else
         {
             set_movesize_capture( hwnd );
Index: windows/nonclient.c
===================================================================
RCS file: /home/wine/wine/windows/nonclient.c,v
retrieving revision 1.109
diff -u -r1.109 nonclient.c
--- windows/nonclient.c	14 Jan 2003 23:41:01 -0000	1.109
+++ windows/nonclient.c	8 Feb 2003 22:44:12 -0000
@@ -2071,8 +2071,15 @@
     case HTBOTTOM:
     case HTBOTTOMLEFT:
     case HTBOTTOMRIGHT:
-	/* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
-	SendMessageW( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam);
+        /* Old comment:
+         * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
+         * This was previously done by setting wParam=SC_SIZE + wParam - 2
+         */
+        /* But that is not what WinNT does. Instead it sends this. This
+         * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
+         * SC_MOUSEMENU into wParam.
+         */
+        SendMessageW( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - (HTLEFT-WMSZ_LEFT), lParam);
 	break;
 
     case HTBORDER:


More information about the wine-patches mailing list