ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/init.C
(Generate patch)

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.121 by root, Wed Nov 30 21:05:39 2005 UTC vs.
Revision 1.124 by root, Wed Dec 21 14:19:19 2005 UTC

226 226
227 if (pix_colors == NULL) 227 if (pix_colors == NULL)
228 return false; 228 return false;
229 229
230#if defined(XPM_BACKGROUND) || defined(TRANSPARENT) 230#if defined(XPM_BACKGROUND) || defined(TRANSPARENT)
231 TermWin.pixmap = None; 231 pixmap = None;
232#endif 232#endif
233 233
234 MEvent.time = CurrentTime; 234 MEvent.time = CurrentTime;
235 MEvent.button = AnyButton; 235 MEvent.button = AnyButton;
236 options = DEFAULT_OPTIONS; 236 options = DEFAULT_OPTIONS;
237 want_refresh = 1; 237 want_refresh = 1;
238 priv_modes = SavedModes = PrivMode_Default; 238 priv_modes = SavedModes = PrivMode_Default;
239 TermWin.focus = 0; 239 focus = 0;
240 TermWin.ncol = 80; 240 ncol = 80;
241 TermWin.nrow = 24; 241 nrow = 24;
242 TermWin.int_bwidth = INTERNALBORDERWIDTH; 242 int_bwidth = INTERNALBORDERWIDTH;
243 TermWin.ext_bwidth = EXTERNALBORDERWIDTH; 243 ext_bwidth = EXTERNALBORDERWIDTH;
244 TermWin.lineSpace = LINESPACE; 244 lineSpace = LINESPACE;
245 TermWin.saveLines = SAVELINES; 245 saveLines = SAVELINES;
246 numpix_colors = TOTAL_COLORS; 246 numpix_colors = TOTAL_COLORS;
247 247
248 refresh_limit = 1; 248 refresh_limit = 1;
249 refresh_type = SLOW_REFRESH; 249 refresh_type = SLOW_REFRESH;
250 prev_nrow = prev_ncol = 0; 250 prev_nrow = prev_ncol = 0;
369 if (!rs[Rs_iconName]) 369 if (!rs[Rs_iconName])
370 rs[Rs_iconName] = rs[Rs_name]; 370 rs[Rs_iconName] = rs[Rs_name];
371 } 371 }
372 372
373 if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0) 373 if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0)
374 TermWin.saveLines = BOUND_POSITIVE_INT16 (i); 374 saveLines = min (i, MAX_POSITIVE_INT16);
375 375
376#if ENABLE_FRILLS 376#if ENABLE_FRILLS
377 if (rs[Rs_int_bwidth] && (i = atoi (rs[Rs_int_bwidth])) >= 0) 377 if (rs[Rs_int_bwidth] && (i = atoi (rs[Rs_int_bwidth])) >= 0)
378 TermWin.int_bwidth = min (i, 100); /* arbitrary limit */ 378 int_bwidth = min (i, MAX_POSITIVE_INT16);
379
379 if (rs[Rs_ext_bwidth] && (i = atoi (rs[Rs_ext_bwidth])) >= 0) 380 if (rs[Rs_ext_bwidth] && (i = atoi (rs[Rs_ext_bwidth])) >= 0)
380 TermWin.ext_bwidth = min (i, 100); /* arbitrary limit */ 381 ext_bwidth = min (i, MAX_POSITIVE_INT16);
382
381 if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0) 383 if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0)
382 TermWin.lineSpace = min (i, 100); /* arbitrary limit */ 384 lineSpace = min (i, MAX_POSITIVE_INT16);
383#endif 385#endif
384 386
385#ifdef POINTER_BLANK 387#ifdef POINTER_BLANK
386 if (rs[Rs_pointerBlankDelay] && (i = atoi (rs[Rs_pointerBlankDelay])) >= 0) 388 if (rs[Rs_pointerBlankDelay] && (i = atoi (rs[Rs_pointerBlankDelay])) >= 0)
387 pointerBlankDelay = i; 389 pointerBlankDelay = i;
388 else 390 else
389 pointerBlankDelay = 2; 391 pointerBlankDelay = 2;
390#endif 392#endif
391 393
392 /* no point having a scrollbar without having any scrollback! */ 394 /* no point having a scrollbar without having any scrollback! */
393 if (!TermWin.saveLines) 395 if (!saveLines)
394 options &= ~Opt_scrollBar; 396 options &= ~Opt_scrollBar;
395 397
396#ifdef PRINTPIPE 398#ifdef PRINTPIPE
397 if (!rs[Rs_print_pipe]) 399 if (!rs[Rs_print_pipe])
398 rs[Rs_print_pipe] = PRINTPIPE; 400 rs[Rs_print_pipe] = PRINTPIPE;
458 rs[Rs_color + i] = def_colorName[i]; 460 rs[Rs_color + i] = def_colorName[i];
459 461
460#ifndef XTERM_REVERSE_VIDEO 462#ifndef XTERM_REVERSE_VIDEO
461 /* this is how we implement reverseVideo */ 463 /* this is how we implement reverseVideo */
462 if (options & Opt_reverseVideo) 464 if (options & Opt_reverseVideo)
463 SWAP_IT (rs[Rs_color + Color_fg], rs[Rs_color + Color_bg], const char *); 465 ::swap (rs[Rs_color + Color_fg], rs[Rs_color + Color_bg]);
464#endif 466#endif
465 467
466 /* convenient aliases for setting fg/bg to colors */ 468 /* convenient aliases for setting fg/bg to colors */
467 color_aliases (Color_fg); 469 color_aliases (Color_fg);
468 color_aliases (Color_bg); 470 color_aliases (Color_bg);
518 env_display = (char *)rxvt_malloc ((i + 9) * sizeof (char)); 520 env_display = (char *)rxvt_malloc ((i + 9) * sizeof (char));
519 521
520 sprintf (env_display, "DISPLAY=%s", val); 522 sprintf (env_display, "DISPLAY=%s", val);
521 523
522 /* avoiding the math library: 524 /* avoiding the math library:
523 * i = (int) (ceil (log10 ((unsigned int)TermWin.parent[0]))) */ 525 * i = (int) (ceil (log10 ((unsigned int)parent[0]))) */
524 for (i = 0, u = (unsigned int)TermWin.parent[0]; u; u /= 10, i++) 526 for (i = 0, u = (unsigned int)parent[0]; u; u /= 10, i++)
525 ; 527 ;
526 MAX_IT (i, 1); 528 max_it (i, 1);
527 env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char)); 529 env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char));
528 530
529 sprintf (env_windowid, "WINDOWID=%u", 531 sprintf (env_windowid, "WINDOWID=%u",
530 (unsigned int)TermWin.parent[0]); 532 (unsigned int)parent[0]);
531 533
532 /* add entries to the environment: 534 /* add entries to the environment:
533 * @ DISPLAY: in case we started with -display 535 * @ DISPLAY: in case we started with -display
534 * @ WINDOWID: X window id number of the window 536 * @ WINDOWID: X window id number of the window
535 * @ COLORTERM: terminal sub-name and also indicates its color 537 * @ COLORTERM: terminal sub-name and also indicates its color
984 if (!XGetWindowAttributes (disp, parent, &wattr)) 986 if (!XGetWindowAttributes (disp, parent, &wattr))
985 rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); 987 rxvt_fatal ("invalid window-id specified with -embed, aborting.\n");
986 988
987 window_calc (wattr.width, wattr.height); 989 window_calc (wattr.width, wattr.height);
988 } 990 }
989
990#endif 991#endif
992
991 window_calc (0, 0); 993 window_calc (0, 0);
992 994
993 /* sub-window placement & size in rxvt_resize_subwindows () */ 995 /* sub-window placement & size in rxvt_resize_subwindows () */
994#ifdef PREFER_24BIT 996#ifdef PREFER_24BIT
995 attributes.background_pixel = pix_colors_focused[Color_border]; 997 attributes.background_pixel = pix_colors_focused[Color_border];
996 attributes.border_pixel = pix_colors_focused[Color_border]; 998 attributes.border_pixel = pix_colors_focused[Color_border];
997 attributes.colormap = display->cmap; 999 attributes.colormap = display->cmap;
998 top = XCreateWindow (disp, parent, 1000 top = XCreateWindow (disp, parent,
999 szHint.x, szHint.y, 1001 szHint.x, szHint.y,
1000 szHint.width, szHint.height, 1002 szHint.width, szHint.height,
1001 TermWin.ext_bwidth, 1003 ext_bwidth,
1002 display->depth, InputOutput, 1004 display->depth, InputOutput,
1003 display->visual, 1005 display->visual,
1004 CWColormap | CWBackPixel | CWBorderPixel, &attributes); 1006 CWColormap | CWBackPixel | CWBorderPixel, &attributes);
1005#else 1007#else
1006 top = XCreateSimpleWindow (disp, parent, 1008 top = XCreateSimpleWindow (disp, parent,
1007 szHint.x, szHint.y, 1009 szHint.x, szHint.y,
1008 szHint.width, szHint.height, 1010 szHint.width, szHint.height,
1009 TermWin.ext_bwidth, 1011 ext_bwidth,
1010 pix_colors_focused[Color_border], 1012 pix_colors_focused[Color_border],
1011 pix_colors_focused[Color_border]); 1013 pix_colors_focused[Color_border]);
1012#endif 1014#endif
1013 1015
1014 TermWin.parent[0] = top; 1016 this->parent[0] = top;
1015 1017
1016 old_width = szHint.width; 1018 old_width = szHint.width;
1017 old_height = szHint.height; 1019 old_height = szHint.height;
1018 1020
1019 process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); 1021 process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
1072 /* cursor (menuBar/scrollBar): Black-on-White */ 1074 /* cursor (menuBar/scrollBar): Black-on-White */
1073 leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); 1075 leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr);
1074#endif 1076#endif
1075 1077
1076 /* the vt window */ 1078 /* the vt window */
1077 TermWin.vt = XCreateSimpleWindow (disp, top, 1079 vt = XCreateSimpleWindow (disp, top,
1078 window_vt_x, 1080 window_vt_x,
1079 window_vt_y, 1081 window_vt_y,
1080 TermWin_TotalWidth (), 1082 TermWin_TotalWidth (),
1081 TermWin_TotalHeight (), 1083 TermWin_TotalHeight (),
1082 0, 1084 0,
1083 pix_colors_focused[Color_fg], 1085 pix_colors_focused[Color_fg],
1084 pix_colors_focused[Color_bg]); 1086 pix_colors_focused[Color_bg]);
1085#ifdef DEBUG_X 1087#ifdef DEBUG_X
1086 XStoreName (disp, TermWin.vt, "vt window"); 1088 XStoreName (disp, vt, "vt window");
1087#endif 1089#endif
1088 1090
1089 attributes.bit_gravity = NorthWestGravity; 1091 attributes.bit_gravity = NorthWestGravity;
1090 XChangeWindowAttributes (disp, TermWin.vt, CWBitGravity, &attributes); 1092 XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes);
1091 1093
1092 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; 1094 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
1093 1095
1094#ifdef POINTER_BLANK 1096#ifdef POINTER_BLANK
1095 if (options & Opt_pointerBlank) 1097 if (options & Opt_pointerBlank)
1096 vt_emask |= PointerMotionMask; 1098 vt_emask |= PointerMotionMask;
1097 else 1099 else
1098#endif 1100#endif
1099 vt_emask |= Button1MotionMask | Button3MotionMask; 1101 vt_emask |= Button1MotionMask | Button3MotionMask;
1100 1102
1101 XSelectInput (disp, TermWin.vt, vt_emask); 1103 XSelectInput (disp, vt, vt_emask);
1102 vt_ev.start (display, TermWin.vt); 1104 vt_ev.start (display, vt);
1103 1105
1104#if defined(MENUBAR) && (MENUBAR_MAX > 1) 1106#if defined(MENUBAR) && (MENUBAR_MAX > 1)
1105 if (menuBar_height ()) 1107 if (menuBar_height ())
1106 { 1108 {
1107 menuBar.win = XCreateSimpleWindow (disp, top, 1109 menuBar.win = XCreateSimpleWindow (disp, top,
1146 1148
1147 /* graphics context for the vt window */ 1149 /* graphics context for the vt window */
1148 gcvalue.foreground = pix_colors[Color_fg]; 1150 gcvalue.foreground = pix_colors[Color_fg];
1149 gcvalue.background = pix_colors[Color_bg]; 1151 gcvalue.background = pix_colors[Color_bg];
1150 gcvalue.graphics_exposures = 1; 1152 gcvalue.graphics_exposures = 1;
1151 TermWin.gc = XCreateGC (disp, TermWin.vt, 1153 gc = XCreateGC (disp, vt,
1152 GCForeground | GCBackground | GCGraphicsExposures, 1154 GCForeground | GCBackground | GCGraphicsExposures,
1153 &gcvalue); 1155 &gcvalue);
1154 1156
1155 TermWin.drawable = new rxvt_drawable (display, TermWin.vt); 1157 drawable = new rxvt_drawable (display, vt);
1156 1158
1157#if defined(MENUBAR) || defined(RXVT_SCROLLBAR) 1159#if defined(MENUBAR) || defined(RXVT_SCROLLBAR)
1158 gcvalue.foreground = pix_colors[Color_topShadow]; 1160 gcvalue.foreground = pix_colors[Color_topShadow];
1159 topShadowGC = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue); 1161 topShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue);
1160 gcvalue.foreground = pix_colors[Color_bottomShadow]; 1162 gcvalue.foreground = pix_colors[Color_bottomShadow];
1161 botShadowGC = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue); 1163 botShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue);
1162 gcvalue.foreground = pix_colors[ (display->depth <= 2 ? Color_fg : Color_scroll)]; 1164 gcvalue.foreground = pix_colors[ (display->depth <= 2 ? Color_fg : Color_scroll)];
1163 scrollbarGC = XCreateGC (disp, TermWin.vt, GCForeground, &gcvalue); 1165 scrollbarGC = XCreateGC (disp, vt, GCForeground, &gcvalue);
1164#endif 1166#endif
1165 1167
1166#ifdef OFF_FOCUS_FADING 1168#ifdef OFF_FOCUS_FADING
1167 // initially we are in unfocused state 1169 // initially we are in unfocused state
1168 if (rs[Rs_fade]) 1170 if (rs[Rs_fade])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines