summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mc/files/0001-Ticket-4200-fix-FTBFS-with-ncurses-build-with-disabl.patch
blob: 408473664f5d16ae20a46696c591304f29f580e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From e7bbf72544ab62db9c92bfe7bd1155227e78c621 Mon Sep 17 00:00:00 2001
From: Andrew Borodin <aborodin@vmail.ru>
Date: Sat, 28 Aug 2021 11:46:53 +0300
Subject: [PATCH] Ticket #4200: fix FTBFS with ncurses build with
 --disable-widec.

Upstream-Status: Accepted [https://github.com/MidnightCommander/mc/commit/e7bbf72544]
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
---
 lib/tty/tty-ncurses.c   | 8 ++++++++
 lib/tty/tty-ncurses.h   | 5 +++++
 lib/tty/tty-slang.h     | 2 ++
 src/filemanager/boxes.c | 2 ++
 4 files changed, 17 insertions(+)

diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c
index f619c0a7bf31..13058a624208 100644
--- a/lib/tty/tty-ncurses.c
+++ b/lib/tty/tty-ncurses.c
@@ -560,6 +560,7 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
 void
 tty_colorize_area (int y, int x, int rows, int cols, int color)
 {
+#ifdef ENABLE_SHADOWS
     cchar_t *ctext;
     wchar_t wch[10];            /* TODO not sure if the length is correct */
     attr_t attrs;
@@ -585,6 +586,13 @@ tty_colorize_area (int y, int x, int rows, int cols, int color)
     }
 
     g_free (ctext);
+#else
+    (void) y;
+    (void) x;
+    (void) rows;
+    (void) cols;
+    (void) color;
+#endif /* ENABLE_SHADOWS */
 }
 
 /* --------------------------------------------------------------------------------------------- */
diff --git a/lib/tty/tty-ncurses.h b/lib/tty/tty-ncurses.h
index d75df9533ab9..8feb17ccd045 100644
--- a/lib/tty/tty-ncurses.h
+++ b/lib/tty/tty-ncurses.h
@@ -30,6 +30,11 @@
 #define NCURSES_CONST const
 #endif
 
+/* do not draw shadows if NCurses is built with --disable-widec */
+#if defined(NCURSES_WIDECHAR) && NCURSES_WIDECHAR
+#define ENABLE_SHADOWS 1
+#endif
+
 /*** typedefs(not structures) and defined constants **********************************************/
 
 /*** enums ***************************************************************************************/
diff --git a/lib/tty/tty-slang.h b/lib/tty/tty-slang.h
index 5b12c6512853..eeaade388af4 100644
--- a/lib/tty/tty-slang.h
+++ b/lib/tty/tty-slang.h
@@ -23,6 +23,8 @@
 #define COLS  SLtt_Screen_Cols
 #define LINES SLtt_Screen_Rows
 
+#define ENABLE_SHADOWS 1
+
 /*** enums ***************************************************************************************/
 
 enum
diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c
index 3eb525be4a9b..98df5ff2ed9a 100644
--- a/src/filemanager/boxes.c
+++ b/src/filemanager/boxes.c
@@ -280,7 +280,9 @@ appearance_box_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm
     switch (msg)
     {
     case MSG_INIT:
+#ifdef ENABLE_SHADOWS
         if (!tty_use_colors ())
+#endif
         {
             Widget *shadow;
 
-- 
2.34.1