]> granicus.if.org Git - vim/commitdiff
patch 8.1.2301: MS-Windows GUI: drawing error when background color changes v8.1.2301
authorBram Moolenaar <Bram@vim.org>
Fri, 15 Nov 2019 21:41:14 +0000 (22:41 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 15 Nov 2019 21:41:14 +0000 (22:41 +0100)
Problem:    MS-Windows GUI: drawing error when background color changes.
Solution:   Implement gui_mch_new_colors(). (Simon Sadler)

src/gui_w32.c
src/version.c

index 02d2e096b565dc1a4a28a961b3ca098ab2c54985..3dbbc5eec0671ec505cf56ef31b94ba8053a468e 100644 (file)
@@ -325,7 +325,7 @@ static
 #endif
 HWND                   s_hwnd = NULL;
 static HDC             s_hdc = NULL;
-static HBRUSH  s_brush = NULL;
+static HBRUSH          s_brush = NULL;
 
 #ifdef FEAT_TOOLBAR
 static HWND            s_toolbarhwnd = NULL;
@@ -1282,7 +1282,18 @@ vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     void
 gui_mch_new_colors(void)
 {
-    /* nothing to do? */
+    HBRUSH prevBrush;
+
+    s_brush = CreateSolidBrush(gui.back_pixel);
+#ifdef SetClassLongPtr
+    prevBrush = (HBRUSH)SetClassLongPtr(
+                               s_hwnd, GCLP_HBRBACKGROUND, (LONG_PTR)s_brush);
+#else
+    prevBrush = (HBRUSH)SetClassLong(
+                                  s_hwnd, GCL_HBRBACKGROUND, (long_u)s_brush);
+#endif
+    InvalidateRect(s_hwnd, NULL, TRUE);
+    DeleteObject(prevBrush);
 }
 
 /*
index 13d861666476c8be561544d3f0ad73cd0b5cc8d5..b91643461d10246d48c3db5917f9757afa1fcf37 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2301,
 /**/
     2300,
 /**/