X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_set_term.c;h=8573fbe7d5225f7bf6bdaeeedafaaaeb48348f27;hp=c5f26bc7a6562b99f647516a28161b6adcf80a20;hb=fae162795e065e5901068152e91f2962b6b247f3;hpb=47d2fb4537d9ad5bb14f4810561a327930ca4280 diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c index c5f26bc7..8573fbe7 100644 --- a/ncurses/base/lib_set_term.c +++ b/ncurses/base/lib_set_term.c @@ -44,10 +44,17 @@ #include #include +#if USE_GPM_SUPPORT +#ifdef HAVE_LIBDL +/* use dynamic loader to avoid linkage dependency */ +#include +#endif +#endif + #undef CUR #define CUR SP_TERMTYPE -MODULE_ID("$Id: lib_set_term.c,v 1.169 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.175 2020/10/10 19:09:03 juergen Exp $") #ifdef USE_TERM_DRIVER #define MaxColors InfoOf(sp).maxcolors @@ -197,6 +204,14 @@ delscreen(SCREEN *sp) if (_nc_find_prescr() == sp) { _nc_forget_prescr(); } +#if USE_GPM_SUPPORT +#ifdef HAVE_LIBDL + if (sp->_dlopen_gpm != 0) { + dlclose(sp->_dlopen_gpm); + sp->_dlopen_gpm = 0; + } +#endif +#endif /* USE_GPM_SUPPORT */ free(sp); /* @@ -340,8 +355,9 @@ NCURSES_SP_NAME(_nc_setupscreen) ( sp->_next_screen = _nc_screen_chain; _nc_screen_chain = sp; - if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) + if ((sp->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) { returnCode(ERR); + } #endif /* @@ -390,6 +406,11 @@ NCURSES_SP_NAME(_nc_setupscreen) ( T(("setting output mode to binary")); fflush(output); setmode(output, O_BINARY); +#endif +#if defined(EXP_WIN32_DRIVER) + T(("setting output mode to binary")); + fflush(output); + _setmode(fileno(output), _O_BINARY); #endif NCURSES_SP_NAME(_nc_set_buffer) (NCURSES_SP_ARGx output, TRUE); sp->_lines = (NCURSES_SIZE_T) slines; @@ -399,6 +420,10 @@ NCURSES_SP_NAME(_nc_setupscreen) ( fflush(output); sp->_ofd = output ? fileno(output) : -1; sp->_ofp = output; +#if defined(EXP_WIN32_DRIVER) + if (output) + _setmode(fileno(output), _O_BINARY); +#endif sp->out_limit = (size_t) ((2 + slines) * (6 + scolumns)); if ((sp->out_buffer = malloc(sp->out_limit)) == 0) sp->out_limit = 0;