Fix for OSX Inline IME does not work in composer and text area when the Flash 6 plugin is running, bug 159016 r=ftang sr=sfraser

This commit is contained in:
peterlubczynski%netscape.com 2002-09-13 03:02:23 +00:00
parent 0f6a559daf
commit cf2dd41612
2 changed files with 42 additions and 12 deletions

View File

@ -174,12 +174,11 @@
#endif
#endif
#if defined(XP_MAC) && TARGET_CARBON
#if defined(XP_MAC) || defined(XP_MACOSX)
#if TARGET_CARBON
#include "nsIClassicPluginFactory.h"
#include <TextServices.h>
#endif
#if defined(XP_MAC) && TARGET_CARBON
#include "nsIClassicPluginFactory.h"
#endif
// this is the name of the directory which will be created
@ -4607,6 +4606,22 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi
}
}
#if defined(XP_MAC) || defined(XP_MACOSX)
#if TARGET_CARBON
/* Flash 6.0 r50 and older on Mac has a bug which calls ::UseInputWindow(NULL, true)
which turn off all our inline IME. Turn it back after the plugin
initializtion and hope that future versions will be fixed. See bug 159016
*/
if (pluginTag->mDescription &&
!PL_strncasecmp(pluginTag->mDescription, "Shockwave Flash 6.0", 19)) {
int ver = atoi(pluginTag->mDescription + 21);
if (ver && ver <= 50) {
::UseInputWindow(NULL, false);
}
}
#endif
#endif
if (plugin != nsnull)
{
*aPlugin = plugin;

View File

@ -464,12 +464,16 @@ nsMacEventHandler::nsMacEventHandler(nsMacWindow* aTopLevelWidget)
}
err = ::NewTSMDocument(1, supportedServices,&mTSMDocument, (long)this);
NS_ASSERTION(err==noErr, "nsMacEventHandler::nsMacEventHandler: NewTSMDocument failed.");
#ifdef DEBUG_TSM
printf("nsMacEventHandler::nsMacEventHandler: created TSMDocument[%p]\n", mTSMDocument);
#endif
mIMEIsComposing = PR_FALSE;
// make sure we do not use input widnow even some other code turn it for default by calling
// ::UseInputWindow(nsnull, TRUE);
if (mTSMDocument)
::UseInputWindow(mTSMDocument, FALSE);
mIMEIsComposing = PR_FALSE;
mIMECompositionStr = nsnull;
#if !TARGET_CARBON
@ -1328,10 +1332,13 @@ if (KeyDown(0x39)) // press [caps lock] to start the profile
//
// Activate The TSMDocument associated with this handler
//
if (mTSMDocument)
err = ::ActivateTSMDocument(mTSMDocument);
else
err = ::UseInputWindow(NULL, true); // get this line from mozilla-classic - mozilla/cmd/macfe/central/TSMProxy.cp
if (mTSMDocument) {
// make sure we do not use input widnow even some other code turn it for default by calling
// ::UseInputWindow(nsnull, TRUE);
::UseInputWindow(mTSMDocument, FALSE);
err = ::ActivateTSMDocument(mTSMDocument);
}
#ifdef DEBUG_TSM
#if 0
NS_ASSERTION(err==noErr,"nsMacEventHandler::HandleActivateEvent: ActivateTSMDocument failed");
@ -1376,8 +1383,13 @@ if (KeyDown(0x39)) // press [caps lock] to start the profile
//
// Deactivate the TSMDocument assoicated with this EventHandler
//
if (mTSMDocument)
err = ::DeactivateTSMDocument(mTSMDocument);
if (mTSMDocument) {
// make sure we do not use input widnow even some other code turn it for default by calling
// ::UseInputWindow(nsnull, TRUE);
::UseInputWindow(mTSMDocument, FALSE);
err = ::DeactivateTSMDocument(mTSMDocument);
}
#ifdef DEBUG_TSM
NS_ASSERTION((noErr==err)||(tsmDocNotActiveErr==err),"nsMacEventHandler::HandleActivateEvent: DeactivateTSMDocument failed");
printf("nsEventHandler::HandleActivateEvent: DeactivateTSMDocument[%p] %s return %d\n",mTSMDocument,
@ -2647,6 +2659,9 @@ nsresult nsMacEventHandler::ResetInputState()
{
OSErr err = noErr;
if (mTSMDocument) {
// make sure we do not use input widnow even some other code turn it for default by calling
// ::UseInputWindow(nsnull, TRUE);
::UseInputWindow(mTSMDocument, FALSE);
err = ::FixTSMDocument(mTSMDocument);
NS_ASSERTION( (noErr==err)||(tsmDocNotActiveErr==err)||(tsmTSNotOpenErr), "Cannot FixTSMDocument");
}