Compare commits

...

3 Commits

Author SHA1 Message Date
zhuzichu 4dbb68abf6 update 2024-01-08 17:11:16 +08:00
zhuzichu d37cd00322 update 2024-01-08 17:03:24 +08:00
zhuzichu f04bc2951f update 2024-01-08 16:40:19 +08:00
3 changed files with 20 additions and 18 deletions

View File

@ -30,7 +30,7 @@ static inline bool isCompositionEnabled(){
} }
return composition_enabled; return composition_enabled;
} }
return true; return false;
} }
#endif #endif
@ -81,24 +81,25 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
return true; return true;
} }
int offsetSize = 0; int offsetSize = 0;
bool isMax = IsZoomed(hwnd); bool isMaximum = IsZoomed(hwnd);
offsetXY = QPoint(abs(clientRect->left - originalLeft),abs(clientRect->top - originalTop)); offsetXY = QPoint(abs(clientRect->left - originalLeft),abs(clientRect->top - originalTop));
if(isCompositionEnabled()){ if(isMaximum){
if(isMax){
_helper->setOriginalPos(QPoint(originalLeft,originalTop)); _helper->setOriginalPos(QPoint(originalLeft,originalTop));
offsetSize = 0; offsetSize = 0;
}else{ }else{
_helper->setOriginalPos({}); _helper->setOriginalPos({});
offsetSize = 1; offsetSize = 1;
} }
}else{ if(!isCompositionEnabled()){
offsetSize = 0; offsetSize = 0;
} }
clientRect->top = originalTop+offsetSize; clientRect->top = originalTop+offsetSize;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0) #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
if(!isMaximum){
clientRect->bottom = originalBottom-offsetSize; clientRect->bottom = originalBottom-offsetSize;
clientRect->left = originalLeft+offsetSize; clientRect->left = originalLeft+offsetSize;
clientRect->right = originalRight-offsetSize; clientRect->right = originalRight-offsetSize;
}
#endif #endif
*result = WVR_REDRAW; *result = WVR_REDRAW;
return true; return true;

View File

@ -91,7 +91,7 @@ Window {
var dx = (_originalPos.x - screen.virtualX)/screen.devicePixelRatio var dx = (_originalPos.x - screen.virtualX)/screen.devicePixelRatio
var dy = (_originalPos.y - screen.virtualY)/screen.devicePixelRatio var dy = (_originalPos.y - screen.virtualY)/screen.devicePixelRatio
if(dx<0 && dy<0){ if(dx<0 && dy<0){
_offsetXY = Qt.point(Math.abs(dx),Math.abs(dy)) _offsetXY = Qt.point(Math.abs(dx)-1,Math.abs(dy)-1)
}else{ }else{
_offsetXY = Qt.point(0,0) _offsetXY = Qt.point(0,0)
} }
@ -206,12 +206,13 @@ Window {
} }
Item{ Item{
id:layout_container id:layout_container
property bool isMaximum : window.visibility == Window.Maximized
anchors{ anchors{
fill:parent fill:parent
topMargin: _offsetXY.y topMargin: _offsetXY.y
bottomMargin: _offsetXY.y bottomMargin: isMaximum ? 0 : _offsetXY.y
leftMargin: _offsetXY.x leftMargin: isMaximum ? 0 :_offsetXY.x
rightMargin: _offsetXY.x rightMargin: isMaximum ? 0 : _offsetXY.x
} }
onWidthChanged: { onWidthChanged: {
window.appBar.width = width window.appBar.width = width

View File

@ -90,7 +90,7 @@ Window {
var dx = (_originalPos.x - screen.virtualX)/screen.devicePixelRatio var dx = (_originalPos.x - screen.virtualX)/screen.devicePixelRatio
var dy = (_originalPos.y - screen.virtualY)/screen.devicePixelRatio var dy = (_originalPos.y - screen.virtualY)/screen.devicePixelRatio
if(dx<0 && dy<0){ if(dx<0 && dy<0){
_offsetXY = Qt.point(Math.abs(dx),Math.abs(dy)) _offsetXY = Qt.point(Math.abs(dx)-1,Math.abs(dy)-1)
}else{ }else{
_offsetXY = Qt.point(0,0) _offsetXY = Qt.point(0,0)
} }