aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2023-11-06 17:00:37 +0000
committerVaxry <[email protected]>2023-11-06 17:00:37 +0000
commita1b7a5a53d66d6289f1a3036d1aa4daa965c363c (patch)
treea40c658a68f47afcbf4238aaec736bce6ecd0f46
parentecf98069f655a4e54943ec70d638ddcf429211d1 (diff)
downloadHyprland-a1b7a5a53d66d6289f1a3036d1aa4daa965c363c.tar.gz
Hyprland-a1b7a5a53d66d6289f1a3036d1aa4daa965c363c.zip
layout: fix various rounding errors
maybe finally will end #3761
-rw-r--r--src/layout/IHyprLayout.cpp11
-rw-r--r--src/layout/MasterLayout.cpp9
2 files changed, 13 insertions, 7 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 22816716..274acb13 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -361,12 +361,15 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
else if (m_eGrabbedCorner == CORNER_BOTTOMLEFT)
newPos = newPos + Vector2D((m_vBeginDragSizeXY - newSize).x, 0);
+ CBox wb = {newPos, newSize};
+ wb.round();
+
if (*PANIMATE) {
- DRAGGINGWINDOW->m_vRealSize = newSize;
- DRAGGINGWINDOW->m_vRealPosition = newPos;
+ DRAGGINGWINDOW->m_vRealSize = wb.size();
+ DRAGGINGWINDOW->m_vRealPosition = wb.pos();
} else {
- DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(newSize);
- DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(newPos);
+ DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(wb.size());
+ DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(wb.pos());
}
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv());
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index e29addfd..57784786 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -700,10 +700,13 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
} else {
- PWINDOW->m_vRealSize = calcSize;
- PWINDOW->m_vRealPosition = calcPos;
+ CBox wb = {calcPos, calcSize};
+ wb.round(); // avoid rounding mess
- g_pXWaylandManager->setWindowSize(PWINDOW, calcSize);
+ PWINDOW->m_vRealPosition = wb.pos();
+ PWINDOW->m_vRealSize = wb.size();
+
+ g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
}
if (m_bForceWarps && !*PANIMATE) {