Sat May 4 10:23:38 2002 Michael Jennings (mej)

Ran reformat-code on the tree.

Also merged in Azundris' Escreen patch.  It's disabled by default for
the moment pending further testing, but you can enable it manually by
defining ESCREEN.


SVN revision: 6202
eterm-0.10
Michael Jennings 21 years ago
parent 43bd347fbb
commit 92ca20bcba
  1. 8
      ChangeLog
  2. 9
      doc/Eterm.1.in
  3. 4
      reformat-code
  4. 2
      src/Makefile.am
  5. 123
      src/README.Escreen
  6. 319
      src/actions.c
  7. 126
      src/buttons.c
  8. 3
      src/buttons.h
  9. 4130
      src/command.c
  10. 356
      src/defaultfont.c
  11. 315
      src/draw.c
  12. 322
      src/e.c
  13. 350
      src/encoding.c
  14. 1113
      src/events.c
  15. 1095
      src/font.c
  16. 348
      src/grkelot.c
  17. 1183
      src/libscream.c
  18. 2
      src/main.c
  19. 1666
      src/menus.c
  20. 414
      src/misc.c
  21. 106
      src/netdisp.c
  22. 6350
      src/options.c
  23. 3
      src/options.h
  24. 3571
      src/pixmap.c
  25. 175
      src/scream.h
  26. 56
      src/screamcfg.h
  27. 4799
      src/screen.c
  28. 3
      src/screen.h
  29. 530
      src/script.c
  30. 1531
      src/scrollbar.c
  31. 413
      src/startup.c
  32. 8
      src/startup.h
  33. 110
      src/system.c
  34. 3967
      src/term.c
  35. 138
      src/timer.c
  36. 446
      src/utmp.c
  37. 1101
      src/windows.c
  38. 411
      utils/Esetroot.c
  39. 44
      utils/Etbg.c
  40. 51
      utils/Ettable.c

@ -4624,3 +4624,11 @@ Mon Apr 29 21:18:20 2002 Michael Jennings (mej)
Fixed the --install option which hasn't worked for ages.
----------------------------------------------------------------------
Sat May 4 10:23:38 2002 Michael Jennings (mej)
Ran reformat-code on the tree.
Also merged in Azundris' Escreen patch. It's disabled by default for
the moment pending further testing, but you can enable it manually by
defining ESCREEN.
----------------------------------------------------------------------

@ -613,7 +613,14 @@ setuid root to do this.
.BI \-e " command" ", \-\-exec " command
Execute
.I command
rather than a shell.
rather than a shell. Forces Eterm mode.
.TP
.BI \-U " URL" ", \-\-url " URL
Pick up a "screen" session at
.I URL
rather than a local one. URLs look like so (screen://user@host.dom/options),
with all parts optional, defaulting to current user at localhost,
respectively. Forces Escreen mode, overrides \-\-exec.
.SH THEMES

@ -3,8 +3,8 @@
for i in *.c src/*.c utils/*.c ; do
if test -f $i; then
echo Reformatting $i
indent -bap -br -ce -ci4 -cli2 -cs -di1 -i2 -l140 -lp -lps -nbc -npcs -nss -nsob -psl $i
indent -bap -br -ce -ci4 -cli2 -cs -di1 -i4 -l140 -lp -lps -nbc -npcs -nss -nsob -psl $i
fi
done
perl -p -i.bak -e 's/(\w+)_t (\*+)\s+/$1_t ($2)/g;' */*.[ch]
perl -p -i.bak -e 's/(\w+)_t (\*+)\s+/$1_t $2/g;' */*.[ch]

@ -14,7 +14,7 @@ libEterm_la_SOURCES = actions.c actions.h buttons.c buttons.h command.c
screen.h script.c script.h scrollbar.c scrollbar.h \
startup.c startup.h system.c system.h term.c term.h \
timer.c timer.h utmp.c windows.c windows.h defaultfont.c \
defaultfont.h
defaultfont.h libscream.c scream.h screamcfg.h
EXTRA_libEterm_la_SOURCES = $(MMX_SRCS)

@ -0,0 +1,123 @@
ESCREEN
1 - What is it?
Eterm now offers you to compile in experimental support for the
"screen" program. "screen" is a terminal multiplexer (one window,
several shells). Yes, it's like konsole or multi-gnome-terminal,
only that your shells won't die just because X or the Window Manager
do. Oh, and you can pick up your home session from work, and vice
versa. And several people can connect to the same session at once,
and...
You get this picture -- if you're a power-user, this is for you.
Also, if you're not a power-user, this is *not* for you. It's alpha.
It's experimental. Reported bugs will get fixed where possible, but
there can be no newbie support at this time.
2 - How do I get it?
You already have all you need. Now, compile with ESCREEN defined in
the DEFS in src/Makefile.
If you don't know how to do that, sorry, but you're not Escreen's
intended audience at this point; please hold on.
Oh, and you also need the screen program. In our tests, we used
$ screen -version
Screen version 3.09.11 (FAU) 14-Feb-02
3 - How do I start it?
If you call it an Eterm, it will behave like one. Same for an Escreen.
(ln -s Eterm Escreen; ./Escreen).
Additionally, when called with a command-line (-e "/some/program"), the
suite will *always* behave like an Eterm, even if invoked as Escreen.
Likewise, when called with an URL (-U "screen://user@some.host.gov/"),
it will behave like an Escreen, even if invoked under another name.
4 - What should I expect from it? (subject to change)
An Eterm should open with a screen (without a status-line) running
inside of it. There should be a button-bar in the Eterm enumerating
the multiplexed terminal (you usually start with one). If you normally
don't use a button-bar, Escreen will create one for you. Otherwise, it
will add buttons to your existing bar.
5 - What should I expect in the future? (TODO)
* Limited support for scrolling. screen doesn't give us all the info
we'd need to make this really sexy. There will likely be limited
support for screen (we need to keep this, it will be what we'll find
on remote machine), and possibly support for enhanced screen-clones
(like the perchance forthcoming "scream").
* Support for ".screenrc". This was temporarily disabled to aid in
debugging and will soon return in conjunction with
* Escreen accepting non-default key setups and
* menus for "screen"-functions so those unfamiliar with the program
will not need to learn a dozen arcance key-sequences (or even get
used to ^A meaning something new).
9 - FAQ
Q I don't see any buttons!
A Debian-users reported this before, and it is presumed to be a problem
with the terminfo-data. Call up Eterm (or xterm, or whatnot). *Then*
call up "screen" from inside that terminal. Is the last line inverted?
If it isn'T, something is seriously weird with your setup, and it's not
a problem in Escreen. Sorry. : (
Q ^A does funny things!
A Well, yes. ^A talks to the screen program. You will be able to move
that to a key of your choice with the next release.
Q I'd like for the button labels to be in a different colour.
A At this time, the labels follow the general (text) colours.
You will be able to define colours for (foreground|background|active|bell)
windows' labels in later releases.
Q Escreen opens, then closes again.
A Escreen cannot run "screen". If you do have "screen", and it is in
the search path, screen apparently terminates right away. Normally
this means that your screen-sessions are messed up; "screen -ls" will
give you a list of them; "screen -wipe" will do the cleaning up.
NOTE: If this happens with a remote session, the remote end might just
find our terminal type confusing. The "--term-name" option with some-
thing vanilla (--term-name vt100) should remedy this.
Q "screen" support rocks! Can we have it in konsole/multi-gnome-terminal?
A I will not attempt anything like that before I am happy with Escreen.
The code, however, is GPL'd, and its use is documented by example of
Eterm. If you can work with that, do.
Q Who's responsible for this?
A Escreen is an Eterm extension conceived and written by Azundris.
Do not complain to KainX (who courteously added the patch for the
enjoyment of the hardy) if you break your Eterm by compiling this
in (or by trying to use the alpha-functionality). By using this,
you agree that anything happening while or because of using it is
your fault, and your fault only.
-- Azundris 2002/05/03 <escreen@azundris.com> http://www.azundris.com/

@ -48,214 +48,213 @@ action_t *action_list = NULL;
unsigned char
action_handle_string(event_t *ev, action_t *action)
{
USE_VAR(ev);
REQUIRE_RVAL(action->param.string != NULL, 0);
cmd_write((unsigned char *) action->param.string, strlen(action->param.string));
return 1;
USE_VAR(ev);
REQUIRE_RVAL(action->param.string != NULL, 0);
cmd_write((unsigned char *) action->param.string, strlen(action->param.string));
return 1;
}
unsigned char
action_handle_echo(event_t *ev, action_t *action)
{
USE_VAR(ev);
REQUIRE_RVAL(action->param.string != NULL, 0);
tt_write((unsigned char *) action->param.string, strlen(action->param.string));
return 1;
USE_VAR(ev);
REQUIRE_RVAL(action->param.string != NULL, 0);
tt_write((unsigned char *) action->param.string, strlen(action->param.string));
return 1;
}
unsigned char
action_handle_script(event_t *ev, action_t *action)
{
USE_VAR(ev);
REQUIRE_RVAL(action->param.script != NULL, 0);
script_parse(action->param.script);
return 1;
USE_VAR(ev);
REQUIRE_RVAL(action->param.script != NULL, 0);
script_parse(action->param.script);
return 1;
}
unsigned char
action_handle_menu(event_t *ev, action_t *action)
{
REQUIRE_RVAL(action->param.menu != NULL, 0);
menu_invoke(ev->xbutton.x, ev->xbutton.y, TermWin.parent, action->param.menu, ev->xbutton.time);
return 1;
REQUIRE_RVAL(action->param.menu != NULL, 0);
menu_invoke(ev->xbutton.x, ev->xbutton.y, TermWin.parent, action->param.menu, ev->xbutton.time);
return 1;
}
action_t *
action_find_match(unsigned short mod, unsigned char button, KeySym keysym)
action_t *action_find_match(unsigned short mod, unsigned char button, KeySym keysym)
{
action_t *action;
action_t *action;
D_ACTIONS(("mod == 0x%08x, button == %d, keysym == 0x%08x\n", mod, button, keysym));
for (action = action_list; action; action = action->next) {
D_ACTIONS(("Checking action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button, action->keysym));
if ((action->mod == mod) && (action->button == button) && (action->keysym == keysym)) {
D_ACTIONS(("Match found at %8p\n", action));
return action;
D_ACTIONS(("mod == 0x%08x, button == %d, keysym == 0x%08x\n", mod, button, keysym));
for (action = action_list; action; action = action->next) {
D_ACTIONS(("Checking action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button, action->keysym));
if ((action->mod == mod) && (action->button == button) && (action->keysym == keysym)) {
D_ACTIONS(("Match found at %8p\n", action));
return action;
}
}
}
return NULL;
return NULL;
}
unsigned char
action_check_button(unsigned char button, int x_button)
{
/* The event we're looking at is a button press. Make sure the
current action is also, and that it matches. Continue if not. */
D_ACTIONS(("Checking button %d vs x_button %d\n", button, x_button));
if (button == BUTTON_NONE) {
/* It was a button press, and this action is not a button action. */
return FALSE;
}
if ((button != BUTTON_ANY) && (button != x_button)) {
/* It's a specific button, and the two don't match. */
return FALSE;
}
D_ACTIONS(("Button match confirmed.\n"));
return TRUE;
/* The event we're looking at is a button press. Make sure the
current action is also, and that it matches. Continue if not. */
D_ACTIONS(("Checking button %d vs x_button %d\n", button, x_button));
if (button == BUTTON_NONE) {
/* It was a button press, and this action is not a button action. */
return FALSE;
}
if ((button != BUTTON_ANY) && (button != x_button)) {
/* It's a specific button, and the two don't match. */
return FALSE;
}
D_ACTIONS(("Button match confirmed.\n"));
return TRUE;
}
unsigned char
action_check_keysym(KeySym keysym, KeySym x_keysym)
{
/* The event we're looking at is a key press. Make sure the
current action is also, and that it matches. Continue if not. */
D_ACTIONS(("Checking keysym 0x%08x vs x_keysym 0x%08x\n", keysym, x_keysym));
if (keysym == None) {
return FALSE;
} else if (keysym != x_keysym) {
return FALSE;
}
D_ACTIONS(("Keysym match confirmed.\n"));
return TRUE;
/* The event we're looking at is a key press. Make sure the
current action is also, and that it matches. Continue if not. */
D_ACTIONS(("Checking keysym 0x%08x vs x_keysym 0x%08x\n", keysym, x_keysym));
if (keysym == None) {
return FALSE;
} else if (keysym != x_keysym) {
return FALSE;
}
D_ACTIONS(("Keysym match confirmed.\n"));
return TRUE;
}
unsigned char
action_check_modifiers(unsigned short mod, int x_mod)
{
unsigned int m = (AltMask | MetaMask | NumLockMask);
unsigned int m = (AltMask | MetaMask | NumLockMask);
/* When we do have to check the modifiers, we do so in this order to eliminate the
most popular choices first. If any test fails, we return FALSE. */
D_ACTIONS(("Checking modifier set 0x%08x (" MOD_FMT ") vs. X modifier set 0x%08x (" MOD_FMT ")\n",
mod, SHOW_MODS(mod), x_mod, SHOW_X_MODS(x_mod)));
if (mod != MOD_ANY) {
/* LOGICAL_XOR() returns true if either the first parameter or the second parameter
is true, but not both...just like XOR. If the mask we're looking for is set in
mod but not in x_mod, or set in x_mod but not in mod, we don't have a match. */
if (LOGICAL_XOR((mod & MOD_CTRL), (x_mod & ControlMask))) {
return FALSE;
}
if (LOGICAL_XOR((mod & MOD_SHIFT), (x_mod & ShiftMask))) {
return FALSE;
/* When we do have to check the modifiers, we do so in this order to eliminate the
most popular choices first. If any test fails, we return FALSE. */
D_ACTIONS(("Checking modifier set 0x%08x (" MOD_FMT ") vs. X modifier set 0x%08x (" MOD_FMT ")\n",
mod, SHOW_MODS(mod), x_mod, SHOW_X_MODS(x_mod)));
if (mod != MOD_ANY) {
/* LOGICAL_XOR() returns true if either the first parameter or the second parameter
is true, but not both...just like XOR. If the mask we're looking for is set in
mod but not in x_mod, or set in x_mod but not in mod, we don't have a match. */
if (LOGICAL_XOR((mod & MOD_CTRL), (x_mod & ControlMask))) {
return FALSE;
}
if (LOGICAL_XOR((mod & MOD_SHIFT), (x_mod & ShiftMask))) {
return FALSE;
}
if (MetaMask != AltMask) {
if (LOGICAL_XOR((mod & MOD_ALT), (x_mod & AltMask))) {
return FALSE;
}
if (LOGICAL_XOR((mod & MOD_META), (x_mod & MetaMask))) {
return FALSE;
}
} else {
if (LOGICAL_XOR((mod & (MOD_META | MOD_ALT)), (x_mod & (MetaMask | AltMask)))) {
return FALSE;
}
}
if (LOGICAL_XOR((mod & MOD_LOCK), (x_mod & LockMask))) {
return FALSE;
}
/* These tests can't use LOGICAL_XOR because the second test has an additional
restriction that the Mod?Mask cannot be set in m; i.e., we want to ignore
any Mod?Mask assigned to Alt, Meta, or the NumLock On state. */
if (((mod & MOD_MOD1) && !(x_mod & Mod1Mask)) || (!(mod & MOD_MOD1) && (x_mod & Mod1Mask) && !(Mod1Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD2) && !(x_mod & Mod2Mask)) || (!(mod & MOD_MOD2) && (x_mod & Mod2Mask) && !(Mod2Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD3) && !(x_mod & Mod3Mask)) || (!(mod & MOD_MOD3) && (x_mod & Mod3Mask) && !(Mod3Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD4) && !(x_mod & Mod4Mask)) || (!(mod & MOD_MOD4) && (x_mod & Mod4Mask) && !(Mod4Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD5) && !(x_mod & Mod5Mask)) || (!(mod & MOD_MOD5) && (x_mod & Mod5Mask) && !(Mod5Mask & m))) {
return FALSE;
}
}
if (MetaMask != AltMask) {
if (LOGICAL_XOR((mod & MOD_ALT), (x_mod & AltMask))) {
return FALSE;
}
if (LOGICAL_XOR((mod & MOD_META), (x_mod & MetaMask))) {
return FALSE;
}
} else {
if (LOGICAL_XOR((mod & (MOD_META | MOD_ALT)), (x_mod & (MetaMask | AltMask)))) {
return FALSE;
}
}
if (LOGICAL_XOR((mod & MOD_LOCK), (x_mod & LockMask))) {
return FALSE;
}
/* These tests can't use LOGICAL_XOR because the second test has an additional
restriction that the Mod?Mask cannot be set in m; i.e., we want to ignore
any Mod?Mask assigned to Alt, Meta, or the NumLock On state. */
if (((mod & MOD_MOD1) && !(x_mod & Mod1Mask)) || (!(mod & MOD_MOD1) && (x_mod & Mod1Mask) && !(Mod1Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD2) && !(x_mod & Mod2Mask)) || (!(mod & MOD_MOD2) && (x_mod & Mod2Mask) && !(Mod2Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD3) && !(x_mod & Mod3Mask)) || (!(mod & MOD_MOD3) && (x_mod & Mod3Mask) && !(Mod3Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD4) && !(x_mod & Mod4Mask)) || (!(mod & MOD_MOD4) && (x_mod & Mod4Mask) && !(Mod4Mask & m))) {
return FALSE;
}
if (((mod & MOD_MOD5) && !(x_mod & Mod5Mask)) || (!(mod & MOD_MOD5) && (x_mod & Mod5Mask) && !(Mod5Mask & m))) {
return FALSE;
}
}
D_ACTIONS(("Modifier match confirmed.\n"));
return TRUE;
D_ACTIONS(("Modifier match confirmed.\n"));
return TRUE;
}
unsigned char
action_dispatch(event_t *ev, KeySym keysym)
{
action_t *action;
action_t *action;
ASSERT_RVAL(ev != NULL, 0);
ASSERT_RVAL(ev->xany.type == ButtonPress || ev->xany.type == KeyPress, 0);
D_ACTIONS(("Event %8p: Button %d, Keysym 0x%08x, Key State 0x%08x (modifiers " MOD_FMT ")\n",
ev, ev->xbutton.button, keysym, ev->xkey.state, SHOW_X_MODS(ev->xkey.state)));
for (action = action_list; action; action = action->next) {
/* The very first thing we do is match the event type to the type
of the current action. This means that we'll only run through
the modifier checks below if we absolutely have to. */
if ((ev->xany.type == ButtonPress && action_check_button(action->button, ev->xbutton.button))
|| (ev->xany.type == KeyPress && action_check_keysym(action->keysym, keysym))) {
if (action_check_modifiers(action->mod, ev->xkey.state)) {
D_ACTIONS(("Match found.\n"));
/* If we've passed all the above tests, it's a match. Dispatch the handler. */
return ((action->handler)(ev, action));
}
ASSERT_RVAL(ev != NULL, 0);
ASSERT_RVAL(ev->xany.type == ButtonPress || ev->xany.type == KeyPress, 0);
D_ACTIONS(("Event %8p: Button %d, Keysym 0x%08x, Key State 0x%08x (modifiers " MOD_FMT ")\n",
ev, ev->xbutton.button, keysym, ev->xkey.state, SHOW_X_MODS(ev->xkey.state)));
for (action = action_list; action; action = action->next) {
/* The very first thing we do is match the event type to the type
of the current action. This means that we'll only run through
the modifier checks below if we absolutely have to. */
if ((ev->xany.type == ButtonPress && action_check_button(action->button, ev->xbutton.button))
|| (ev->xany.type == KeyPress && action_check_keysym(action->keysym, keysym))) {
if (action_check_modifiers(action->mod, ev->xkey.state)) {
D_ACTIONS(("Match found.\n"));
/* If we've passed all the above tests, it's a match. Dispatch the handler. */
return ((action->handler) (ev, action));
}
}
}
}
return (0);
return (0);
}
void
action_add(unsigned short mod, unsigned char button, KeySym keysym, action_type_t type, void *param) {
action_add(unsigned short mod, unsigned char button, KeySym keysym, action_type_t type, void *param)
{
action_t *action;
action_t *action;
if (!action_list || (action = action_find_match(mod, button, keysym)) == NULL) {
action = (action_t *) MALLOC(sizeof(action_t));
action->next = action_list;
action_list = action;
} else {
if (action->type == ACTION_STRING || action->type == ACTION_ECHO || action->type == ACTION_SCRIPT) {
if (action->param.string) {
FREE(action->param.string);
}
if (!action_list || (action = action_find_match(mod, button, keysym)) == NULL) {
action = (action_t *) MALLOC(sizeof(action_t));
action->next = action_list;
action_list = action;
} else {
if (action->type == ACTION_STRING || action->type == ACTION_ECHO || action->type == ACTION_SCRIPT) {
if (action->param.string) {
FREE(action->param.string);
}
}
}
}
action->mod = mod;
action->button = button;
action->type = type;
action->keysym = keysym;
switch(type) {
case ACTION_STRING:
action->handler = (action_handler_t) action_handle_string;
action->param.string = (char *) MALLOC(strlen((char *) param) + 2);
strcpy(action->param.string, (char *) param);
parse_escaped_string(action->param.string);
break;
case ACTION_ECHO:
action->handler = (action_handler_t) action_handle_echo;
action->param.string = (char *) MALLOC(strlen((char *) param) + 2);
strcpy(action->param.string, (char *) param);
parse_escaped_string(action->param.string);
break;
case ACTION_SCRIPT:
action->handler = (action_handler_t) action_handle_script;
action->param.script = (char *) MALLOC(strlen((char *) param) + 2);
strcpy(action->param.script, (char *) param);
break;
case ACTION_MENU:
action->handler = (action_handler_t) action_handle_menu;
action->param.menu = (menu_t *) param;
break;
default:
break;
}
D_ACTIONS(("Added action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button, action->keysym));
action->mod = mod;
action->button = button;
action->type = type;
action->keysym = keysym;
switch (type) {
case ACTION_STRING:
action->handler = (action_handler_t) action_handle_string;
action->param.string = (char *) MALLOC(strlen((char *) param) + 2);
strcpy(action->param.string, (char *) param);
parse_escaped_string(action->param.string);
break;
case ACTION_ECHO:
action->handler = (action_handler_t) action_handle_echo;
action->param.string = (char *) MALLOC(strlen((char *) param) + 2);
strcpy(action->param.string, (char *) param);
parse_escaped_string(action->param.string);
break;
case ACTION_SCRIPT:
action->handler = (action_handler_t) action_handle_script;
action->param.script = (char *) MALLOC(strlen((char *) param) + 2);
strcpy(action->param.script, (char *) param);
break;
case ACTION_MENU:
action->handler = (action_handler_t) action_handle_menu;
action->param.menu = (menu_t *) param;
break;
default:
break;
}
D_ACTIONS(("Added action. mod == 0x%08x, button == %d, keysym == 0x%08x\n", action->mod, action->button, action->keysym));
}

@ -67,8 +67,7 @@ draw_string(buttonbar_t *bbar, Drawable d, GC gc, int x, int y, char *str, size_
return;
}
buttonbar_t *
bbar_create(void)
buttonbar_t *bbar_create(void)
{
buttonbar_t *bbar;
Cursor cursor;
@ -185,7 +184,8 @@ bbar_handle_enter_notify(event_t *ev)
return 0;
}
bbar_draw(bbar, IMAGE_STATE_SELECTED, 0);
XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y),
&unused_mask);
b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y);
if (b) {
bbar_select_button(bbar, b);
@ -248,7 +248,8 @@ bbar_handle_button_release(event_t *ev)
return 0;
}
XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask);
XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y),
&unused_mask);
b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y);
if (b) {
@ -280,7 +281,8 @@ bbar_handle_motion_notify(event_t *ev)
return 0;
}
while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, MotionNotify, ev));
XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &mask);
XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y),
&mask);
D_BBAR((" -> Pointer is at %d, %d with mask 0x%08x\n", ev->xbutton.x, ev->xbutton.y, mask));
b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y);
@ -309,8 +311,7 @@ bbar_dispatch_event(event_t *ev)
return (0);
}
buttonbar_t *
find_bbar_by_window(Window win)
buttonbar_t *find_bbar_by_window(Window win)
{
buttonbar_t *bbar;
@ -494,7 +495,8 @@ button_calc_size(buttonbar_t *bbar, button_t *button)
D_BBAR((" -> Final icon dimensions are %hux%hu\n", button->icon_w, button->icon_h));
}
#endif
D_BBAR((" -> Set button to %dx%d at %d, %d and icon to %dx%d\n", button->w, button->h, button->x, button->y, button->icon_w, button->icon_h));
D_BBAR((" -> Set button to %dx%d at %d, %d and icon to %dx%d\n", button->w, button->h, button->x, button->y, button->icon_w,
button->icon_h));
}
void
@ -542,7 +544,7 @@ bbar_add_button(buttonbar_t *bbar, button_t *button)
D_BBAR(("bbar_add_button(%8p, %8p): Adding button \"%s\".\n", bbar, button, button->text));
if (bbar->buttons) {
if (bbar->buttons) {
for (b = bbar->buttons; b->next; b = b->next);
b->next = button;
} else {
@ -570,7 +572,8 @@ bbar_set_font(buttonbar_t *bbar, const char *fontname)
ASSERT_RVAL(fontname != NULL, 0);
D_BBAR(("bbar_set_font(%8p, \"%s\"): Current font is %8p, dimensions %d/%d/%d\n", bbar, fontname, bbar->font, bbar->fwidth, bbar->fheight, bbar->h));
D_BBAR(("bbar_set_font(%8p, \"%s\"): Current font is %8p, dimensions %d/%d/%d\n", bbar, fontname, bbar->font, bbar->fwidth,
bbar->fheight, bbar->h));
if (bbar->font) {
free_font(bbar->font);
}
@ -595,8 +598,7 @@ bbar_set_font(buttonbar_t *bbar, const char *fontname)
return 1;
}
button_t *
find_button_by_text(buttonbar_t *bbar, char *text)
button_t *find_button_by_text(buttonbar_t *bbar, char *text)
{
register button_t *b;
@ -615,8 +617,7 @@ find_button_by_text(buttonbar_t *bbar, char *text)
return NULL;
}
button_t *
find_button_by_coords(buttonbar_t *bbar, int x, int y)
button_t *find_button_by_coords(buttonbar_t *bbar, int x, int y)
{
register button_t *b;
@ -635,8 +636,7 @@ find_button_by_coords(buttonbar_t *bbar, int x, int y)
return NULL;
}
button_t *
button_create(char *text)
button_t *button_create(char *text)
{
button_t *button;
@ -688,21 +688,21 @@ button_set_action(button_t *button, action_type_t type, char *action)
button->type = type;
switch (type) {
case ACTION_MENU:
button->action.menu = find_menu_by_title(menu_list, action);
break;
case ACTION_STRING:
case ACTION_ECHO:
button->action.string = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.string, action);
parse_escaped_string(button->action.string);
break;
case ACTION_SCRIPT:
button->action.script = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.script, action);
break;
default:
break;
case ACTION_MENU:
button->action.menu = find_menu_by_title(menu_list, action);
break;
case ACTION_STRING:
case ACTION_ECHO:
button->action.string = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.string, action);
parse_escaped_string(button->action.string);
break;
case ACTION_SCRIPT:
button->action.script = (char *) MALLOC(strlen(action) + 2);
strcpy(button->action.script, action);
break;
default:
break;
}
return 1;
}
@ -749,7 +749,8 @@ bbar_click_button(buttonbar_t *bbar, button_t *button)
if (image_mode_is(image_button, MODE_MASK)) {
paste_simage(images[image_button].clicked, image_button, bbar->win, bbar->win, button->x, button->y, button->w, button->h);
} else {
draw_shadow_from_colors(bbar->win, PixColors[menuBottomShadowColor], PixColors[menuTopShadowColor], button->x, button->y, button->w, button->h, 2);
draw_shadow_from_colors(bbar->win, PixColors[menuBottomShadowColor], PixColors[menuTopShadowColor], button->x, button->y, button->w,
button->h, 2);
}
if (image_mode_is(image_button, MODE_AUTO)) {
enl_ipc_sync();
@ -768,28 +769,28 @@ void
button_check_action(buttonbar_t *bbar, button_t *button, unsigned char press, Time t)
{
switch (button->type) {
case ACTION_MENU:
if (press) {
menu_invoke(button->x, button->y + button->h, bbar->win, button->action.menu, t);
}
break;
case ACTION_STRING:
if (!press) {
cmd_write((unsigned char *) button->action.string, strlen(button->action.string));
}
break;
case ACTION_ECHO:
if (!press) {
tt_write((unsigned char *) button->action.string, strlen(button->action.string));
}
break;
case ACTION_SCRIPT:
if (!press) {
script_parse((char *) button->action.script);
}
break;
default:
break;
case ACTION_MENU:
if (press) {
menu_invoke(button->x, button->y + button->h, bbar->win, button->action.menu, t);
}
break;
case ACTION_STRING:
if (!press) {
cmd_write((unsigned char *) button->action.string, strlen(button->action.string));
}
break;
case ACTION_ECHO:
if (!press) {
tt_write((unsigned char *) button->action.string, strlen(button->action.string));
}
break;
case ACTION_SCRIPT:
if (!press) {
script_parse((char *) button->action.script);
}
break;
default:
break;
}
}
@ -898,7 +899,19 @@ bbar_draw(buttonbar_t *bbar, unsigned char image_state, unsigned char force_mode
paste_simage(button->icon, image_max, bbar->win, bbar->bg, button->icon_x, button->icon_y, button->icon_w, button->icon_h);
}
if (button->len) {
draw_string(bbar, bbar->bg, bbar->gc, button->text_x, button->text_y, button->text, button->len);
#ifdef ESCREEN
GC gc; /* evil temporary hack */
XGCValues gcvalue;
gcvalue.foreground = PixColors[button->flags + 2];
gcvalue.font = bbar->font->fid;
if (button->flags && (gc = LIBAST_X_CREATE_GC(GCForeground | GCFont, &gcvalue))) {
draw_string(bbar, bbar->bg, gc, button->text_x, button->text_y, button->text, button->len);
XFreeGC(Xdisplay, gc);
} else
#endif
draw_string(bbar, bbar->bg, bbar->gc, button->text_x, button->text_y, button->text, button->len);
}
}
for (button = bbar->rbuttons; button; button = button->next) {
@ -965,8 +978,7 @@ bbar_calc_positions(void)
bbar->y = top_y;
top_y += bbar->h;
}
D_BBAR(("Set coordinates for buttonbar %8p (window 0x%08x) to %lu, %lu\n",
bbar, bbar->win, bbar->x, bbar->y));
D_BBAR(("Set coordinates for buttonbar %8p (window 0x%08x) to %lu, %lu\n", bbar, bbar->win, bbar->x, bbar->y));
if (TermWin.parent != None) {
XReparentWindow(Xdisplay, bbar->win, TermWin.parent, bbar->x, bbar->y);
XMoveResizeWindow(Xdisplay, bbar->win, bbar->x, bbar->y, bbar->w, bbar->h);

@ -70,6 +70,9 @@ typedef struct button_struct {
unsigned short x, y, w, h;
unsigned short text_x, text_y;
unsigned short icon_x, icon_y, icon_w, icon_h;
#ifdef ESCREEN
int flags;
#endif
struct button_struct *next;
} button_t;

File diff suppressed because it is too large Load Diff

@ -23,37 +23,37 @@
*/
const struct name2encoding n2e[] = {
#ifdef MULTI_CHARSET
{ "EUCJP", ENC_EUCJ },
{ "UJIS", ENC_EUCJ },
{ "SHIFTJIS", ENC_SJIS },
{ "SJIS", ENC_SJIS },
{ "EUCKR", ENC_EUCKR },
{ "EUCCN", ENC_GB },
{ "GB2312", ENC_GB },
{ "GB", ENC_GB },
{ "BIG5", ENC_BIG5 },
{ "BIGFIVE", ENC_BIG5 },
{ "BIG5HKSCS", ENC_BIG5 },
{ "UTF8", ENC_UTF8 },
#endif /* MULTI_CHARSET */
{ "KOI8R", ENC_KOI8R },
{ "KOI8U", ENC_KOI8U },
{ "ISO88591", ENC_ISO8859_1 },
{ "ISO88592", ENC_ISO8859_2 },
{ "ISO88593", ENC_ISO8859_3 },
{ "ISO88594", ENC_ISO8859_4 },
{ "ISO88595", ENC_ISO8859_5 },
{ "ISO88596", ENC_ISO8859_6 },
{ "ISO88597", ENC_ISO8859_7 },
{ "ISO88598", ENC_ISO8859_8 },
{ "ISO88599", ENC_ISO8859_9 },
{ "ISO885910", ENC_ISO8859_10 },
{ "ISO885911", ENC_ISO8859_11 },
{ "ISO885912", ENC_ISO8859_12 },
{ "ISO885913", ENC_ISO8859_13 },
{ "ISO885914", ENC_ISO8859_14 },
{ "ISO885915", ENC_ISO8859_15 },
{ NULL, ENC_DUMMY }
{"EUCJP", ENC_EUCJ},
{"UJIS", ENC_EUCJ},
{"SHIFTJIS", ENC_SJIS},
{"SJIS", ENC_SJIS},
{"EUCKR", ENC_EUCKR},
{"EUCCN", ENC_GB},
{"GB2312", ENC_GB},
{"GB", ENC_GB},
{"BIG5", ENC_BIG5},
{"BIGFIVE", ENC_BIG5},
{"BIG5HKSCS", ENC_BIG5},
{"UTF8", ENC_UTF8},
#endif /* MULTI_CHARSET */
{"KOI8R", ENC_KOI8R},
{"KOI8U", ENC_KOI8U},
{"ISO88591", ENC_ISO8859_1},
{"ISO88592", ENC_ISO8859_2},
{"ISO88593", ENC_ISO8859_3},
{"ISO88594", ENC_ISO8859_4},
{"ISO88595", ENC_ISO8859_5},
{"ISO88596", ENC_ISO8859_6},
{"ISO88597", ENC_ISO8859_7},
{"ISO88598", ENC_ISO8859_8},
{"ISO88599", ENC_ISO8859_9},
{"ISO885910", ENC_ISO8859_10},
{"ISO885911", ENC_ISO8859_11},
{"ISO885912", ENC_ISO8859_12},
{"ISO885913", ENC_ISO8859_13},
{"ISO885914", ENC_ISO8859_14},
{"ISO885915", ENC_ISO8859_15},
{NULL, ENC_DUMMY}
};
@ -79,49 +79,49 @@ const struct name2encoding n2e[] = {
*/
const struct name2encoding l2e[] = {
#ifdef MULTI_CHARSET
{ "ja_JP.EUC", ENC_EUCJ },
{ "ja_JP", ENC_EUCJ },
{ "ko_KR.EUC", ENC_EUCKR },
{ "ko_KR", ENC_EUCKR },
{ "zh_CN.EUC", ENC_GB },
{ "zh_CN", ENC_GB },
{ "zh_TW", ENC_BIG5 },
#endif /* MULTI_CHARSET */
{ "da", ENC_ISO8859_1 },
{ "de", ENC_ISO8859_1 },
{ "en", ENC_ISO8859_1 },
{ "fi", ENC_ISO8859_1 },
{ "fr", ENC_ISO8859_1 },
{ "is", ENC_ISO8859_1 },
{ "it", ENC_ISO8859_1 },
{ "la", ENC_ISO8859_1 },
{ "lt", ENC_ISO8859_1 },
{ "nl", ENC_ISO8859_1 },
{ "no", ENC_ISO8859_1 },
{ "pt", ENC_ISO8859_1 },
{ "sv", ENC_ISO8859_1 },
{ "cs", ENC_ISO8859_2 },
{ "hr", ENC_ISO8859_2 },
{ "hu", ENC_ISO8859_2 },
{ "la", ENC_ISO8859_2 },
{ "lt", ENC_ISO8859_2 },
{ "pl", ENC_ISO8859_2 },
{ "ro", ENC_ISO8859_2 },
{ "sk", ENC_ISO8859_2 },
{ "sl", ENC_ISO8859_2 },
{ "ar", ENC_ISO8859_6 },
{ "el", ENC_ISO8859_7 },
{ "tr", ENC_ISO8859_9 },
{ "lt", ENC_ISO8859_13 },
{ "lv", ENC_ISO8859_13 },
{ "mi", ENC_ISO8859_13 },
{ "ru", ENC_KOI8R }, /* ISO8859-5 ? */
{ "uk", ENC_KOI8U },
{"ja_JP.EUC", ENC_EUCJ},
{"ja_JP", ENC_EUCJ},
{"ko_KR.EUC", ENC_EUCKR},
{"ko_KR", ENC_EUCKR},
{"zh_CN.EUC", ENC_GB},
{"zh_CN", ENC_GB},
{"zh_TW", ENC_BIG5},
#endif /* MULTI_CHARSET */
{"da", ENC_ISO8859_1},
{"de", ENC_ISO8859_1},
{"en", ENC_ISO8859_1},
{"fi", ENC_ISO8859_1},
{"fr", ENC_ISO8859_1},
{"is", ENC_ISO8859_1},
{"it", ENC_ISO8859_1},
{"la", ENC_ISO8859_1},
{"lt", ENC_ISO8859_1},
{"nl", ENC_ISO8859_1},
{"no", ENC_ISO8859_1},
{"pt", ENC_ISO8859_1},
{"sv", ENC_ISO8859_1},
{"cs", ENC_ISO8859_2},
{"hr", ENC_ISO8859_2},
{"hu", ENC_ISO8859_2},
{"la", ENC_ISO8859_2},
{"lt", ENC_ISO8859_2},
{"pl", ENC_ISO8859_2},
{"ro", ENC_ISO8859_2},
{"sk", ENC_ISO8859_2},
{"sl", ENC_ISO8859_2},
{"ar", ENC_ISO8859_6},
{"el", ENC_ISO8859_7},
{"tr", ENC_ISO8859_9},
{"lt", ENC_ISO8859_13},
{"lv", ENC_ISO8859_13},
{"mi", ENC_ISO8859_13},
{"ru", ENC_KOI8R}, /* ISO8859-5 ? */
{"uk", ENC_KOI8U},
#if 0
{ "vi", ENC_VISCII },
{ "th", ENC_TIS620 },
{"vi", ENC_VISCII},
{"th", ENC_TIS620},
#endif
{ NULL, ENC_DUMMY }
{NULL, ENC_DUMMY}
};
@ -134,34 +134,34 @@ const struct name2encoding l2e[] = {
*/
const struct defaultfont defaultfont[] = {
#ifdef MULTI_CHARSET
{ ENC_EUCJ, "eucj", DEF_EUCJ, {NFONT_LIST_EUCJ}, {MFONT_LIST_EUCJ} },
{ ENC_SJIS, "sjis", DEF_EUCJ, {NFONT_LIST_EUCJ}, {MFONT_LIST_EUCJ} },
{ ENC_GB, "gb", DEF_GB, {NFONT_LIST_GB}, {MFONT_LIST_GB} },
{ ENC_BIG5, "big5", DEF_BIG5, {NFONT_LIST_BIG5}, {MFONT_LIST_BIG5} },
{ ENC_EUCKR, "euckr",DEF_EUCKR, {NFONT_LIST_EUCKR}, {MFONT_LIST_EUCKR} },
{ ENC_UTF8, "iso-10646",DEF_10646,{NFONT_LIST_10646},{MFONT_LIST_10646} },
#endif /* MULTI_CHARSET */
{ ENC_ISO8859_7,"none",DEF_7, {NFONT_LIST_7}, {MFONT_LIST_NULL} },
{ ENC_KOI8R, "none",DEF_KOI8R, {NFONT_LIST_KOI8R}, {MFONT_LIST_NULL} },
{ ENC_KOI8U, "none",DEF_KOI8U, {NFONT_LIST_KOI8U}, {MFONT_LIST_NULL} },
{ ENC_DUMMY, "none",DEF_DUMMY, {MFONT_LIST_NULL}, {MFONT_LIST_NULL} }
{ENC_EUCJ, "eucj", DEF_EUCJ, {NFONT_LIST_EUCJ}, {MFONT_LIST_EUCJ}},
{ENC_SJIS, "sjis", DEF_EUCJ, {NFONT_LIST_EUCJ}, {MFONT_LIST_EUCJ}},
{ENC_GB, "gb", DEF_GB, {NFONT_LIST_GB}, {MFONT_LIST_GB}},
{ENC_BIG5, "big5", DEF_BIG5, {NFONT_LIST_BIG5}, {MFONT_LIST_BIG5}},
{ENC_EUCKR, "euckr", DEF_EUCKR, {NFONT_LIST_EUCKR}, {MFONT_LIST_EUCKR}},
{ENC_UTF8, "iso-10646", DEF_10646, {NFONT_LIST_10646}, {MFONT_LIST_10646}},
#endif /* MULTI_CHARSET */
{ENC_ISO8859_7, "none", DEF_7, {NFONT_LIST_7}, {MFONT_LIST_NULL}},
{ENC_KOI8R, "none", DEF_KOI8R, {NFONT_LIST_KOI8R}, {MFONT_LIST_NULL}},
{ENC_KOI8U, "none", DEF_KOI8U, {NFONT_LIST_KOI8U}, {MFONT_LIST_NULL}},
{ENC_DUMMY, "none", DEF_DUMMY, {MFONT_LIST_NULL}, {MFONT_LIST_NULL}}
};
/* special common rule for ISO-8859-x */
const char *const defaultfont_8859[] = {
NFONT_LIST_ISO8859X
NFONT_LIST_ISO8859X
};
/* fallback defaults */
const int def_def_idx = DEF_10646;
const char *const def_fonts[] = {
NFONT_LIST_10646
NFONT_LIST_10646
};
#ifdef MULTI_CHARSET
const char *const def_mfonts[] = {
MFONT_LIST_10646
MFONT_LIST_10646
};
#endif
@ -170,120 +170,124 @@ const char *const def_mfonts[] = {
void
eterm_default_font_locale(char ***fonts, char ***mfonts, char **mencoding, int *def_idx)
{
char *locale;
char *encoding_str = NULL;
char encoding_buf[ENCODINGBUFLEN];
char *p, *p2;
enum enc_label encoding = ENC_DUMMY;
int j, k;
locale = setlocale(LC_CTYPE, "");
if (locale == NULL)
if ((locale = getenv("LC_ALL")) == NULL)
if ((locale = getenv("LC_CTYPE")) == NULL)
if ((locale = getenv("LANG")) == NULL)
locale = "C"; /* failsafe */
char *locale;
char *encoding_str = NULL;
char encoding_buf[ENCODINGBUFLEN];
char *p, *p2;
enum enc_label encoding = ENC_DUMMY;
int j, k;
/* Obtain a "normalized" name of current encoding.
* The current encoding is available via nl_langinfo().
* Otherwise, it comes from locale name.
*/
locale = setlocale(LC_CTYPE, "");
if (locale == NULL)
if ((locale = getenv("LC_ALL")) == NULL)
if ((locale = getenv("LC_CTYPE")) == NULL)
if ((locale = getenv("LANG")) == NULL)
locale = "C"; /* failsafe */
/* Obtain a "normalized" name of current encoding.
* The current encoding is available via nl_langinfo().
* Otherwise, it comes from locale name.
*/
#ifdef HAVE_NL_LANGINFO
encoding_str = nl_langinfo(CODESET);
encoding_str = nl_langinfo(CODESET);
#else
encoding_str = NULL;
encoding_str = NULL;
#endif
if (encoding_str && *encoding_str) {
for (j = 0; n2e[j].name; j++) {
if (!strcmp(encoding_str, n2e[j].name)) {
encoding = n2e[j].encoding;
break;
}
if (encoding_str && *encoding_str) {
for (j = 0; n2e[j].name; j++) {
if (!strcmp(encoding_str, n2e[j].name)) {
encoding = n2e[j].encoding;
break;
}
}
}
}
if (encoding == ENC_DUMMY) {
p = strchr(locale, '.');
if (p) {
strncpy(encoding_buf, p + 1, ENCODINGBUFLEN);
p = strchr(encoding_buf, '@');
if (p) *p = 0;
} else {
strncpy(encoding_buf, locale, ENCODINGBUFLEN);
}
encoding_buf[ENCODINGBUFLEN - 1] = 0;
for (p = p2 = encoding_buf; 1; p++, p2++) {
while (*p2 == '_' || *p2 == '-') p2++;
if (!*p2) break;
*p = toupper(*p2);
}
*p = 0;
for (j = 0; n2e[j].name; j++) {
if (!strcmp(encoding_buf, n2e[j].name)) {
encoding = n2e[j].encoding;
break;
}
if (encoding == ENC_DUMMY) {
p = strchr(locale, '.');
if (p) {
strncpy(encoding_buf, p + 1, ENCODINGBUFLEN);
p = strchr(encoding_buf, '@');
if (p)
*p = 0;
} else {
strncpy(encoding_buf, locale, ENCODINGBUFLEN);
}
encoding_buf[ENCODINGBUFLEN - 1] = 0;
for (p = p2 = encoding_buf; 1; p++, p2++) {
while (*p2 == '_' || *p2 == '-')
p2++;
if (!*p2)
break;
*p = toupper(*p2);
}
*p = 0;
for (j = 0; n2e[j].name; j++) {
if (!strcmp(encoding_buf, n2e[j].name)) {
encoding = n2e[j].encoding;
break;
}
}
}
}
/* If the conversion fails, try using "language"/"country"
* part of the locale name.
*/
if (encoding == ENC_DUMMY) {
for (j = 0; l2e[j].name; j++) {
if (!strncmp(locale, l2e[j].name, strlen(l2e[j].name))) {
encoding = l2e[j].encoding;
break;
}
/* If the conversion fails, try using "language"/"country"
* part of the locale name.
*/
if (encoding == ENC_DUMMY) {
for (j = 0; l2e[j].name; j++) {
if (!strncmp(locale, l2e[j].name, strlen(l2e[j].name))) {
encoding = l2e[j].encoding;
break;
}
}
}
}
/* Now, the encoding to be used has been determined.
* Fonts and encoding will be determined according to the encoding.
*/
for (j = 0; defaultfont[j].enc_label != ENC_DUMMY; j++) {
if (encoding == defaultfont[j].enc_label) {
*def_idx = defaultfont[j].def_idx;
/* Now, the encoding to be used has been determined.
* Fonts and encoding will be determined according to the encoding.
*/
for (j = 0; defaultfont[j].enc_label != ENC_DUMMY; j++) {
if (encoding == defaultfont[j].enc_label) {
*def_idx = defaultfont[j].def_idx;
#ifdef MULTI_CHARSET
*mencoding = STRDUP(defaultfont[j].encoding_method);
*mencoding = STRDUP(defaultfont[j].encoding_method);
#endif
for (k = 0; k < NFONTS; k++) {
eterm_font_add(fonts, defaultfont[j].font[k], k);
for (k = 0; k < NFONTS; k++) {
eterm_font_add(fonts, defaultfont[j].font[k], k);
#ifdef MULTI_CHARSET
eterm_font_add(mfonts, defaultfont[j].mfont[k], k);
eterm_font_add(mfonts, defaultfont[j].mfont[k], k);
#endif
}
return;
}
return;
}
}
}
/*
* fallback for unknown encodings. ISO-8559-* gets special treatment
*/
#ifdef MULTI_CHARSET
*mencoding = STRDUP("none");
*mencoding = STRDUP("none");
#endif
if (encoding >= ENC_ISO8859_1 && encoding <= ENC_ISO8859_LAST) {
/* fallback for ISO-8859-* encodings */
k = encoding - ENC_ISO8859_1 + 1;
*def_idx = DEF_8859;
} else {
/* fallback for "C", "POSIX", and invalid locales */
k = 0;
*def_idx = def_def_idx;
}
for (j = 0; j < NFONTS; j++) {
if (k == 0) eterm_font_add(fonts, def_fonts[j], j);
else {
/* couple of wasted bytes each but lots of future expansion */
sprintf(encoding_buf, defaultfont_8859[j], k);
eterm_font_add(fonts, encoding_buf, j);
if (encoding >= ENC_ISO8859_1 && encoding <= ENC_ISO8859_LAST) {
/* fallback for ISO-8859-* encodings */
k = encoding - ENC_ISO8859_1 + 1;