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)
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 02d2e09..3dbbc5e 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -325,7 +325,7 @@
#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 @@
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);
}
/*
diff --git a/src/version.c b/src/version.c
index 13d8616..b916434 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2301,
+/**/
2300,
/**/
2299,