From ef2bf18c341ed8f2c9011c464918eb64d6765828 Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Sat, 19 Apr 2003 12:20:18 +0000 Subject: [PATCH] 170852 patch by yokoyama@netscape.com r=shanjian sr=roc+moz Remove #ifdef MOZ_UNICODE and MOZ_AIMM (no makefile changes yet) --- mailnews/compose/src/nsMsgCompose.cpp | 12 +- webshell/tests/viewer/windows/nsButton.cpp | 2 - webshell/tests/viewer/windows/nsButton.h | 2 - .../tests/viewer/windows/nsCheckButton.cpp | 2 - webshell/tests/viewer/windows/nsCheckButton.h | 2 - webshell/tests/viewer/windows/nsLabel.cpp | 2 - webshell/tests/viewer/windows/nsLabel.h | 2 - .../tests/viewer/windows/nsTextHelper.cpp | 2 - webshell/tests/viewer/windows/nsTextHelper.h | 2 - .../tests/viewer/windows/nsTextWidget.cpp | 2 - webshell/tests/viewer/windows/nsTextWidget.h | 2 - widget/src/windows/nsAppShell.cpp | 43 --- widget/src/windows/nsFilePicker.cpp | 293 --------------- widget/src/windows/nsFilePicker.h | 5 - widget/src/windows/nsScrollbar.cpp | 2 - widget/src/windows/nsScrollbar.h | 2 - widget/src/windows/nsToolkit.cpp | 43 --- widget/src/windows/nsToolkit.h | 8 - widget/src/windows/nsWindow.cpp | 333 +----------------- widget/src/windows/nsWindow.h | 4 - 20 files changed, 16 insertions(+), 749 deletions(-) diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp index 007a4bcfaa31..4494766027ae 100644 --- a/mailnews/compose/src/nsMsgCompose.cpp +++ b/mailnews/compose/src/nsMsgCompose.cpp @@ -3517,16 +3517,8 @@ nsresult nsMsgCompose::AttachmentPrettyName(const char* url, PRUnichar** _retval char * leafName = fileSpec.GetLeafName(); if (leafName && *leafName) { -#ifdef MOZ_UNICODE - /* file URL is now in UTF-8 */ - *_retval = ToNewUnicode(NS_ConvertUTF8toUCS2(leafName)); -#else - nsAutoString tempStr; - nsresult rv = ConvertToUnicode(nsMsgI18NFileSystemCharset(), leafName, tempStr); - if (NS_FAILED(rv)) - tempStr.AssignWithConversion(leafName); - *_retval = ToNewUnicode(tempStr); -#endif /* MOZ_UNICODE */ + /* file URL is now in UTF-8 */ + *_retval = ToNewUnicode(NS_ConvertUTF8toUCS2(leafName)); nsCRT::free(leafName); return NS_OK; } diff --git a/webshell/tests/viewer/windows/nsButton.cpp b/webshell/tests/viewer/windows/nsButton.cpp index e01c04b11e98..3d58ed159c66 100644 --- a/webshell/tests/viewer/windows/nsButton.cpp +++ b/webshell/tests/viewer/windows/nsButton.cpp @@ -174,7 +174,6 @@ PRBool nsButton::OnResize(nsRect &aWindowRect) return PR_FALSE; } -#ifdef MOZ_UNICODE //------------------------------------------------------------------------- // // return the window class name and initialize the class if needed @@ -184,7 +183,6 @@ LPCWSTR nsButton::WindowClassW() { return L"BUTTON"; } -#endif /* MOZ_UNICODE */ //------------------------------------------------------------------------- // diff --git a/webshell/tests/viewer/windows/nsButton.h b/webshell/tests/viewer/windows/nsButton.h index cd5e333493b2..f96634881bda 100644 --- a/webshell/tests/viewer/windows/nsButton.h +++ b/webshell/tests/viewer/windows/nsButton.h @@ -77,9 +77,7 @@ public: protected: nsString mLabel; -#ifdef MOZ_UNICODE virtual LPCWSTR WindowClassW(); -#endif /* MOZ_UNICODE */ virtual LPCTSTR WindowClass(); virtual DWORD WindowStyle(); virtual DWORD WindowExStyle(); diff --git a/webshell/tests/viewer/windows/nsCheckButton.cpp b/webshell/tests/viewer/windows/nsCheckButton.cpp index 82c41ad29fc0..c0538ee4ac65 100644 --- a/webshell/tests/viewer/windows/nsCheckButton.cpp +++ b/webshell/tests/viewer/windows/nsCheckButton.cpp @@ -199,7 +199,6 @@ PRBool nsCheckButton::OnResize(nsRect &aWindowRect) return PR_FALSE; } -#ifdef MOZ_UNICODE //------------------------------------------------------------------------- // // return the window class name and initialize the class if needed @@ -209,7 +208,6 @@ LPCWSTR nsCheckButton::WindowClassW() { return L"BUTTON"; } -#endif /* MOZ_UNICODE */ //------------------------------------------------------------------------- // diff --git a/webshell/tests/viewer/windows/nsCheckButton.h b/webshell/tests/viewer/windows/nsCheckButton.h index dfabe44adfbd..0b699605f57a 100644 --- a/webshell/tests/viewer/windows/nsCheckButton.h +++ b/webshell/tests/viewer/windows/nsCheckButton.h @@ -80,9 +80,7 @@ public: protected: PRBool mState; -#ifdef MOZ_UNICODE virtual LPCWSTR WindowClassW(); -#endif /* MOZ_UNICODE */ virtual LPCTSTR WindowClass(); virtual DWORD WindowStyle(); virtual DWORD WindowExStyle(); diff --git a/webshell/tests/viewer/windows/nsLabel.cpp b/webshell/tests/viewer/windows/nsLabel.cpp index 8239bba2273d..46fb20b9bb65 100644 --- a/webshell/tests/viewer/windows/nsLabel.cpp +++ b/webshell/tests/viewer/windows/nsLabel.cpp @@ -176,7 +176,6 @@ PRBool nsLabel::OnResize(nsRect &aWindowRect) return PR_FALSE; } -#ifdef MOZ_UNICODE //------------------------------------------------------------------------- // // return the window class name and initialize the class if needed @@ -186,7 +185,6 @@ LPCWSTR nsLabel::WindowClassW() { return L"STATIC"; } -#endif /* MOZ_UNICODE */ //------------------------------------------------------------------------- // diff --git a/webshell/tests/viewer/windows/nsLabel.h b/webshell/tests/viewer/windows/nsLabel.h index 0a5280d329d4..8436173cad0d 100644 --- a/webshell/tests/viewer/windows/nsLabel.h +++ b/webshell/tests/viewer/windows/nsLabel.h @@ -81,9 +81,7 @@ public: protected: nsLabelAlignment mAlignment; -#ifdef MOZ_UNICODE virtual LPCWSTR WindowClassW(); -#endif /* MOZ_UNICODE */ virtual LPCTSTR WindowClass(); virtual DWORD WindowStyle(); virtual DWORD WindowExStyle(); diff --git a/webshell/tests/viewer/windows/nsTextHelper.cpp b/webshell/tests/viewer/windows/nsTextHelper.cpp index f9380a562a59..3d404282a2b9 100644 --- a/webshell/tests/viewer/windows/nsTextHelper.cpp +++ b/webshell/tests/viewer/windows/nsTextHelper.cpp @@ -176,7 +176,6 @@ nsTextHelper::~nsTextHelper() { } -#ifdef MOZ_UNICODE //------------------------------------------------------------------------- // // return the window class name and initialize the class if needed @@ -186,7 +185,6 @@ LPCWSTR nsTextHelper::WindowClassW() { return(L"EDIT"); } -#endif /* MOZ_UNICODE */ //------------------------------------------------------------------------- // diff --git a/webshell/tests/viewer/windows/nsTextHelper.h b/webshell/tests/viewer/windows/nsTextHelper.h index b41aff5f7138..e4767c9c3028 100644 --- a/webshell/tests/viewer/windows/nsTextHelper.h +++ b/webshell/tests/viewer/windows/nsTextHelper.h @@ -68,9 +68,7 @@ public: NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData); -#ifdef MOZ_UNICODE virtual LPCWSTR WindowClassW(); -#endif /* MOZ_UNICODE */ virtual LPCTSTR WindowClass(); virtual DWORD WindowStyle(); virtual PRBool AutoErase(); diff --git a/webshell/tests/viewer/windows/nsTextWidget.cpp b/webshell/tests/viewer/windows/nsTextWidget.cpp index dc5ed55d7e08..0911403b8913 100644 --- a/webshell/tests/viewer/windows/nsTextWidget.cpp +++ b/webshell/tests/viewer/windows/nsTextWidget.cpp @@ -179,7 +179,6 @@ PRBool nsTextWidget::OnResize(nsRect &aWindowRect) return PR_FALSE; } -#ifdef MOZ_UNICODE //------------------------------------------------------------------------- // // return the window class name and initialize the class if needed @@ -189,7 +188,6 @@ LPCWSTR nsTextWidget::WindowClassW() { return(nsTextHelper::WindowClassW()); } -#endif /* MOZ_UNICODE */ //------------------------------------------------------------------------- // diff --git a/webshell/tests/viewer/windows/nsTextWidget.h b/webshell/tests/viewer/windows/nsTextWidget.h index 91ab1add92dc..99916e1156e2 100644 --- a/webshell/tests/viewer/windows/nsTextWidget.h +++ b/webshell/tests/viewer/windows/nsTextWidget.h @@ -75,9 +75,7 @@ public: protected: -#ifdef MOZ_UNICODE virtual LPCWSTR WindowClassW(); -#endif /* MOZ_UNICODE */ virtual LPCTSTR WindowClass(); virtual DWORD WindowStyle(); virtual DWORD WindowExStyle(); diff --git a/widget/src/windows/nsAppShell.cpp b/widget/src/windows/nsAppShell.cpp index 024e98350588..d797011de631 100644 --- a/widget/src/windows/nsAppShell.cpp +++ b/widget/src/windows/nsAppShell.cpp @@ -47,9 +47,7 @@ #include #include "nsWidgetsCID.h" -#ifdef MOZ_AIMM #include "aimm.h" -#endif static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); @@ -98,13 +96,8 @@ BOOL PeekKeyAndIMEMessage(LPMSG msg, HWND hwnd) { MSG msg1, msg2, *lpMsg; BOOL b1, b2; -#ifdef MOZ_UNICODE b1 = nsToolkit::mPeekMessage(&msg1, NULL, WM_KEYFIRST, WM_IME_KEYLAST, PM_NOREMOVE); b2 = nsToolkit::mPeekMessage(&msg2, NULL, WM_IME_SETCONTEXT, WM_IME_KEYUP, PM_NOREMOVE); -#else - b1 = ::PeekMessage(&msg1, NULL, WM_KEYFIRST, WM_IME_KEYLAST, PM_NOREMOVE); - b2 = ::PeekMessage(&msg2, NULL, WM_IME_SETCONTEXT, WM_IME_KEYUP, PM_NOREMOVE); -#endif /* MOZ_UNICODE */ if (b1 || b2) { if (b1 && b2) { if (msg1.time < msg2.time) @@ -115,11 +108,7 @@ BOOL PeekKeyAndIMEMessage(LPMSG msg, HWND hwnd) lpMsg = &msg1; else lpMsg = &msg2; -#ifdef MOZ_UNICODE return nsToolkit::mPeekMessage(msg, hwnd, lpMsg->message, lpMsg->message, PM_REMOVE); -#else - return ::PeekMessage(msg, hwnd, lpMsg->message, lpMsg->message, PM_REMOVE); -#endif /* MOZ_UNICODE */ } return false; @@ -144,25 +133,13 @@ NS_METHOD nsAppShell::Run(void) // Give priority to system messages (in particular keyboard, mouse, // timer, and paint messages). if (PeekKeyAndIMEMessage(&msg, NULL) || -#ifdef MOZ_UNICODE nsToolkit::mPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || nsToolkit::mPeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { -#else - ::PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || - ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { -#endif /* MOZ_UNICODE */ keepGoing = (msg.message != WM_QUIT); if (keepGoing != 0) { -//#ifdef MOZ_AIMM // not need? -// if (!nsToolkit::gAIMMMsgPumpOwner || (nsToolkit::gAIMMMsgPumpOwner->OnTranslateMessage(&msg) != S_OK)) -//#endif TranslateMessage(&msg); -#ifdef MOZ_UNICODE nsToolkit::mDispatchMessage(&msg); -#else - ::DispatchMessage(&msg); -#endif /* MOZ_UNICODE */ if (mDispatchListener) mDispatchListener->AfterDispatch(); } @@ -174,11 +151,7 @@ NS_METHOD nsAppShell::Run(void) do { timerManager->FireNextIdleTimer(); timerManager->HasIdleTimers(&hasTimers); -#ifdef MOZ_UNICODE } while (hasTimers && !nsToolkit::mPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)); -#else - } while (hasTimers && !::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)); -#endif } else { if (!gKeepGoing) { @@ -223,13 +196,8 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) // Give priority to system messages (in particular keyboard, mouse, // timer, and paint messages). if (PeekKeyAndIMEMessage(&msg, NULL) || -#ifdef MOZ_UNICODE nsToolkit::mPeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || nsToolkit::mPeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { -#else - ::PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE) || - ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { -#endif /* MOZ_UNICODE */ gotMessage = true; } else { PRBool hasTimers; @@ -238,11 +206,7 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) do { timerManager->FireNextIdleTimer(); timerManager->HasIdleTimers(&hasTimers); -#ifdef MOZ_UNICODE } while (hasTimers && !nsToolkit::mPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)); -#else - } while (hasTimers && !::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)); -#endif /* MOZ_UNICODE */ } else { // Block and wait for any posted application message ::WaitMessage(); @@ -256,9 +220,6 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) printf("-> %d", msg.message); #endif -//#ifdef MOZ_AIMM // not need? -// if (!nsToolkit::gAIMMMsgPumpOwner || (nsToolkit::gAIMMMsgPumpOwner->OnTranslateMessage(&msg) != S_OK)) -//#endif TranslateMessage(&msg); aEvent = &msg; aRealEvent = PR_TRUE; @@ -267,11 +228,7 @@ nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) nsresult nsAppShell::DispatchNativeEvent(PRBool aRealEvent, void *aEvent) { -#ifdef MOZ_UNICODE nsToolkit::mDispatchMessage((MSG *)aEvent); -#else - DispatchMessage((MSG *)aEvent); -#endif /* MOZ_UNICODE */ return NS_OK; } diff --git a/widget/src/windows/nsFilePicker.cpp b/widget/src/windows/nsFilePicker.cpp index f5a75f3d3ddb..67213362545c 100644 --- a/widget/src/windows/nsFilePicker.cpp +++ b/widget/src/windows/nsFilePicker.cpp @@ -43,18 +43,14 @@ #include #include -#ifdef MOZ_UNICODE #include "nsString.h" #include "nsToolkit.h" -#endif // MOZ_UNICODE static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker) -#ifdef MOZ_UNICODE nsString nsFilePicker::mLastUsedUnicodeDirectory; -#endif char nsFilePicker::mLastUsedDirectory[MAX_PATH+1] = { 0 }; #define MAX_EXTENSION_LENGTH 10 @@ -90,7 +86,6 @@ nsFilePicker::~nsFilePicker() // Show - Display the file dialog // //------------------------------------------------------------------------- -#ifdef MOZ_UNICODE NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal) { NS_ENSURE_ARG_POINTER(aReturnVal); @@ -333,308 +328,24 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal) return NS_OK; } -#endif NS_IMETHODIMP nsFilePicker::Show(PRInt16 *aReturnVal) -#ifdef MOZ_UNICODE { return ShowW(aReturnVal); } -#else -{ - NS_ENSURE_ARG_POINTER(aReturnVal); - - // suppress blur event - if (mParentWidget) { - nsWindow *parent = NS_STATIC_CAST(nsWindow *, mParentWidget); - parent->SuppressBlurEvents(PR_TRUE); - } - - PRBool result = PR_FALSE; - char fileBuffer[MAX_PATH+1] = ""; - char *converted = ConvertToFileSystemCharset(mDefault.get()); - if (nsnull == converted) { - mDefault.ToCString(fileBuffer,MAX_PATH); - } - else { - PL_strncpyz(fileBuffer, converted, MAX_PATH+1); - nsMemory::Free( converted ); - } - - char htmExt[] = "html"; - - char *title = ConvertToFileSystemCharset(mTitle.get()); - if (nsnull == title) - title = ToNewCString(mTitle); - nsCAutoString initialDir; - mDisplayDirectory->GetNativePath(initialDir); - // If no display directory, re-use the last one. - if(initialDir.IsEmpty()) { - // Allocate copy of last used dir. - initialDir = mLastUsedDirectory; - } - - mFile.SetLength(0); - - if (mMode == modeGetFolder) { - - char dirBuffer[MAX_PATH+1]; - PL_strncpy(dirBuffer, initialDir.get(), MAX_PATH); - BROWSEINFO browserInfo; - browserInfo.hwndOwner = (HWND) - (mParentWidget ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0); - browserInfo.pidlRoot = nsnull; - browserInfo.pszDisplayName = (LPSTR)dirBuffer; - browserInfo.lpszTitle = title; - browserInfo.ulFlags = BIF_RETURNONLYFSDIRS;//BIF_STATUSTEXT | BIF_RETURNONLYFSDIRS; - browserInfo.lpfn = nsnull; - browserInfo.lParam = nsnull; - browserInfo.iImage = nsnull; - - // XXX UNICODE support is needed here --> DONE - LPITEMIDLIST list = ::SHBrowseForFolder(&browserInfo); - if (list != NULL) { - result = ::SHGetPathFromIDList(list, (LPSTR)fileBuffer); - if (result) { - mFile.Append(fileBuffer); - } - - // free PIDL - LPMALLOC pMalloc = NULL; - ::SHGetMalloc(&pMalloc); - if(pMalloc) { - pMalloc->Free(list); - pMalloc->Release(); - } - } - } - else { - - OPENFILENAME ofn; - memset(&ofn, 0, sizeof(ofn)); - - ofn.lStructSize = sizeof(ofn); - - char extensionBuffer[MAX_EXTENSION_LENGTH+1] = ""; - - PRInt32 l = (mFilterList.Length()+2)*2; - char *filterBuffer = (char*) nsMemory::Alloc(l); - int len = WideCharToMultiByte(CP_ACP, 0, - mFilterList.get(), - mFilterList.Length(), - filterBuffer, - l, NULL, NULL); - filterBuffer[len] = '\0'; - filterBuffer[len+1] = '\0'; - - if (!initialDir.IsEmpty()) { - ofn.lpstrInitialDir = initialDir.get(); - } - - ofn.lpstrTitle = title; - ofn.lpstrFilter = filterBuffer; - ofn.nFilterIndex = mSelectedType; - ofn.hwndOwner = (HWND) - (mParentWidget ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0); - ofn.lpstrFile = fileBuffer; - ofn.nMaxFile = MAX_PATH; - - ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; - - if (!mDefaultExtension.IsEmpty()) { - // Someone was cool and told us what to do - char *convertedExt = ConvertToFileSystemCharset(mDefaultExtension.get()); - if (!convertedExt) { - mDefaultExtension.ToCString(extensionBuffer, MAX_EXTENSION_LENGTH); - } - else { - PL_strncpyz(extensionBuffer, convertedExt, MAX_EXTENSION_LENGTH+1); - nsMemory::Free( convertedExt ); - } - ofn.lpstrDefExt = extensionBuffer; - } - else { - // Get file extension from suggested filename - // to detect if we are saving an html file - //XXX: nsIFile SHOULD HAVE A GetExtension() METHOD! - PRInt32 extIndex = mDefault.RFind("."); - if ( extIndex >= 0) { - nsAutoString ext; - mDefault.Right(ext, mDefault.Length() - extIndex); - // Should we test for ".cgi", ".asp", ".jsp" and other - // "generated" html pages? - - if ( ext.EqualsIgnoreCase(".htm") || - ext.EqualsIgnoreCase(".html") || - ext.EqualsIgnoreCase(".shtml") ) { - // This is supposed to append ".htm" if user doesn't supply an extension - //XXX Actually, behavior is sort of weird: - // often appends ".html" even if you have an extension - // It obeys your extension if you put quotes around name - ofn.lpstrDefExt = htmExt; - } - } - } - - if (mMode == modeOpen) { - // FILE MUST EXIST! - ofn.Flags |= OFN_FILEMUSTEXIST; - result = ::GetOpenFileName(&ofn); - } - else if (mMode == modeOpenMultiple) { - ofn.Flags |= OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER; - result = ::GetOpenFileName(&ofn); - } - else if (mMode == modeSave) { - ofn.Flags |= OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; - result = ::GetSaveFileName(&ofn); - if (!result) { - // Error, find out what kind. - if (::GetLastError() == ERROR_INVALID_PARAMETER || - ::CommDlgExtendedError() == FNERR_INVALIDFILENAME) { - // probably the default file name is too long or contains illegal characters! - // Try again, without a starting file name. - ofn.lpstrFile[0] = 0; - result = ::GetSaveFileName(&ofn); - } - } - } - else { - NS_ASSERTION(0, "Only load, save and getFolder are supported modes"); - } - - // Remember what filter type the user selected - mSelectedType = (PRInt16)ofn.nFilterIndex; - - // Clean up filter buffers - if (filterBuffer) - nsMemory::Free( filterBuffer ); - - // Set user-selected location of file or directory - if (result == PR_TRUE) { - // I think it also needs a conversion here (to unicode since appending to nsString) - // but doing that generates garbage file name, weird. - if (mMode == modeOpenMultiple) { - nsresult rv = NS_NewISupportsArray(getter_AddRefs(mFiles)); - NS_ENSURE_SUCCESS(rv,rv); - - // from msdn.microsoft.com, "Open and Save As Dialog Boxes" section: - // If you specify OFN_EXPLORER, - // The directory and file name strings are NULL separated, - // with an extra NULL character after the last file name. - // This format enables the Explorer-style dialog boxes - // to return long file names that include spaces. - char *current = fileBuffer; - - nsCAutoString dirName(current); - // sometimes dirName contains a trailing slash - // and sometimes it doesn't. - if (current[dirName.Length() - 1] != '\\') - dirName += '\\'; - - while (current && *current && *(current + strlen(current) + 1)) { - current = current + strlen(current) + 1; - - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1", &rv); - NS_ENSURE_SUCCESS(rv,rv); - - rv = file->InitWithNativePath(dirName + nsDependentCString(current)); - NS_ENSURE_SUCCESS(rv,rv); - - rv = mFiles->AppendElement(file); - NS_ENSURE_SUCCESS(rv,rv); - } - - // handle the case where the user selected just one - // file. according to msdn.microsoft.com: - // If you specify OFN_ALLOWMULTISELECT and the user selects - // only one file, the lpstrFile string does not have - // a separator between the path and file name. - if (current && *current && (current == fileBuffer)) { - nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1", &rv); - NS_ENSURE_SUCCESS(rv,rv); - - rv = file->InitWithNativePath(nsDependentCString(current)); - NS_ENSURE_SUCCESS(rv,rv); - - rv = mFiles->AppendElement(file); - NS_ENSURE_SUCCESS(rv,rv); - } - } - else { - mFile.Append(fileBuffer); - } - } - } - - if (title) - nsMemory::Free( title ); - - if (result) { - PRInt16 returnOKorReplace = returnOK; - - // Remember last used directory. - nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); - NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); - - file->InitWithNativePath(mFile); - nsCOMPtr dir; - if (NS_SUCCEEDED(file->GetParent(getter_AddRefs(dir)))) { - nsCOMPtr localDir(do_QueryInterface(dir)); - if (localDir) { - nsCAutoString newDir; - localDir->GetNativePath(newDir); - if(!newDir.IsEmpty()) - PL_strncpyz(mLastUsedDirectory, newDir.get(), MAX_PATH+1); - // Update mDisplayDirectory with this directory, also. - // Some callers rely on this. - mDisplayDirectory->InitWithNativePath( nsDependentCString(mLastUsedDirectory) ); - } - } - - if (mMode == modeSave) { - // Windows does not return resultReplace, - // we must check if file already exists - PRBool exists = PR_FALSE; - file->Exists(&exists); - if (exists) - returnOKorReplace = returnReplace; - } - *aReturnVal = returnOKorReplace; - } - else { - *aReturnVal = returnCancel; - } - if (mParentWidget) { - nsWindow *parent = NS_STATIC_CAST(nsWindow *, mParentWidget); - parent->SuppressBlurEvents(PR_FALSE); - } - - return NS_OK; -} -#endif NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) { NS_ENSURE_ARG_POINTER(aFile); -#ifdef MOZ_UNICODE if (mUnicodeFile.IsEmpty()) return NS_OK; -#else - if (mFile.IsEmpty()) - return NS_OK; -#endif nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); -#ifdef MOZ_UNICODE file->InitWithPath(mUnicodeFile); -#else - file->InitWithNativePath(mFile); -#endif NS_ADDREF(*aFile = file); @@ -646,11 +357,7 @@ NS_IMETHODIMP nsFilePicker::GetFileURL(nsIFileURL **aFileURL) { nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); -#ifdef MOZ_UNICODE file->InitWithPath(mUnicodeFile); -#else - file->InitWithNativePath(mFile); -#endif nsCOMPtr uri; NS_NewFileURI(getter_AddRefs(uri), file); diff --git a/widget/src/windows/nsFilePicker.h b/widget/src/windows/nsFilePicker.h index b8f5d2d8c59a..14f13298d69f 100644 --- a/widget/src/windows/nsFilePicker.h +++ b/widget/src/windows/nsFilePicker.h @@ -59,9 +59,7 @@ public: NS_IMETHOD GetFileURL(nsIFileURL * *aFileURL); NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); NS_IMETHOD Show(PRInt16 *aReturnVal); -#ifdef MOZ_UNICODE NS_IMETHOD ShowW(PRInt16 *aReturnVal); -#endif NS_IMETHOD AppendFilter(const PRUnichar *aTitle, const PRUnichar *aFilter) ; protected: @@ -89,11 +87,8 @@ protected: PRInt16 mSelectedType; nsCOMPtr mFiles; static char mLastUsedDirectory[]; - -#ifdef MOZ_UNICODE nsString mUnicodeFile; static nsString mLastUsedUnicodeDirectory; -#endif }; #endif // nsFilePicker_h__ diff --git a/widget/src/windows/nsScrollbar.cpp b/widget/src/windows/nsScrollbar.cpp index 2180aa334621..e007fd07114b 100644 --- a/widget/src/windows/nsScrollbar.cpp +++ b/widget/src/windows/nsScrollbar.cpp @@ -533,7 +533,6 @@ NS_METHOD nsScrollbar::GetBounds(nsRect &aRect) } -#ifdef MOZ_UNICODE //------------------------------------------------------------------------- // // return the window class name and initialize the class if needed @@ -562,4 +561,3 @@ LPCWSTR nsScrollbar::WindowClassW() return classicScrollBarClass; } -#endif diff --git a/widget/src/windows/nsScrollbar.h b/widget/src/windows/nsScrollbar.h index 1b5d4a7d94c0..653e7274b4df 100644 --- a/widget/src/windows/nsScrollbar.h +++ b/widget/src/windows/nsScrollbar.h @@ -81,9 +81,7 @@ public: protected: virtual LPCTSTR WindowClass(); -#ifdef MOZ_UNICODE virtual LPCWSTR WindowClassW(); -#endif /* MOZ_UNICODE */ virtual DWORD WindowStyle(); virtual DWORD WindowExStyle(); diff --git a/widget/src/windows/nsToolkit.cpp b/widget/src/windows/nsToolkit.cpp index bf7967a5412f..c50d1da7600a 100644 --- a/widget/src/windows/nsToolkit.cpp +++ b/widget/src/windows/nsToolkit.cpp @@ -44,12 +44,10 @@ #include "nsIServiceManager.h" #include "nsIEventQueueService.h" #include "nsIEventQueue.h" -#ifdef MOZ_AIMM // objbase.h must be declared before initguid.h to use the |DEFINE_GUID|'s in aimm.h #include #include #include "aimm.h" -#endif // unknwn.h is needed to build with WIN32_LEAN_AND_MEAN #include @@ -81,8 +79,6 @@ PRBool nsToolkit::mUseImeApiW = PR_FALSE; PRBool nsToolkit::mW2KXP_CP936 = PR_FALSE; PRBool nsToolkit::mIsWinXP = PR_FALSE; -#ifdef MOZ_AIMM - DEFINE_GUID(IID_IActiveIMMApp, 0x08c0e040, 0x62d1, 0x11d1, 0x93, 0x26, 0x0, 0x60, 0xb0, 0x67, 0xb8, 0x6e); @@ -94,7 +90,6 @@ DEFINE_GUID(IID_IActiveIMMMessagePumpOwner, IActiveIMMApp* nsToolkit::gAIMMApp = NULL; PRInt32 nsToolkit::gAIMMCount = 0; -#endif nsWindow *MouseTrailer::mCaptureWindow = NULL; nsWindow *MouseTrailer::mHoldMouse = NULL; @@ -183,7 +178,6 @@ LRESULT CALLBACK DetectWindowMove(int code, WPARAM wParam, LPARAM lParam) -#ifdef MOZ_UNICODE #include "nsWindowAPI.h" @@ -508,18 +502,14 @@ NS_UnregisterClass nsToolkit::mUnregisterClass = nsUnregisterClass; NS_SHGetPathFromIDList nsToolkit::mSHGetPathFromIDList = nsSHGetPathFromIDList; NS_SHBrowseForFolder nsToolkit::mSHBrowseForFolder = nsSHBrowseForFolder; -#endif /* MOZ_UNICODE */ - void RunPump(void* arg) { ThreadInitInfo *info = (ThreadInitInfo*)arg; ::PR_EnterMonitor(info->monitor); -#ifdef MOZ_AIMM // Start Active Input Method Manager on this thread if(nsToolkit::gAIMMApp) nsToolkit::gAIMMApp->Activate(TRUE); -#endif // do registration and creation in this thread info->toolkit->CreateInternalWindow(PR_GetCurrentThread()); @@ -533,17 +523,10 @@ void RunPump(void* arg) // Process messages MSG msg; -#ifdef MOZ_UNICODE while (nsToolkit::mGetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); nsToolkit::mDispatchMessage(&msg); } -#else - while (GetMessage(&msg, NULL, 0, 0)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } -#endif } //------------------------------------------------------------------------- @@ -556,7 +539,6 @@ nsToolkit::nsToolkit() mGuiThread = NULL; mDispatchWnd = 0; -#ifdef MOZ_AIMM // // Initialize COM since create Active Input Method Manager object // @@ -567,7 +549,6 @@ nsToolkit::nsToolkit() ::CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER, IID_IActiveIMMApp, (void**) &nsToolkit::gAIMMApp); nsToolkit::gAIMMCount++; -#endif #ifdef MOZ_STATIC_COMPONENT_LIBS nsToolkit::Startup(GetModuleHandle(NULL)); @@ -584,7 +565,6 @@ nsToolkit::~nsToolkit() { NS_PRECONDITION(::IsWindow(mDispatchWnd), "Invalid window handle"); -#ifdef MOZ_AIMM nsToolkit::gAIMMCount--; if (!nsToolkit::gAIMMCount) { @@ -595,7 +575,6 @@ nsToolkit::~nsToolkit() } ::CoUninitialize(); } -#endif // Destroy the Dispatch Window ::DestroyWindow(mDispatchWnd); @@ -645,7 +624,6 @@ nsToolkit::Startup(HMODULE hModule) nsToolkit::mIsNT = (osversion.dwPlatformId == VER_PLATFORM_WIN32_NT); if (nsToolkit::mIsNT) { -#ifdef MOZ_UNICODE // For Windows 9x base OS nsFoo is already pointing to A functions // However on NT base OS we should point them to respective W functions nsToolkit::mDefWindowProc = DefWindowProcW; @@ -673,7 +651,6 @@ nsToolkit::Startup(HMODULE hModule) if (!nsToolkit::mSHBrowseForFolder) nsToolkit::mSHBrowseForFolder = &nsSHBrowseForFolder; } -#endif /* MOZ_UNICODE */ nsToolkit::mUseImeApiW = PR_TRUE; // XXX Hack for stopping the crash (125573) if (osversion.dwMajorVersion == 5 && (osversion.dwMinorVersion == 0 || osversion.dwMinorVersion == 1)) { @@ -690,12 +667,7 @@ nsToolkit::Startup(HMODULE hModule) // // register the internal window class // -#ifdef MOZ_UNICODE WNDCLASSW wc; -#else - WNDCLASS wc; -#endif /* MOZ_UNICODE */ - wc.style = CS_GLOBALCLASS; wc.lpfnWndProc = nsToolkit::WindowProc; wc.cbClsExtra = 0; @@ -705,13 +677,8 @@ nsToolkit::Startup(HMODULE hModule) wc.hCursor = NULL; wc.hbrBackground = NULL; wc.lpszMenuName = NULL; -#ifdef MOZ_UNICODE wc.lpszClassName = L"nsToolkitClass"; VERIFY(nsToolkit::mRegisterClass(&wc)); -#else - wc.lpszClassName = "nsToolkitClass"; - VERIFY(::RegisterClass(&wc)); -#endif /* MOZ_UNICODE */ } @@ -815,13 +782,9 @@ NS_METHOD nsToolkit::Init(PRThread *aThread) // Store the thread ID of the thread containing the message pump. // If no thread is provided create one if (NULL != aThread) { - -#ifdef MOZ_AIMM // Start Active Input Method Manager on this thread if(nsToolkit::gAIMMApp) nsToolkit::gAIMMApp->Activate(TRUE); -#endif - CreateInternalWindow(aThread); } else { // create a thread where the message pump will run @@ -874,19 +837,13 @@ LRESULT CALLBACK nsToolkit::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, } -#ifdef MOZ_AIMM if(nsToolkit::gAIMMApp) { LRESULT lResult; if (nsToolkit::gAIMMApp->OnDefWindowProc(hWnd, msg, wParam, lParam, &lResult) == S_OK) return lResult; } -#endif -#ifdef MOZ_UNICODE return nsToolkit::mDefWindowProc(hWnd, msg, wParam, lParam); -#else - return ::DefWindowProc(hWnd, msg, wParam, lParam); -#endif } diff --git a/widget/src/windows/nsToolkit.h b/widget/src/windows/nsToolkit.h index 314728296d06..d340da8ab4db 100644 --- a/widget/src/windows/nsToolkit.h +++ b/widget/src/windows/nsToolkit.h @@ -41,13 +41,9 @@ #include "nsdefs.h" #include "nsIToolkit.h" -#ifdef MOZ_AIMM struct IActiveIMMApp; -#endif -#ifdef MOZ_UNICODE #include "nsWindowAPI.h" -#endif struct MethodInfo; class nsIEventQueue; @@ -106,13 +102,10 @@ public: static void Startup(HINSTANCE hModule); static void Shutdown(); -#ifdef MOZ_AIMM // Active Input Method support static IActiveIMMApp *gAIMMApp; static PRInt32 gAIMMCount; -#endif -#ifdef MOZ_UNICODE // Ansi API support static HMODULE mShell32Module; static NS_DefWindowProc mDefWindowProc; @@ -131,7 +124,6 @@ public: static NS_UnregisterClass mUnregisterClass; static NS_SHGetPathFromIDList mSHGetPathFromIDList; static NS_SHBrowseForFolder mSHBrowseForFolder; -#endif }; #define WM_CALLMETHOD (WM_USER+1) diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 619a0ab4e810..433a2e7b7103 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -93,9 +93,7 @@ #endif #include -#ifdef MOZ_AIMM #include "aimm.h" -#endif // MOZ_AIMM #include "nsNativeDragTarget.h" #include "nsIRollupListener.h" @@ -269,8 +267,6 @@ static PRBool is_vk_down(int vk) // Macro for Active Input Method Manager (AIMM) support. // Use AIMM method instead of Win32 Imm APIs. // -#ifdef MOZ_AIMM - #define NS_IMM_GETCOMPOSITIONSTRING(hIMC, dwIndex, pBuf, dwBufLen, compStrLen) \ { \ compStrLen = 0; \ @@ -439,99 +435,6 @@ static PRBool is_vk_down(int vk) } \ } -#else /* !MOZ_AIMM */ - -#define NS_IMM_GETCOMPOSITIONSTRING(hIMC, dwIndex, pBuf, dwBufLen, compStrLen) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - compStrLen = theIMM.GetCompositionStringA(hIMC, dwIndex, pBuf, dwBufLen); \ - } - -#define NS_IMM_GETCOMPOSITIONSTRINGW(hIMC, dwIndex, pBuf, dwBufLen, compStrLen) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - compStrLen = theIMM.GetCompositionStringW(hIMC, dwIndex, pBuf, dwBufLen); \ - } - -#define NS_IMM_GETCONTEXT(hWnd, hIMC) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - hIMC = theIMM.GetContext(hWnd); \ - } - -#define NS_IMM_GETCONVERSIONSTATUS(hIMC, lpfdwConversion, lpfdwSentence) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.GetConversionStatus(hIMC, (lpfdwConversion), (lpfdwSentence)); \ - } - -#define NS_IMM_RELEASECONTEXT(hWnd, hIMC) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.ReleaseContext(hWnd, hIMC); \ - } - -#define NS_IMM_NOTIFYIME(hIMC, dwAction, dwIndex, dwValue) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.NotifyIME(hIMC, dwAction, dwIndex, dwValue); \ - } - -#define NS_IMM_SETCANDIDATEWINDOW(hIMC, candForm) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.SetCandidateWindow(hIMC, candForm); \ - } - -#define NS_IMM_SETCOMPOSITIONWINDOW(hIMC, compForm) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.SetCompositionWindow(hIMC, compForm); \ - } - -#define NS_IMM_GETCOMPOSITIONFONT(hIMC, lf) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.GetCompositionFont(hIMC, lf); \ - } - -#define NS_IMM_GETCOMPOSITIONFONTW(hIMC, lf) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.GetCompositionFontW(hIMC, lf); \ - } - -#define NS_IMM_SETCOMPOSITIONFONT(hIMC, lf) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.SetCompositionFont(hIMC, lf); \ - } - -#define NS_IMM_SETCOMPOSITIONFONTW(hIMC, lf) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.SetCompositionFontW(hIMC, lf); \ - } - -#define NS_IMM_SETCONVERSIONSTATUS(hIMC, lpfdwConversion, lpfdwSentence) \ - { \ - nsIMM &theIMM = nsIMM::LoadModule(); \ - theIMM.SetConversionStatus(hIMC, (lpfdwConversion), (lpfdwSentence)); \ - } - -#define NS_IMM_GETPROPERTY(hKL, dwIndex, dwProp) \ - { \ - nsIMM& theIMM = nsIMM::LoadModule(); \ - dwProp = (DWORD)theIMM.GetProperty(hKL, dwIndex); \ - } - -#define NS_IMM_GETDEFAULTIMEWND(hWnd, phDefWnd) \ - { \ - nsIMM& theIMM = nsIMM::LoadModule(); \ - *(phDefWnd) = theIMM.GetDefaultIMEWnd(hWnd); \ - } -#endif /* MOZ_AIMM */ - // // for reconversion define // @@ -744,21 +647,12 @@ static nsAttentionTimerMonitor *gAttentionTimerMonitor = 0; BOOL CALLBACK nsWindow::BroadcastMsgToChildren(HWND aWnd, LPARAM aMsg) { -#ifdef MOZ_UNICODE LONG proc = nsToolkit::mGetWindowLong(aWnd, GWL_WNDPROC); if (proc == (LONG)&nsWindow::WindowProc) { // its one of our windows so go ahead and send a message to it WNDPROC winProc = (WNDPROC)nsToolkit::mGetWindowLong(aWnd, GWL_WNDPROC); nsToolkit::mCallWindowProc(winProc, aWnd, aMsg, 0, 0); } -#else - LONG proc = ::GetWindowLong(aWnd, GWL_WNDPROC); - if (proc == (LONG)&nsWindow::WindowProc) { - // its one of our windows so go ahead and send a message to it - WNDPROC winProc = (WNDPROC)GetWindowLong(aWnd, GWL_WNDPROC); - ::CallWindowProc(winProc, aWnd, aMsg, 0, 0); - } -#endif return TRUE; } @@ -1418,11 +1312,7 @@ LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM // why we are hitting this assert if (nsnull == someWindow) { NS_ASSERTION(someWindow, "someWindow is null, cannot call any CallWindowProc"); -#ifdef MOZ_UNICODE return nsToolkit::mDefWindowProc(hWnd, msg, wParam, lParam); -#else - return ::DefWindowProc(hWnd, msg, wParam, lParam); -#endif } // hold on to the window for the life of this method, in case it gets @@ -1449,25 +1339,14 @@ LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM } #if defined(STRICT) - #ifdef MOZ_UNICODE return nsToolkit::mCallWindowProc((WNDPROC)someWindow->GetPrevWindowProc(), hWnd, msg, wParam, lParam); - #else - return ::CallWindowProc((WNDPROC)someWindow->GetPrevWindowProc(), hWnd, - msg, wParam, lParam); - #endif #else - #ifdef MOZ_UNICODE return nsToolkit::mCallWindowProc((FARPROC)someWindow->GetPrevWindowProc(), hWnd, msg, wParam, lParam); - #else - return ::CallWindowProc((FARPROC)someWindow->GetPrevWindowProc(), hWnd, - msg, wParam, lParam); - #endif #endif } -#ifdef MOZ_AIMM // // Default Window proceduer for AIMM support. // @@ -1479,13 +1358,8 @@ LRESULT CALLBACK nsWindow::DefaultWindowProc(HWND hWnd, UINT msg, WPARAM wParam, if (nsToolkit::gAIMMApp->OnDefWindowProc(hWnd, msg, wParam, lParam, &lResult) == S_OK) return lResult; } -#ifdef MOZ_UNICODE return nsToolkit::mDefWindowProc(hWnd, msg, wParam, lParam); -#else - return ::DefWindowProc(hWnd, msg, wParam, lParam); -#endif } -#endif static BOOL CALLBACK DummyDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { return FALSE; @@ -1606,7 +1480,6 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent, (DLGPROC)DummyDialogProc, NULL); } else { -#ifdef MOZ_UNICODE mWnd = nsToolkit::mCreateWindowEx(extendedStyle, aInitData && aInitData->mDropShadow ? WindowPopupClassW() : WindowClassW(), @@ -1620,21 +1493,6 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent, NULL, nsToolkit::mDllInstance, NULL); -#else - mWnd = ::CreateWindowEx(extendedStyle, - aInitData && aInitData->mDropShadow ? - WindowPopupClass() : WindowClass(), - "", - style, - aRect.x, - aRect.y, - aRect.width, - GetHeight(aRect.height), - parent, - NULL, - nsToolkit::mDllInstance, - NULL); -#endif } VERIFY(mWnd); @@ -1668,7 +1526,6 @@ PRBool nsWindow::SetWin32ContentType() nsContentType newContentType = mContentType; -#ifdef MOZ_UNICODE if (newContentType == eContentTypeInherit) { HWND parentWnd = mWnd; newContentType = eContentTypeUI; // default if we're the root @@ -1678,17 +1535,6 @@ PRBool nsWindow::SetWin32ContentType() } nsContentType oldContentType = (nsContentType)nsToolkit::mGetWindowLong(mWnd, GWL_ID); nsToolkit::mSetWindowLong(mWnd, GWL_ID, (PRInt32)newContentType); -#else - if (newContentType == eContentTypeInherit) { - HWND parentWnd = mWnd; - newContentType = eContentTypeUI; // default if we're the root - if ((parentWnd = ::GetParent(parentWnd)) != 0) { - newContentType = (nsContentType)nsToolkit::GetWindowLong(parentWnd, GWL_ID); - } - } - nsContentType oldContentType = (nsContentType)nsToolkit::GetWindowLong(mWnd, GWL_ID); - nsToolkit::SetWindowLong(mWnd, GWL_ID, (PRInt32)newContentType); -#endif return oldContentType != newContentType; } @@ -2001,11 +1847,7 @@ NS_METHOD nsWindow::ModalEventFilter(PRBool aRealEvent, void *aEvent, // if not, accept events for any window that hasn't been // disabled. if (!acceptEvent) { -#ifdef MOZ_UNICODE LONG proc = nsToolkit::mGetWindowLong(msgWindow, GWL_WNDPROC); -#else - LONG proc = ::GetWindowLong(msgWindow, GWL_WNDPROC); -#endif /* MOZ_UNICODE */ if (proc == (LONG)&nsWindow::WindowProc) { nsWindow *msgWin = GetNSWindowPtr(msgWindow); msgWin->IsEnabled(&acceptEvent); @@ -2474,11 +2316,7 @@ NS_METHOD nsWindow::SetFont(const nsFont &aFont) HFONT hfont = (HFONT)fontHandle; // Draw in the new font -#ifdef MOZ_UNICODE nsToolkit::mSendMessage(mWnd, WM_SETFONT, (WPARAM)hfont, (LPARAM)0); -#else - ::SendMessage(mWnd, WM_SETFONT, (WPARAM)hfont, (LPARAM)0); -#endif NS_RELEASE(metrics); return NS_OK; @@ -2640,13 +2478,8 @@ NS_IMETHODIMP nsWindow::HideWindowChrome(PRBool aShouldHide) DWORD style, exStyle; if (aShouldHide) { -#ifdef MOZ_UNICODE DWORD tempStyle = nsToolkit::mGetWindowLong(hwnd, GWL_STYLE); DWORD tempExStyle = nsToolkit::mGetWindowLong(hwnd, GWL_EXSTYLE); -#else - DWORD tempStyle = ::GetWindowLong(hwnd, GWL_STYLE); - DWORD tempExStyle = ::GetWindowLong(hwnd, GWL_EXSTYLE); -#endif /* MOZ_UNICODE */ style = WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX; exStyle = 0; @@ -2656,26 +2489,16 @@ NS_IMETHODIMP nsWindow::HideWindowChrome(PRBool aShouldHide) } else { if (!mOldStyle || !mOldExStyle) { -#ifdef MOZ_UNICODE mOldStyle = nsToolkit::mGetWindowLong(hwnd, GWL_STYLE); mOldExStyle = nsToolkit::mGetWindowLong(hwnd, GWL_EXSTYLE); -#else - mOldStyle = ::GetWindowLong(hwnd, GWL_STYLE); - mOldExStyle = ::GetWindowLong(hwnd, GWL_EXSTYLE); -#endif /* MOZ_UNICODE */ } style = mOldStyle; exStyle = mOldExStyle; } -#ifdef MOZ_UNICODE nsToolkit::mSetWindowLong(hwnd, GWL_STYLE, style); nsToolkit::mSetWindowLong(hwnd, GWL_EXSTYLE, exStyle); -#else - ::SetWindowLong(hwnd, GWL_STYLE, style); - ::SetWindowLong(hwnd, GWL_EXSTYLE, exStyle); -#endif return NS_OK; } @@ -3226,23 +3049,17 @@ BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte } else { // 0x20 - SPACE, 0x3D - EQUALS -#ifdef MOZ_UNICODE if(mbcsCharCode < 0x20 || (virtualKeyCode == 0x3D && mIsControlDown)) -#else - if(virtualKeyCode < 0x20 || (virtualKeyCode == 0x3D && mIsControlDown)) -#endif /* MOZ_UNICODE */ { uniChar = 0; } else { -#ifdef MOZ_UNICODE if (nsToolkit::mIsNT) { uniChar = mbcsCharCode; } else { -#endif /* MOZ_UNICODE */ char charToConvert[3]; size_t length; @@ -3271,9 +3088,7 @@ BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte } ::MultiByteToWideChar(gCurrentKeyboardCP,MB_PRECOMPOSED,charToConvert,length, &uniChar, 1); -#ifdef MOZ_UNICODE } -#endif /* MOZ_UNICODE */ virtualKeyCode = 0; } } @@ -3756,11 +3571,7 @@ static nsresult HeapDump(const char *filename, const char *heading) BOOL CALLBACK nsWindow::DispatchStarvedPaints(HWND aWnd, LPARAM aMsg) { -#ifdef MOZ_UNICODE LONG proc = nsToolkit::mGetWindowLong(aWnd, GWL_WNDPROC); -#else - LONG proc = ::GetWindowLong(aWnd, GWL_WNDPROC); -#endif /* MOZ_UNICODE */ if (proc == (LONG)&nsWindow::WindowProc) { // its one of our windows so check to see if it has a // invalidated rect. If it does. Dispatch a synchronous @@ -4321,17 +4132,10 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT break; case WM_KILLFOCUS: -#ifdef MOZ_UNICODE WCHAR className[19]; nsToolkit::mGetClassName((HWND)wParam, className, 19); if(wcscmp(className, WindowClassW())) isMozWindowTakingFocus = PR_FALSE; -#else - char className[19]; - ::GetClassName((HWND)wParam, className, 19); - if(strcmp(className, WindowClass())) - isMozWindowTakingFocus = PR_FALSE; -#endif if(gJustGotDeactivate) { gJustGotDeactivate = PR_FALSE; result = DispatchFocus(NS_DEACTIVATE, isMozWindowTakingFocus); @@ -4432,18 +4236,10 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT if (pl.showCmd == SW_SHOWMINIMIZED) { // Deactivate -#ifdef MOZ_UNICODE WCHAR className[19]; nsToolkit::mGetClassName((HWND)wParam, className, 19); if(wcscmp(className, WindowClassW())) isMozWindowTakingFocus = PR_FALSE; -#else - char className[19]; - ::GetClassName((HWND)wParam, className, 19); - if(strcmp(className, WindowClass())) - isMozWindowTakingFocus = PR_FALSE; -#endif - gJustGotDeactivate = PR_FALSE; result = DispatchFocus(NS_DEACTIVATE, isMozWindowTakingFocus); } else if (pl.showCmd == SW_SHOWNORMAL){ @@ -4695,11 +4491,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT break; } -#ifdef MOZ_UNICODE LONG proc = nsToolkit::mGetWindowLong(destWnd, GWL_WNDPROC); -#else - LONG proc = ::GetWindowLong(destWnd, GWL_WNDPROC); -#endif /* MOZ_UNICODE */ if (proc != (LONG)&nsWindow::WindowProc) { // Some other app, or a plugin window. // Windows directs WM_MOUSEWHEEL to the focused window. @@ -4818,7 +4610,6 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT #define CS_XP_DROPSHADOW 0x00020000 -#ifdef MOZ_UNICODE LPCWSTR nsWindow::WindowClassW() { const LPCWSTR className = L"MozillaWindowClass"; @@ -4828,11 +4619,7 @@ LPCWSTR nsWindow::WindowClassW() // wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wc.style = CS_DBLCLKS; -#ifdef MOZ_AIMM wc.lpfnWndProc = nsWindow::DefaultWindowProc; -#else - wc.lpfnWndProc = nsToolkit::nsDefWindowProc; -#endif wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = nsToolkit::mDllInstance; @@ -4843,11 +4630,9 @@ LPCWSTR nsWindow::WindowClassW() wc.lpszClassName = className; nsWindow::sIsRegistered = nsToolkit::mRegisterClass(&wc); -#ifdef MOZ_AIMM // Call FilterClientWindows method since it enables ActiveIME on CJK Windows if(nsToolkit::gAIMMApp) nsToolkit::gAIMMApp->FilterClientWindows((ATOM*)&nsWindow::sIsRegistered,1); -#endif // MOZ_AIMM } return className; @@ -4860,11 +4645,7 @@ LPCWSTR nsWindow::WindowPopupClassW() if (!nsWindow::sIsPopupClassRegistered) { WNDCLASSW wc; wc.style = CS_DBLCLKS | CS_XP_DROPSHADOW; -#ifdef MOZ_AIMM wc.lpfnWndProc = nsWindow::DefaultWindowProc; -#else - wc.lpfnWndProc = nsToolkit::nsDefWindowProc; -#endif wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = nsToolkit::mDllInstance; @@ -4888,83 +4669,26 @@ LPCWSTR nsWindow::WindowPopupClassW() LPCTSTR nsWindow::WindowClass() { - return (NS_ConvertUCS2toUTF8(WindowClassW()).get()); + // Call into the wide version to make sure things get + // registered properly. + WindowClassW(); + + // XXX: The class name used here must be kept in sync with + // the classname used in WindowClassW(); + return "MozillaWindowClass"; } LPCTSTR nsWindow::WindowPopupClass() { - return (NS_ConvertUCS2toUTF8(WindowPopupClassW()).get()); + // Call into the wide version to make sure things get + // registered properly. + WindowPopupClassW(); + + // XXX: The class name used here must be kept in sync with + // the classname used in WindowPopupClassW(); + return "MozillaDropShadowWindowClass"; } -#else -LPCTSTR nsWindow::WindowClass() -{ - const LPCTSTR className = "MozillaWindowClass"; - - if (!nsWindow::sIsRegistered) { - WNDCLASS wc; - -// wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; - wc.style = CS_DBLCLKS; -#ifdef MOZ_AIMM - wc.lpfnWndProc = nsWindow::DefaultWindowProc; -#else - wc.lpfnWndProc = ::DefWindowProc; -#endif - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = nsToolkit::mDllInstance; - wc.hIcon = ::LoadIcon(::GetModuleHandle(NULL), IDI_APPLICATION); - wc.hCursor = NULL; - wc.hbrBackground = mBrush; - wc.lpszMenuName = NULL; - wc.lpszClassName = className; - - nsWindow::sIsRegistered = ::RegisterClass(&wc); -#ifdef MOZ_AIMM - // Call FilterClientWindows method since it enables ActiveIME on CJK Windows - if(nsToolkit::gAIMMApp) - nsToolkit::gAIMMApp->FilterClientWindows((ATOM*)&nsWindow::sIsRegistered,1); -#endif // MOZ_AIMM - } - - return className; -} - -LPCTSTR nsWindow::WindowPopupClass() -{ - const LPCTSTR className = "MozillaDropShadowWindowClass"; - - if (!nsWindow::sIsPopupClassRegistered) { - WNDCLASS wc; - wc.style = CS_DBLCLKS | CS_XP_DROPSHADOW; -#ifdef MOZ_AIMM - wc.lpfnWndProc = nsWindow::DefaultWindowProc; -#else - wc.lpfnWndProc = ::DefWindowProc; -#endif - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = nsToolkit::mDllInstance; - wc.hIcon = ::LoadIcon(::GetModuleHandle(NULL), IDI_APPLICATION); - wc.hCursor = NULL; - wc.hbrBackground = mBrush; - wc.lpszMenuName = NULL; - wc.lpszClassName = className; - - nsWindow::sIsPopupClassRegistered = ::RegisterClass(&wc); - if (!nsWindow::sIsPopupClassRegistered) { - // For older versions of Win32 (i.e., not XP), the registration will - // fail, so we have to re-register without the CS_XP_DROPSHADOW flag. - wc.style = CS_DBLCLKS; - nsWindow::sIsPopupClassRegistered = ::RegisterClass(&wc); - } - } - - return className; -} -#endif - //------------------------------------------------------------------------- // // return nsWindow styles @@ -5081,30 +4805,21 @@ void nsWindow::SubclassWindow(BOOL bState) if (bState) { // change the nsWindow proc -#ifdef MOZ_UNICODE if (mUnicodeWidget) mPrevWndProc = (WNDPROC)nsToolkit::mSetWindowLong(mWnd, GWL_WNDPROC, (LONG)nsWindow::WindowProc); else mPrevWndProc = (WNDPROC)::SetWindowLong(mWnd, GWL_WNDPROC, (LONG)nsWindow::WindowProc); -#else - mPrevWndProc = (WNDPROC)::SetWindowLong(mWnd, GWL_WNDPROC, - (LONG)nsWindow::WindowProc); -#endif NS_ASSERTION(mPrevWndProc, "Null standard window procedure"); // connect the this pointer to the nsWindow handle SetNSWindowPtr(mWnd, this); } else { -#ifdef MOZ_UNICODE if (mUnicodeWidget) nsToolkit::mSetWindowLong(mWnd, GWL_WNDPROC, (LONG)mPrevWndProc); else ::SetWindowLong(mWnd, GWL_WNDPROC, (LONG)mPrevWndProc); -#else - ::SetWindowLong(mWnd, GWL_WNDPROC, (LONG)mPrevWndProc); -#endif SetNSWindowPtr(mWnd, NULL); mPrevWndProc = NULL; } @@ -5746,11 +5461,7 @@ NS_METHOD nsWindow::SetTitle(const nsString& aTitle) { char* title = GetACPString(aTitle); if (title) { -#ifdef MOZ_UNICODE nsToolkit::mSendMessage(mWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCWSTR)PromiseFlatString(aTitle).get()); -#else - ::SendMessage(mWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCTSTR)title); -#endif delete [] title; } return NS_OK; @@ -5824,11 +5535,7 @@ NS_METHOD nsWindow::SetIcon(const nsAString& anIconSpec) if ( bigIcon ) { LRESULT rv = 0; -#ifdef MOZ_UNICODE rv = nsToolkit::mSendMessage(mWnd, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)bigIcon); -#else - rv = ::SendMessage(mWnd, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)bigIcon); -#endif } #ifdef DEBUG_law else { @@ -5838,11 +5545,7 @@ NS_METHOD nsWindow::SetIcon(const nsAString& anIconSpec) #endif if ( smallIcon ) { LRESULT rv = 0; -#ifdef MOZ_UNICODE rv = nsToolkit::mSendMessage(mWnd, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)smallIcon); -#else - rv = ::SendMessage(mWnd, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)smallIcon); -#endif } #ifdef DEBUG_law else { @@ -6246,12 +5949,10 @@ BOOL nsWindow::OnIMEChar(BYTE aByte1, BYTE aByte2, LPARAM aKeyState) size_t length; int err = 0; -#ifdef MOZ_UNICODE if (nsToolkit::mIsNT) { uniChar = MAKEWORD(aByte2, aByte1); } else { -#endif /* MOZ_UNICODE */ if (aByte1) { charToConvert[0] = aByte1; charToConvert[1] = aByte2; @@ -6263,9 +5964,7 @@ BOOL nsWindow::OnIMEChar(BYTE aByte1, BYTE aByte2, LPARAM aKeyState) } err = ::MultiByteToWideChar(gCurrentKeyboardCP, MB_PRECOMPOSED, charToConvert, length, &uniChar, 1); -#ifdef MOZ_UNICODE } -#endif /* MOZ_UNICODE */ #ifdef DEBUG_IME if (!err) { @@ -6898,11 +6597,7 @@ nsWindow::HandleMouseActionOfIME(int aAction, POINT *ptPos) // send MS_MSIME_MOUSE message to default IME window. HWND imeWnd; NS_IMM_GETDEFAULTIMEWND(mWnd, &imeWnd); -#ifdef MOZ_UNICODE if (nsToolkit::mSendMessage(imeWnd, nsWindow::uWM_MSIME_MOUSE, MAKELONG(MAKEWORD(aAction, positioning), offset), (LPARAM) hIMC) == 1) -#else - if (::SendMessage(imeWnd, nsWindow::uWM_MSIME_MOUSE, MAKELONG(MAKEWORD(aAction, positioning), offset), (LPARAM) hIMC) == 1) -#endif IsHandle = PR_TRUE; } NS_IMM_RELEASECONTEXT(mWnd, hIMC); diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index b1faf06067ab..080ac128a9ca 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -431,10 +431,8 @@ protected: // Allow Derived classes to modify the height that is passed // when the window is created or resized. virtual PRInt32 GetHeight(PRInt32 aProposedHeight); -#ifdef MOZ_UNICODE virtual LPCWSTR WindowClassW(); virtual LPCWSTR WindowPopupClassW(); -#endif virtual LPCTSTR WindowClass(); virtual LPCTSTR WindowPopupClass(); virtual DWORD WindowStyle(); @@ -477,9 +475,7 @@ protected: UINT msg, WPARAM wParam, LPARAM lParam); -#ifdef MOZ_AIMM static LRESULT CALLBACK DefaultWindowProc(HWND hWns, UINT msg, WPARAM wParam, LPARAM lParam); -#endif static PRBool ConvertStatus(nsEventStatus aStatus);