Can't turn on IM after a popup window opens
Call SetFocus() of XIC again to the current focused widget
r=blizzard,sr=shaver,a=asa(for1.0branch)
This commit is contained in:
katakai%japan.sun.com 2002-05-10 01:11:24 +00:00
Родитель a33d4fd81d
Коммит f27b386052
3 изменённых файлов: 28 добавлений и 2 удалений

Просмотреть файл

@ -54,6 +54,7 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CI
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
nsIMEStatus *nsIMEGtkIC::gStatus = 0;
nsWindow *nsIMEGtkIC::gGlobalFocusWindow = 0;
#endif // USE_XIM
nsGtkIMEHelper* nsGtkIMEHelper::gSingleton = nsnull;
@ -987,6 +988,12 @@ nsIMEGtkIC::GetFocusWindow()
return mFocusWindow;
}
nsWindow *
nsIMEGtkIC::GetGlobalFocusWindow()
{
return gGlobalFocusWindow;
}
// workaround for kinput2/over-the-spot/ic-per-shell
// http://bugzilla.mozilla.org/show_bug.cgi?id=28022
//
@ -1010,6 +1017,8 @@ void
nsIMEGtkIC::SetFocusWindow(nsWindow * aFocusWindow)
{
mFocusWindow = aFocusWindow;
gGlobalFocusWindow = aFocusWindow;
GdkWindow *gdkWindow = (GdkWindow*)aFocusWindow->GetNativeData(NS_NATIVE_WINDOW);
if (!gdkWindow) return;

Просмотреть файл

@ -139,6 +139,7 @@ class nsIMEGtkIC {
static nsIMEStatus *gStatus;
nsWindow *mClientWindow;
nsWindow *mFocusWindow;
static nsWindow *gGlobalFocusWindow;
nsIMEGtkIC(nsWindow*, GdkFont*, GdkFont*);
nsIMEGtkIC(nsWindow*, GdkFont*);
GdkICPrivate *mIC;
@ -152,6 +153,7 @@ class nsIMEGtkIC {
static nsIMEGtkIC *GetXIC(nsWindow*, GdkFont*);
void SetFocusWindow(nsWindow * aFocusWindow);
nsWindow* GetFocusWindow();
nsWindow* GetGlobalFocusWindow();
static void UnsetFocusWindow();
static GdkIMStyle GetInputStyle();

Просмотреть файл

@ -3746,7 +3746,7 @@ nsWindow::IMEDestroyIC()
}
// reset parent window for status window
if (xic->mInputStyle & GDK_IM_PREEDIT_CALLBACKS) {
if (xic->mInputStyle & GDK_IM_STATUS_CALLBACKS) {
xic->ResetStatusWindow(this);
}
@ -3757,11 +3757,26 @@ nsWindow::IMEDestroyIC()
delete xic;
} else {
// xic and mIMEShellWindow are valid
// see discussion in bug 53989
nsWindow *gwin = xic->GetGlobalFocusWindow();
nsWindow *fwin = xic->GetFocusWindow();
// bug 53989
// if the current focused widget in xic is being destroyed,
// we need to change focused window to mIMEShellWindow
if (fwin && fwin == this) {
xic->SetFocusWindow(mIMEShellWindow);
xic->UnsetFocusWindow();
// bug 142873
// if focus is already changed before, we need to change
// focus window to the current focused window again for XIC
if (gwin && gwin != this && sFocusWindow == gwin) {
nsIMEGtkIC *focused_xic = gwin->IMEGetInputContext(PR_FALSE);
if (focused_xic) {
focused_xic->SetFocusWindow(gwin);
}
}
}
}
}