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

--HG--
extra : rebase_source : 2aed309de5a47f3c0572cfae2c595b8e46e9ac35
This commit is contained in:
Jeremias Bosch 2010-08-30 16:40:14 -07:00
Родитель d1af3c0112
Коммит 6d57316a23
2 изменённых файлов: 33 добавлений и 8 удалений

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

@ -3137,15 +3137,18 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
QScopedPointer<QApplication> app(new QApplication(gArgc, gArgv));
#endif
// try to get the MInputContext if possible to support the MeeGo VKB
QInputContext *inputContext = app->inputContext();
if (inputContext && inputContext->identifierName() != "MInputContext") {
QInputContext* context = QInputContextFactory::create("MInputContext",
app.data());
if (context)
app->setInputContext(context);
#if MOZ_PLATFORM_MAEMO > 5
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// try to get the MInputContext if possible to support the MeeGo VKB
QInputContext* inputContext = app->inputContext();
if (inputContext && inputContext->identifierName() != "MInputContext") {
QInputContext* context = QInputContextFactory::create("MInputContext",
app.data());
if (context)
app->setInputContext(context);
}
}
#endif
QStringList nonQtArguments = app->arguments();
gQtOnlyArgc = 1;
gQtOnlyArgv = (char**) malloc(sizeof(char*)

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

@ -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));