X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb5e4d9ac1527441fe107460c7fee93092175a3e..f35746ceeda33434574d667f81d7e6e8b18b7c46:/src/msw/fdrepdlg.cpp?ds=sidebyside diff --git a/src/msw/fdrepdlg.cpp b/src/msw/fdrepdlg.cpp index 5cc89364cd..76c85f3c8a 100644 --- a/src/msw/fdrepdlg.cpp +++ b/src/msw/fdrepdlg.cpp @@ -37,7 +37,7 @@ #include "wx/msw/private.h" -#if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__) +#if !defined(__WIN32__) || defined(__WXWINCE__) #include #endif @@ -102,6 +102,8 @@ private: // registered Message for Dialog static UINT ms_msgFindDialog; + + DECLARE_NO_COPY_CLASS(wxFindReplaceDialogImpl) }; UINT wxFindReplaceDialogImpl::ms_msgFindDialog = 0; @@ -228,9 +230,33 @@ wxFindReplaceDialogImpl::~wxFindReplaceDialogImpl() LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg, WPARAM wParam, LPARAM lParam) { +#if wxUSE_UNICODE_MSLU + static unsigned long s_lastMsgFlags = 0; + + // This flag helps us to identify the bogus ANSI message + // sent by UNICOWS.DLL (see below) + // while we're sending our message to the dialog + // we ignore possible messages sent in between + static bool s_blockMsg = false; +#endif // wxUSE_UNICODE_MSLU + if ( nMsg == wxFindReplaceDialogImpl::GetFindDialogMessage() ) { FINDREPLACE *pFR = (FINDREPLACE *)lParam; + +#if wxUSE_UNICODE_MSLU + // This is a hack for a MSLU problem: Versions up to 1.0.4011 + // of UNICOWS.DLL send the correct UNICODE item after button press + // and a bogus ANSI mode item right after this, so lets ignore + // the second bogus message + if ( s_lastMsgFlags == pFR->Flags ) + { + s_lastMsgFlags = 0; + return 0; + } + s_lastMsgFlags = pFR->Flags; +#endif // wxUSE_UNICODE_MSLU + wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData; // map flags from Windows @@ -286,8 +312,20 @@ LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg, event.SetReplaceString(pFR->lpstrReplaceWith); } +#if wxUSE_UNICODE_MSLU + s_blockMsg = true; +#endif // wxUSE_UNICODE_MSLU + dialog->Send(event); + +#if wxUSE_UNICODE_MSLU + s_blockMsg = false; +#endif // wxUSE_UNICODE_MSLU } +#if wxUSE_UNICODE_MSLU + else if ( !s_blockMsg ) + s_lastMsgFlags = 0; +#endif // wxUSE_UNICODE_MSLU WNDPROC wndProc = (WNDPROC)::GetWindowLong(hwnd, GWL_USERDATA);