Fix for scrollbar painting problem in Visual Studio - Resend

Rein Klazes wijn at wanadoo.nl
Mon Apr 11 10:26:35 CDT 2005


Hi,

Submitted 19 February, not committed, no comments.


Visual Studio 6 does the following:

  hbrush = DefWindowProc( hwnd, WM_CTLCOLORSCROLLBAR, ...);
  ...
  DeleteObject( hbrush);

Wine's DefWindowProc returns, for some esthetic reason, the
hPattern55AABrush, local to dlls/user/uitools.c. Since this handle is
nor marked as a system handle, it gets deleted and all scroll bars
develop painting failures.

Changelog:
	dlls/user	: uitools.c
	windows		: syscolor.c

	Mark the hPattern55AABrush as a system object, so it won't be
	deleted by DeleteObject().

Rein.
-------------- next part --------------
--- wine/dlls/user/uitools.c	2004-12-09 19:07:48.000000000 +0100
+++ mywine/dlls/user/uitools.c	2005-02-19 13:23:54.000000000 +0100
@@ -29,9 +29,12 @@
 #include "user_private.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
+#include "wownt32.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(graphics);
 
+extern void SYSCOLOR_MakeObjectSystem( HGDIOBJ16 handle, BOOL set);
+
 static const WORD wPattern55AA[] =
 {
     0x5555, 0xaaaa, 0x5555, 0xaaaa,
@@ -131,6 +134,8 @@ HBRUSH UITOOLS_GetPattern55AABrush(void)
     {
         hPattern55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
         hPattern55AABrush = CreatePatternBrush( hPattern55AABitmap );
+        /* so DeleteObject() will not delete the brush */
+        SYSCOLOR_MakeObjectSystem( HBRUSH_16(hPattern55AABrush), TRUE);
     }
     return hPattern55AABrush;
 }
--- wine/windows/syscolor.c	2004-12-09 19:08:51.000000000 +0100
+++ mywine/windows/syscolor.c	2005-02-19 12:48:12.000000000 +0100
@@ -92,7 +92,7 @@ static HPEN   SysColorPens[NUM_SYS_COLOR
  * For a description of the GDI object magics and their flags,
  * see "Undocumented Windows" (wrong about the OBJECT_NOSYSTEM flag, though).
  */
-static void SYSCOLOR_MakeObjectSystem( HGDIOBJ16 handle, BOOL set)
+void SYSCOLOR_MakeObjectSystem( HGDIOBJ16 handle, BOOL set)
 {
     static WORD heap_sel = 0;
     LPWORD ptr;


More information about the wine-patches mailing list