2000-03-08 19:38:31 -08:00
|
|
|
/*
|
2006-01-04 01:22:41 -08:00
|
|
|
* Copyright (C) 1997-2006, Michael Jennings
|
2000-03-08 19:38:31 -08:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
1999-08-17 18:12:47 -07:00
|
|
|
*
|
2000-03-08 19:38:31 -08:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
1999-08-17 18:12:47 -07:00
|
|
|
*
|
2000-03-08 19:38:31 -08:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1999-08-17 18:12:47 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
static const char cvs_ident[] = "$Id$";
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "feature.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <X11/cursorfont.h>
|
|
|
|
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
#include "buttons.h"
|
1999-08-17 18:12:47 -07:00
|
|
|
#include "command.h"
|
|
|
|
#include "e.h"
|
|
|
|
#include "events.h"
|
1999-09-21 19:34:13 -07:00
|
|
|
#include "font.h"
|
1999-10-07 15:18:14 -07:00
|
|
|
#include "startup.h"
|
1999-08-17 18:12:47 -07:00
|
|
|
#include "menus.h"
|
|
|
|
#include "options.h"
|
|
|
|
#include "pixmap.h"
|
|
|
|
#include "screen.h"
|
|
|
|
#include "scrollbar.h"
|
|
|
|
#include "term.h"
|
|
|
|
#include "windows.h"
|
|
|
|
|
|
|
|
XWindowAttributes attr;
|
|
|
|
XSetWindowAttributes Attributes;
|
2002-05-04 07:25:30 -07:00
|
|
|
XSizeHints szHint = {
|
|
|
|
PMinSize | PResizeInc | PBaseSize,
|
|
|
|
0, 0, 80, 24, /* x, y, width, height */
|
|
|
|
1, 1, /* Min width, height */
|
|
|
|
0, 0, /* Max width, height - unused */
|
|
|
|
1, 1, /* increments: width, height */
|
|
|
|
{1, 1}, /* increments: x, y */
|
|
|
|
{0, 0}, /* Aspect ratio - unused */
|
|
|
|
0, 0, /* base size: width, height */
|
|
|
|
NorthWestGravity /* gravity */
|
1999-08-17 18:12:47 -07:00
|
|
|
};
|
2002-05-04 07:25:30 -07:00
|
|
|
Cursor TermWin_cursor; /* cursor for vt window */
|
1999-08-17 18:12:47 -07:00
|
|
|
|
1999-09-20 21:09:53 -07:00
|
|
|
void
|
|
|
|
set_text_property(Window win, char *propname, char *value)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
XTextProperty prop;
|
|
|
|
Atom atom;
|
|
|
|
|
|
|
|
ASSERT(propname != NULL);
|
|
|
|
|
|
|
|
if (value == NULL) {
|
|
|
|
atom = XInternAtom(Xdisplay, propname, True);
|
|
|
|
if (atom == None) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
XDeleteProperty(Xdisplay, win, atom);
|
|
|
|
} else {
|
|
|
|
atom = XInternAtom(Xdisplay, propname, False);
|
|
|
|
prop.value = (unsigned char *) value;
|
|
|
|
prop.encoding = XA_STRING;
|
|
|
|
prop.format = 8;
|
|
|
|
prop.nitems = strlen(value);
|
|
|
|
XSetTextProperty(Xdisplay, win, &prop, atom);
|
|
|
|
}
|
1999-09-20 21:09:53 -07:00
|
|
|
}
|
|
|
|
|
2000-03-28 18:44:41 -08:00
|
|
|
unsigned long
|
|
|
|
get_tint_by_color_name(const char *color)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
XColor wcol, xcol;
|
|
|
|
unsigned long r, g, b, t;
|
|
|
|
|
|
|
|
wcol.pixel = WhitePixel(Xdisplay, Xscreen);
|
|
|
|
XQueryColor(Xdisplay, cmap, &wcol);
|
|
|
|
|
|
|
|
D_PIXMAP(("Tint string is \"%s\", white color is rgbi:%d/%d/%d\n", color, wcol.red, wcol.green, wcol.blue));
|
|
|
|
if (!XParseColor(Xdisplay, cmap, color, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_error("Unable to parse tint color \"%s\". Ignoring.\n", color);
|
2002-05-04 07:25:30 -07:00
|
|
|
return 0xffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
D_PIXMAP(("RGB values for color are %d/%d/%d\n", xcol.red, xcol.green, xcol.blue));
|
|
|
|
if ((wcol.flags & DoRed) && (xcol.flags & DoRed)) {
|
|
|
|
r = (xcol.red << 8) / wcol.red;
|
|
|
|
D_PIXMAP(("Got red == %lu\n", r));
|
|
|
|
if (r >= 0x100)
|
|
|
|
r = 0xff;
|
|
|
|
} else {
|
|
|
|
r = 0xff;
|
|
|
|
}
|
|
|
|
if ((wcol.flags & DoGreen) && (xcol.flags & DoGreen)) {
|
|
|
|
g = (xcol.green << 8) / wcol.green;
|
|
|
|
D_PIXMAP(("Got green == %lu\n", g));
|
|
|
|
if (g >= 0x100)
|
|
|
|
g = 0xff;
|
|
|
|
} else {
|
|
|
|
g = 0xff;
|
|
|
|
}
|
|
|
|
if ((wcol.flags & DoBlue) && (xcol.flags & DoBlue)) {
|
|
|
|
b = (xcol.blue << 8) / wcol.blue;
|
|
|
|
D_PIXMAP(("Got blue == %lu\n", b));
|
|
|
|
if (b >= 0x100)
|
|
|
|
b = 0xff;
|
|
|
|
} else {
|
|
|
|
b = 0xff;
|
|
|
|
}
|
|
|
|
t = (r << 16) | (g << 8) | b;
|
|
|
|
D_PIXMAP(("Final tint is 0x%06x\n", t));
|
|
|
|
return t;
|
2000-03-28 18:44:41 -08:00
|
|
|
}
|
|
|
|
|
1999-08-17 18:12:47 -07:00
|
|
|
Pixel
|
|
|
|
get_bottom_shadow_color(Pixel norm_color, const char *type)
|
|
|
|
{
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
XColor xcol;
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.pixel = norm_color;
|
|
|
|
XQueryColor(Xdisplay, cmap, &xcol);
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.red /= 2;
|
|
|
|
xcol.green /= 2;
|
|
|
|
xcol.blue /= 2;
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
|
2005-04-18 18:57:24 -07:00
|
|
|
xcol.green, xcol.blue);
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.pixel = PixColors[minColor];
|
|
|
|
}
|
|
|
|
return (xcol.pixel);
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Pixel
|
|
|
|
get_top_shadow_color(Pixel norm_color, const char *type)
|
|
|
|
{
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
XColor xcol, white;
|
1999-08-17 18:12:47 -07:00
|
|
|
|
|
|
|
# ifdef PREFER_24BIT
|
2002-05-04 07:25:30 -07:00
|
|
|
white.red = white.green = white.blue = r = g = b = ~0;
|
|
|
|
XAllocColor(Xdisplay, cmap, &white);
|
1999-08-17 18:12:47 -07:00
|
|
|
# else
|
2002-05-04 07:25:30 -07:00
|
|
|
white.pixel = WhitePixel(Xdisplay, Xscreen);
|
|
|
|
XQueryColor(Xdisplay, cmap, &white);
|
1999-08-17 18:12:47 -07:00
|
|
|
# endif
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.pixel = norm_color;
|
|
|
|
XQueryColor(Xdisplay, cmap, &xcol);
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.red = MAX((white.red / 5), xcol.red);
|
|
|
|
xcol.green = MAX((white.green / 5), xcol.green);
|
|
|
|
xcol.blue = MAX((white.blue / 5), xcol.blue);
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.red = MIN(white.red, (xcol.red * 7) / 5);
|
|
|
|
xcol.green = MIN(white.green, (xcol.green * 7) / 5);
|
|
|
|
xcol.blue = MIN(white.blue, (xcol.blue * 7) / 5);
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red,
|
2005-04-18 18:57:24 -07:00
|
|
|
xcol.green, xcol.blue);
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.pixel = PixColors[WhiteColor];
|
|
|
|
}
|
|
|
|
return (xcol.pixel);
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
Pixel
|
|
|
|
get_color_by_name(const char *name, const char *fallback)
|
1999-08-17 18:12:47 -07:00
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
XColor xcol;
|
|
|
|
|
|
|
|
if (name == NULL) {
|
|
|
|
if (fallback == NULL) {
|
|
|
|
return ((Pixel) - 1);
|
|
|
|
} else {
|
|
|
|
name = fallback;
|
|
|
|
}
|
|
|
|
} else if (isdigit(*name)) {
|
|
|
|
unsigned long c;
|
|
|
|
|
|
|
|
c = strtoul(name, (char **) NULL, 0);
|
|
|
|
if (c <= 15) {
|
|
|
|
name = rs_color[c + minColor];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!XParseColor(Xdisplay, cmap, name, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to resolve \"%s\" as a color name. Falling back on \"%s\".\n", name, NONULL(fallback));
|
2002-05-04 07:25:30 -07:00
|
|
|
name = fallback;
|
|
|
|
if (name) {
|
|
|
|
if (!XParseColor(Xdisplay, cmap, name, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning
|
2005-04-18 18:57:24 -07:00
|
|
|
("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.\n",
|
|
|
|
name);
|
2002-05-04 07:25:30 -07:00
|
|
|
return ((Pixel) - 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return ((Pixel) - 1);
|
|
|
|
}
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on \"%s\".\n",
|
2002-05-04 07:25:30 -07:00
|
|
|
name, xcol.pixel, xcol.red, xcol.green, xcol.blue, NONULL(fallback));
|
|
|
|
name = fallback;
|
|
|
|
if (name) {
|
|
|
|
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel,
|
2005-04-18 18:57:24 -07:00
|
|
|
xcol.red, xcol.green, xcol.blue);
|
2002-05-04 07:25:30 -07:00
|
|
|
return ((Pixel) - 1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return ((Pixel) - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (xcol.pixel);
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Pixel
|
|
|
|
get_color_by_pixel(Pixel pixel, Pixel fallback)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
XColor xcol;
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.pixel = pixel;
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
if (!XQueryColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to convert pixel value 0x%08x to an XColor structure. Falling back on 0x%08x.\n", pixel, fallback);
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.pixel = fallback;
|
|
|
|
if (!XQueryColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to convert pixel value 0x%08x to an XColor structure.\n", xcol.pixel);
|
2002-05-04 07:25:30 -07:00
|
|
|
return ((Pixel) 0);
|
|
|
|
}
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
}
|
|
|
|
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel,
|
2005-04-18 18:57:24 -07:00
|
|
|
xcol.red, xcol.green, xcol.blue, fallback);
|
2002-05-04 07:25:30 -07:00
|
|
|
xcol.pixel = fallback;
|
|
|
|
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red,
|
2005-04-18 18:57:24 -07:00
|
|
|
xcol.green, xcol.blue);
|
2002-05-04 07:25:30 -07:00
|
|
|
return ((Pixel) 0);
|
|
|
|
}
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
return (xcol.pixel);
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
process_colors(void)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
int i;
|
|
|
|
Pixel pixel;
|
|
|
|
|
|
|
|
for (i = 0; i < NRS_COLORS; i++) {
|
2005-04-18 18:57:24 -07:00
|
|
|
D_COLORS(("Adding color %d of %d (%s)\n", i, NRS_COLORS, def_colorName[i]));
|
2002-10-22 20:03:27 -07:00
|
|
|
if ((Xdepth <= 2) || ((pixel = get_color_by_name(rs_color[i], def_colorName[i])) == (Pixel) (-1))) {
|
2002-05-04 07:25:30 -07:00
|
|
|
switch (i) {
|
2005-04-18 18:57:24 -07:00
|
|
|
case fgColor:
|
|
|
|
pixel = WhitePixel(Xdisplay, Xscreen);
|
|
|
|
break;
|
|
|
|
case bgColor:
|
|
|
|
pixel = BlackPixel(Xdisplay, Xscreen);
|
|
|
|
break;
|
1999-08-17 18:12:47 -07:00
|
|
|
#ifndef NO_CURSORCOLOR
|
2005-04-18 18:57:24 -07:00
|
|
|
case cursorColor:
|
|
|
|
pixel = PixColors[bgColor];
|
|
|
|
break;
|
|
|
|
case cursorColor2:
|
|
|
|
pixel = PixColors[fgColor];
|
|
|
|
break;
|
1999-08-17 18:12:47 -07:00
|
|
|
#endif /* NO_CURSORCOLOR */
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
#ifndef NO_BOLDUNDERLINE
|
2005-04-18 18:57:24 -07:00
|
|
|
case colorBD:
|
|
|
|
pixel = PixColors[fgColor];
|
|
|
|
break;
|
|
|
|
case colorUL:
|
|
|
|
pixel = PixColors[fgColor];
|
|
|
|
break;
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
#endif
|
2002-10-22 20:03:27 -07:00
|
|
|
#ifdef ESCREEN
|
2005-04-18 18:57:24 -07:00
|
|
|
case ES_COLOR_CURRENT:
|
|
|
|
pixel = PixColors[YellowColor];
|
|
|
|
break;
|
|
|
|
case ES_COLOR_ACTIVE:
|
|
|
|
pixel = PixColors[BlueColor];
|
|
|
|
break;
|
2002-10-22 20:03:27 -07:00
|
|
|
#endif
|
2005-04-18 18:57:24 -07:00
|
|
|
case pointerColor:
|
|
|
|
pixel = PixColors[fgColor];
|
|
|
|
break;
|
|
|
|
case borderColor:
|
|
|
|
pixel = PixColors[bgColor];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
pixel = PixColors[fgColor]; /* None */
|
|
|
|
break;
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
|
|
|
}
|
2005-04-18 18:57:24 -07:00
|
|
|
D_COLORS(("Pixel : %x\n", pixel));
|
2002-05-04 07:25:30 -07:00
|
|
|
PixColors[i] = pixel;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Xdepth <= 2) { /* Monochrome */
|
|
|
|
PixColors[topShadowColor] = PixColors[fgColor];
|
|
|
|
PixColors[bottomShadowColor] = PixColors[fgColor];
|
|
|
|
PixColors[unfocusedTopShadowColor] = PixColors[fgColor];
|
|
|
|
PixColors[unfocusedBottomShadowColor] = PixColors[fgColor];
|
|
|
|
|
|
|
|
PixColors[menuTopShadowColor] = PixColors[fgColor];
|
|
|
|
PixColors[menuBottomShadowColor] = PixColors[fgColor];
|
|
|
|
PixColors[unfocusedMenuTopShadowColor] = PixColors[fgColor];
|
|
|
|
PixColors[unfocusedMenuBottomShadowColor] = PixColors[fgColor];
|
|
|
|
} else {
|
|
|
|
PixColors[bottomShadowColor] = get_bottom_shadow_color(images[image_sb].norm->bg, "bottomShadowColor");
|
2005-04-18 18:57:24 -07:00
|
|
|
PixColors[unfocusedBottomShadowColor] =
|
|
|
|
get_bottom_shadow_color(images[image_sb].disabled->bg, "unfocusedBottomShadowColor");
|
2002-05-04 07:25:30 -07:00
|
|
|
PixColors[topShadowColor] = get_top_shadow_color(images[image_sb].norm->bg, "topShadowColor");
|
|
|
|
PixColors[unfocusedTopShadowColor] = get_top_shadow_color(images[image_sb].disabled->bg, "unfocusedTopShadowColor");
|
|
|
|
|
|
|
|
PixColors[menuBottomShadowColor] = get_bottom_shadow_color(images[image_menu].norm->bg, "menuBottomShadowColor");
|
2005-04-18 18:57:24 -07:00
|
|
|
PixColors[unfocusedMenuBottomShadowColor] =
|
|
|
|
get_bottom_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuBottomShadowColor");
|
2002-05-04 07:25:30 -07:00
|
|
|
PixColors[menuTopShadowColor] = get_top_shadow_color(images[image_menu].norm->bg, "menuTopShadowColor");
|
2005-04-18 18:57:24 -07:00
|
|
|
PixColors[unfocusedMenuTopShadowColor] =
|
|
|
|
get_top_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuTopShadowColor");
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
|
|
|
stored_palette(SAVE);
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
}
|
1999-08-17 18:12:47 -07:00
|
|
|
|
Sun Mar 2 23:40:39 2003 Michael Jennings (mej)
Fixed a bug with foreground/background color change pointed out by
Thomas <arnognul@tiscali.se>.
Also added support for all the other OSC color change sequences (at
least those for the colors that Eterm uses). The sequences are of
the form "\e];n;color[;color[...]]\a", where n is between 10 and 19.
You can specify up to (20 - n) semicolon-separated colors representing
the following attributes in order: foreground, background, cursor,
mouse pointer, mouse pointer background (*), Tek foreground (*), Tek
background (*), highlight color (*), bold color, and underline color.
Attributes marked with a (*) are ignored by Eterm and may be left
empty, but their trailing semicolons must be present for xterm
compatibility.
For example, to set a white foreground, black background, yellow text
cursor, green mouse cursor, #ffaa00 for bold, and cyan for underline,
you could use either of the following:
echo -e "\e]10;white;black;yellow;green;;;;;#ffaa00;cyan\007"
or
echo -e "\e]10;white\007"
echo -e "\e]11;black\007"
echo -e "\e]12;yellow\007"
echo -e "\e]13;green\007"
echo -e "\e]18;#ffaa00\007"
echo -e "\e]19;cyan\007"
Note that the setting of bold and underline colors using 18 and 19 are
Eterm extensions.
SVN revision: 6739
2003-03-02 20:53:35 -08:00
|
|
|
void
|
|
|
|
set_pointer_colors(const char *fg_name, const char *bg_name)
|
|
|
|
{
|
|
|
|
XColor fg, bg;
|
|
|
|
|
|
|
|
if (fg_name != NULL) {
|
|
|
|
fg.pixel = get_color_by_name(fg_name, COLOR_NAME(pointerColor));
|
|
|
|
} else {
|
|
|
|
fg.pixel = PixColors[pointerColor];
|
|
|
|
}
|
|
|
|
XQueryColor(Xdisplay, cmap, &fg);
|
|
|
|
if (bg_name != NULL) {
|
|
|
|
bg.pixel = get_color_by_name(bg_name, COLOR_NAME(bgColor));
|
|
|
|
} else {
|
|
|
|
bg.pixel = PixColors[bgColor];
|
|
|
|
}
|
|
|
|
XQueryColor(Xdisplay, cmap, &bg);
|
|
|
|
XRecolorCursor(Xdisplay, TermWin_cursor, &fg, &bg);
|
|
|
|
}
|
|
|
|
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
/* Create_Windows() - Open and map the window */
|
|
|
|
void
|
|
|
|
Create_Windows(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
Cursor cursor;
|
|
|
|
XClassHint classHint;
|
|
|
|
XWMHints wmHint;
|
|
|
|
Atom prop = None;
|
|
|
|
CARD32 val;
|
|
|
|
int x = 0, y = 0, flags;
|
|
|
|
unsigned int width = 0, height = 0;
|
|
|
|
MWMHints mwmhints;
|
|
|
|
|
2003-08-24 08:09:32 -07:00
|
|
|
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_BORDERLESS)) {
|
2002-05-04 07:25:30 -07:00
|
|
|
prop = XInternAtom(Xdisplay, "_MOTIF_WM_INFO", True);
|
|
|
|
if (prop == None) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");
|
2002-05-04 07:25:30 -07:00
|
|
|
Attributes.override_redirect = TRUE;
|
|
|
|
mwmhints.flags = 0;
|
|
|
|
} else {
|
|
|
|
mwmhints.flags = MWM_HINTS_DECORATIONS;
|
|
|
|
mwmhints.decorations = 0;
|
|
|
|
}
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
} else {
|
2002-05-04 07:25:30 -07:00
|
|
|
mwmhints.flags = 0;
|
|
|
|
}
|
|
|
|
Attributes.colormap = cmap;
|
|
|
|
|
2004-12-14 15:24:33 -08:00
|
|
|
szHint.base_width = (2 * TermWin.internalBorder + ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR))
|
|
|
|
? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0));
|
2002-05-04 07:25:30 -07:00
|
|
|
szHint.base_height = (2 * TermWin.internalBorder) + bbar_calc_docked_height(BBAR_DOCKED);
|
|
|
|
|
|
|
|
flags = (rs_geometry ? XParseGeometry(rs_geometry, &x, &y, &width, &height) : 0);
|
|
|
|
D_X11(("XParseGeometry(geom, %d, %d, %d, %d)\n", x, y, width, height));
|
|
|
|
|
|
|
|
if (flags & WidthValue) {
|
|
|
|
szHint.width = width;
|
|
|
|
szHint.flags |= USSize;
|
|
|
|
}
|
|
|
|
if (flags & HeightValue) {
|
|
|
|
szHint.height = height;
|
|
|
|
szHint.flags |= USSize;
|
|
|
|
}
|
2002-10-07 19:18:09 -07:00
|
|
|
TERM_WINDOW_SET_COLS(szHint.width);
|
|
|
|
TERM_WINDOW_SET_ROWS(szHint.height);
|
2002-05-04 07:25:30 -07:00
|
|
|
|
|
|
|
change_font(1, NULL);
|
|
|
|
|
|
|
|
if (flags & XValue) {
|
|
|
|
if (flags & XNegative) {
|
|
|
|
x += (DisplayWidth(Xdisplay, Xscreen) - (szHint.width + TermWin.internalBorder));
|
|
|
|
}
|
|
|
|
szHint.x = x;
|
|
|
|
szHint.flags |= USPosition;
|
|
|
|
}
|
|
|
|
if (flags & YValue) {
|
|
|
|
if (flags & YNegative) {
|
|
|
|
y += (DisplayHeight(Xdisplay, Xscreen) - (szHint.height + TermWin.internalBorder));
|
|
|
|
}
|
|
|
|
szHint.y = y;
|
|
|
|
szHint.flags |= USPosition;
|
|
|
|
}
|
|
|
|
if (flags) {
|
|
|
|
D_X11(("Geometry values after parsing: %dx%d%+d%+d\n", width, height, x, y));
|
|
|
|
}
|
|
|
|
|
|
|
|
Attributes.background_pixel = PixColors[bgColor];
|
|
|
|
Attributes.border_pixel = PixColors[bgColor];
|
|
|
|
D_X11(("Size Hints: x %d, y %d. Width/Height: Base %dx%d, Minimum %dx%d, Current %dx%d, Increment %dx%d\n",
|
2005-04-18 18:57:24 -07:00
|
|
|
szHint.x, szHint.y, szHint.base_width, szHint.base_height, szHint.min_width, szHint.min_height, szHint.width,
|
|
|
|
szHint.height, szHint.width_inc, szHint.height_inc));
|
2002-05-04 07:25:30 -07:00
|
|
|
TermWin.parent = XCreateWindow(Xdisplay, Xroot, szHint.x, szHint.y, szHint.width, szHint.height, 0, Xdepth, InputOutput,
|
1999-08-17 18:12:47 -07:00
|
|
|
#ifdef PREFER_24BIT
|
2002-05-04 07:25:30 -07:00
|
|
|
Xvisual,
|
1999-08-17 18:12:47 -07:00
|
|
|
#else
|
2002-05-04 07:25:30 -07:00
|
|
|
CopyFromParent,
|
1999-08-17 18:12:47 -07:00
|
|
|
#endif
|
2002-05-04 07:25:30 -07:00
|
|
|
CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect, &Attributes);
|
|
|
|
|
Sun Mar 2 23:40:39 2003 Michael Jennings (mej)
Fixed a bug with foreground/background color change pointed out by
Thomas <arnognul@tiscali.se>.
Also added support for all the other OSC color change sequences (at
least those for the colors that Eterm uses). The sequences are of
the form "\e];n;color[;color[...]]\a", where n is between 10 and 19.
You can specify up to (20 - n) semicolon-separated colors representing
the following attributes in order: foreground, background, cursor,
mouse pointer, mouse pointer background (*), Tek foreground (*), Tek
background (*), highlight color (*), bold color, and underline color.
Attributes marked with a (*) are ignored by Eterm and may be left
empty, but their trailing semicolons must be present for xterm
compatibility.
For example, to set a white foreground, black background, yellow text
cursor, green mouse cursor, #ffaa00 for bold, and cyan for underline,
you could use either of the following:
echo -e "\e]10;white;black;yellow;green;;;;;#ffaa00;cyan\007"
or
echo -e "\e]10;white\007"
echo -e "\e]11;black\007"
echo -e "\e]12;yellow\007"
echo -e "\e]13;green\007"
echo -e "\e]18;#ffaa00\007"
echo -e "\e]19;cyan\007"
Note that the setting of bold and underline colors using 18 and 19 are
Eterm extensions.
SVN revision: 6739
2003-03-02 20:53:35 -08:00
|
|
|
xterm_seq(ESCSEQ_XTERM_TITLE, rs_title);
|
|
|
|
xterm_seq(ESCSEQ_XTERM_ICONNAME, rs_iconName);
|
2002-05-04 07:25:30 -07:00
|
|
|
classHint.res_name = (char *) rs_name;
|
|
|
|
classHint.res_class = APL_NAME;
|
|
|
|
wmHint.window_group = TermWin.parent;
|
2003-08-24 08:09:32 -07:00
|
|
|
wmHint.input = ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_INPUT)) ? False : True);
|
|
|
|
wmHint.initial_state = (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_ICONIC) ? IconicState : NormalState);
|
2002-05-04 07:25:30 -07:00
|
|
|
wmHint.window_group = TermWin.parent;
|
|
|
|
wmHint.flags = (InputHint | StateHint | WindowGroupHint);
|
1999-08-17 18:12:47 -07:00
|
|
|
#ifdef PIXMAP_SUPPORT
|
2002-05-04 07:25:30 -07:00
|
|
|
set_icon_pixmap(rs_icon, &wmHint);
|
1999-08-17 18:12:47 -07:00
|
|
|
#endif
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
XSetWMProperties(Xdisplay, TermWin.parent, NULL, NULL, argv, argc, &szHint, &wmHint, &classHint);
|
|
|
|
XSelectInput(Xdisplay, Xroot, PropertyChangeMask);
|
2005-04-18 18:57:24 -07:00
|
|
|
XSelectInput(Xdisplay, TermWin.parent,
|
|
|
|
(KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask | PropertyChangeMask));
|
2002-05-04 07:25:30 -07:00
|
|
|
if (mwmhints.flags) {
|
|
|
|
prop = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", False);
|
2004-12-14 15:24:33 -08:00
|
|
|
XChangeProperty(Xdisplay, TermWin.parent, prop, prop, 32,
|
|
|
|
PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS);
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
2004-12-14 15:24:33 -08:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
/* vt cursor: Black-on-White is standard, but this is more popular */
|
|
|
|
TermWin_cursor = XCreateFontCursor(Xdisplay, XC_xterm);
|
Sun Mar 2 23:40:39 2003 Michael Jennings (mej)
Fixed a bug with foreground/background color change pointed out by
Thomas <arnognul@tiscali.se>.
Also added support for all the other OSC color change sequences (at
least those for the colors that Eterm uses). The sequences are of
the form "\e];n;color[;color[...]]\a", where n is between 10 and 19.
You can specify up to (20 - n) semicolon-separated colors representing
the following attributes in order: foreground, background, cursor,
mouse pointer, mouse pointer background (*), Tek foreground (*), Tek
background (*), highlight color (*), bold color, and underline color.
Attributes marked with a (*) are ignored by Eterm and may be left
empty, but their trailing semicolons must be present for xterm
compatibility.
For example, to set a white foreground, black background, yellow text
cursor, green mouse cursor, #ffaa00 for bold, and cyan for underline,
you could use either of the following:
echo -e "\e]10;white;black;yellow;green;;;;;#ffaa00;cyan\007"
or
echo -e "\e]10;white\007"
echo -e "\e]11;black\007"
echo -e "\e]12;yellow\007"
echo -e "\e]13;green\007"
echo -e "\e]18;#ffaa00\007"
echo -e "\e]19;cyan\007"
Note that the setting of bold and underline colors using 18 and 19 are
Eterm extensions.
SVN revision: 6739
2003-03-02 20:53:35 -08:00
|
|
|
set_pointer_colors(NULL, NULL);
|
2002-05-04 07:25:30 -07:00
|
|
|
|
|
|
|
/* cursor (menu/scrollbar): Black-on-White */
|
|
|
|
cursor = XCreateFontCursor(Xdisplay, XC_left_ptr);
|
|
|
|
|
|
|
|
/* the vt window */
|
2004-12-14 15:24:33 -08:00
|
|
|
TermWin.x = (((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR))
|
|
|
|
&& !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)))
|
|
|
|
? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0);
|
2002-05-04 07:25:30 -07:00
|
|
|
TermWin.y = bbar_calc_docked_height(BBAR_DOCKED_TOP);
|
2004-12-14 15:24:33 -08:00
|
|
|
TermWin.vt = XCreateWindow(Xdisplay, TermWin.parent, TermWin.x, TermWin.y, szHint.width, szHint.height,
|
|
|
|
0, Xdepth, InputOutput, CopyFromParent,
|
2002-06-02 17:24:22 -07:00
|
|
|
CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWColormap, &Attributes);
|
2002-05-04 07:25:30 -07:00
|
|
|
D_X11(("Created terminal window 0x%08x at %dx%d\n", TermWin.vt, TermWin.x, TermWin.y));
|
2003-08-24 08:09:32 -07:00
|
|
|
if (!(background_is_pixmap()) && !(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_BORDERLESS))) {
|
2002-05-04 07:25:30 -07:00
|
|
|
XSetWindowBackground(Xdisplay, TermWin.vt, PixColors[bgColor]);
|
|
|
|
XClearWindow(Xdisplay, TermWin.vt);
|
|
|
|
}
|
|
|
|
XDefineCursor(Xdisplay, TermWin.vt, TermWin_cursor);
|
2005-04-18 18:57:24 -07:00
|
|
|
TermWin.mask =
|
|
|
|
(EnterWindowMask | LeaveWindowMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask |
|
|
|
|
Button2MotionMask | Button3MotionMask);
|
2002-05-04 07:25:30 -07:00
|
|
|
XSelectInput(Xdisplay, TermWin.vt, TermWin.mask);
|
|
|
|
|
|
|
|
/* If the user wants a specific desktop, tell the WM that */
|
|
|
|
if (rs_desktop != -1) {
|
|
|
|
val = rs_desktop;
|
2005-04-18 18:57:24 -07:00
|
|
|
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_DESKTOP], XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);
|
2004-12-14 15:24:33 -08:00
|
|
|
}
|
|
|
|
|
2006-10-30 13:12:12 -08:00
|
|
|
/* Make window sticky if requested */
|
|
|
|
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_STICKY)) {
|
|
|
|
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_STATE], XA_ATOM, 32, PropModeReplace,
|
|
|
|
(unsigned char *) &props[PROP_EWMH_STATE_STICKY], 1);
|
|
|
|
}
|
|
|
|
|
2005-09-15 18:56:01 -07:00
|
|
|
/* Set startup ID property if given by the launching application. */
|
|
|
|
if (getenv("DESKTOP_STARTUP_ID")) {
|
|
|
|
Atom atom;
|
|
|
|
unsigned char *tmp = SPIF_CAST_PTR(uchar) getenv("DESKTOP_STARTUP_ID");
|
|
|
|
|
|
|
|
atom = XInternAtom(Xdisplay, "UTF8_STRING", False);
|
|
|
|
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_STARTUP_ID], atom, 8, PropModeReplace, tmp, strlen(tmp) + 1);
|
|
|
|
unsetenv("DESKTOP_STARTUP_ID");
|
|
|
|
}
|
|
|
|
|
2004-12-14 15:24:33 -08:00
|
|
|
/* Set window opacity if needed. */
|
|
|
|
if ((props[PROP_EWMH_OPACITY] != None) && (rs_opacity != 0xff)) {
|
|
|
|
XChangeProperty(Xdisplay, TermWin.parent, props[PROP_EWMH_OPACITY],
|
2005-04-18 18:57:24 -07:00
|
|
|
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1);
|
2004-12-14 15:24:33 -08:00
|
|
|
XChangeProperty(Xdisplay, TermWin.vt, props[PROP_EWMH_OPACITY],
|
2005-04-18 18:57:24 -07:00
|
|
|
XA_CARDINAL, 32, PropModeReplace, SPIF_CAST_PTR(uchar) & rs_opacity, 1);
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We're done creating our windows. Now let's initialize the event subsystem to handle them. */
|
|
|
|
event_init_subsystem((event_dispatcher_t) process_x_event, (event_dispatcher_init_t) event_init_primary_dispatcher);
|
|
|
|
|
|
|
|
XMapWindow(Xdisplay, TermWin.vt);
|
|
|
|
XMapWindow(Xdisplay, TermWin.parent);
|
1999-11-15 12:33:44 -08:00
|
|
|
XSetWindowBackground(Xdisplay, TermWin.vt, PixColors[bgColor]);
|
2002-05-04 07:25:30 -07:00
|
|
|
|
|
|
|
render_simage(images[image_bg].current, TermWin.vt, TermWin_TotalWidth(), TermWin_TotalHeight(), image_bg, 0);
|
|
|
|
if (image_mode_is(image_bg, MODE_AUTO)) {
|
|
|
|
enl_ipc_sync();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* graphics context for the vt window */
|
|
|
|
{
|
|
|
|
XGCValues gcvalue;
|
|
|
|
|
|
|
|
gcvalue.font = TermWin.font->fid;
|
|
|
|
gcvalue.foreground = PixColors[fgColor];
|
|
|
|
gcvalue.background = PixColors[bgColor];
|
|
|
|
gcvalue.graphics_exposures = 0;
|
|
|
|
TermWin.gc = LIBAST_X_CREATE_GC(GCForeground | GCBackground | GCFont | GCGraphicsExposures, &gcvalue);
|
2005-08-16 07:50:49 -07:00
|
|
|
D_X11(("Created GC 0x%08x for TermWin.gc\n", TermWin.gc));
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
|
|
|
|
2003-08-24 08:09:32 -07:00
|
|
|
if (BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_NO_CURSOR)) {
|
2002-05-04 07:25:30 -07:00
|
|
|
scr_cursor_visible(0);
|
|
|
|
}
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
|
2000-07-10 14:14:56 -07:00
|
|
|
/* resize window keeping one point (determined by window geometry) in place */
|
|
|
|
void
|
|
|
|
resize_parent(unsigned int width, unsigned int height)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
XWindowAttributes attr;
|
|
|
|
|
2003-08-24 08:09:32 -07:00
|
|
|
if (!(BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_RESIZE_GRAVITY)) || !XGetWindowAttributes(Xdisplay, TermWin.parent, &attr)) {
|
2002-05-04 07:25:30 -07:00
|
|
|
XResizeWindow(Xdisplay, TermWin.parent, width, height);
|
|
|
|
} else {
|
|
|
|
Window junkwin;
|
|
|
|
int x, y, scr_w, scr_h;
|
|
|
|
int dx = 0, dy = 0;
|
|
|
|
|
|
|
|
scr_w = WidthOfScreen(attr.screen);
|
|
|
|
scr_h = HeightOfScreen(attr.screen);
|
|
|
|
dx = attr.width - width;
|
|
|
|
dy = attr.height - height;
|
|
|
|
XTranslateCoordinates(Xdisplay, TermWin.parent, attr.root, 0, 0, &x, &y, &junkwin);
|
|
|
|
/* Check position of the center of the window */
|
|
|
|
if (x < (scr_w - attr.width) / 2) {
|
|
|
|
/* left half */
|
|
|
|
dx = 0;
|
|
|
|
} else if (x == (scr_w - attr.width) / 2) {
|
|
|
|
/* exact center */
|
|
|
|
dx /= 2;
|
|
|
|
}
|
|
|
|
if (y < (scr_h - attr.height) / 2) {
|
|
|
|
/* top half */
|
|
|
|
dy = 0;
|
|
|
|
} else if (y == (scr_h - attr.height) / 2) {
|
|
|
|
/* exact center */
|
|
|
|
dy /= 2;
|
|
|
|
}
|
2005-04-18 18:57:24 -07:00
|
|
|
D_X11(("Calling XMoveResizeWindow(Xdisplay, 0x%08x, %d + %d, %d + %d, %d, %d)\n", TermWin.parent, x, dx, y, dy, width,
|
|
|
|
height));
|
2002-05-04 07:25:30 -07:00
|
|
|
XMoveResizeWindow(Xdisplay, TermWin.parent, x + dx, y + dy, width, height);
|
|
|
|
}
|
2000-07-10 14:14:56 -07:00
|
|
|
}
|
|
|
|
|
1999-10-11 11:37:55 -07:00
|
|
|
/* good for toggling 80/132 columns */
|
1999-08-17 18:12:47 -07:00
|
|
|
void
|
1999-10-11 11:37:55 -07:00
|
|
|
set_width(unsigned short width)
|
1999-08-17 18:12:47 -07:00
|
|
|
{
|
2002-10-07 19:18:09 -07:00
|
|
|
unsigned short height = TERM_WINDOW_GET_REPORTED_ROWS();
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-10-07 19:18:09 -07:00
|
|
|
if (width != TERM_WINDOW_GET_REPORTED_COLS()) {
|
2002-05-04 07:25:30 -07:00
|
|
|
width = szHint.base_width + width * TermWin.fwidth;
|
|
|
|
height = szHint.base_height + height * TermWin.fheight;
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
resize_parent(width, height);
|
|
|
|
handle_resize(width, height);
|
|
|
|
}
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-10-11 11:37:55 -07:00
|
|
|
update_size_hints(void)
|
1999-08-17 18:12:47 -07:00
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
D_X11(("Called.\n"));
|
2005-04-18 18:57:24 -07:00
|
|
|
szHint.base_width = (2 * TermWin.internalBorder) + ((scrollbar_is_visible())? (scrollbar_trough_width()) : (0));
|
2002-05-04 07:25:30 -07:00
|
|
|
szHint.base_height = (2 * TermWin.internalBorder) + bbar_calc_docked_height(BBAR_DOCKED);
|
1999-12-20 11:08:00 -08:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
szHint.width_inc = TermWin.fwidth;
|
|
|
|
szHint.height_inc = TermWin.fheight;
|
1999-12-20 11:08:00 -08:00
|
|
|
|
2005-04-18 18:57:24 -07:00
|
|
|
D_X11(("Size Hints: base width/height == %lux%lu, width/height increment == %lux%lu\n", szHint.base_width, szHint.base_height,
|
|
|
|
szHint.width_inc, szHint.height_inc));
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
szHint.min_width = szHint.base_width + szHint.width_inc;
|
|
|
|
szHint.min_height = szHint.base_height + szHint.height_inc;
|
2002-10-07 19:18:09 -07:00
|
|
|
szHint.width = szHint.base_width + TERM_WINDOW_GET_WIDTH();
|
|
|
|
szHint.height = szHint.base_height + TERM_WINDOW_GET_HEIGHT();
|
2005-04-18 18:57:24 -07:00
|
|
|
D_X11((" Minimum width/height == %lux%lu, width/height == %lux%lu\n", szHint.min_width, szHint.min_height,
|
|
|
|
szHint.width, szHint.height));
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
szHint.flags = PMinSize | PResizeInc | PBaseSize;
|
|
|
|
XSetWMNormalHints(Xdisplay, TermWin.parent, &szHint);
|
1999-10-11 11:37:55 -07:00
|
|
|
}
|
1999-08-17 18:12:47 -07:00
|
|
|
|
1999-10-11 11:37:55 -07:00
|
|
|
/* Resize terminal window and scrollbar window */
|
|
|
|
void
|
|
|
|
term_resize(int width, int height)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
static int last_width = 0, last_height = 0;
|
|
|
|
|
|
|
|
D_X11(("term_resize(%d, %d)\n", width, height));
|
2002-10-07 19:18:09 -07:00
|
|
|
TERM_WINDOW_SET_WIDTH();
|
|
|
|
TERM_WINDOW_SET_HEIGHT();
|
|
|
|
D_X11((" -> New TermWin width/height == %lux%lu\n", TERM_WINDOW_GET_WIDTH(), TERM_WINDOW_GET_HEIGHT()));
|
|
|
|
width = TERM_WINDOW_FULL_WIDTH();
|
|
|
|
height = TERM_WINDOW_FULL_HEIGHT();
|
2005-04-18 18:57:24 -07:00
|
|
|
XMoveResizeWindow(Xdisplay, TermWin.vt, ((BITFIELD_IS_SET(eterm_options, ETERM_OPTIONS_SCROLLBAR_RIGHT)) ? (0)
|
|
|
|
: ((scrollbar_is_visible())? (scrollbar_trough_width()) : (0))),
|
2002-05-04 07:25:30 -07:00
|
|
|
bbar_calc_docked_height(BBAR_DOCKED_TOP), width, height);
|
|
|
|
if (width != last_width || height != last_height) {
|
2002-10-07 19:18:09 -07:00
|
|
|
render_simage(images[image_bg].current, TermWin.vt, width, height, image_bg, 0);
|
2002-05-04 07:25:30 -07:00
|
|
|
scr_reset();
|
|
|
|
scr_touch();
|
|
|
|
if (image_mode_is(image_bg, MODE_AUTO)) {
|
|
|
|
enl_ipc_sync();
|
|
|
|
}
|
|
|
|
last_width = width;
|
|
|
|
last_height = height;
|
2000-02-15 19:37:34 -08:00
|
|
|
}
|
2001-12-03 17:22:07 -08:00
|
|
|
#ifdef USE_XIM
|
2002-05-04 07:25:30 -07:00
|
|
|
xim_set_status_position();
|
2001-12-03 17:22:07 -08:00
|
|
|
#endif
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
|
1999-10-11 11:37:55 -07:00
|
|
|
/* Resize due to font change; update size hints and child windows */
|
1999-08-17 18:12:47 -07:00
|
|
|
void
|
1999-10-11 11:37:55 -07:00
|
|
|
parent_resize(void)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
D_X11(("Called.\n"));
|
|
|
|
update_size_hints();
|
|
|
|
resize_parent(szHint.width, szHint.height);
|
|
|
|
D_X11((" -> New parent width/height == %lux%lu\n", szHint.width, szHint.height));
|
|
|
|
term_resize(szHint.width, szHint.height);
|
|
|
|
scrollbar_resize(szHint.width, szHint.height - bbar_calc_docked_height(BBAR_DOCKED));
|
|
|
|
bbar_resize_all(szHint.width);
|
1999-10-11 11:37:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
handle_resize(unsigned int width, unsigned int height)
|
1999-08-17 18:12:47 -07:00
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
static short first_time = 1;
|
|
|
|
int new_ncol = (width - szHint.base_width) / TermWin.fwidth;
|
|
|
|
int new_nrow = (height - szHint.base_height) / TermWin.fheight;
|
|
|
|
|
|
|
|
D_EVENTS(("handle_resize(%u, %u)\n", width, height));
|
2002-06-08 09:50:38 -07:00
|
|
|
|
2002-10-07 19:18:09 -07:00
|
|
|
if (first_time || (new_ncol != TERM_WINDOW_GET_REPORTED_ROWS()) || (new_nrow != TERM_WINDOW_GET_REPORTED_COLS())) {
|
|
|
|
TERM_WINDOW_SET_COLS(new_ncol);
|
|
|
|
TERM_WINDOW_SET_ROWS(new_nrow);
|
2002-05-04 07:25:30 -07:00
|
|
|
term_resize(width, height);
|
2002-10-07 19:18:09 -07:00
|
|
|
szHint.width = szHint.base_width + TERM_WINDOW_GET_WIDTH();
|
|
|
|
szHint.height = szHint.base_height + TERM_WINDOW_GET_HEIGHT();
|
2002-05-04 07:25:30 -07:00
|
|
|
D_X11((" -> New szHint.width/height == %lux%lu\n", szHint.width, szHint.height));
|
|
|
|
scrollbar_resize(width, szHint.height - bbar_calc_docked_height(BBAR_DOCKED));
|
|
|
|
bbar_resize_all(szHint.width);
|
|
|
|
first_time = 0;
|
|
|
|
}
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-10-28 07:02:35 -07:00
|
|
|
handle_move(int x, int y)
|
1999-08-17 18:12:47 -07:00
|
|
|
{
|
2006-05-17 12:42:39 -07:00
|
|
|
int dx, dy;
|
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if ((TermWin.x != x) || (TermWin.y != y)) {
|
2006-05-17 12:42:39 -07:00
|
|
|
dx = abs(TermWin.x - x);
|
|
|
|
dy = abs(TermWin.y - y);
|
2002-05-04 07:25:30 -07:00
|
|
|
TermWin.x = x;
|
|
|
|
TermWin.y = y;
|
2006-05-17 12:42:39 -07:00
|
|
|
/* If we've moved an even multiple of the screen size, there's no
|
|
|
|
need to redraw trans/viewport images; the images will line up. */
|
2002-05-04 07:25:30 -07:00
|
|
|
if (image_mode_any(MODE_TRANS | MODE_VIEWPORT)) {
|
2006-05-17 12:42:39 -07:00
|
|
|
if ((dx % DisplayWidth(Xdisplay, Xscreen)) || (dy % DisplayHeight(Xdisplay, Xscreen))) {
|
|
|
|
redraw_images_by_mode(MODE_TRANS | MODE_VIEWPORT);
|
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
2000-02-15 19:37:34 -08:00
|
|
|
}
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef XTERM_COLOR_CHANGE
|
2000-03-24 18:18:14 -08:00
|
|
|
void
|
|
|
|
stored_palette(char op)
|
|
|
|
{
|
2002-10-22 20:03:27 -07:00
|
|
|
static Pixel default_colors[NRS_COLORS + EXTRA_COLORS];
|
2002-05-04 07:25:30 -07:00
|
|
|
static unsigned char stored = 0;
|
2005-04-18 15:04:07 -07:00
|
|
|
unsigned int i;
|
2002-05-04 07:25:30 -07:00
|
|
|
|
|
|
|
if (op == SAVE) {
|
|
|
|
for (i = 0; i < NRS_COLORS; i++) {
|
|
|
|
default_colors[i] = PixColors[i];
|
|
|
|
}
|
|
|
|
stored = 1;
|
|
|
|
} else if (op == RESTORE && stored) {
|
|
|
|
for (i = 0; i < NRS_COLORS; i++) {
|
|
|
|
PixColors[i] = default_colors[i];
|
|
|
|
}
|
2000-03-24 18:18:14 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-17 18:12:47 -07:00
|
|
|
void
|
|
|
|
set_window_color(int idx, const char *color)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
XColor xcol;
|
|
|
|
int i;
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
D_X11(("idx == %d, color == \"%s\"\n", idx, NONULL(color)));
|
2000-03-24 18:18:14 -08:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
if (color == NULL || *color == '\0')
|
|
|
|
return;
|
1999-08-17 18:12:47 -07:00
|
|
|
|
2002-05-04 07:25:30 -07:00
|
|
|
/* handle color aliases */
|
|
|
|
if (isdigit(*color)) {
|
|
|
|
i = atoi(color);
|
2002-06-08 08:44:08 -07:00
|
|
|
if (i >= 8 && i <= 15) { /* bright colors */
|
2002-05-04 07:25:30 -07:00
|
|
|
i -= 8;
|
|
|
|
PixColors[idx] = PixColors[minBright + i];
|
2005-04-18 18:57:24 -07:00
|
|
|
} else if (i >= 0 && i <= 7) { /* normal colors */
|
2002-05-04 07:25:30 -07:00
|
|
|
PixColors[idx] = PixColors[minColor + i];
|
|
|
|
} else {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Color index %d is invalid.\n", i);
|
2002-05-04 07:25:30 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (XParseColor(Xdisplay, cmap, color, &xcol)) {
|
|
|
|
if (!XAllocColor(Xdisplay, cmap, &xcol)) {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to allocate \"%s\" in the color map.\n", color);
|
2002-05-04 07:25:30 -07:00
|
|
|
return;
|
|
|
|
}
|
2005-04-18 15:04:07 -07:00
|
|
|
if ((idx > maxBright) && (idx < 256) && (PixColors[idx])) {
|
|
|
|
XFreeColors(Xdisplay, cmap, (unsigned long *) &(PixColors[idx]), 1, 0);
|
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
PixColors[idx] = xcol.pixel;
|
1999-09-21 19:34:13 -07:00
|
|
|
} else {
|
2006-02-13 11:52:45 -08:00
|
|
|
libast_print_warning("Unable to resolve \"%s\" as a color name.\n", color);
|
2002-05-04 07:25:30 -07:00
|
|
|
return;
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
2002-05-04 07:25:30 -07:00
|
|
|
set_colorfgbg();
|
|
|
|
scr_touch();
|
|
|
|
scr_refresh(DEFAULT_REFRESH);
|
Sun Mar 2 23:40:39 2003 Michael Jennings (mej)
Fixed a bug with foreground/background color change pointed out by
Thomas <arnognul@tiscali.se>.
Also added support for all the other OSC color change sequences (at
least those for the colors that Eterm uses). The sequences are of
the form "\e];n;color[;color[...]]\a", where n is between 10 and 19.
You can specify up to (20 - n) semicolon-separated colors representing
the following attributes in order: foreground, background, cursor,
mouse pointer, mouse pointer background (*), Tek foreground (*), Tek
background (*), highlight color (*), bold color, and underline color.
Attributes marked with a (*) are ignored by Eterm and may be left
empty, but their trailing semicolons must be present for xterm
compatibility.
For example, to set a white foreground, black background, yellow text
cursor, green mouse cursor, #ffaa00 for bold, and cyan for underline,
you could use either of the following:
echo -e "\e]10;white;black;yellow;green;;;;;#ffaa00;cyan\007"
or
echo -e "\e]10;white\007"
echo -e "\e]11;black\007"
echo -e "\e]12;yellow\007"
echo -e "\e]13;green\007"
echo -e "\e]18;#ffaa00\007"
echo -e "\e]19;cyan\007"
Note that the setting of bold and underline colors using 18 and 19 are
Eterm extensions.
SVN revision: 6739
2003-03-02 20:53:35 -08:00
|
|
|
redraw_image(image_bg);
|
1999-08-17 18:12:47 -07:00
|
|
|
}
|
|
|
|
#endif /* XTERM_COLOR_CHANGE */
|
|
|
|
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
Window
|
|
|
|
find_window_by_coords(Window win, int win_x, int win_y, int rel_x, int rel_y)
|
|
|
|
{
|
2002-05-04 07:25:30 -07:00
|
|
|
Window *children = NULL;
|
|
|
|
XWindowAttributes attr;
|
|
|
|
Window child = 0, parent_win = 0, root_win = 0;
|
|
|
|
int i;
|
|
|
|
unsigned int ww, wh, num;
|
|
|
|
int wx, wy;
|
|
|
|
|
|
|
|
D_X11(("win 0x%08x at %d, %d. Coords are %d, %d.\n", win, win_x, win_y, rel_x, rel_y));
|
|
|
|
|
|
|
|
/* Bad or invisible window. */
|
|
|
|
if ((!XGetWindowAttributes(Xdisplay, win, &attr)) || (attr.map_state != IsViewable)) {
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
wx = attr.x + win_x;
|
|
|
|
wy = attr.y + win_y;
|
|
|
|
ww = attr.width;
|
|
|
|
wh = attr.height;
|
|
|
|
|
|
|
|
if (!((rel_x >= wx) && (rel_y >= wy) && (rel_x < (int) (wx + ww)) && (rel_y < (int) (wy + wh)))) {
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!XQueryTree(Xdisplay, win, &root_win, &parent_win, &children, &num)) {
|
|
|
|
return win;
|
|
|
|
}
|
|
|
|
if (children) {
|
|
|
|
D_X11(("%d children.\n", num));
|
|
|
|
for (i = num - 1; i >= 0; i--) {
|
|
|
|
D_X11(("Trying children[%d] (0x%08x)\n", i, children[i]));
|
|
|
|
if ((child = find_window_by_coords(children[i], wx, wy, rel_x, rel_y)) != None) {
|
|
|
|
D_X11(("Match!\n"));
|
|
|
|
XFree(children);
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
D_X11(("XFree(children)\n"));
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
XFree(children);
|
2002-05-04 07:25:30 -07:00
|
|
|
}
|
|
|
|
D_X11(("Returning 0x%08x\n", win));
|
|
|
|
return win;
|
Thu Feb 10 15:10:01 PST 2000 Michael Jennings <mej@eterm.org>
This is the first public availability of the work thus far on Eterm
0.9.1. There's quite a bit of new stuff here.
* Added scrollbar thumb support.
* Completely redid the terminfo/termcap stuff. The terminfo file is
now compiled (by tic) and installed by default (unless you specify
--without-terminfo). The config files still say xterm, though,
because some programs (like SLang and GNU mc) use the silly algorithm
of "Is $TERM set to xterm?" to detect mouse reporting support in a
terminal. =P But if you don't ever use xterm, you can use Eterm's
termcap and just name it "xterm" instead. Thanks to Marius Gedminas
<mgedmin@takas.lt> for his patch that started this whole revamp.
* Added the kEsetroot script for KDE users from Dax Games
<dgames@isoc.net>.
* You can now configure the Home and End emulation via --with-home=
and --with-end= options to configure. The --with-terminfo option is
also new, and --enable-xim is now the default.
* Added a new image state, disabled, for when Eterm loses focus. This
is supported by all widgets (well, all those that could possibly be
on screen when Eterm lost focus), even the background image. So you
could actually have all your images darken on focus out and restore
to normal on focus in.
* Widget colors formerly dealt with as colors (menu text color,
scrollbar color, etc.) are now handled by the imageclasses. Each
image state can have a foreground and background color defined. The
current exception is the background image; I hope to add that later.
The foreground is the text color and the background is the object
color (for solid color mode). So menu text color is set by the menu
imageclass. And again, for unfocused colors, use the disabled state
of the imageclass.
* Proportionally-spaced fonts are now handled much better. They are
still forced into evenly-spaced columns (it's a terminal for crying
out loud!) but at least you don't end up with Eterm's wider than your
screen. :-)
* Home on refresh is gone, as is home on echo. It's now much simpler.
There are two options: home on output, and home on input, the former
being a combination of echo and refresh. Also, keypresses that don't
necessarily have corresonding output can trigger a home on input,
like Ctrl-End or whatever...ones that don't have special meaning.
Credit to Darren Stuart Embry <dse@louisville.edu> for pointing out
this issue and the one with "m-" in font names.
* I finally got around to re-merging the new parser stuff from my
work on the Not Game. Closed up some old potential behavior quirks
with theme parsing.
* Added a new escape sequence to fork-and-exec a program. Also added
a scrollback search capability to highlight all occurances of a string
in your scrollback buffer. Use the new "Etsearch" utility to access
it. "Etsearch string" to search for a string, then "Etsearch" by
itself to reset the highlighting.
* And of course, the biggie. Eterm now supports a completely-
customizeable buttonbar. Not a menubar, a buttonbar. It can have an
arbitrary number of buttons, and each button can perform an action,
just like a menuitem. So a button could bring up a menu (like a
menubar) or launch a program (like a launchbar) or perform an
operation (like a toolbar). Each button can have an icon, text, or
both. And you can have buttons left- or right-justified in the
buttonbar. You will eventually be able to have an arbitrary number
of buttonbars, but I'm still working on that.
As with any change this big, things could very easily be broken. So
beware. :-) I have tested this myself, and everything seems to work,
but I can't test every possibility. Let me know if you find anything
that's broken, and enjoy!
SVN revision: 2048
2000-02-10 16:25:07 -08:00
|
|
|
}
|