Sat Dec 29 15:39:38 2001 Michael Jennings (mej)
Fixed a little-endian bug with 24-bit XImages, added a bit to init_locale() in an effort to replicate the behavior of the Athena widgets, and added a -b option to Esetroot based on a patch from Oliwier Ptak <supergrass@gmx.net>. SVN revision: 5792
This commit is contained in:
parent
36b1140007
commit
a923b86954
|
@ -4440,3 +4440,10 @@ Fri Dec 14 15:17:14 2001 Michael Jennings (mej)
|
|||
termcap fix from Fredrik Svensson <fred@ludd.luth.se> and another
|
||||
mod to Paul's patch.
|
||||
----------------------------------------------------------------------
|
||||
Sat Dec 29 15:39:38 2001 Michael Jennings (mej)
|
||||
|
||||
Fixed a little-endian bug with 24-bit XImages, added a bit to
|
||||
init_locale() in an effort to replicate the behavior of the Athena
|
||||
widgets, and added a -b option to Esetroot based on a patch from
|
||||
Oliwier Ptak <supergrass@gmx.net>.
|
||||
----------------------------------------------------------------------
|
||||
|
|
|
@ -1762,31 +1762,29 @@ init_locale(void)
|
|||
char *locale = NULL;
|
||||
|
||||
locale = setlocale(LC_ALL, "");
|
||||
XSetLocaleModifiers("");
|
||||
TermWin.fontset = (XFontSet) 0;
|
||||
if (locale == NULL) {
|
||||
print_error("Setting locale failed.\n");
|
||||
if ((locale == NULL) || (!XSupportsLocale())) {
|
||||
print_warning("Locale not supported; defaulting to portable \"C\" locale.\n");
|
||||
locale = setlocale(LC_ALL, "C");
|
||||
XSetLocaleModifiers("");
|
||||
REQUIRE(locale);
|
||||
REQUIRE(XSupportsLocale());
|
||||
} else {
|
||||
#ifdef USE_XIM
|
||||
# ifdef MULTI_CHARSET
|
||||
if (strcmp(locale, "C"))
|
||||
# endif
|
||||
{
|
||||
#ifdef MULTI_CHARSET
|
||||
TermWin.fontset = create_fontset(etfonts[def_font_idx], etmfonts[def_font_idx]);
|
||||
TermWin.fontset = create_fontset(etfonts[def_font_idx], etmfonts[def_font_idx]);
|
||||
#else
|
||||
TermWin.fontset = create_fontset(etfonts[def_font_idx], "-misc-fixed-medium-r-semicondensed--13-*-75-*-c-*-iso10646-1");
|
||||
TermWin.fontset = create_fontset(etfonts[def_font_idx], "-misc-fixed-medium-r-semicondensed--13-*-75-*-c-*-iso10646-1");
|
||||
#endif
|
||||
if ((TermWin.fontset == (XFontSet) 0) || (xim_real_init() != -1)) {
|
||||
return;
|
||||
}
|
||||
if ((TermWin.fontset == (XFontSet) 0) || (xim_real_init() != -1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
# ifdef USE_X11R6_XIM
|
||||
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
|
||||
XRegisterIMInstantiateCallback(Xdisplay, NULL, NULL, NULL, xim_instantiate_cb, NULL);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
/* Reset locale to NULL since the call to create_fontset() has freed that memory. */
|
||||
locale = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* USE_XIM || MULTI_CHARSET */
|
||||
|
|
|
@ -1561,12 +1561,12 @@ shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm)
|
|||
ptr[x + 1] = g;
|
||||
ptr[x + 2] = b;
|
||||
# else
|
||||
r = (ptr[x + 0] * rm) >> 8;
|
||||
r = (ptr[x + 2] * rm) >> 8;
|
||||
g = (ptr[x + 1] * gm) >> 8;
|
||||
b = (ptr[x + 2] * bm) >> 8;
|
||||
ptr[x + 0] = r;
|
||||
b = (ptr[x + 0] * bm) >> 8;
|
||||
ptr[x + 2] = r;
|
||||
ptr[x + 1] = g;
|
||||
ptr[x + 2] = b;
|
||||
ptr[x + 0] = b;
|
||||
# endif
|
||||
}
|
||||
ptr += bpl;
|
||||
|
|
|
@ -98,18 +98,18 @@ main(int argc, char *argv[])
|
|||
{
|
||||
#ifdef PIXMAP_SUPPORT
|
||||
unsigned char scale = 0, center = 0, fit = 0, mirror = 0;
|
||||
char *displayname = NULL;
|
||||
char *fname = NULL;
|
||||
char *displayname = NULL, *fname = NULL, *bgcolor = NULL;
|
||||
Imlib_Image im;
|
||||
Pixmap p = None, temp_pmap = None, m = None;
|
||||
register unsigned char i;
|
||||
GC gc;
|
||||
XGCValues gcv;
|
||||
XColor xcolor;
|
||||
int w, h, x, y;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "%s [-display <display_name>] [-scale] [-center] [-fit] [-mirror] pixmap\n", *argv);
|
||||
fprintf(stderr, "\t Short options are also recognized (-d, -s, -c, -f, and -m)\n");
|
||||
fprintf(stderr, "%s [-display <display_name>] [-bgcolor <color>] [-scale] [-center] [-fit] [-mirror] pixmap\n", *argv);
|
||||
fprintf(stderr, "\t Short options are also recognized (-d, -b, -s, -c, -f, and -m)\n");
|
||||
exit(0);
|
||||
}
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
@ -118,6 +118,8 @@ main(int argc, char *argv[])
|
|||
}
|
||||
if (argv[i][1] == 'd') {
|
||||
displayname = argv[++i];
|
||||
} else if (argv[i][1] == 'b') {
|
||||
bgcolor = argv[++i];
|
||||
} else if (argv[i][1] == 's') {
|
||||
scale = 1;
|
||||
} else if (argv[i][1] == 'c') {
|
||||
|
@ -131,8 +133,8 @@ main(int argc, char *argv[])
|
|||
debug = 1;
|
||||
} else {
|
||||
fprintf(stderr, "%s: Unrecognized option \'%c\'\n\n", *argv, argv[i][1]);
|
||||
fprintf(stderr, "%s [-display display] [-scale] [-center] [-fit] [-mirror] pixmap\n", *argv);
|
||||
fprintf(stderr, "\t Short options are also recognized (-d, -s, -c, -f, and -m)\n");
|
||||
fprintf(stderr, "%s [-display <display_name>] [-bgcolor <color>] [-scale] [-center] [-fit] [-mirror] pixmap\n", *argv);
|
||||
fprintf(stderr, "\t Short options are also recognized (-d, -b, -s, -c, -f, and -m)\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +147,7 @@ main(int argc, char *argv[])
|
|||
|
||||
if (debug) {
|
||||
fprintf(stderr, "%s:%d: Display name is \"%s\"\n", __FILE__, __LINE__, displayname ? displayname : "(nil)");
|
||||
fprintf(stderr, "%s:%d: Background color name is \"%s\"\n", __FILE__, __LINE__, bgcolor ? bgcolor : "(nil)");
|
||||
fprintf(stderr, "%s:%d: Image will be %s\n", __FILE__, __LINE__, scale ? "scaled" : (center ? "centered" : (fit ? "fit" : "tiled")));
|
||||
fprintf(stderr, "%s:%d: Image file is %s\n", __FILE__, __LINE__, fname ? fname : "(nil)");
|
||||
}
|
||||
|
@ -203,9 +206,14 @@ main(int argc, char *argv[])
|
|||
w = (int) (w * x_ratio);
|
||||
h = (int) (h * x_ratio);
|
||||
}
|
||||
|
||||
p = XCreatePixmap(Xdisplay, Xroot, scr->width, scr->height, Xdepth);
|
||||
gcv.foreground = gcv.background = BlackPixel(Xdisplay, screen);
|
||||
gc = XCreateGC(Xdisplay, p, ((center || fit) ? (GCForeground | GCBackground) : 0), &gcv);
|
||||
if (bgcolor && XParseColor(Xdisplay, DefaultColormap(Xdisplay, screen), bgcolor, &xcolor)
|
||||
&& XAllocColor(Xdisplay, DefaultColormap(Xdisplay, screen), &xcolor)) {
|
||||
gcv.foreground = gcv.background = xcolor.pixel;
|
||||
}
|
||||
gc = XCreateGC(Xdisplay, p, (GCForeground | GCBackground), &gcv);
|
||||
if (scale) {
|
||||
XFillRectangle(Xdisplay, p, gc, 0, 0, w, h);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue