transparent. Long Live Xft!
- do not include X11/Intrinsic.h anymore, directly use
Xlib/Xutil/Xresource directly.
+ - replace named colours by xorg's rgb.txt equivalents, to
+ reduce round trip time on startup, and short-cut allocation
+ of rgb:rr/gg/bb.
+ - further RTT optimisations.
7.4 Sat Jan 28 15:26:27 CET 2006
- screen background wasn't always erased properly when scrolling,
/*
* Define default colours for certain items. If you have a low colour
* display, then consider using colours which are already pre-allocated:
+ *
* Black (#000000)
- * Red3 (#CD0000) + these
- * Green3 (#00CD00) + colours
- * Yellow3 (#CDCD00) + are
- * Blue3 (#0000CD) + not
- * Magenta3 (#CD00CD) + pre-allocated
- * Cyan3 (#00CDCD) + if
- * AntiqueWhite (#FAEBD7) + NO_BRIGHTCOLOR
- * Grey25 (#404040) + defined
+ * Red3 (#CD0000)
+ * Green3 (#00CD00)
+ * Yellow3 (#CDCD00)
+ * Blue3 (#0000CD)
+ * Magenta3 (#CD00CD)
+ * Cyan3 (#00CDCD)
+ * AntiqueWhite (#FAEBD7)
+ * Grey25 (#404040)
* Red (#FF0000)
* Green (#00FF00)
* Yellow (#FFFF00)
* White (#FFFFFF)
*/
/* These colours MUST be defined */
-#define COLOR_FOREGROUND "Black"
-#define COLOR_BACKGROUND "White"
-#define COLOR_SCROLLBAR "#B2B2B2" /* scrollColor match Netscape */
-#define COLOR_SCROLLTROUGH "#969696"
+#define COLOR_FOREGROUND "rgb:00/00/00"
+#define COLOR_BACKGROUND "rgb:ff/ff/ff"
+#define COLOR_SCROLLBAR "rgb:b2/b2/b2" /* scrollColor match Netscape */
+#define COLOR_SCROLLTROUGH "rgb:96/96/96"
/*
* The cursor colours are special. Be very careful about setting these:
COLOR_FOREGROUND,
COLOR_BACKGROUND,
/* low-intensity colors */
- "Black", /* 0: black (#000000) */
- "Red3", /* 1: red (#CD0000) */
- "Green3", /* 2: green (#00CD00) */
- "Yellow3", /* 3: yellow (#CDCD00) */
- "Blue3", /* 4: blue (#0000CD) */
- "Magenta3", /* 5: magenta (#CD00CD) */
- "Cyan3", /* 6: cyan (#00CDCD) */
-# ifdef XTERM_COLORS
- "Grey90", /* 7: white (#E5E5E5) */
-# else
- "AntiqueWhite", /* 7: white (#FAEBD7) */
+ "rgb:00/00/00", // 0: black (Black)
+ "rgb:cd/00/00", // 1: red (Red3)
+ "rgb:00/cd/00", // 2: green (Green3)
+ "rgb:cd/cd/00", // 3: ywlloe (Yellow3)
+ "rgb:00/00/cd", // 4: blue (Blue3)
+ "rgb:cd/00/cd", // 5: magenta (Magenta3)
+ "rgb:00/cd/cd", // 6: cyan (Cyan3)
+# ifdef XTERM_COLORS
+ "rgb:e5/e5/e5", // 7: white (Grey90)
+# else
+ "rgb:fa/eb/d7", // 7: white (AntiqueWhite)
# endif
/* high-intensity colors */
# ifdef XTERM_COLORS
- "Grey30", /* 8: bright black (#4D4D4D) */
+ "rgb:4d/4d/4d", // 8: bright black (Grey30)
# else
- "Grey25", /* 8: bright black (#404040) */
+ "rgb:40/40/40", // 8: bright black (Grey25)
# endif
- "Red", /* 1/9: bright red (#FF0000) */
- "Green", /* 2/10: bright green (#00FF00) */
- "Yellow", /* 3/11: bright yellow (#FFFF00) */
- "Blue", /* 4/12: bright blue (#0000FF) */
- "Magenta", /* 5/13: bright magenta (#FF00FF) */
- "Cyan", /* 6/14: bright cyan (#00FFFF) */
- "White", /* 7/15: bright white (#FFFFFF) */
+ "rgb:ff/00/00", // 1/9: bright red (Reed)
+ "rgb:00/ff/00", // 2/10: bright green (Green)
+ "rgb:ff/ff/00", // 3/11: bright yellow (Yellow)
+ "rgb:00/00/ff", // 4/12: bright blue (Blue)
+ "rgb:ff/00/ff", // 5/13: bright magenta (Magenta)
+ "rgb:00/ff/ff", // 6/14: bright cyan (Cyan)
+ "rgb:ff/ff/ff", // 7/15: bright white (White)
// 88 xterm colours
"rgb:00/00/00",
NULL,
#endif
#if OFF_FOCUS_FADING
- "black",
+ "rgb:00/00/00",
#endif
};
codeset cs;
bool enc2b, encm;
- char *get_property (XFontStruct *f, const char *property, const char *repl) const;
+ char *get_property (XFontStruct *f, Atom property, const char *repl) const;
bool set_properties (rxvt_fontprop &p, int height, const char *weight, const char *slant, int avgwidth);
bool set_properties (rxvt_fontprop &p, XFontStruct *f);
bool set_properties (rxvt_fontprop &p, const char *name);
};
char *
-rxvt_font_x11::get_property (XFontStruct *f, const char *property, const char *repl) const
+rxvt_font_x11::get_property (XFontStruct *f, Atom property, const char *repl) const
{
unsigned long value;
- if (XGetFontProperty (f, XInternAtom (term->xdisp, property, 0), &value))
+ if (XGetFontProperty (f, property, &value))
return XGetAtomName (term->xdisp, value);
else
return rxvt_strdup (repl);
#endif
unsigned long avgwidth;
- if (!XGetFontProperty (f, XInternAtom (term->xdisp, "AVERAGE_WIDTH", 0), &avgwidth))
+ if (!XGetFontProperty (f, term->xa [XA_AVERAGE_WIDTH], &avgwidth))
avgwidth = 0;
- char *weight = get_property (f, "WEIGHT_NAME", "medium");
- char *slant = get_property (f, "SLANT", "r");
+ char *weight = get_property (f, term->xa [XA_WEIGHT_NAME], "medium");
+ char *slant = get_property (f, term->xa [XA_SLANT], "r");
set_properties (p, height, weight, slant, avgwidth);
if (!f)
return false;
- char *new_name = get_property (f, "FONT", name);
+ char *new_name = get_property (f, XA_FONT, name);
if (new_name)
set_name (new_name);
if (!f)
return false;
- char *registry = get_property (f, "CHARSET_REGISTRY", 0);
- char *encoding = get_property (f, "CHARSET_ENCODING", 0);
+ char *registry = get_property (f, term->xa [XA_CHARSET_REGISTRY], 0);
+ char *encoding = get_property (f, term->xa [XA_CHARSET_ENCODING], 0);
if (registry && encoding)
{
}
else
{
- const char *charset = get_property (f, "FONT", 0);
+ const char *charset = get_property (f, XA_FONT, 0);
if (!charset)
charset = name;
#endif
const char *const xa_names[] =
- {
- "TEXT",
- "COMPOUND_TEXT",
- "UTF8_STRING",
- "MULTIPLE",
- "TARGETS",
- "TIMESTAMP",
- "VT_SELECTION",
- "INCR",
- "WM_PROTOCOLS",
- "WM_DELETE_WINDOW",
- "CLIPBOARD",
+{
+ "TEXT",
+ "COMPOUND_TEXT",
+ "UTF8_STRING",
+ "MULTIPLE",
+ "TARGETS",
+ "TIMESTAMP",
+ "VT_SELECTION",
+ "INCR",
+ "WM_PROTOCOLS",
+ "WM_DELETE_WINDOW",
+ "CLIPBOARD",
+ "AVERAGE_WIDTH",
+ "WEIGHT_NAME",
+ "SLANT",
+ "CHARSET_REGISTRY",
+ "CHARSET_ENCODING",
#if ENABLE_FRILLS
- "_MOTIF_WM_HINTS",
+ "_MOTIF_WM_HINTS",
#endif
#if ENABLE_EWMH
- "_NET_WM_PID",
- "_NET_WM_NAME",
- "_NET_WM_ICON_NAME",
- "_NET_WM_PING",
+ "_NET_WM_PID",
+ "_NET_WM_NAME",
+ "_NET_WM_ICON_NAME",
+ "_NET_WM_PING",
#endif
#if USE_XIM
- "WM_LOCALE_NAME",
- "XIM_SERVERS",
+ "WM_LOCALE_NAME",
+ "XIM_SERVERS",
#endif
#ifdef TRANSPARENT
- "_XROOTPMAP_ID",
- "ESETROOT_PMAP_ID",
+ "_XROOTPMAP_ID",
+ "ESETROOT_PMAP_ID",
#endif
#if ENABLE_XEMBED
- "_XEMBED",
- "_XEMBED_INFO",
+ "_XEMBED",
+ "_XEMBED_INFO",
+#endif
+#if !ENABLE_MINIMAL
+ "SCREEN_RESOURCES",
+ "XDCCC_LINEAR_RGB_CORRECTION",
+ "XDCCC_LINEAR_RGB_MATRICES",
+ "WM_COLORMAP_WINDOWS",
+ "WM_STATE",
#endif
- };
+};
/////////////////////////////////////////////////////////////////////////////
char eos;
int mult;
- if ( l == 1+4*1 && 4 == sscanf (name, "#%1hx%1hx%1hx%1hx%c", &r.a, &r.r, &r.g, &r.b, &eos))
+ // shortcutting this saves countless server RTTs for the built-in colours
+ if (l == 3+3*3 && 3 == sscanf (name, "rgb:%hx/%hx/%hx/%hx%c", &r.r, &r.g, &r.b, &r.a, &eos))
+ {
+ r.a = rxvt_rgba::MAX_CC;
+ mult = rxvt_rgba::MAX_CC / 0x00ff;
+ }
+
+ // parse a number of non-standard ARGB colour specifications
+ else if ( l == 1+4*1 && 4 == sscanf (name, "#%1hx%1hx%1hx%1hx%c", &r.a, &r.r, &r.g, &r.b, &eos))
mult = rxvt_rgba::MAX_CC / 0x000f;
else if (l == 1+4*2 && 4 == sscanf (name, "#%2hx%2hx%2hx%2hx%c", &r.a, &r.r, &r.g, &r.b, &eos))
mult = rxvt_rgba::MAX_CC / 0x00ff;
mult = rxvt_rgba::MAX_CC / 0xffff;
else if (l == 4+5*4 && 4 == sscanf (name, "rgba:%hx/%hx/%hx/%hx%c", &r.r, &r.g, &r.b, &r.a, &eos))
mult = rxvt_rgba::MAX_CC / 0xffff;
+
+ // slow case: server round trip
else
return XftColorAllocName (screen->xdisp, screen->visual, screen->cmap, name, &c);
r.r *= mult; r.g *= mult; r.b *= mult; r.a *= mult;
+
return set (screen, r);
#else
XColor xc;
XA_WM_PROTOCOLS,
XA_WM_DELETE_WINDOW,
XA_CLIPBOARD,
+ XA_AVERAGE_WIDTH,
+ XA_WEIGHT_NAME,
+ XA_SLANT,
+ XA_CHARSET_REGISTRY,
+ XA_CHARSET_ENCODING,
#if ENABLE_FRILLS
XA_MOTIF_WM_HINTS,
#endif
#if ENABLE_XEMBED
XA_XEMBED,
XA_XEMBED_INFO,
+#endif
+#if !ENABLE_MINIMAL
+ // these are usually allocated by other subsystens, but we do it
+ // here to avoid a server roundtrip.
+ XA_SCREEN_RESOURCES,
+ XA_XDCCC_LINEAR_RGB_CORRECTION,
+ XA_XDCCC_LINEAR_RGB_MATRICES,
+ XA_WM_COLORMAP_WINDOWS,
+ XA_WM_STATE,
#endif
NUM_XA
};