Mon Mar 6 21:11:13 PST 2000 Michael Jennings <mej@eterm.org>

Added a new option.  -0 (that's a zero) or --itrans will invoke the
	immotile optimization for transparency, so named because it works best
	on windows that don't move around much on the desktop.  It works even
	better for windows that are sticky between desktops.  So if you have
	logging windows (running tail -f and the like) that are shaded/tinted,
	you definitely want to have this.  It will even benefit ordinary Eterm
	windows, provided you don't move them around a lot.  Eterms that do
	not change desktops may be better off with the other way; Eterms that
	are not shaded or tinted at all will not behave any differently.

	Here's the technical explanation for those who are interested.  The
	old (and still the default) behavior is for Eterm to check to see if
	any color modifiers are applied to the image_bg class, and if so, to
	make a copy of the *entire* desktop image which is then shaded/tinted
	appropriately.  It then snapshots a portion of that for the actual
	background.  This way, if the Eterm window is moved, all the shading
	and tinting will have already been done, so all it has to do is grab
	another portion of the desktop and use it.  However, this involves a
	LOT of calculations (one per pixel of the desktop pixmap) on startup
	and at every desktop switch.

	The immotile optimization is intended to reverse that logic by
	optimizing for windows that do not move (hence the term "immotile").
	It takes the snapshot of the desktop pixmap and applies any shading
	or tinting *after* taking the portion it needs.  This requires much
	fewer calculations on startup and when changing desktops, but the
	entire set of calculations must be repeated whenever the window is
	moved.  This is fine for small windows or windows that don't move
	very often, but that's not always the case.  So it is to your
	advantage to pick one or the other depending on how you use each
	particular theme or window.

	Two notes.  One, keep in mind that the -0/--itrans option doesn't
	*activate* transparency; you still need -O/--trans for that.  Two,
	this does not affect Eterms with no color modifiers applied to the
	background.  In that case, Eterm still references the existing
	desktop pixmap to save memory.


SVN revision: 2191
This commit is contained in:
Michael Jennings 2000-03-07 05:30:33 +00:00
parent 32a72bb631
commit 607268f595
4 changed files with 54 additions and 3 deletions

View File

@ -3290,3 +3290,44 @@ Fri Mar 3 21:05:11 PST 2000 Michael Jennings <mej@eterm.org>
too damned long. Just thought you should know.
-------------------------------------------------------------------------------
Mon Mar 6 21:11:13 PST 2000 Michael Jennings <mej@eterm.org>
Added a new option. -0 (that's a zero) or --itrans will invoke the
immotile optimization for transparency, so named because it works best
on windows that don't move around much on the desktop. It works even
better for windows that are sticky between desktops. So if you have
logging windows (running tail -f and the like) that are shaded/tinted,
you definitely want to have this. It will even benefit ordinary Eterm
windows, provided you don't move them around a lot. Eterms that do
not change desktops may be better off with the other way; Eterms that
are not shaded or tinted at all will not behave any differently.
Here's the technical explanation for those who are interested. The
old (and still the default) behavior is for Eterm to check to see if
any color modifiers are applied to the image_bg class, and if so, to
make a copy of the *entire* desktop image which is then shaded/tinted
appropriately. It then snapshots a portion of that for the actual
background. This way, if the Eterm window is moved, all the shading
and tinting will have already been done, so all it has to do is grab
another portion of the desktop and use it. However, this involves a
LOT of calculations (one per pixel of the desktop pixmap) on startup
and at every desktop switch.
The immotile optimization is intended to reverse that logic by
optimizing for windows that do not move (hence the term "immotile").
It takes the snapshot of the desktop pixmap and applies any shading
or tinting *after* taking the portion it needs. This requires much
fewer calculations on startup and when changing desktops, but the
entire set of calculations must be repeated whenever the window is
moved. This is fine for small windows or windows that don't move
very often, but that's not always the case. So it is to your
advantage to pick one or the other depending on how you use each
particular theme or window.
Two notes. One, keep in mind that the -0/--itrans option doesn't
*activate* transparency; you still need -O/--trans for that. Two,
this does not affect Eterms with no color modifiers applied to the
background. In that case, Eterm still references the existing
desktop pixmap to save memory.
-------------------------------------------------------------------------------

View File

@ -260,6 +260,7 @@ static const struct {
OPT_LONG("anchor-pixmap", "scrollbar anchor pixmap [scaling optional]", &rs_pixmaps[image_sa]),
OPT_LONG("menu-pixmap", "menu pixmap [scaling optional]", &rs_pixmaps[image_menu]),
OPT_BOOL('O', "trans", "creates a pseudo-transparent Eterm", &image_toggles, IMOPT_TRANS),
OPT_BOOL('0', "itrans", "use immotile-optimized transparency", &image_toggles, IMOPT_ITRANS),
OPT_BLONG("viewport-mode", "use viewport mode for the background image", &image_toggles, IMOPT_VIEWPORT),
OPT_LONG("cmod", "image color modifier (\"brightness contrast gamma\")", &rs_cmod_image),
OPT_LONG("cmod-red", "red-only color modifier (\"brightness contrast gamma\")", &rs_cmod_red),
@ -2208,6 +2209,13 @@ parse_toggles(char *buff, void *state)
Options &= ~(Opt_report_as_keysyms);
}
} else if (!BEG_STRCASECMP(buff, "itrans ") || !BEG_STRCASECMP(buff, "immotile_trans ")) {
if (bool_val) {
image_toggles |= IMOPT_ITRANS;
} else {
image_toggles &= ~IMOPT_ITRANS;
}
} else {
print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles", file_peek_path(), file_peek_line(), buff);
}
@ -4409,6 +4417,7 @@ save_config(char *path)
fprintf(fp, " select_line %d\n", (Options & Opt_select_whole_line ? 1 : 0));
fprintf(fp, " select_trailing_spaces %d\n", (Options & Opt_select_trailing_spaces ? 1 : 0));
fprintf(fp, " report_as_keysyms %d\n", (Options & Opt_report_as_keysyms ? 1 : 0));
fprintf(fp, " itrans %d\n", (image_toggles & IMOPT_ITRANS ? 1 : 0));
fprintf(fp, " end toggles\n\n");
fprintf(fp, " begin keyboard\n");

View File

@ -79,7 +79,8 @@
# define Opt_double_buffer (1LU << 24)
# define IMOPT_TRANS (1U << 0)
# define IMOPT_VIEWPORT (1U << 1)
# define IMOPT_ITRANS (1U << 1)
# define IMOPT_VIEWPORT (1U << 2)
#define BOOL_OPT_ISTRUE(s) (!strcasecmp((s), true_vals[0]) || !strcasecmp((s), true_vals[1]) \
|| !strcasecmp((s), true_vals[2]) || !strcasecmp((s), true_vals[3]))

View File

@ -523,7 +523,7 @@ create_trans_pixmap(simage_t *simg, unsigned char which, Drawable d, int x, int
D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, ph, desktop_pixmap));
XCopyArea(Xdisplay, desktop_pixmap, p, gc, x, y, width, height, 0, 0);
}
if (which != image_bg && need_colormod(simg->iml)) {
if ((which != image_bg || (image_toggles & IMOPT_ITRANS)) && need_colormod(simg->iml)) {
colormod_trans(p, simg->iml, gc, width, height);
}
if (simg->iml->bevel != NULL) {
@ -1584,7 +1584,7 @@ get_desktop_pixmap(void)
D_PIXMAP(("Desktop pixmap has changed. Updating desktop_pixmap\n"));
free_desktop_pixmap();
orig_desktop_pixmap = p;
if (need_colormod(images[image_bg].current->iml)) {
if (!(image_toggles & IMOPT_ITRANS) && need_colormod(images[image_bg].current->iml)) {
int px, py;
unsigned int pw, ph, pb, pd;
Window w;