From 0b72d31ab4c87b11e4bea423819793e48cc1cb12 Mon Sep 17 00:00:00 2001
From: Slávek Banko <slavek.banko@axis.cz>
Date: Mon, 24 Nov 2025 01:50:17 +0100
Subject: ArchLinux tdebase: Backport d2b2363d93: twin: fix tiling of maximized
 windows. This resolves issue #675
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
---
 arch/tde-core/tde-tdebase/PKGBUILD                 | 10 +++++++-
 .../bp000-fix-tiling-of-maximized-windows.diff     | 28 ++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 arch/tde-core/tde-tdebase/bp000-fix-tiling-of-maximized-windows.diff

diff --git a/arch/tde-core/tde-tdebase/PKGBUILD b/arch/tde-core/tde-tdebase/PKGBUILD
index 5215412ff..85a6db207 100644
--- a/arch/tde-core/tde-tdebase/PKGBUILD
+++ b/arch/tde-core/tde-tdebase/PKGBUILD
@@ -7,7 +7,7 @@ _kdemod="${_mod/tde/kde}"
 
 pkgname="tde-${_mod}"
 pkgver=14.1.5
-pkgrel=1
+pkgrel=2
 pkgdesc="Trinity Desktop Enviroment base components"
 arch=('i686' 'x86_64' 'aarch64' 'armv7h' 'powerpc64le')
 url="https://scm.trinitydesktop.org/scm/git/${_mod}"
@@ -52,6 +52,7 @@ options=('staticlibs' 'libtool' '!strip')
 install="trinity-${_mod}.install"
 
 source=("https://mirror.ppa.trinitydesktop.org/trinity/releases/R${pkgver}/main/${_cat}${_mod}-trinity-${pkgver}.tar.xz"
+        'bp000-fix-tiling-of-maximized-windows.diff'
         'agent-shutdown.sh'
         'agent-startup.sh'
         'tdm-trinity'
@@ -60,6 +61,7 @@ source=("https://mirror.ppa.trinitydesktop.org/trinity/releases/R${pkgver}/main/
         'xsession.patch')
 
 md5sums=('d411d22bbce474ece21cf838e7491f41'
+         '235431ac1f009c0db8a34ddd22b034f8'
          '18e8d01124b19f7df2937c06e177bf7f'
          'c963ef6e37c9051119972a58c67f05fb'
          'bb4c25e560fa719e8e8f49ef80bd1c99'
@@ -69,6 +71,12 @@ md5sums=('d411d22bbce474ece21cf838e7491f41'
 
 [ -n "$TDEDIR" ] || TDEDIR=/opt/trinity
 
+prepare() {
+  msg "Apply backported patches"
+  cd ${srcdir}/${pkgname#*-}-trinity-${pkgver} || exit 1
+  patch -p1 < ${srcdir}/bp000-fix-tiling-of-maximized-windows.diff
+}
+
 build() {
   msg "Creating out-of-source build directory: ${srcdir}/build"
   mkdir -p ${srcdir}/build
diff --git a/arch/tde-core/tde-tdebase/bp000-fix-tiling-of-maximized-windows.diff b/arch/tde-core/tde-tdebase/bp000-fix-tiling-of-maximized-windows.diff
new file mode 100644
index 000000000..a4fe63d49
--- /dev/null
+++ b/arch/tde-core/tde-tdebase/bp000-fix-tiling-of-maximized-windows.diff
@@ -0,0 +1,28 @@
+commit 23b75093d5599baeb816bbf0163ade78d2201818
+Author: Michele Calgaro <michele.calgaro@yahoo.it>
+Date:   Sat Nov 22 20:39:15 2025 +0900
+
+    twin: fix tiling of maximized windows. This resolves issue #675
+    
+    Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
+    (cherry picked from commit d2b2363d9345e74035e0585344d7150c4a62ef1c)
+
+diff --git a/twin/geometry.cpp b/twin/geometry.cpp
+index 88d0ba8cd..bdef2356c 100644
+--- a/twin/geometry.cpp
++++ b/twin/geometry.cpp
+@@ -1915,12 +1915,12 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
+     TQRect clientArea = workspace()->clientArea( MaximizeArea, this );
+ 
+     // save sizes for restoring, if maximalizing
+-    if( !activeTiled && !adjust && !( y() == clientArea.top() && height() == clientArea.height()))
++    if( !adjust && !( y() == clientArea.top() && height() == clientArea.height()))
+         {
+         geom_restore.setTop( y());
+         geom_restore.setHeight( height());
+         }
+-    if( !activeTiled && !adjust && !( x() == clientArea.left() && width() == clientArea.width()))
++    if( !adjust && !( x() == clientArea.left() && width() == clientArea.width()))
+         {
+         geom_restore.setLeft( x());
+         geom_restore.setWidth( width());
-- 
cgit v1.2.3

