Bug 651307 Don't commit composition string on plugins at changing input source r=smichaud

This commit is contained in:
Masayuki Nakano 2011-05-11 13:52:45 +09:00
parent a4ea6b689d
commit 36ce1aa162
2 changed files with 22 additions and 1 deletions

View File

@ -2288,6 +2288,8 @@ pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
// See bug 404131, topmost <panel> element wins to Dashboard on MacOSX.
pref("ui.panel.default_level_parent", false);
pref("ui.plugin.cancel_composition_at_input_source_changed", false);
pref("mousewheel.system_scroll_override_on_root_content.enabled", false);
# XP_MACOSX

View File

@ -26,6 +26,9 @@
*/
#import "ComplexTextInputPanel.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsServiceManagerUtils.h"
#define kInputWindowHeight 20
@ -83,7 +86,23 @@
- (void)keyboardInputSourceChanged:(NSNotification *)notification
{
[self cancelComposition];
static PRInt8 sDoCancel = -1;
if (!sDoCancel || ![self inComposition]) {
return;
}
if (sDoCancel < 0) {
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
NS_ENSURE_TRUE(prefs, );
PRBool cancelComposition = PR_FALSE;
nsresult rv =
prefs->GetBoolPref("ui.plugin.cancel_composition_at_input_source_changed",
&cancelComposition);
NS_ENSURE_SUCCESS(rv, );
sDoCancel = cancelComposition ? 1 : 0;
}
if (sDoCancel) {
[self cancelComposition];
}
}
- (BOOL)interpretKeyEvent:(NSEvent*)event string:(NSString**)string