mc: allow/enable ncursesw

This commit is contained in:
mglae 2021-12-04 15:55:23 +01:00
parent 4fa3e0ef44
commit 980e4d521d
2 changed files with 0 additions and 72 deletions

View File

@ -38,7 +38,6 @@ PKG_CONFIGURE_OPTS_TARGET=" \
pre_configure_target() {
LDFLAGS+=" -lcrypto -lssl"
CFLAGS+=' -DNCURSES_WIDECHAR=0'
}
post_makeinstall_target() {

View File

@ -1,71 +0,0 @@
See https://midnight-commander.org/ticket/4200
diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c
index 5cddf5059..2c117ef4b 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 d75df9533..8feb17ccd 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 c36785ffc..15fd00a94 100644
--- a/lib/tty/tty-slang.h
+++ b/lib/tty/tty-slang.h
@@ -27,6 +27,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 ed16d04dd..4c1f5ba84 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;