MCPcopy Create free account
hub / github.com/NetHack/NetHack / set_tty_attrib

Function set_tty_attrib

outdated/sys/mac/mactty.c:944–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

942}
943
944short
945set_tty_attrib(WindowPtr window, tty_attrib attrib, long value)
946{
947 RGBColor rgb_color;
948 RECORD_EXISTS(record);
949
950 if (attrib < 0 || attrib >= TTY_NUMBER_ATTRIBUTES) {
951 return general_failure;
952 }
953 record->attribute[attrib] = value;
954 /*
955 * Presently, no attributes generate a new bitmap.
956 */
957 switch (attrib) {
958 case TTY_ATTRIB_CURSOR:
959 /*
960 * Check if we should change tables
961 */
962 if (0L != (value & TA_RAW_OUTPUT)) {
963 s_control = RAW_CONTROLS;
964 } else {
965 s_control = COOKED_CONTROLS;
966 }
967 break;
968 case TTY_ATTRIB_FLAGS:
969 /*
970 * Check if we should flush the output going from cached to
971 * draw-direct
972 */
973 if (0L != (value & TA_ALWAYS_REFRESH)) {
974 update_tty(window);
975 }
976 break;
977 case TTY_ATTRIB_FOREGROUND:
978 /*
979 * Set foreground color
980 */
981 TA_TO_RGB(value, rgb_color);
982 select_offscreen_port(record);
983 RGBForeColor(&rgb_color);
984 select_onscreen_window(record);
985 break;
986 case TTY_ATTRIB_BACKGROUND:
987 /*
988 * Set background color
989 */
990 TA_TO_RGB(value, rgb_color);
991 select_offscreen_port(record);
992 RGBBackColor(&rgb_color);
993 select_onscreen_window(record);
994 break;
995 default:
996 break;
997 }
998 return noErr;
999}
1000
1001/*

Callers 4

_mt_init_stuffFunction · 0.85
_mt_set_colorsFunction · 0.85
setfttyFunction · 0.85
setttyFunction · 0.85

Calls 3

update_ttyFunction · 0.85
select_offscreen_portFunction · 0.85
select_onscreen_windowFunction · 0.85

Tested by

no test coverage detected