changeset 18617:5beda1754026 v8.1.2301

patch 8.1.2301: MS-Windows GUI: drawing error when background color changes Commit: https://github.com/vim/vim/commit/ab85ca4e6a40b2998db7b00896505486f5c16b41 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Nov 15 22:41:14 2019 +0100 patch 8.1.2301: MS-Windows GUI: drawing error when background color changes Problem: MS-Windows GUI: drawing error when background color changes. Solution: Implement gui_mch_new_colors(). (Simon Sadler)
author Bram Moolenaar <Bram@vim.org>
date Fri, 15 Nov 2019 22:45:05 +0100
parents 8eeed64a6325
children 74422854344d
files src/gui_w32.c src/version.c
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -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, 
     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);
 }
 
 /*
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2301,
+/**/
     2300,
 /**/
     2299,