diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 98cdecc..7f2649a 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2093,6 +2093,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
 {
     QWindow *previous = QGuiApplicationPrivate::focus_window;
     QWindow *newFocus = e->activated.data();
+    qDebug() << __FUNCTION__ << previous << "->" <<newFocus;
 
     if (previous == newFocus)
         return;
@@ -2120,6 +2121,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
             r = Qt::PopupFocusReason;
         QFocusEvent focusOut(QEvent::FocusOut, r);
         QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
+        qDebug() << __FUNCTION__ << "disconnecting _q_updateFocusObject" << previous;
         QObject::disconnect(previous, SIGNAL(focusObjectChanged(QObject*)),
                             qApp, SLOT(_q_updateFocusObject(QObject*)));
     } else if (!platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)) {
@@ -2133,6 +2135,7 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
             r = Qt::PopupFocusReason;
         QFocusEvent focusIn(QEvent::FocusIn, r);
         QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+        qDebug() << __FUNCTION__ << "connecting _q_updateFocusObject" << QGuiApplicationPrivate::focus_window;
         QObject::connect(QGuiApplicationPrivate::focus_window, SIGNAL(focusObjectChanged(QObject*)),
                          qApp, SLOT(_q_updateFocusObject(QObject*)));
     } else if (!platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState)) {
@@ -3686,6 +3689,7 @@ const QDrawHelperGammaTables *QGuiApplicationPrivate::gammaTables()
 void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object)
 {
     Q_Q(QGuiApplication);
+    qDebug() << __FUNCTION__ << object;
 
     QPlatformInputContext *inputContext = platformIntegration()->inputContext();
     bool enabled = false;
@@ -3693,6 +3697,7 @@ void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object)
         QInputMethodQueryEvent query(Qt::ImEnabled | Qt::ImHints);
         QGuiApplication::sendEvent(object, &query);
         enabled = query.value(Qt::ImEnabled).toBool();
+        qDebug() << __FUNCTION__ << object << enabled;
         if (enabled) {
             static const bool supportsHiddenText = inputContext->hasCapability(QPlatformInputContext::HiddenTextCapability);
             const Qt::InputMethodHints hints = static_cast<Qt::InputMethodHints>(query.value(Qt::ImHints).toInt());
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 8adbd49..cb7a8b9 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -218,11 +218,12 @@ void QWindowsInputContext::reset()
     doneContext();
 }
 
-void QWindowsInputContext::setFocusObject(QObject *)
+void QWindowsInputContext::setFocusObject(QObject *o)
 {
     // ### fixme: On Windows 8.1, it has been observed that the Input context
     // remains active when this happens resulting in a lock-up. Consecutive
     // key events still have VK_PROCESSKEY set and are thus ignored.
+    qDebug() << __FUNCTION__ << o;
     if (m_compositionContext.isComposing)
         reset();
     updateEnabled();
@@ -230,13 +231,13 @@ void QWindowsInputContext::setFocusObject(QObject *)
 
 void QWindowsInputContext::updateEnabled()
 {
+    qDebug() << __FUNCTION__ << QGuiApplication::focusObject();
     if (!QGuiApplication::focusObject())
         return;
     if (QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(QGuiApplication::focusWindow())) {
         const bool accepted = inputMethodAccepted();
-        if (QWindowsContext::verbose > 1)
-            qCDebug(lcQpaInputMethods) << __FUNCTION__ << platformWindow->window() << "accepted=" << accepted;
-            QWindowsInputContext::setWindowsImeEnabled(platformWindow, accepted);
+        qCDebug(lcQpaInputMethods) << __FUNCTION__ << platformWindow->window() << "accepted=" << accepted;
+        QWindowsInputContext::setWindowsImeEnabled(platformWindow, accepted);
     }
 }
 
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index ace50f1..0963d7f 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -6497,6 +6497,7 @@ bool QWidget::hasFocus() const
 
 void QWidget::setFocus(Qt::FocusReason reason)
 {
+    qDebug() << __FUNCTION__ << this << reason;
     if (!isEnabled())
         return;
 
@@ -6508,8 +6509,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
 #if 0 // Used to be included in Qt4 for Q_WS_WIN
         && GetFocus() == f->internalWinId()
 #endif
-       )
+       ) {
+        qDebug() << __FUNCTION__ << "return1";
         return;
+    }
 
 #ifndef QT_NO_GRAPHICSVIEW
     QWidget *previousProxyFocus = 0;
@@ -6536,11 +6539,13 @@ void QWidget::setFocus(Qt::FocusReason reason)
     }
 #endif
 
+    qDebug() << __FUNCTION__ << "f=" << f << "f->isActiveWindow()" << f->isActiveWindow();
     if (f->isActiveWindow()) {
         QWidget *prev = QApplicationPrivate::focus_widget;
         if (prev) {
             if (reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason
                 && prev->testAttribute(Qt::WA_InputMethodEnabled)) {
+                qDebug() << __FUNCTION__ << "calling QGuiApplication::inputMethod()->commit()";
                 QGuiApplication::inputMethod()->commit();
             }
 
@@ -6599,8 +6604,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
     }
 
     if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) {
-        if (extra->window)
+        if (extra->window) {
+            qDebug() << __FUNCTION__ << "emit focusObjectChanged" << extra->window;
             emit extra->window->focusObjectChanged(f);
+        }
     }
 }
 
@@ -6708,8 +6715,10 @@ void QWidget::clearFocus()
     // thing as the application's focusWidget, which is why this piece of code is
     // not inside the hasFocus() block above.
     if (QTLWExtra *extra = window()->d_func()->maybeTopData()) {
-        if (extra->window)
+        if (extra->window) {
+            qDebug() << __FUNCTION__ << "emit focusObjectChanged" << extra->window;
             emit extra->window->focusObjectChanged(extra->window->focusObject());
+        }
     }
 }
 
