https://issues.imfreedom.org/issue/LIBGNT-20/libgnt-2.14.3-failed-to-build-with-ncurses-6.5
From d27eb35024396102585ca5aaf93057e0b69f1cf5 Mon Sep 17 00:00:00 2001
From: Rui Chen <rui@chenrui.dev>
Date: Mon, 15 Jul 2024 17:24:06 -0400
Subject: [PATCH] fix: build patch for incomplete type definition errors for
 'struct panel'

Signed-off-by: Rui Chen <rui@chenrui.dev>
---
 gntwm.c | 84 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/gntwm.c b/gntwm.c
index ffb1f4a..2ca4a6a 100644
--- a/gntwm.c
+++ b/gntwm.c
@@ -161,47 +161,49 @@ static void
 work_around_for_ncurses_bug(void)
 {
 #ifndef NO_WIDECHAR
-	PANEL *panel = NULL;
-	while ((panel = panel_below(panel)) != NULL) {
-		int sx, ex, sy, ey, w, y;
-		cchar_t ch;
-		PANEL *below = panel;
-
-		sx = getbegx(panel->win);
-		ex = getmaxx(panel->win) + sx;
-		sy = getbegy(panel->win);
-		ey = getmaxy(panel->win) + sy;
-
-		while ((below = panel_below(below)) != NULL) {
-			if (sy > getbegy(below->win) + getmaxy(below->win) ||
-					ey < getbegy(below->win))
-				continue;
-			if (sx > getbegx(below->win) + getmaxx(below->win) ||
-					ex < getbegx(below->win))
-				continue;
-			for (y = MAX(sy, getbegy(below->win)); y <= MIN(ey, getbegy(below->win) + getmaxy(below->win)); y++) {
-				if (mvwin_wch(below->win, y - getbegy(below->win), sx - 1 - getbegx(below->win), &ch) != OK)
-					goto right;
-				w = widestringwidth(ch.chars);
-				if (w > 1 && (ch.attr & 1)) {
-					ch.chars[0] = ' ';
-					ch.attr &= ~ A_CHARTEXT;
-					mvwadd_wch(below->win, y - getbegy(below->win), sx - 1 - getbegx(below->win), &ch);
-					touchline(below->win, y - getbegy(below->win), 1);
-				}
+    PANEL *panel = NULL;
+    while ((panel = panel_below(panel)) != NULL) {
+        int sx, ex, sy, ey, w, y;
+        cchar_t ch;
+        PANEL *below = panel;
+        WINDOW *panel_win = panel_window(panel);
+
+        sx = getbegx(panel_win);
+        ex = getmaxx(panel_win) + sx;
+        sy = getbegy(panel_win);
+        ey = getmaxy(panel_win) + sy;
+
+        while ((below = panel_below(below)) != NULL) {
+            WINDOW *below_win = panel_window(below);
+            if (sy > getbegy(below_win) + getmaxy(below_win) ||
+                    ey < getbegy(below_win))
+                continue;
+            if (sx > getbegx(below_win) + getmaxx(below_win) ||
+                    ex < getbegx(below_win))
+                continue;
+            for (y = MAX(sy, getbegy(below_win)); y <= MIN(ey, getbegy(below_win) + getmaxy(below_win)); y++) {
+                if (mvwin_wch(below_win, y - getbegy(below_win), sx - 1 - getbegx(below_win), &ch) != OK)
+                    goto right;
+                w = widestringwidth(ch.chars);
+                if (w > 1 && (ch.attr & 1)) {
+                    ch.chars[0] = ' ';
+                    ch.attr &= ~ A_CHARTEXT;
+                    mvwadd_wch(below_win, y - getbegy(below_win), sx - 1 - getbegx(below_win), &ch);
+                    touchline(below_win, y - getbegy(below_win), 1);
+                }
 right:
-				if (mvwin_wch(below->win, y - getbegy(below->win), ex + 1 - getbegx(below->win), &ch) != OK)
-					continue;
-				w = widestringwidth(ch.chars);
-				if (w > 1 && !(ch.attr & 1)) {
-					ch.chars[0] = ' ';
-					ch.attr &= ~ A_CHARTEXT;
-					mvwadd_wch(below->win, y - getbegy(below->win), ex + 1 - getbegx(below->win), &ch);
-					touchline(below->win, y - getbegy(below->win), 1);
-				}
-			}
-		}
-	}
+                if (mvwin_wch(below_win, y - getbegy(below_win), ex + 1 - getbegx(below_win), &ch) != OK)
+                    continue;
+                w = widestringwidth(ch.chars);
+                if (w > 1 && !(ch.attr & 1)) {
+                    ch.chars[0] = ' ';
+                    ch.attr &= ~ A_CHARTEXT;
+                    mvwadd_wch(below_win, y - getbegy(below_win), ex + 1 - getbegx(below_win), &ch);
+                    touchline(below_win, y - getbegy(below_win), 1);
+                }
+            }
+        }
+    }
 #endif
 }
 
@@ -2287,5 +2289,3 @@ void gnt_wm_set_event_stack(GntWM *wm, gboolean set)
 {
 	wm->event_stack = set;
 }
-
-
-- 
2.45.2

