diff --git a/framelessquickhelper.cpp b/framelessquickhelper.cpp index bd37213..f7c2a67 100644 --- a/framelessquickhelper.cpp +++ b/framelessquickhelper.cpp @@ -263,13 +263,27 @@ void FramelessQuickHelper::removeWindowFrame(const bool center) { #ifdef Q_OS_WINDOWS const auto hWnd = reinterpret_cast(win->winId()); if (hWnd) { - WinNativeEventFilter::addFramelessWindow(hWnd, nullptr, center); + WinNativeEventFilter::addFramelessWindow(hWnd); } #else m_framelessHelper.removeWindowFrame(win); - if (center) { - FramelessHelper::moveWindowToDesktopCenter(win); +#endif + } + if (center) { + moveWindowToDesktopCenter(); + } +} + +void FramelessQuickHelper::moveWindowToDesktopCenter() { + const auto win = window(); + if (win) { +#ifdef Q_OS_WINDOWS + const auto hWnd = reinterpret_cast(win->winId()); + if (hWnd) { + WinNativeEventFilter::moveWindowToDesktopCenter(hWnd); } +#else + FramelessHelper::moveWindowToDesktopCenter(win); #endif } } diff --git a/framelessquickhelper.h b/framelessquickhelper.h index 49a39ae..d1fc072 100644 --- a/framelessquickhelper.h +++ b/framelessquickhelper.h @@ -86,6 +86,7 @@ public: public Q_SLOTS: void removeWindowFrame(const bool center = true); + void moveWindowToDesktopCenter(); void setIgnoreAreas(const QVector &val); void clearIgnoreAreas();