From 077ec0cffd9fec89f18ff3a38c5a68e9b00a1ace Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Wed, 10 Nov 1999 19:55:29 +0000 Subject: [PATCH] Send WM_CTLCOLOREDIT not WM_CTLCOLORSTATIC messages to parent of a disabled edit control if the application expects a windows version before WIN95 and NT40. --- controls/edit.c | 7 +++++-- include/winversion.h | 1 + misc/version.c | 26 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/controls/edit.c b/controls/edit.c index 1e53fb7eff3..3f759dd73eb 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -23,6 +23,7 @@ #include "debugtools.h" #include "callback.h" #include "tweak.h" +#include "winversion.h" DECLARE_DEBUG_CHANNEL(combo) DECLARE_DEBUG_CHANNEL(edit) @@ -3103,7 +3104,8 @@ static LRESULT EDIT_WM_EraseBkGnd(WND *wnd, EDITSTATE *es, HDC dc) HBRUSH brush; RECT rc; - if (!es->bEnableState || (es->style & ES_READONLY)) + if ( VERSION_AppWinVer() >= 0x40000 &&( + !es->bEnableState || (es->style & ES_READONLY))) brush = (HBRUSH)EDIT_SEND_CTLCOLORSTATIC(wnd, dc); else brush = (HBRUSH)EDIT_SEND_CTLCOLOR(wnd, dc); @@ -3710,7 +3712,8 @@ static void EDIT_WM_Paint(WND *wnd, EDITSTATE *es, WPARAM wParam) } if (es->font) old_font = SelectObject(dc, es->font); - if (!es->bEnableState || (es->style & ES_READONLY)) + if ( VERSION_AppWinVer() >= 0x40000 &&( + !es->bEnableState || (es->style & ES_READONLY))) EDIT_SEND_CTLCOLORSTATIC(wnd, dc); else EDIT_SEND_CTLCOLOR(wnd, dc); diff --git a/include/winversion.h b/include/winversion.h index 1ae952d734f..f10d2737a20 100644 --- a/include/winversion.h +++ b/include/winversion.h @@ -16,5 +16,6 @@ typedef enum extern WINDOWS_VERSION VERSION_GetVersion(void); extern char *VERSION_GetVersionName(void); extern BOOL VERSION_OsIsUnicode(void); +extern DWORD VERSION_AppWinVer(void); #endif /* __WINE_WINVERSION_H */ diff --git a/misc/version.c b/misc/version.c index 5e5161dba71..c1163b36bb9 100644 --- a/misc/version.c +++ b/misc/version.c @@ -317,6 +317,32 @@ WINDOWS_VERSION VERSION_GetVersion(void) return pdb->winver; } +/********************************************************************** + * VERSION_AppWinVer + * Returns the window version in case Wine emulates a later version + * of windows then the application expects. + * + * In a number of cases when windows runs an application that was + * designed for an earlier windows version, windows reverts + * to "old" behaviour of that earlier version. + * + * An example is a disabled edit control that needs to be painted. + * Old style behaviour is to send a WM_CTLCOLOREDIT message. This was + * changed in Win95, NT4.0 by a WM_CTLCOLORSTATIC message _only_ for + * applications with an expected version 0f 4.0 or higher. + * + */ +DWORD VERSION_AppWinVer(void) +{ + WINDOWS_VERSION ver = VERSION_GetVersion(); + DWORD dwEmulatedVersion=MAKELONG( VersionData[ver].getVersionEx.dwMinorVersion, + VersionData[ver].getVersionEx.dwMajorVersion); + /* fixme: this may not be 100% correct; see discussion on the + * wine developer list in Nov 1999 */ + DWORD dwProcVersion = GetProcessVersion(0); + return dwProcVersion < dwEmulatedVersion ? dwProcVersion : dwEmulatedVersion; +} + /********************************************************************** * VERSION_GetVersionName