From c3d2a57fc8d7d669d95dad28bfca619f79d80a45 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Tue, 24 Jul 2001 01:00:37 +0000 Subject: [PATCH] Mon Jul 23 17:59:18 2001 Michael Jennings (mej) Fixed the problem where the wrong font would end up in your menus and buttonbars if you enable multibyte support but don't have a specific encoding in use. I also corrected a large number of misplaced newlines in error messages; I think that was some Perl-fu gone awry. SVN revision: 4980 --- ChangeLog | 7 +++++++ configure.in | 5 ++++- src/buttons.c | 6 +++--- src/command.c | 1 + src/command.h | 10 +++++----- src/menus.c | 5 +++-- src/options.c | 54 +++++++++++++++++++++++++++------------------------ 7 files changed, 52 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32e519e..9a4411e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4308,3 +4308,10 @@ Mon Jul 23 11:05:45 2001 Michael Jennings (mej) Well that was dumb. PNG backgrounds which were tiled rather than scaled would end up nuking most of the window. Fixed now. ---------------------------------------------------------------------- +Mon Jul 23 17:59:18 2001 Michael Jennings (mej) + +Fixed the problem where the wrong font would end up in your menus and +buttonbars if you enable multibyte support but don't have a specific +encoding in use. I also corrected a large number of misplaced +newlines in error messages; I think that was some Perl-fu gone awry. +---------------------------------------------------------------------- diff --git a/configure.in b/configure.in index b923eee..9c1795a 100644 --- a/configure.in +++ b/configure.in @@ -582,16 +582,19 @@ AC_ARG_WITH(mousewheel, fi, AC_MSG_RESULT(yes) AC_DEFINE(MOUSEWHEEL) ) + MULTICHAR_ENCODING="" AC_MSG_CHECKING(for multi-charset support) AC_ARG_ENABLE(multi-charset, [ --enable-multi-charset compile with multibyte font support], if test "$enableval" = "no"; then MULTI_CHARSET_TYPE="" + elif test "$enableval" = "yes"; then + MULTI_CHARSET_TYPE="unicode" else MULTI_CHARSET_TYPE="$enableval" fi, - if (xlsfonts | grep 10646 >/dev/null 2>&1); then + if (xlsfonts | grep 10646 >&5 2>&5); then MULTI_CHARSET_TYPE="unicode" else MULTI_CHARSET_TYPE="" diff --git a/src/buttons.c b/src/buttons.c index 874c49e..cbb368e 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -53,13 +53,13 @@ static inline void draw_string(buttonbar_t *bbar, Drawable d, GC gc, int x, int y, char *str, size_t len) { - D_BBAR(("Writing string \"%s\" (length %lu) onto drawable 0x%08x at %d, %d\n", str, len, d, x, y)); + D_BBAR(("Writing string \"%s\" (length %lu) using font 0x%08x onto drawable 0x%08x at %d, %d\n", str, len, bbar->font, d, x, y)); REQUIRE(bbar != NULL); REQUIRE(d != None); REQUIRE(gc != None); #ifdef MULTI_CHARSET - if (bbar->fontset) + if (bbar->fontset && encoding_method != LATIN1) XmbDrawString(Xdisplay, d, bbar->fontset, gc, x, y, str, len); else #endif @@ -548,7 +548,7 @@ bbar_set_font(buttonbar_t *bbar, const char *fontname) bbar->fheight = font->ascent + font->descent + rs_line_space; XSetFont(Xdisplay, bbar->gc, font->fid); bbar_reset_total_height(); - D_BBAR(("New dimensions are %d/%d/%d\n", bbar->fwidth, bbar->fheight, bbar->h)); + D_BBAR(("Font is \"%s\" (0x%08x). New dimensions are %d/%d/%d\n", NONULL(fontname), font, bbar->fwidth, bbar->fheight, bbar->h)); return 1; } diff --git a/src/command.c b/src/command.c index 4330cda..2e3d956 100644 --- a/src/command.c +++ b/src/command.c @@ -2209,6 +2209,7 @@ run_command(char **argv) } } #endif + D_CMD(("[%d] execvp(\"%s\", %8p) is next. I'm outta here!\n", getpid(), NONULL(argv[0]), argv)); execvp(argv[0], argv); print_error("execvp() failed, cannot execute \"%s\": %s\n", argv[0], strerror(errno)); } else { diff --git a/src/command.h b/src/command.h index aa418af..b99a0e3 100644 --- a/src/command.h +++ b/src/command.h @@ -107,14 +107,14 @@ if (test) PrivateModes |= (bit); else PrivateModes &= ~(bit);} while (0) #ifdef HAVE_TERMIOS_H # ifdef TCSANOW /* POSIX */ # define GET_TERMIOS(fd,tios) tcgetattr(fd, tios) -# define SET_TERMIOS(fd,tios) do {cfsetospeed(tios, BAUDRATE); cfsetispeed(tios, BAUDRATE); tcsetattr(fd, TCSANOW, tios); } while (0) +# define SET_TERMIOS(fd,tios) do {cfsetospeed(tios, BAUDRATE); cfsetispeed(tios, BAUDRATE); tcsetattr(fd, TCSANOW, tios);} while (0) # else # ifdef TIOCSETA -# define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) -# define SET_TERMIOS(fd,tios) do {tios->c_cflag |= BAUDRATE; ioctl(fd, TIOCSETA, tios); } while (0) +# define GET_TERMIOS(fd,tios) ioctl(fd, TIOCGETA, tios) +# define SET_TERMIOS(fd,tios) do {tios->c_cflag |= BAUDRATE; ioctl(fd, TIOCSETA, tios);} while (0) # else -# define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) -# define SET_TERMIOS(fd,tios) do {tios->c_cflag |= BAUDRATE; ioctl(fd, TCSETS, tios); } while (0) +# define GET_TERMIOS(fd,tios) ioctl(fd, TCGETS, tios) +# define SET_TERMIOS(fd,tios) do {tios->c_cflag |= BAUDRATE; ioctl(fd, TCSETS, tios);} while (0) # endif # endif # define SET_TTYMODE(fd,tios) SET_TERMIOS(fd, tios) diff --git a/src/menus.c b/src/menus.c index c10d2e4..7a31a0c 100644 --- a/src/menus.c +++ b/src/menus.c @@ -38,6 +38,7 @@ static const char cvs_ident[] = "$Id$"; #include "misc.h" #include "options.h" #include "pixmap.h" +#include "profile.h" #include "screen.h" #include "script.h" #include "term.h" @@ -101,7 +102,7 @@ draw_string(Drawable d, GC gc, int x, int y, char *str, size_t len) D_MENU(("Writing string \"%s\" (length %lu) onto drawable 0x%08x at %d, %d\n", str, len, d, x, y)); #ifdef MULTI_CHARSET - if (current_menu && current_menu->fontset) + if (current_menu && current_menu->fontset && encoding_method != LATIN1) XmbDrawString(Xdisplay, d, current_menu->fontset, gc, x, y, str, len); else #endif @@ -1167,7 +1168,7 @@ menu_display(int x, int y, menu_t *menu) menu->y = y; D_MENU(("Displaying menu \"%s\" (window 0x%08x) at root coordinates %d, %d\n", menu->title, menu->win, menu->x, menu->y)); - menu_draw(menu); + PROF_FUNC(menu_draw, menu_draw(menu)); menu->state |= (MENU_STATE_IS_MAPPED); /* Take control of the pointer so we get all events for it, even those outside the menu window */ diff --git a/src/options.c b/src/options.c index 5f94227..7d3d596 100644 --- a/src/options.c +++ b/src/options.c @@ -1295,8 +1295,8 @@ parse_color(char *buff, void *state) FREE(tmp); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context color", file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context color\n", + file_peek_path(), file_peek_line(), buff); } return state; } @@ -1374,8 +1374,8 @@ parse_attributes(char *buff, void *state) } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context attributes", file_peek_path(), file_peek_line(), (buff ? buff : "")); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context attributes\n", + file_peek_path(), file_peek_line(), (buff ? buff : "")); } return state; } @@ -1726,8 +1726,8 @@ parse_keyboard(char *buff, void *state) } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplKP); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for \n" - "attribute app_keypad", file_peek_path(), file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_keypad\n", + file_peek_path(), file_peek_line(), tmp); return NULL; } @@ -1745,14 +1745,14 @@ parse_keyboard(char *buff, void *state) } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplCUR); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for \n" - "attribute app_cursor", file_peek_path(), file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_cursor\n", + file_peek_path(), file_peek_line(), tmp); return NULL; } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context keyboard", file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context keyboard\n", + file_peek_path(), file_peek_line(), buff); } return state; } @@ -1820,8 +1820,8 @@ parse_misc(char *buff, void *state) #endif } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context misc", file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context misc\n", + file_peek_path(), file_peek_line(), buff); } return state; } @@ -1864,8 +1864,8 @@ parse_imageclasses(char *buff, void *state) #endif } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context imageclasses", file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context imageclasses\n", + file_peek_path(), file_peek_line(), buff); } return state; } @@ -2256,8 +2256,8 @@ parse_image(char *buff, void *state) images[idx].current->iml->pad = (Imlib_Border *) NULL; } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context image", file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context image\n", + file_peek_path(), file_peek_line(), buff); } return ((void *) state); } @@ -2345,8 +2345,8 @@ parse_actions(char *buff, void *state) } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context action", file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context action\n", + file_peek_path(), file_peek_line(), buff); } return state; } @@ -2585,8 +2585,8 @@ parse_bbar(char *buff, void *state) bbar_add_button(bbar, button); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid \n" - "within context menu", file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", + file_peek_path(), file_peek_line(), buff); } return ((void *) bbar); } @@ -2629,9 +2629,11 @@ parse_multichar(char *buff, void *state) && BEG_STRCASECMP(rs_multichar_encoding, "euckr") && BEG_STRCASECMP(rs_multichar_encoding, "big5") && BEG_STRCASECMP(rs_multichar_encoding, "gb") - && BEG_STRCASECMP(rs_multichar_encoding, "iso-10646")) { + && BEG_STRCASECMP(rs_multichar_encoding, "iso-10646") + && BEG_STRCASECMP(rs_multichar_encoding, "none")) { print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"\n", file_peek_path(), file_peek_line(), rs_multichar_encoding); + FREE(rs_multichar_encoding); return NULL; } } else { @@ -2644,8 +2646,8 @@ parse_multichar(char *buff, void *state) unsigned char n; if (num_words(buff) != 3) { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" - "attribute font", file_peek_path(), file_peek_line(), NONULL(tmp)); + print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for attribute font\n", + file_peek_path(), file_peek_line(), NONULL(tmp)); return NULL; } if (isdigit(*tmp)) { @@ -2668,8 +2670,10 @@ parse_multichar(char *buff, void *state) file_peek_path(), file_peek_line(), buff); } #else - print_warning("Multichar support was not compiled in, ignoring entire context\n"); - file_poke_skip(1); + if (*buff == CONF_BEGIN_CHAR) { + print_warning("Multichar support was not compiled in, ignoring entire context\n"); + file_poke_skip(1); + } #endif return state; buff = NULL;