Bug 583341 - "Lose" focus if MeeGoTouch VKB is closed by the user. r=romaxa a=npodb

This commit is contained in:
Jeremias Bosch
2010-08-30 16:40:14 -07:00
parent 927832d961
commit 9989691398
2 changed files with 33 additions and 8 deletions

View File

@@ -106,6 +106,12 @@
#include "nsIDOMSimpleGestureEvent.h" //Gesture support
#if MOZ_PLATFORM_MAEMO > 5
#include "nsIDOMWindow.h"
#include "nsIDOMElement.h"
#include "nsIFocusManager.h"
#endif
#ifdef MOZ_X11
#include "keysym2ucs.h"
#endif //MOZ_X11
@@ -1284,6 +1290,22 @@ nsWindow::OnFocusOutEvent(QEvent *aEvent)
if (!mWidget)
return nsEventStatus_eIgnore;
#ifdef MOZ_PLATFORM_MAEMO > 5
if (((QFocusEvent*)aEvent)->reason() == Qt::OtherFocusReason
&& mWidget->isVKBOpen()) {
// We assume that the VKB was open in this case, because of the focus
// reason and clear the focus in the active window.
nsCOMPtr<nsIFocusManager> fm = do_GetService("@mozilla.org/focus-manager;1");
if (fm) {
nsCOMPtr<nsIDOMWindow> domWindow;
fm->GetActiveWindow(getter_AddRefs(domWindow));
fm->ClearFocus(domWindow);
}
return nsEventStatus_eIgnore;
}
#endif
DispatchDeactivateEventOnTopLevelWindow();
LOGFOCUS(("Done with container focus out [%p]\n", (void *)this));