From a75b84af7775be5539dc08a01947490fe68e1548 Mon Sep 17 00:00:00 2001 From: Alex Kompel Date: Wed, 29 Apr 2015 12:27:01 -0700 Subject: [PATCH] win32_gui: fix text window background color --- win/win32/mhmenu.c | 10 +++++++++- win/win32/mhtext.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index 849470b5e..a23caa29f 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -469,7 +469,7 @@ INT_PTR CALLBACK MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar SetTextColor(hdcEdit, text_fg_brush ? text_fg_color : (COLORREF)GetSysColor(DEFAULT_COLOR_FG_TEXT) ); - return (BOOL)(text_bg_brush + return (INT_PTR)(text_bg_brush ? text_bg_brush : SYSCLR_TO_BRUSH(DEFAULT_COLOR_BG_TEXT)); } } return FALSE; @@ -1556,7 +1556,15 @@ LRESULT CALLBACK NHMenuListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA /* Text control window proc - implements scrolling without a cursor */ LRESULT CALLBACK NHMenuTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + HDC hDC; + RECT rc; + switch(message) { + case WM_ERASEBKGND: + hDC = (HDC) wParam; + GetClientRect(hWnd, &rc); + FillRect(hDC, &rc, text_bg_brush? text_bg_brush : SYSCLR_TO_BRUSH(DEFAULT_COLOR_BG_TEXT)); + return 0; case WM_KEYDOWN: switch (wParam) diff --git a/win/win32/mhtext.c b/win/win32/mhtext.c index d816255bf..e46577397 100644 --- a/win/win32/mhtext.c +++ b/win/win32/mhtext.c @@ -164,7 +164,7 @@ INT_PTR CALLBACK NHTextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP SetTextColor(hdcEdit, text_fg_brush ? text_fg_color : (COLORREF)GetSysColor(DEFAULT_COLOR_FG_TEXT) ); - return (BOOL)(text_bg_brush + return (INT_PTR)(text_bg_brush ? text_bg_brush : SYSCLR_TO_BRUSH(DEFAULT_COLOR_BG_TEXT)); } } return FALSE; @@ -242,7 +242,15 @@ void LayoutText(HWND hWnd) /* Edit box hook */ LRESULT CALLBACK NHEditHookWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + HDC hDC; + RECT rc; + switch(message) { + case WM_ERASEBKGND: + hDC = (HDC) wParam; + GetClientRect(hWnd, &rc); + FillRect(hDC, &rc, text_bg_brush? text_bg_brush : SYSCLR_TO_BRUSH(DEFAULT_COLOR_BG_TEXT)); + return 1; case WM_KEYDOWN: switch (wParam)