wnew->screen.Acolors[i].mode = False;
static void VTInitialize (	Widget wrequest,	Widget new_arg,	ArgList args GCC_UNUSED,	Cardinal *num_args GCC_UNUSED){   XtermWidget request = (XtermWidget) wrequest;   XtermWidget wnew    = (XtermWidget) new_arg;   Widget my_parent = SHELL_OF(wnew);   int i;#if OPT_ISO_COLORS   Boolean color_ok;#endif   char *s;   /* Zero out the entire "screen" component of "wnew" widget, then do    * field-by-field assignment of "screen" fields that are named in the    * resource list.    */   bzero ((char *) &wnew->screen, sizeof(wnew->screen));   /* dummy values so that we don't try to Realize the parent shell with height    * or width of 0, which is illegal in X.  The real size is computed in the    * xtermWidget's Realize proc, but the shell's Realize proc is called first,    * and must see a valid size.    */   wnew->core.height = wnew->core.width = 1;   /*    * The definition of -rv now is that it changes the definition of    * XtDefaultForeground and XtDefaultBackground.  So, we no longer    * need to do anything special.    */   wnew->screen.display = wnew->core.screen->display;   /*    * We use the default foreground/background colors to compare/check if a    * color-resource has been set.    */#define MyBlackPixel(dpy) BlackPixel(dpy,DefaultScreen(dpy))#define MyWhitePixel(dpy) WhitePixel(dpy,DefaultScreen(dpy))   if (request->misc.re_verse) {	wnew->dft_foreground = MyWhitePixel(wnew->screen.display);	wnew->dft_background = MyBlackPixel(wnew->screen.display);   } else {	wnew->dft_foreground = MyBlackPixel(wnew->screen.display);	wnew->dft_background = MyWhitePixel(wnew->screen.display);   }   TRACE(("Color resource initialization:\n"));   TRACE(("   Default foreground %#lx\n", wnew->dft_foreground));   TRACE(("   Default background %#lx\n", wnew->dft_background));   TRACE(("   Screen foreground  %#lx\n", request->screen.foreground));   TRACE(("   Screen background  %#lx\n", request->core.background_pixel));   wnew->screen.mouse_button = -1;   wnew->screen.mouse_row = -1;   wnew->screen.mouse_col = -1;   wnew->screen.c132 = request->screen.c132;   wnew->screen.curses = request->screen.curses;   wnew->screen.hp_ll_bc = request->screen.hp_ll_bc;#if OPT_XMC_GLITCH   wnew->screen.xmc_glitch = request->screen.xmc_glitch;   wnew->screen.xmc_attributes = request->screen.xmc_attributes;   wnew->screen.xmc_inline = request->screen.xmc_inline;   wnew->screen.move_sgr_ok = request->screen.move_sgr_ok;#endif   wnew->screen.foreground = request->screen.foreground;   wnew->screen.cursorcolor = request->screen.cursorcolor;#if OPT_BLINK_CURS   wnew->screen.cursor_blink = request->screen.cursor_blink;   wnew->screen.cursor_on = request->screen.cursor_on;   wnew->screen.cursor_off = request->screen.cursor_off;#endif   wnew->screen.border = request->screen.border;   wnew->screen.jumpscroll = request->screen.jumpscroll;   wnew->screen.old_fkeys = request->screen.old_fkeys;   wnew->screen.delete_is_del = request->screen.delete_is_del;   wnew->keyboard.type = wnew->screen.old_fkeys   		? keyboardIsLegacy		: keyboardIsDefault;#ifdef ALLOWLOGGING   wnew->screen.logfile = request->screen.logfile;#endif   wnew->screen.marginbell = request->screen.marginbell;   wnew->screen.mousecolor = request->screen.mousecolor;   wnew->screen.mousecolorback = request->screen.mousecolorback;   wnew->screen.multiscroll = request->screen.multiscroll;   wnew->screen.nmarginbell = request->screen.nmarginbell;   wnew->screen.savelines = request->screen.savelines;   wnew->screen.scrolllines = request->screen.scrolllines;   wnew->screen.scrollttyoutput = request->screen.scrollttyoutput;   wnew->screen.scrollkey = request->screen.scrollkey;   wnew->screen.term_id = request->screen.term_id;   for (s = request->screen.term_id; *s; s++) {	if (!isalpha(*s))	    break;   }   wnew->screen.terminal_id = atoi(s);   if (wnew->screen.terminal_id < MIN_DECID)       wnew->screen.terminal_id = MIN_DECID;   if (wnew->screen.terminal_id > MAX_DECID)       wnew->screen.terminal_id = MAX_DECID;   TRACE(("term_id '%s' -> terminal_id %d\n",	wnew->screen.term_id,	wnew->screen.terminal_id));   wnew->screen.ansi_level = (wnew->screen.terminal_id / 100);   wnew->screen.visualbell = request->screen.visualbell;#if OPT_NUM_LOCK   wnew->misc.real_NumLock = request->misc.real_NumLock;   wnew->misc.num_lock = 0;   wnew->misc.alt_left = 0;   wnew->misc.alt_right = 0;   wnew->misc.meta_trans = False;   wnew->misc.meta_left = 0;   wnew->misc.meta_right = 0;#endif#if OPT_SHIFT_KEYS   wnew->misc.shift_keys = request->misc.shift_keys;#endif#if OPT_TEK4014   wnew->misc.tekInhibit = request->misc.tekInhibit;   wnew->misc.tekSmall = request->misc.tekSmall;   wnew->screen.TekEmu = request->screen.TekEmu;#endif   wnew->misc.re_verse0 =   wnew->misc.re_verse = request->misc.re_verse;   wnew->screen.multiClickTime = request->screen.multiClickTime;   wnew->screen.bellSuppressTime = request->screen.bellSuppressTime;   wnew->screen.charClass = request->screen.charClass;   wnew->screen.cutNewline = request->screen.cutNewline;   wnew->screen.cutToBeginningOfLine = request->screen.cutToBeginningOfLine;   wnew->screen.highlight_selection = request->screen.highlight_selection;   wnew->screen.trim_selection = request->screen.trim_selection;   wnew->screen.always_highlight = request->screen.always_highlight;   wnew->screen.pointer_cursor = request->screen.pointer_cursor;   wnew->screen.answer_back = request->screen.answer_back;   wnew->screen.printer_command = request->screen.printer_command;   wnew->screen.printer_autoclose = request->screen.printer_autoclose;   wnew->screen.printer_extent = request->screen.printer_extent;   wnew->screen.printer_formfeed = request->screen.printer_formfeed;   wnew->screen.printer_controlmode = request->screen.printer_controlmode;#if OPT_PRINT_COLORS   wnew->screen.print_attributes = request->screen.print_attributes;#endif   TRACE(("keyboard_dialect:%s\n", request->screen.keyboard_dialect));   wnew->screen.keyboard_dialect = request->screen.keyboard_dialect;   wnew->screen.input_eight_bits = request->screen.input_eight_bits;   wnew->screen.output_eight_bits = request->screen.output_eight_bits;   wnew->screen.control_eight_bits = request->screen.control_eight_bits;   wnew->screen.backarrow_key = request->screen.backarrow_key;   wnew->screen.meta_sends_esc = request->screen.meta_sends_esc;   wnew->screen.allowSendEvents = request->screen.allowSendEvents;#ifndef NO_ACTIVE_ICON   wnew->screen.fnt_icon = request->screen.fnt_icon;#endif /* NO_ACTIVE_ICON */   wnew->misc.titeInhibit = request->misc.titeInhibit;   wnew->misc.dynamicColors = request->misc.dynamicColors;   for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) {       wnew->screen.menu_font_names[i] = request->screen.menu_font_names[i];   }   /* set default in realize proc */   wnew->screen.menu_font_names[fontMenu_fontdefault] = NULL;   wnew->screen.menu_font_names[fontMenu_fontescape] = NULL;   wnew->screen.menu_font_names[fontMenu_fontsel] = NULL;   wnew->screen.menu_font_number = fontMenu_fontdefault;#if OPT_DEC_CHRSET   wnew->screen.font_doublesize = request->screen.font_doublesize;   wnew->screen.cache_doublesize = request->screen.cache_doublesize;   if (wnew->screen.cache_doublesize > NUM_CHRSET)       wnew->screen.cache_doublesize = NUM_CHRSET;   if (wnew->screen.cache_doublesize == 0)       wnew->screen.font_doublesize = False;   TRACE(("Doublesize%s enabled, up to %d fonts\n",       wnew->screen.font_doublesize ? "" : " not",       wnew->screen.cache_doublesize));#endif   wnew->num_ptrs = (OFF_ATTRS+1); /* OFF_FLAGS, OFF_CHARS, OFF_ATTRS */#if OPT_ISO_COLORS   wnew->screen.boldColors    = request->screen.boldColors;   wnew->screen.colorAttrMode = request->screen.colorAttrMode;   wnew->screen.colorBDMode   = request->screen.colorBDMode;   wnew->screen.colorBLMode   = request->screen.colorBLMode;   wnew->screen.colorMode     = request->screen.colorMode;   wnew->screen.colorULMode   = request->screen.colorULMode;   for (i = 0, color_ok = False; i < MAXCOLORS; i++) {       wnew->screen.Acolors[i] = request->screen.Acolors[i];#if OPT_COLOR_RES       TRACE(("Acolors[%d] = %s\n", i, request->screen.Acolors[i].resource));       if (strcmp(wnew->screen.Acolors[i].resource, XtDefaultForeground))	   color_ok = True;#else       TRACE(("Acolors[%d] = %#lx\n", i, request->screen.Acolors[i]));       if (wnew->screen.Acolors[i] != wnew->dft_foreground	&& wnew->screen.Acolors[i] != request->screen.foreground	&& wnew->screen.Acolors[i] != request->core.background_pixel)	   color_ok = True;#endif   }   /* If none of the colors are anything other than the foreground or    * background, we'll assume this isn't color, no matter what the colorMode    * resource says.  (There doesn't seem to be any good way to determine if    * the resource lookup failed versus the user having misconfigured this).    */   if (!color_ok) {	wnew->screen.colorMode = False;	TRACE(("All colors are foreground or background: disable colorMode\n"));   }#if OPT_EXT_COLORS   wnew->num_ptrs = (OFF_BGRND+1);#else   wnew->num_ptrs = (OFF_COLOR+1);#endif   wnew->sgr_foreground = -1;   wnew->sgr_extended = 0;#endif /* OPT_ISO_COLORS */#if OPT_HIGHLIGHT_COLOR   wnew->screen.highlightcolor = request->screen.highlightcolor;#endif#if OPT_DEC_CHRSET   wnew->num_ptrs = (OFF_CSETS+1);#endif#if OPT_WIDE_CHARS   wnew->screen.wide_chars = request->screen.wide_chars;   if (request->screen.utf8_mode) {      wnew->screen.wide_chars = True;      wnew->screen.utf8_mode = 2; /* disable further change */      TRACE(("initialized UTF-8 mode\n"));   }   if (wnew->screen.wide_chars != False)      wnew->num_ptrs = (OFF_WIDEC+1);#endif   wnew->screen.bold_mode = request->screen.bold_mode;   wnew->screen.underline = request->screen.underline;   wnew->cur_foreground = 0;   wnew->cur_background = 0;   wnew->keyboard.flags = MODE_SRM;   if (wnew->screen.backarrow_key)	   wnew->keyboard.flags |= MODE_DECBKM;   /* look for focus related events on the shell, because we need    * to care about the shell's border being part of our focus.    */   XtAddEventHandler(my_parent, EnterWindowMask, FALSE,		HandleEnterWindow, (Opaque)NULL);   XtAddEventHandler(my_parent, LeaveWindowMask, FALSE,		HandleLeaveWindow, (Opaque)NULL);   XtAddEventHandler(my_parent, FocusChangeMask, FALSE,		HandleFocusChange, (Opaque)NULL);   XtAddEventHandler((Widget)wnew, 0L, TRUE,		VTNonMaskableEvent, (Opaque)NULL);   XtAddEventHandler((Widget)wnew, PropertyChangeMask, FALSE,		     HandleBellPropertyChange, (Opaque)NULL);#if HANDLE_STRUCT_NOTIFY#if OPT_TOOLBAR   wnew->screen.fullVwin.menu_bar = request->screen.fullVwin.menu_bar;   wnew->screen.fullVwin.menu_height = request->screen.fullVwin.menu_height;#else   /* Flag icon name with "***"  on window output when iconified.    * Put in a handler that will tell us when we get Map/Unmap events.    */   if ( zIconBeep )#endif       XtAddEventHandler(my_parent, StructureNotifyMask, FALSE,			 HandleStructNotify, (XtPointer)0);#endif /* HANDLE_STRUCT_NOTIFY */   wnew->screen.bellInProgress = FALSE;   set_character_class (wnew->screen.charClass);   /* create it, but don't realize it */   ScrollBarOn (wnew, TRUE, FALSE);   /* make sure that the resize gravity acceptable */   if ( wnew->misc.resizeGravity != NorthWestGravity &&	wnew->misc.resizeGravity != SouthWestGravity) {       Cardinal nparams = 1;       XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XTermError",		       "unsupported resizeGravity resource value (%d)",		       (String *) &(wnew->misc.resizeGravity), &nparams);       wnew->misc.resizeGravity = SouthWestGravity;   }#ifndef NO_ACTIVE_ICON   wnew->screen.whichVwin = &wnew->screen.fullVwin;#if OPT_TEK4014   wnew->screen.whichTwin = &wnew->screen.fullTwin;#endif#endif /* NO_ACTIVE_ICON */    if (wnew->screen.savelines < 0)	wnew->screen.savelines = 0;    wnew->flags = 0;    if (!wnew->screen.jumpscroll)	wnew->flags |= SMOOTHSCROLL;    if (wnew->misc.reverseWrap)	wnew->flags |= REVERSEWRAP;    if (wnew->misc.autoWrap)	wnew->flags |= WRAPAROUND;    if (wnew->misc.re_verse != wnew->misc.re_verse0)	wnew->flags |= REVERSE_VIDEO;    wnew->initflags = wnew->flags;    if (wnew->misc.appcursorDefault)	wnew->keyboard.flags |= MODE_DECCKM;    if (wnew->misc.appkeypadDefault)	wnew->keyboard.flags |= MODE_DECKPAM;   return;}