diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index cdc0b24..9e9d8e7 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -591,6 +591,7 @@ QWindowsWindowData
                                  context->frameX, context->frameY,
                                  context->frameWidth, context->frameHeight,
                                  parentHandle, NULL, appinst, NULL);
+    qDebug() << "created window" << w << debugWinStyle(style);
     qCDebug(lcQpaWindows).nospace()
         << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "
         << context->obtainedGeometry << context->margins;
@@ -623,7 +624,7 @@ void WindowCreationData::applyWindowFlags(HWND hwnd) const
     const LONG_PTR newExStyle = exStyle;
     if (newExStyle != oldExStyle)
         SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle);
-    qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << hwnd << *this
+    qDebug().nospace() << __FUNCTION__ << hwnd << *this
         << "\n    Style from " << debugWinStyle(oldStyle) << "\n    to "
         << debugWinStyle(newStyle) << "\n    ExStyle from "
         << debugWinExStyle(oldExStyle) << " to "
@@ -720,7 +721,7 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co
     ncp->rgrc[0].right -= customMargins.right();
     ncp->rgrc[0].bottom -= customMargins.bottom();
     result = 0;
-    qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << oldClientArea << '+' << customMargins << "-->"
+    qDebug().nospace() << __FUNCTION__ << oldClientArea << '+' << customMargins << "-->"
         << ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2]
         << ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy;
     return true;
@@ -1284,11 +1285,14 @@ QRect QWindowsWindow::normalGeometry() const
     const bool fakeFullScreen = m_savedFrameGeometry.isValid() && window()->windowState() == Qt::WindowFullScreen;
     const QRect frame = fakeFullScreen ? m_savedFrameGeometry : normalFrameGeometry(m_data.hwnd);
     const QMargins margins = fakeFullScreen ? QWindowsGeometryHint::frame(m_savedStyle, 0) : frameMargins();
-    return frame.isValid() ? frame.marginsRemoved(margins) : frame;
+    QRect n =frame.isValid() ? frame.marginsRemoved(margins) : frame;
+    qDebug() << __FUNCTION__ << n;
+    return n;
 }
 
 void QWindowsWindow::setGeometry(const QRect &rectIn)
 {
+    qDebug() << __FUNCTION__ << window() << rectIn;
     QRect rect = rectIn;
     // This means it is a call from QWindow::setFramePosition() and
     // the coordinates include the frame (size is still the contents rectangle).
@@ -1375,6 +1379,7 @@ void QWindowsWindow::handleGeometryChange()
         return;
     const QRect previousGeometry = m_data.geometry;
     m_data.geometry = geometry_sys();
+    qDebug() << __FUNCTION__ << m_data.geometry ;
     QPlatformWindow::setGeometry(m_data.geometry);
     QWindowSystemInterface::handleGeometryChange(window(), m_data.geometry);
     // QTBUG-32121: OpenGL/normal windows (with exception of ANGLE) do not receive
@@ -1608,8 +1613,8 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
     const Qt::WindowState oldState = m_windowState;
     if (oldState == newState)
         return;
-    qCDebug(lcQpaWindows) << '>' << __FUNCTION__ << this << window()
-        << " from " << debugWindowStates(oldState) << " to " << debugWindowStates(newState);
+    qDebug() << '\n' << '>' << __FUNCTION__ << this << window()
+        << "\nFROM " << debugWindowStates(oldState) << " TO " << debugWindowStates(newState) << '\n';
 
     const bool visible = isVisible();
 
@@ -1620,9 +1625,14 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
             setFlag(WithinMaximize);
             if (newState == Qt::WindowFullScreen)
                 setFlag(MaximizeToFullScreen);
-            ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
+            int ncmd = newState == Qt::WindowMaximized ? SW_MAXIMIZE : SW_SHOWNOACTIVATE;
+            qDebug() << __FUNCTION__<< ">changing maximized" << oldState << newState
+                     << ">ShowWindow" << ncmd;
+            if (!ShowWindow(m_data.hwnd, ncmd))
+                qErrnoWarning("ShowWindow");
             clearFlag(WithinMaximize);
             clearFlag(MaximizeToFullScreen);
+            qDebug() << __FUNCTION__<< "<ShowWindow, < done changing maximized";
         }
     }
 
@@ -1640,6 +1650,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
         }
 #endif
         if (newState == Qt::WindowFullScreen) {
+            qDebug() << __FUNCTION__ << "->WindowFullScreen ON";
 #ifndef Q_FLATTEN_EXPOSE
             UINT newStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
 #else
@@ -1658,6 +1669,8 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
                 } else {
 #endif
                     m_savedFrameGeometry = frameGeometry_sys();
+                    qDebug() << __FUNCTION__ << "m_savedFrameGeometry" << m_savedFrameGeometry
+                             << "savedSt" << debugWinStyle(m_savedStyle);
 #ifndef Q_OS_WINCE
                 }
 #endif
@@ -1666,6 +1679,7 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
                 newStyle |= WS_SYSMENU;
             if (visible)
                 newStyle |= WS_VISIBLE;
+            qDebug() << __FUNCTION__ << "setting new style" << newStyle;
             setStyle(newStyle);
             // Use geometry of QWindow::screen() within creation or the virtual screen the
             // window is in (QTBUG-31166, QTBUG-30724).
@@ -1674,46 +1688,60 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
             const UINT swpf = SWP_FRAMECHANGED | SWP_NOACTIVATE;
             const bool wasSync = testFlag(SynchronousGeometryChangeEvent);
             setFlag(SynchronousGeometryChangeEvent);
+            qDebug() << __FUNCTION__ << ">SetWindowPos" << r << showbase << hex << swpf;
             SetWindowPos(m_data.hwnd, HWND_TOP, r.left(), r.top(), r.width(), r.height(), swpf);
+            qDebug() << __FUNCTION__ << "<SetWindowPos";
             if (!wasSync)
                 clearFlag(SynchronousGeometryChangeEvent);
             QWindowSystemInterface::handleGeometryChange(window(), r);
             QWindowSystemInterface::flushWindowSystemEvents();
         } else if (newState != Qt::WindowMinimized) {
+            qDebug() << __FUNCTION__ << "->!WindowMinimized" << newState << "m_savedStyle" << debugWinStyle(m_savedStyle);
             // Restore saved state.
             unsigned newStyle = m_savedStyle ? m_savedStyle : style();
             if (visible)
                 newStyle |= WS_VISIBLE;
+            qDebug() << __FUNCTION__ << "setting new style " << debugWinStyle(m_savedStyle);
             setStyle(newStyle);
-
             UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
             if (!m_savedFrameGeometry.isValid())
                 swpf |= SWP_NOSIZE | SWP_NOMOVE;
+            qDebug() << __FUNCTION__ << "RESToring" << m_savedFrameGeometry ;
             const bool wasSync = testFlag(SynchronousGeometryChangeEvent);
             setFlag(SynchronousGeometryChangeEvent);
-            SetWindowPos(m_data.hwnd, 0, m_savedFrameGeometry.x(), m_savedFrameGeometry.y(),
-                         m_savedFrameGeometry.width(), m_savedFrameGeometry.height(), swpf);
+            qDebug() << __FUNCTION__ << ">SetWindowPos" << m_savedFrameGeometry  << showbase << hex << swpf;
+            if (!SetWindowPos(m_data.hwnd, 0, m_savedFrameGeometry.x(), m_savedFrameGeometry.y(),
+                         m_savedFrameGeometry.width(), m_savedFrameGeometry.height(), swpf))
+                qErrnoWarning("SetWindowPos");
+            qDebug() << __FUNCTION__ << "<SetWindowPos";
             if (!wasSync)
                 clearFlag(SynchronousGeometryChangeEvent);
             // preserve maximized state
-            if (visible)
-                ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
+            if (visible) {
+                int cmdShow = (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE;
+                qDebug() << __FUNCTION__ << ">ShowWindow"  << hex << showbase <<cmdShow;
+                if (!ShowWindow(m_data.hwnd, cmdShow))
+                    qErrnoWarning("ShowWindow");
+                qDebug() << __FUNCTION__ << "<ShowWindow";
+            }
             m_savedStyle = 0;
             m_savedFrameGeometry = QRect();
         }
     }
 
     if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) {
+        qDebug() <<"Qt::WindowMinimized changed!";
         if (visible)
             ShowWindow(m_data.hwnd, (newState == Qt::WindowMinimized) ? SW_MINIMIZE :
                        (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
     }
-    qCDebug(lcQpaWindows) << '<' << __FUNCTION__ << this << window() << debugWindowStates(newState);
+    qDebug() << '<' << __FUNCTION__ << this << window()
+              << "\nDONE FROM " << debugWindowStates(oldState) << " TO " << debugWindowStates(newState) << '\n';
 }
 
 void QWindowsWindow::setStyle(unsigned s) const
 {
-    qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << debugWinStyle(s);
+    qDebug() << __FUNCTION__ << this << window() << debugWinStyle(s);
     setFlag(WithinSetStyle);
     setFlag(FrameDirty);
     SetWindowLongPtr(m_data.hwnd, GWL_STYLE, s);
@@ -1929,11 +1957,13 @@ void QWindowsWindow::setFrameStrutEventsEnabled(bool enabled)
 #ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
 void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
 {
+    const MINMAXINFO mmiIn = *mmi;
     const QWindowsGeometryHint hint(window(), m_data.customMargins);
     hint.applyToMinMaxInfo(m_data.hwnd, mmi);
 
     if ((testFlag(WithinMaximize) || (window()->windowState() == Qt::WindowMinimized))
             && (m_data.flags & Qt::FramelessWindowHint)) {
+        qDebug() << __FUNCTION__ << "Frameless windows shouldn't cover the taskbar when maximized";
         // This block fixes QTBUG-8361: Frameless windows shouldn't cover the
         // taskbar when maximized
         const QScreen *screen = effectiveScreen(window());
@@ -1948,12 +1978,13 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
             // If you have the taskbar on top, or on the left you don't want it at (0,0):
             mmi->ptMaxPosition.x = screen->availableGeometry().x();
             mmi->ptMaxPosition.y = screen->availableGeometry().y();
+            qDebug() << __FUNCTION__ << "Frameless windows shouldn't cover the taskbar when maximized triggered";
         } else if (!screen){
             qWarning() << "effectiveScreen() returned a null screen";
         }
     }
 
-    qCDebug(lcQpaWindows) << __FUNCTION__ << window() << *mmi;
+    qDebug() << __FUNCTION__ << window() << mmiIn <<"->" << *mmi;
 }
 
 bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const
