diff --git a/src/FluFramelessHelper.cpp b/src/FluFramelessHelper.cpp index 9d99254a..daeeffee 100644 --- a/src/FluFramelessHelper.cpp +++ b/src/FluFramelessHelper.cpp @@ -140,14 +140,8 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void * offsetTop = 1; } } - if(isCompositionEnabled()){ - clientRect->top = originalTop+offsetTop; - }else{ - clientRect->top = originalTop; - clientRect->bottom = originalBottom; - clientRect->left = originalLeft; - clientRect->right = originalRight; - } + clientRect->top = originalTop+offsetTop; + clientRect->bottom = originalBottom-offsetTop; *result = WVR_REDRAW; return true; }if(uMsg == WM_NCHITTEST){ @@ -299,18 +293,16 @@ void FluFramelessHelper::componentComplete(){ _realHeight = QQmlProperty(window,"_realHeight"); _realWidth = QQmlProperty(window,"_realWidth"); _appBarHeight = QQmlProperty(window,"_appBarHeight"); - _enableMarginsBottomLeftRight = QQmlProperty(window,"_enableMarginsBottomLeftRight"); #ifdef Q_OS_WIN - _enableMarginsBottomLeftRight.write(!isCompositionEnabled()); window->setFlag(Qt::CustomizeWindowHint,true); _nativeEvent =new FramelessEventFilter(this); qApp->installNativeEventFilter(_nativeEvent); HWND hwnd = reinterpret_cast(window->winId()); DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); if(resizeable()){ - SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME); + SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_BORDER); }else{ - SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME); + SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_BORDER); } SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); showShadow(hwnd); diff --git a/src/FluFramelessHelper.h b/src/FluFramelessHelper.h index 79a658e3..445e67af 100644 --- a/src/FluFramelessHelper.h +++ b/src/FluFramelessHelper.h @@ -61,7 +61,6 @@ private: QQmlProperty _realHeight; QQmlProperty _realWidth; QQmlProperty _appBarHeight; - QQmlProperty _enableMarginsBottomLeftRight; }; #endif // FLUFRAMELESSHELPER_H diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index bc2a28be..d85f7a0f 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -64,7 +64,6 @@ Window { property int _realHeight property int _realWidth property int _appBarHeight: appBar.height - property bool _enableMarginsBottomLeftRight: false id:window color:"transparent" Component.onCompleted: { @@ -210,9 +209,7 @@ Window { anchors{ fill:parent topMargin: _offsetXY.y - bottomMargin: _enableMarginsBottomLeftRight ? _offsetXY.y : 0 - leftMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0 - rightMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0 + bottomMargin: _offsetXY.y } onWidthChanged: { window.appBar.width = width diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index e36354ec..b188c11c 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -63,7 +63,6 @@ Window { property int _realHeight property int _realWidth property int _appBarHeight: appBar.height - property bool _enableMarginsBottomLeftRight: false id:window color:"transparent" Component.onCompleted: { @@ -209,9 +208,7 @@ Window { anchors{ fill:parent topMargin: _offsetXY.y - bottomMargin: _enableMarginsBottomLeftRight ? _offsetXY.y : 0 - leftMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0 - rightMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0 + bottomMargin: _offsetXY.y } onWidthChanged: { window.appBar.width = width