follow-up for curses_putmixed vs genl_putmixed

This commit is contained in:
nhmall
2023-06-11 09:58:36 -04:00
parent 37b21dd9fd
commit 41c9c660e8
3 changed files with 24 additions and 12 deletions

View File

@@ -91,8 +91,8 @@ endif
ifdef WANT_WIN_CURSES
WINCFLAGS += -DCURSES_GRAPHICS
ifeq "$(NOPUTMIXED)" "1"
WINCFLAGS += -DCURSES_GENL_PUTMIXED
ifeq "$(USE_GENL_PUTMIXED)" "1"
WINCFLAGS += -DUSE_GENL_PUTMIXED
else
WINCFLAGS += -D_XOPEN_SOURCE_EXTENDED=1
endif

View File

@@ -24,6 +24,11 @@ extern long curs_mesg_suppress_seq; /* from cursmesg.c */
extern boolean curs_mesg_no_suppress; /* ditto */
extern int mesg_mixed;
extern glyph_info mesg_gi;
#ifndef CURSES_GENL_PUTMIXED
#if !defined(PDCURSES) || defined(PDC_WIDE)
#define USE_CURSES_PUTMIXED
#endif
#endif
/* stubs for curses_procs{} */
#ifdef POSITIONBAR
@@ -72,10 +77,10 @@ struct window_procs curses_procs = {
curses_destroy_nhwindow,
curses_curs,
curses_putstr,
#if defined(CURSES_GENL_PUTMIXED) || (defined(PDCURSES) && !defined(PDC_WIDE))
genl_putmixed,
#else
#ifdef USE_CURSES_PUTMIXED
curses_putmixed,
#else
genl_putmixed,
#endif
curses_display_file,
curses_start_menu,

View File

@@ -30,6 +30,13 @@ boolean curs_mesg_no_suppress = FALSE;
int mesg_mixed = 0;
glyph_info mesg_gi;
#ifndef CURSES_GENL_PUTMIXED
#if !defined(PDCURSES) || defined(PDC_WIDE)
#define USE_CURSES_PUTMIXED
#endif
#endif
/* Message window routines for curses interface */
/* Private declarations */
@@ -46,7 +53,7 @@ static void unscroll_window(winid wid);
static void directional_scroll(winid wid, int nlines);
static void mesg_add_line(const char *mline);
static nhprev_mesg *get_msg_line(boolean reverse, int mindex);
#if !defined(CURSES_GENL_PUTMIXED) || (defined(PDCURSES) && !defined(PDC_WIDE))
#ifdef USE_CURSES_PUTMIXED
static int curscolor(int nhcolor, boolean *boldon);
#endif
@@ -70,7 +77,7 @@ curses_message_win_puts(const char *message, boolean recursed)
boolean bold, border = curses_window_has_border(MESSAGE_WIN),
adjustbold = FALSE;
int message_length = (int) strlen(message);
#if !defined(CURSES_GENL_PUTMIXED) || (defined(PDCURSES) && !defined(PDC_WIDE))
#ifdef USE_CURSES_PUTMIXED
boolean have_mixed_leadin = FALSE;
cchar_t mixed_leadin_cchar[2];
#endif
@@ -123,7 +130,7 @@ curses_message_win_puts(const char *message, boolean recursed)
linespace -= 2;
bold = (height > 1 && !last_messages);
#if !defined(CURSES_GENL_PUTMIXED) || (defined(PDCURSES) && !defined(PDC_WIDE))
#ifdef USE_CURSES_PUTMIXED
if (mesg_mixed) {
wchar_t w[2];
int leadin_color;
@@ -152,7 +159,7 @@ curses_message_win_puts(const char *message, boolean recursed)
message_length++; /* account for that additional column */
}
}
#endif /* CURSES_GENL_PUTMIXED || PDCURSES without PDC_WIDE */
#endif /* USE_CURSES_PUTMIXED */
if (linespace < message_length) {
if (my - border_space >= height - 1) {
@@ -193,7 +200,7 @@ curses_message_win_puts(const char *message, boolean recursed)
if (mx == border_space && message_length > width - 3) {
/* split needed */
tmpstr = curses_break_str(message, (width - 3), 1);
#if !defined(CURSES_GENL_PUTMIXED) || (defined(PDCURSES) && !defined(PDC_WIDE))
#ifdef USE_CURSES_PUTMIXED
if (have_mixed_leadin) {
mvwadd_wch(win, my, mx, mixed_leadin_cchar);
++mx;
@@ -214,7 +221,7 @@ curses_message_win_puts(const char *message, boolean recursed)
curses_message_win_puts(tmpstr, TRUE);
free(tmpstr);
} else {
#if !defined(CURSES_GENL_PUTMIXED) || (defined(PDCURSES) && !defined(PDC_WIDE))
#ifdef USE_CURSES_PUTMIXED
if (have_mixed_leadin) {
mvwadd_wch(win, my, mx, mixed_leadin_cchar);
++mx;
@@ -230,7 +237,7 @@ curses_message_win_puts(const char *message, boolean recursed)
wrefresh(win);
}
#if !defined(CURSES_GENL_PUTMIXED) || (defined(PDCURSES) && !defined(PDC_WIDE))
#ifdef USE_CURSES_PUTMIXED
static int
curscolor(int nhcolor, boolean *boldon)
{