Bug 186549: add a pref. that allows different windows to retain their own input locale settings

Patch by Masayuki Nakano
r=emaijala
sr=bzbarsky
This commit is contained in:
ere%atp.fi 2004-12-09 19:01:35 +00:00
parent d46f71b538
commit 7ddd1f5ea0
3 changed files with 18 additions and 0 deletions

View File

@ -1069,6 +1069,9 @@ pref("advanced.system.supportDDEExec", true);
// Use CP932 compatible map for JIS X 0208
pref("intl.jis0208.map", "CP932");
// Switch the keyboard layout per window
pref("intl.keyboard.per_window_layout", false);
# WINNT
#endif

View File

@ -854,6 +854,7 @@ nsWindow::nsWindow() : nsBaseWidget()
mNativeDragTarget = nsnull;
mIsTopWidgetWindow = PR_FALSE;
mLastKeyboardLayout = 0;
sInstanceCount++;
@ -866,6 +867,7 @@ nsWindow::nsWindow() : nsBaseWidget()
HKL nsWindow::gKeyboardLayout = 0;
UINT nsWindow::gCurrentKeyboardCP = 0;
PRBool nsWindow::gSwitchKeyboardLayout = PR_FALSE;
//-------------------------------------------------------------------------
//
@ -1577,6 +1579,11 @@ nsWindow::StandardWindowCreate(nsIWidget *aParent,
&trimOnMinimize))
&& !trimOnMinimize)
gTrimOnMinimize = 0;
PRBool switchKeyboardLayout;
if (NS_SUCCEEDED(prefBranch->GetBoolPref("intl.keyboard.per_window_layout",
&switchKeyboardLayout)))
gSwitchKeyboardLayout = switchKeyboardLayout;
}
}
}
@ -4184,6 +4191,8 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
if (WA_INACTIVE == fActive) {
gJustGotDeactivate = PR_TRUE;
if (mIsTopWidgetWindow)
mLastKeyboardLayout = gKeyboardLayout;
} else {
gJustGotActivate = PR_TRUE;
nsMouseEvent event(NS_MOUSE_ACTIVATE, this);
@ -4198,6 +4207,9 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
*aRetValue = MA_ACTIVATE;
else
*aRetValue = MA_NOACTIVATE;
if (gSwitchKeyboardLayout && mLastKeyboardLayout)
ActivateKeyboardLayout(mLastKeyboardLayout, 0);
}
}
break;

View File

@ -568,6 +568,9 @@ protected:
static UINT gCurrentKeyboardCP;
static HKL gKeyboardLayout;
static PRBool gSwitchKeyboardLayout;
HKL mLastKeyboardLayout;
// Drag & Drop
nsNativeDragTarget * mNativeDragTarget;