Window drawing patch from CW

Duane Clark dclark at akamail.com
Sat Jan 26 21:08:46 CST 2002


Modified files:
	windows			: rect.c
	loader			: win.c

Log message:
	Codeweavers
	Don't fill in nonexistent rectangles.
	Small fix to coordinate fix.
	Focus fix in enable window.




-------------- next part --------------
Index: windows/rect.c
===================================================================
RCS file: /home/wine/wine/windows/rect.c,v
retrieving revision 1.12
diff -u -r1.12 rect.c
--- windows/rect.c	2000/12/22 01:38:02	1.12
+++ windows/rect.c	2002/01/27 01:03:04
@@ -29,6 +29,7 @@
 BOOL WINAPI SetRect( LPRECT rect, INT left, INT top,
                        INT right, INT bottom )
 {
+    if (!rect) return FALSE;
     rect->left   = left;
     rect->right  = right;
     rect->top    = top;
@@ -51,6 +52,7 @@
  */
 BOOL WINAPI SetRectEmpty( LPRECT rect )
 {
+    if (!rect) return FALSE;
     rect->left = rect->right = rect->top = rect->bottom = 0;
     return TRUE;
 }
@@ -96,6 +98,7 @@
  */
 BOOL WINAPI IsRectEmpty( const RECT *rect )
 {
+    if (!rect) return TRUE;
     return ((rect->left >= rect->right) || (rect->top >= rect->bottom));
 }
 
@@ -115,6 +118,7 @@
  */
 BOOL WINAPI PtInRect( const RECT *rect, POINT pt )
 {
+    if (!rect) return FALSE;
     return ((pt.x >= rect->left) && (pt.x < rect->right) &&
 	    (pt.y >= rect->top) && (pt.y < rect->bottom));
 }
@@ -137,6 +141,7 @@
  */
 BOOL WINAPI OffsetRect( LPRECT rect, INT x, INT y )
 {
+    if (!rect) return FALSE;
     rect->left   += x;
     rect->right  += x;
     rect->top    += y;
@@ -162,6 +167,7 @@
  */
 BOOL WINAPI InflateRect( LPRECT rect, INT x, INT y )
 {
+    if (!rect) return FALSE;
     rect->left   -= x;
     rect->top 	 -= y;
     rect->right  += x;
@@ -197,6 +203,7 @@
 BOOL WINAPI IntersectRect( LPRECT dest, const RECT *src1,
                                const RECT *src2 )
 {
+    if (!dest || !src1 || !src2) return FALSE;
     if (IsRectEmpty(src1) || IsRectEmpty(src2) ||
 	(src1->left >= src2->right) || (src2->left >= src1->right) ||
 	(src1->top >= src2->bottom) || (src2->top >= src1->bottom))
@@ -248,6 +255,7 @@
 BOOL WINAPI UnionRect( LPRECT dest, const RECT *src1,
                            const RECT *src2 )
 {
+    if (!dest) return FALSE;
     if (IsRectEmpty(src1))
     {
 	if (IsRectEmpty(src2))
@@ -287,6 +295,7 @@
  */
 BOOL WINAPI EqualRect( const RECT* rect1, const RECT* rect2 )
 {
+    if (!rect1 || !rect2) return FALSE;
     return ((rect1->left == rect2->left) && (rect1->right == rect2->right) &&
 	    (rect1->top == rect2->top) && (rect1->bottom == rect2->bottom));
 }
@@ -336,6 +345,7 @@
 {
     RECT tmp;
 
+    if (!dest) return FALSE;
     if (IsRectEmpty( src1 ))
     {
 	SetRectEmpty( dest );
Index: windows/win.c
===================================================================
RCS file: /home/wine/wine/windows/win.c,v
retrieving revision 1.176
diff -u -r1.176 win.c
--- windows/win.c	2002/01/22 00:50:07	1.176
+++ windows/win.c	2002/01/27 01:03:08
@@ -848,6 +848,19 @@
             }
         }
     }
+    else
+    {
+	/* neither x nor cx are default. Check the y values .
+	 * In the trace we see Outlook using cy set to CW_USEDEFAULT
+	 * when opening the address book.
+	 */
+	if (cs->cy == CW_USEDEFAULT || cs->cy == CW_USEDEFAULT16) {
+	    RECT r;
+	    FIXME("Strange use of CW_USEDEFAULT in nHeight\n");
+	    SystemParametersInfoA( SPI_GETWORKAREA, 0, &r, 0);
+	    cs->cy = (((r.bottom - r.top) * 3) / 4) - cs->y;
+	}
+    }
 }
 
 /***********************************************************************
@@ -1667,6 +1680,11 @@
     {
         WIN_SetStyle( hwnd, style & ~WS_DISABLED );
         SendMessageA( hwnd, WM_ENABLE, TRUE, 0 );
+	/* GLA */
+	if ((style & WS_VISIBLE) && !(style & WS_CHILD) &&
+	    (GetFocus() == 0)) {
+	    SetFocus( hwnd );
+	}
     }
     else if (!enable && !retvalue)
     {


More information about the wine-patches mailing list