/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright 2020 Thomas E. Dickey *
+ * Copyright 1998-2006,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_wattroff.c,v 1.4 1998/05/10 12:02:11 tom Exp $")
+MODULE_ID("$Id: lib_wattroff.c,v 1.11 2020/02/02 23:34:34 tom Exp $")
-int wattr_off(WINDOW *win, NCURSES_CONST attr_t at, void *opts GCC_UNUSED)
+NCURSES_EXPORT(int)
+wattr_off(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
{
- T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at)));
- if (win) {
- T(("... current %s", _traceattr(win->_attrs)));
- toggle_attr_off(win->_attrs,at);
- returnCode(OK);
- } else
- returnCode(ERR);
+ T((T_CALLED("wattr_off(%p,%s)"), (void *) win, _traceattr(at)));
+ if (win) {
+ T(("... current %s (%d)",
+ _traceattr(WINDOW_ATTRS(win)),
+ GET_WINDOW_PAIR(win)));
+
+ if_EXT_COLORS({
+ if (at & A_COLOR)
+ win->_color = 0;
+ });
+ toggle_attr_off(WINDOW_ATTRS(win), at);
+ returnCode(OK);
+ } else
+ returnCode(ERR);
}