diff --git a/mozilla/widget/src/gtk/nsWindow.cpp b/mozilla/widget/src/gtk/nsWindow.cpp index e421f48a373..959bdd2ea39 100644 --- a/mozilla/widget/src/gtk/nsWindow.cpp +++ b/mozilla/widget/src/gtk/nsWindow.cpp @@ -1211,8 +1211,6 @@ GdkCursor *nsWindow::GtkCreateCursor(nsCursor aCursorType) NS_IMETHODIMP nsWindow::SetFocus(PRBool aRaise) { - PRBool sendActivate = gJustGotActivate; - gJustGotActivate = PR_FALSE; #ifdef DEBUG_FOCUS printf("nsWindow::SetFocus %p\n", NS_STATIC_CAST(void *, this)); #endif /* DEBUG_FOCUS */ @@ -1285,9 +1283,6 @@ nsWindow::SetFocus(PRBool aRaise) #endif // USE_XIM DispatchSetFocusEvent(); - if (sendActivate) { - DispatchActivateEvent(); - } #ifdef DEBUG_FOCUS printf("Returning:\n"); @@ -1330,6 +1325,12 @@ void nsWindow::DispatchSetFocusEvent(void) NS_ADDREF_THIS(); DispatchFocus(event); + + if (gJustGotActivate) { + gJustGotActivate = PR_FALSE; + DispatchActivateEvent(); + } + NS_RELEASE_THIS(); } @@ -1436,6 +1437,11 @@ void nsWindow::HandleMozAreaFocusIn(void) // window. embedding handles activate semantics for us. if (mIsToplevel) gJustGotActivate = PR_TRUE; + +#ifdef USE_XIM + IMESetFocusWindow(); +#endif // USE_XIM + DispatchSetFocusEvent(); } diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index c5dad7c5d6e..afe8084d7d8 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -489,7 +489,7 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent) printf("nsWebShellWindow::NS_ACTIVATE\n"); #endif // Sucky platform specific code to get around event dispatch ordering -#if defined(WIN32) || defined(XP_OS2) +#if defined(WIN32) || defined(XP_OS2) || defined (MOZ_WIDGET_GTK) nsCOMPtr domWindow; eventWindow->ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow));