From 0e71e0bdfa8bbc5f1f33e3757e9c34f9fe89fa34 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Tue, 9 Jun 2026 22:36:57 +0300
Subject: twin: use base width/height for stepped size calculations

Prioritize use of base_width/base_height (when available) instead of
min_width/min_height to calculate the proper size for windows that use
stepped size increments.

This is a proper fix for TDE/tde#57.

Fixes: https://mirror.git.trinitydesktop.org/gitea/tde/tde/issues/57
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 twin/geometry.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/twin/geometry.cpp b/twin/geometry.cpp
index 0dda2ec6f..6dda85a0c 100644
--- a/twin/geometry.cpp
+++ b/twin/geometry.cpp
@@ -1133,8 +1133,9 @@ TQSize Client::sizeForClientSize( const TQSize& wsize, Sizemode mode, bool nofra
     int h1 = h;
     int width_inc = xSizeHint.width_inc;
     int height_inc = xSizeHint.height_inc;
-    int basew_inc = xSizeHint.min_width; // see getWmNormalHints()
-    int baseh_inc = xSizeHint.min_height;
+    // Note: see also getWmNormalHints()
+    int basew_inc = (xSizeHint.flags & PBaseSize) ? xSizeHint.base_width  : xSizeHint.min_width;
+    int baseh_inc = (xSizeHint.flags & PBaseSize) ? xSizeHint.base_height : xSizeHint.min_height;
     w = int(( w - basew_inc ) / width_inc ) * width_inc + basew_inc;
     h = int(( h - baseh_inc ) / height_inc ) * height_inc + baseh_inc;
 // code for aspect ratios based on code from FVWM
-- 
cgit v1.2.3

