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.49 by pcg, Fri Apr 2 15:15:25 2004 UTC vs.
Revision 1.57 by root, Mon Jun 21 22:24:07 2004 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: init.c 2 * File: init.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
7 * - original version 7 * - original version
324 NULL, /* Color_RV */ 324 NULL, /* Color_RV */
325#endif /* ! NO_BOLD_UNDERLINE_REVERSE */ 325#endif /* ! NO_BOLD_UNDERLINE_REVERSE */
326#ifdef OPTION_HC 326#ifdef OPTION_HC
327 NULL, 327 NULL,
328#endif 328#endif
329#if TINTING
330 NULL,
331#endif
332#ifdef KEEP_SCROLLCOLOR 329#ifdef KEEP_SCROLLCOLOR
333 COLOR_SCROLLBAR, 330 COLOR_SCROLLBAR,
334 COLOR_SCROLLTROUGH, 331 COLOR_SCROLLTROUGH,
335#endif /* KEEP_SCROLLCOLOR */ 332#endif /* KEEP_SCROLLCOLOR */
336 333#if TINTING
334 NULL,
335#endif
337 }; 336 };
338 337
339const char *const xa_names[NUM_XA] = 338const char *const xa_names[NUM_XA] =
340 { 339 {
341 "TEXT", 340 "TEXT",
753void 752void
754rxvt_term::set_locale (const char *locale) 753rxvt_term::set_locale (const char *locale)
755{ 754{
756#if HAVE_XSETLOCALE || HAVE_SETLOCALE 755#if HAVE_XSETLOCALE || HAVE_SETLOCALE
757 free (this->locale); 756 free (this->locale);
758 this->locale = rxvt_strdup (setlocale (LC_CTYPE, locale)); 757 this->locale = setlocale (LC_CTYPE, locale);
758
759 if (!this->locale)
760 {
761 rxvt_warn ("unable to set locale \"%s\", using default locale instead.\n", locale);
762 setlocale (LC_CTYPE, "");
763 this->locale = "";
764 }
765
766 this->locale = rxvt_strdup (this->locale);
759 SET_LOCALE (this->locale); 767 SET_LOCALE (this->locale);
760 mbstate.reset (); 768 mbstate.reset ();
761#endif 769#endif
762#if 0 770#if 0
763#if HAVE_NL_LANGINFO 771#if HAVE_NL_LANGINFO
826 meta_char = (Options & Opt_meta8 ? 0x80 : C0_ESC); 834 meta_char = (Options & Opt_meta8 ? 0x80 : C0_ESC);
827#endif 835#endif
828 836
829 get_ourmods (); 837 get_ourmods ();
830 838
831 if (! (Options & Opt_scrollTtyOutput)) 839 if (!(Options & Opt_scrollTtyOutput))
832 PrivateModes |= PrivMode_TtyOutputInh; 840 PrivateModes |= PrivMode_TtyOutputInh;
833 if (Options & Opt_scrollTtyKeypress) 841 if (Options & Opt_scrollTtyKeypress)
834 PrivateModes |= PrivMode_Keypress; 842 PrivateModes |= PrivMode_Keypress;
835 if (! (Options & Opt_jumpScroll)) 843 if (!(Options & Opt_jumpScroll))
836 PrivateModes |= PrivMode_smoothScroll; 844 PrivateModes |= PrivMode_smoothScroll;
837 845
838#ifndef NO_BACKSPACE_KEY 846#ifndef NO_BACKSPACE_KEY
839 if (STRCMP (key_backspace, "DEC") == 0) 847 if (STRCMP (key_backspace, "DEC") == 0)
840 PrivateModes |= PrivMode_HaveBackSpace; 848 PrivateModes |= PrivMode_HaveBackSpace;
930 */ 938 */
931#ifdef KEEP_SCROLLCOLOR 939#ifdef KEEP_SCROLLCOLOR
932 940
933 if (XDEPTH <= 2) 941 if (XDEPTH <= 2)
934 { /* Monochrome */ 942 { /* Monochrome */
935 PixColors[Color_scroll] = PixColors[Color_fg]; 943 PixColors[Color_scroll] = PixColors[Color_fg];
936 PixColors[Color_topShadow] = PixColors[Color_bg]; 944 PixColors[Color_topShadow] = PixColors[Color_bg];
937 PixColors[Color_bottomShadow] = PixColors[Color_bg]; 945 PixColors[Color_bottomShadow] = PixColors[Color_bg];
938 } 946 }
939 else 947 else
940 { 948 {
941 rxvt_color xcol[3]; 949 rxvt_color xcol[3];
942 /* xcol[0] == white 950 /* xcol[0] == white
943 * xcol[1] == top shadow 951 * xcol[1] == top shadow
944 * xcol[2] == bot shadow */ 952 * xcol[2] == bot shadow */
945 953
946 xcol[1] = PixColors[Color_scroll]; 954 xcol[1] = PixColors[Color_scroll];
1072/*----------------------------------------------------------------------*/ 1080/*----------------------------------------------------------------------*/
1073/* rxvt_Create_Windows () - Open and map the window */ 1081/* rxvt_Create_Windows () - Open and map the window */
1074void 1082void
1075rxvt_term::create_windows (int argc, const char *const *argv) 1083rxvt_term::create_windows (int argc, const char *const *argv)
1076{ 1084{
1077 XClassHint classHint; 1085 XClassHint classHint;
1078 XWMHints wmHint; 1086 XWMHints wmHint;
1079 XGCValues gcvalue; 1087 XGCValues gcvalue;
1080 long vt_emask; 1088 long vt_emask;
1081 1089 XSetWindowAttributes attributes;
1082 XWindowAttributes gattr; 1090 XWindowAttributes gattr;
1083 1091
1084 if (Options & Opt_transparent) 1092 if (Options & Opt_transparent)
1085 { 1093 {
1086 XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr); 1094 XGetWindowAttributes (display->display, RootWindow (display->display, display->screen), &gattr);
1099 1107
1100 window_calc (0, 0); 1108 window_calc (0, 0);
1101 old_width = szHint.width; 1109 old_width = szHint.width;
1102 old_height = szHint.height; 1110 old_height = szHint.height;
1103 1111
1104 /* parent window - reverse video so we can see placement errors
1105 * sub-window placement & size in rxvt_resize_subwindows () 1112 /* sub-window placement & size in rxvt_resize_subwindows () */
1106 */
1107 1113
1108#ifdef PREFER_24BIT 1114#ifdef PREFER_24BIT
1109 XSetWindowAttributes attributes;
1110
1111 attributes.background_pixel = PixColors[Color_fg]; 1115 attributes.background_pixel = PixColors[Color_bg];
1112 attributes.border_pixel = PixColors[Color_border]; 1116 attributes.border_pixel = PixColors[Color_border];
1113 attributes.colormap = display->cmap; 1117 attributes.colormap = display->cmap;
1114 TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display), 1118 TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display),
1115 szHint.x, szHint.y, 1119 szHint.x, szHint.y,
1116 szHint.width, szHint.height, 1120 szHint.width, szHint.height,
1117 TermWin.ext_bwidth, 1121 TermWin.ext_bwidth,
1118 display->depth, InputOutput, 1122 display->depth, InputOutput,
1119 display->visual, 1123 display->visual,
1120 CWBackPixel | CWBorderPixel | CWColormap, &attributes); 1124 CWColormap | CWBackPixel | CWBorderPixel, &attributes);
1121#else 1125#else
1122 TermWin.parent[0] = XCreateSimpleWindow (display->display, DefaultRootWindow (display->display), 1126 TermWin.parent[0] = XCreateSimpleWindow (display->display, DefaultRootWindow (display->display),
1123 szHint.x, szHint.y, 1127 szHint.x, szHint.y,
1124 szHint.width, 1128 szHint.width, szHint.height,
1125 szHint.height,
1126 TermWin.ext_bwidth, 1129 TermWin.ext_bwidth,
1127 PixColors[Color_border], 1130 PixColors[Color_border],
1128 PixColors[Color_fg]); 1131 PixColors[Color_bg]);
1129#endif 1132#endif
1130 1133
1131 process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); 1134 process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
1132 process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); 1135 process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST);
1133 1136
1134 classHint.res_name = (char *)rs[Rs_name]; 1137 classHint.res_name = (char *)rs[Rs_name];
1135 classHint.res_class = (char *)RESCLASS; 1138 classHint.res_class = (char *)RESCLASS;
1136 1139
1137 wmHint.flags = (InputHint | StateHint | WindowGroupHint); 1140 wmHint.flags = InputHint | StateHint | WindowGroupHint;
1138 wmHint.input = True; 1141 wmHint.input = True;
1139 wmHint.initial_state = (Options & Opt_iconic ? IconicState 1142 wmHint.initial_state = Options & Opt_iconic ? IconicState : NormalState;
1140 : NormalState);
1141 wmHint.window_group = TermWin.parent[0]; 1143 wmHint.window_group = TermWin.parent[0];
1142 1144
1143 XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL, 1145 XSetWMProperties (display->display, TermWin.parent[0], NULL, NULL,
1144 (char **)argv, argc, &szHint, &wmHint, &classHint); 1146 (char **)argv, argc, &szHint, &wmHint, &classHint);
1145 1147
1180 } 1182 }
1181#endif 1183#endif
1182 1184
1183 /* the vt window */ 1185 /* the vt window */
1184 TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0], 1186 TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0],
1185 window_vt_x, window_vt_y, 1187 window_vt_x,
1188 window_vt_y,
1186 TermWin_TotalWidth (), 1189 TermWin_TotalWidth (),
1187 TermWin_TotalHeight (), 1190 TermWin_TotalHeight (),
1188 0, 1191 0,
1189 PixColors[Color_fg], 1192 PixColors[Color_fg],
1190 PixColors[Color_bg]); 1193 PixColors[Color_bg]);
1191 1194
1192#ifdef DEBUG_X 1195#ifdef DEBUG_X
1193 XStoreName (display->display, TermWin.vt, "vt window"); 1196 XStoreName (display->display, TermWin.vt, "vt window");
1194#endif 1197#endif
1195 1198
1199 attributes.bit_gravity = NorthWestGravity;
1200 XChangeWindowAttributes (display->display, TermWin.vt, CWBitGravity, &attributes);
1201
1196 vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask 1202 vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
1197 | PropertyChangeMask);
1198 1203
1199#ifdef POINTER_BLANK 1204#ifdef POINTER_BLANK
1200 pointer_unblank (); 1205 pointer_unblank ();
1201 1206
1202 if ((Options & Opt_pointerBlank)) 1207 if (Options & Opt_pointerBlank)
1203 vt_emask |= PointerMotionMask; 1208 vt_emask |= PointerMotionMask;
1204 else 1209 else
1205#endif 1210#endif
1206 vt_emask |= (Button1MotionMask | Button3MotionMask); 1211 vt_emask |= Button1MotionMask | Button3MotionMask;
1207 1212
1208 XSelectInput (display->display, TermWin.vt, vt_emask); 1213 XSelectInput (display->display, TermWin.vt, vt_emask);
1209 vt_ev.start (display, TermWin.vt); 1214 vt_ev.start (display, TermWin.vt);
1210 1215
1211#if defined(MENUBAR) && (MENUBAR_MAX > 1) 1216#if defined(MENUBAR) && (MENUBAR_MAX > 1)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines