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.120 by root, Mon Nov 28 18:37:42 2005 UTC vs.
Revision 1.122 by root, Sun Dec 18 00:59:42 2005 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines