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.339 by sf-exg, Mon Oct 13 17:05:32 2014 UTC vs.
Revision 1.344 by sf-exg, Tue Jun 16 11:58:26 2015 UTC

41#include <limits> 41#include <limits>
42 42
43#include <signal.h> 43#include <signal.h>
44 44
45#include <fcntl.h> 45#include <fcntl.h>
46
47#ifdef HAVE_XMU
48# include <X11/Xmu/CurUtil.h>
49#endif
46 50
47#ifdef HAVE_XSETLOCALE 51#ifdef HAVE_XSETLOCALE
48# define X_LOCALE 52# define X_LOCALE
49# include <X11/Xlocale.h> 53# include <X11/Xlocale.h>
50#else 54#else
1056 run_command (argv); 1060 run_command (argv);
1057} 1061}
1058 1062
1059/*----------------------------------------------------------------------*/ 1063/*----------------------------------------------------------------------*/
1060void 1064void
1061rxvt_term::get_colours () 1065rxvt_term::get_colors ()
1062{ 1066{
1063 int i; 1067 int i;
1064 1068
1065#ifdef OFF_FOCUS_FADING 1069#ifdef OFF_FOCUS_FADING
1066 pix_colors = pix_colors_focused; 1070 pix_colors = pix_colors_focused;
1067#endif 1071#endif
1068 1072
1069 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 1073 for (i = 0; i < NRS_COLORS; i++)
1070 {
1071 const char *name = rs[Rs_color + i]; 1074 if (const char *name = rs[Rs_color + i])
1072
1073 if (!name)
1074 continue;
1075
1076 rxvt_color xcol;
1077
1078 if (!set_color (xcol, name)) 1075 set_color (pix_colors [i], name);
1079 {
1080#ifndef XTERM_REVERSE_VIDEO
1081 if (i < 2 && option (Opt_reverseVideo))
1082 name = def_colorName [1 - i];
1083 else
1084#endif
1085 name = def_colorName [i];
1086
1087 if (!name)
1088 continue;
1089
1090 if (!set_color (xcol, name))
1091 {
1092 switch (i)
1093 {
1094 case Color_fg:
1095 case Color_bg:
1096 rxvt_warn ("unable to get foreground/background colour, continuing.\n");
1097 name = "";
1098 break;
1099#ifndef NO_CURSORCOLOR
1100 case Color_cursor2:
1101#endif
1102 case Color_pointer_fg:
1103 name = rs[Rs_color + Color_fg];
1104 xcol.set (this, name);
1105 break;
1106 default:
1107 name = rs[Rs_color + Color_bg];
1108 xcol.set (this, name);
1109 break;
1110 }
1111 }
1112 }
1113
1114 pix_colors[i] = xcol;
1115 rs[Rs_color + i] = name;
1116 }
1117
1118 if (depth <= 2)
1119 {
1120 if (!rs[Rs_color + Color_pointer_fg]) alias_color (Color_pointer_fg, Color_fg);
1121 if (!rs[Rs_color + Color_pointer_bg]) alias_color (Color_pointer_bg, Color_bg);
1122 if (!rs[Rs_color + Color_border] ) alias_color (Color_border, Color_fg);
1123 }
1124 1076
1125 /* 1077 /*
1126 * get scrollBar shadow colors 1078 * get scrollBar shadow colors
1127 * 1079 *
1128 * The calculations of topShadow/bottomShadow values are adapted 1080 * The calculations of topShadow/bottomShadow values are adapted
1129 * from the fvwm window manager. 1081 * from the fvwm window manager.
1130 */ 1082 */
1131#ifdef RXVT_SCROLLBAR 1083#ifdef RXVT_SCROLLBAR
1132 if (depth <= 2)
1133 {
1134 /* Monochrome */
1135 alias_color (Color_scroll, Color_fg);
1136 alias_color (Color_topShadow, Color_bg);
1137 alias_color (Color_bottomShadow, Color_bg);
1138 }
1139 else
1140 {
1141 pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]); 1084 pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
1142 1085
1143 rgba cscroll; 1086 rgba cscroll;
1144 pix_colors [Color_scroll].get (cscroll); 1087 pix_colors [Color_scroll].get (cscroll);
1145 1088
1146 /* topShadowColor */ 1089 /* topShadowColor */
1147 if (!pix_colors[Color_topShadow].set (this, 1090 if (!pix_colors[Color_topShadow].set (this,
1148 rgba ( 1091 rgba (
1149 min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5), 1092 min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5),
1150 min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5), 1093 min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5),
1151 min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), 1094 min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5),
1152 cscroll.a) 1095 cscroll.a)
1153 )) 1096 ))
1154 alias_color (Color_topShadow, Color_White); 1097 alias_color (Color_topShadow, Color_White);
1155 }
1156#endif 1098#endif
1157 1099
1158#ifdef OFF_FOCUS_FADING 1100#ifdef OFF_FOCUS_FADING
1159 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 1101 for (i = 0; i < NRS_COLORS; i++)
1160 update_fade_color (i); 1102 update_fade_color (i, true);
1161#endif 1103#endif
1162} 1104}
1163 1105
1164/*----------------------------------------------------------------------*/ 1106/*----------------------------------------------------------------------*/
1165/* color aliases, fg/bg bright-bold */ 1107/* color aliases, fg/bg bright-bold */
1269} 1211}
1270 1212
1271void 1213void
1272rxvt_term::set_icon (const char *file) 1214rxvt_term::set_icon (const char *file)
1273{ 1215{
1274#if HAVE_PIXBUF 1216#if HAVE_PIXBUF && ENABLE_EWMH
1275 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (file, NULL); 1217 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (file, NULL);
1276 if (!pixbuf) 1218 if (!pixbuf)
1277 { 1219 {
1278 rxvt_warn ("Loading image icon failed, continuing without.\n"); 1220 rxvt_warn ("Loading image icon failed, continuing without.\n");
1279 return; 1221 return;
1344 Window top, parent; 1286 Window top, parent;
1345 1287
1346 dLocal (Display *, dpy); 1288 dLocal (Display *, dpy);
1347 1289
1348 /* grab colors before netscape does */ 1290 /* grab colors before netscape does */
1349 get_colours (); 1291 get_colors ();
1350 1292
1351 if (!set_fonts ()) 1293 if (!set_fonts ())
1352 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); 1294 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
1353 1295
1354 parent = display->root; 1296 parent = display->root;
1465 | ExposureMask | StructureNotifyMask); 1407 | ExposureMask | StructureNotifyMask);
1466 1408
1467 termwin_ev.start (display, top); 1409 termwin_ev.start (display, top);
1468 1410
1469 /* vt cursor: Black-on-White is standard, but this is more popular */ 1411 /* vt cursor: Black-on-White is standard, but this is more popular */
1412 unsigned int shape = XC_xterm;
1413
1414#ifdef HAVE_XMU
1415 if (rs[Rs_pointerShape])
1416 {
1417 int stmp = XmuCursorNameToIndex (rs[Rs_pointerShape]);
1418 if (stmp >= 0)
1419 shape = stmp;
1420 }
1421#endif
1422
1470 TermWin_cursor = XCreateFontCursor (dpy, XC_xterm); 1423 TermWin_cursor = XCreateFontCursor (dpy, shape);
1471 1424
1472 /* the vt window */ 1425 /* the vt window */
1473 vt = XCreateSimpleWindow (dpy, top, 1426 vt = XCreateSimpleWindow (dpy, top,
1474 window_vt_x, window_vt_y, 1427 window_vt_x, window_vt_y,
1475 vt_width, vt_height, 1428 vt_width, vt_height,
1507 if (rs[Rs_fade]) 1460 if (rs[Rs_fade])
1508 pix_colors = pix_colors_unfocused; 1461 pix_colors = pix_colors_unfocused;
1509#endif 1462#endif
1510 1463
1511 pointer_unblank (); 1464 pointer_unblank ();
1512 scr_recolour (); 1465 scr_recolor ();
1513} 1466}
1514 1467
1515/*----------------------------------------------------------------------*/ 1468/*----------------------------------------------------------------------*/
1516/* 1469/*
1517 * Run the command in a subprocess and return a file descriptor for the 1470 * Run the command in a subprocess and return a file descriptor for the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines