Fix for bug 640 - moving thin frames leaves mess

Pavel Roskin proski at gnu.org
Sun Sep 28 02:00:02 CDT 2003


On Sat, 27 Sep 2003, Alexandre Julliard wrote:

> > 3) Black pen, white background, pattern, opaque mode.  The background
> > would still be changing the image.  If we consider the pen white, the
> > pattern would be lost.  I actually didn't test it, but I expect it to be
> > broken.
>
> I don't see how a XOR with 0 would ever change anything.

You will have XOR with background.  Look here:
http://www.red-bean.com/~proski/wine/

Patch for cmdlgtst.c to produce those pictures is attached.  before.png
was taken with current Wine.  after.png is with the fix that removes the
special procession of R2_XORPEN.  I would not say that nobody will use
this effect.  Anyway, the whole thing is not worth arguing about.

-- 
Regards,
Pavel Roskin
-------------- next part --------------
--- cmdlgtst.c
+++ cmdlgtst.c
@@ -245,6 +245,30 @@ void mwi_InitAll(HWND hWnd)
 	mwi_FindReplace(hWnd);
 }
 
+void myDrawFocusRect( HDC hdc, const RECT* rc )
+{
+    HBRUSH hOldBrush;
+    HPEN hOldPen, hNewPen;
+    INT oldDrawMode, oldBkMode;
+    COLORREF oldBkColor;
+
+    hOldBrush = SelectObject(hdc, GetStockObject(NULL_BRUSH));
+    hNewPen = CreatePen(PS_DASHDOTDOT, 1, RGB(0, 0, 0));
+    hOldPen = SelectObject(hdc, hNewPen);
+    oldDrawMode = SetROP2(hdc, R2_XORPEN);
+    oldBkColor = SetBkColor(hdc, RGB(0, 255, 255));
+    oldBkMode = SetBkMode(hdc, OPAQUE);
+
+    Rectangle(hdc, rc->left, rc->top, rc->right, rc->bottom);
+
+    SetBkMode(hdc, oldBkColor);
+    SetBkMode(hdc, oldBkMode);
+    SetROP2(hdc, oldDrawMode);
+    SelectObject(hdc, hOldPen);
+    DeleteObject(hNewPen);
+    SelectObject(hdc, hOldBrush);
+}
+
 /*
  * Various configurations for the window.  Ideally, this
  * would be stored with the window itself, but then, this
@@ -312,6 +336,12 @@ void paintMainWindow(HWND hWnd, UINT iMe
 	font = (HFONT) SelectObject(ps.hdc, font);
 	DeleteObject(font);
 
+	rect.left += 10;
+	rect.right -= 10;
+	rect.top += 10;
+	rect.bottom -= 10;
+	myDrawFocusRect(ps.hdc, &rect);
+
 	EndPaint(hWnd, &ps);
 }
 


More information about the wine-devel mailing list