From 2249ff4080c7a199089e97b80539ad794ca6ba7c Mon Sep 17 00:00:00 2001 From: Eric Mullins Date: Sat, 10 Oct 2009 11:15:50 -0600 Subject: [PATCH] Cleaned up ConsoleWndProc (not complete, see below) Using static variables this way is not appropriate. I only addressed hInput and hText in this commit though. But imagine the WndProc being used by multiple windows instead of just one, and you can see why using static variables in this way is wrong. --- winboard/winboard.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/winboard/winboard.c b/winboard/winboard.c index 6c5d0ee..5fda158 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -8099,14 +8099,16 @@ LRESULT CALLBACK ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static SnapData sd; - static HWND hText, hInput /*, hFocus*/; -// InputSource *is = consoleInputSource; + HWND hText, hInput; RECT rect; static int sizeX, sizeY; int newSizeX, newSizeY; MINMAXINFO *mmi; WORD wMask; + hText = GetDlgItem(hDlg, OPT_ConsoleText); + hInput = GetDlgItem(hDlg, OPT_ConsoleInput); + switch (message) { case WM_NOTIFY: if (((NMHDR*)lParam)->code == EN_LINK) @@ -8126,8 +8128,6 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_INITDIALOG: /* message: initialize dialog box */ hwndConsole = hDlg; - hText = GetDlgItem(hDlg, OPT_ConsoleText); - hInput = GetDlgItem(hDlg, OPT_ConsoleInput); SetFocus(hInput); consoleTextWindowProc = (WNDPROC) SetWindowLong(hText, GWL_WNDPROC, (LONG) ConsoleTextSubclass); -- 1.7.0.4