[PATCH 2/2] user32: SetSysColors updates pens from SYSCOLOR_GetPen

Fabian Maurer dark.shadow4 at web.de
Sat Jan 14 13:33:40 CST 2017


No tests since it's an internal function,
but it's the same as with the brushes.

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/gdi32/pen.c          |  7 -------
 dlls/user32/sysparams.c   | 17 +++++++++++------
 include/wine/gdi_driver.h |  7 +++++++
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c
index d6c1dc4576..6ce6097e86 100644
--- a/dlls/gdi32/pen.c
+++ b/dlls/gdi32/pen.c
@@ -33,13 +33,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
 
-  /* GDI logical pen object */
-typedef struct
-{
-    struct brush_pattern pattern;
-    EXTLOGPEN            logpen;
-} PENOBJ;
-
 
 static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc );
 static INT PEN_GetObject( HGDIOBJ handle, INT count, LPVOID buffer );
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 88848c9df5..1fc09003d0 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -890,17 +890,12 @@ done:
 static BOOL set_rgb_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
 {
     WCHAR buf[32];
-    HPEN pen;
 
     wsprintfW( buf, CSrgb, GetRValue(int_param), GetGValue(int_param), GetBValue(int_param) );
     if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
     entry->rgb.val = int_param;
     entry->hdr.loaded = TRUE;
-    if ((pen = InterlockedExchangePointer( (void **)&entry->rgb.pen, 0 )))
-    {
-        __wine_make_gdi_object_system( pen, FALSE );
-        DeleteObject( pen );
-    }
+
     return TRUE;
 }
 
@@ -2645,6 +2640,8 @@ static void set_syscolors_gdi( INT index, COLORREF color )
 {
     HBRUSH brush = system_colors[index].brush;
     LOGBRUSH *brush_info;
+    HPEN pen = system_colors[index].pen;
+    PENOBJ *pen_info;
 
     if(brush)
     {
@@ -2654,6 +2651,14 @@ static void set_syscolors_gdi( INT index, COLORREF color )
             brush_info->lbColor = color;
         __wine_GDI_ReleaseObj( brush );
     }
+
+    if(pen)
+    {
+        pen_info = __wine_GDI_GetObjPtr( pen, OBJ_PEN );
+        if(pen_info->logpen.elpColor != color)
+            pen_info->logpen.elpColor = color;
+        __wine_GDI_ReleaseObj( pen );
+    }
 }
 
 /*************************************************************************
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index 6064a2d13c..458ce3d314 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -62,6 +62,13 @@ struct brush_pattern
     UINT                  usage;    /* color usage for DIB info */
 };
 
+/* GDI logical pen object */
+typedef struct
+{
+  struct brush_pattern pattern;
+  EXTLOGPEN            logpen;
+} PENOBJ;
+
 struct gdi_dc_funcs
 {
     INT      (*pAbortDoc)(PHYSDEV);
-- 
2.11.0




More information about the wine-patches mailing list