From dfed60dd34a670fa63d6f9e2e61010f2f1be83c1 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Fri, 29 Oct 1999 15:47:25 +0000 Subject: [PATCH] Fri Oct 29 16:43:19 PDT 1999 Michael Jennings You can now apply additional color modifiers to the various widgets in transparent mode that further modify the background. So, in other words, you could have a scrollbar anchor that, in the normal state, is darker than the transparent background, and in selected/clicked state, is brighter. Or any variation on that theme. :-) Once you've got this version going, try the following changes to your trans theme's config file: begin image type anchor mode trans allow image trans auto state normal file bar_vertical_1.png geom :scale border 3 3 2 2 cmod image 192 bevel up 1 1 1 1 state selected file bar_vertical_2.png geom :scale border 3 3 2 2 cmod image 320 bevel up 1 1 1 1 end image You'll see what I'm talking about. :-) SVN revision: 1043 --- ChangeLog | 33 ++++++++++++++++++++++++++++++++- src/pixmap.c | 19 +++++++++++-------- src/pixmap.h | 4 ++-- src/scrollbar.c | 4 +++- 4 files changed, 48 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index af5c093..a0b463a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2685,8 +2685,39 @@ Thu Oct 28 16:17:21 PDT 1999 Michael Jennings Thu Oct 28 20:11:15 PDT 1999 Michael Jennings Fixed a couple problems pointed out by Joel Lesher - and Rahsheen Porter + and Rahsheen Porter regarding tinted/shaded transparency and a typo in the auto mode theme file. Doh! ------------------------------------------------------------------------------- +Fri Oct 29 16:43:19 PDT 1999 Michael Jennings + + You can now apply additional color modifiers to the various widgets + in transparent mode that further modify the background. So, in other + words, you could have a scrollbar anchor that, in the normal state, + is darker than the transparent background, and in selected/clicked + state, is brighter. Or any variation on that theme. :-) + + Once you've got this version going, try the following changes to your + trans theme's config file: + + begin image + type anchor + mode trans allow image trans auto + state normal + file bar_vertical_1.png + geom :scale + border 3 3 2 2 + cmod image 192 + bevel up 1 1 1 1 + state selected + file bar_vertical_2.png + geom :scale + border 3 3 2 2 + cmod image 320 + bevel up 1 1 1 1 + end image + + You'll see what I'm talking about. :-) + +------------------------------------------------------------------------------- diff --git a/src/pixmap.c b/src/pixmap.c index f7dbaf8..8c45a45 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -597,6 +597,12 @@ render_simage(simage_t * simg, Window win, unsigned short width, unsigned short } else { XCopyArea(Xdisplay, desktop_pixmap, simg->pmap->pixmap, gc, x, y, width, height, 0, 0); } + if (which != image_bg && need_colormod(simg->iml)) { + colormod_trans(simg->pmap->pixmap, simg->iml, gc, width, height); + } + if (simg->iml->bevel != NULL) { + Imlib_bevel_pixmap(imlib_id, simg->pmap->pixmap, width, height, simg->iml->bevel->edges, simg->iml->bevel->up); + } D_PIXMAP(("Setting background of window 0x%08x to 0x%08x\n", win, simg->pmap->pixmap)); XSetWindowBackgroundPixmap(Xdisplay, win, simg->pmap->pixmap); } @@ -970,10 +976,8 @@ load_image(const char *file, short type) # define MOD_IS_SET(mod) ((mod) && ((mod)->brightness != 0xff || (mod)->contrast != 0xff || (mod)->gamma != 0xff)) unsigned char -need_colormod(void) +need_colormod(register imlib_t *iml) { - register imlib_t *iml = images[image_bg].current->iml; - if (MOD_IS_SET(iml->mod) || MOD_IS_SET(iml->rmod) || MOD_IS_SET(iml->gmod) || MOD_IS_SET(iml->bmod)) { return 1; } else { @@ -982,7 +986,7 @@ need_colormod(void) } void -colormod_trans(Pixmap p, GC gc, unsigned short w, unsigned short h) +colormod_trans(Pixmap p, imlib_t *iml, GC gc, unsigned short w, unsigned short h) { XImage *ximg; @@ -994,7 +998,6 @@ colormod_trans(Pixmap p, GC gc, unsigned short w, unsigned short h) int real_depth = 0; register int br, bg, bb; register unsigned int mr, mg, mb; - imlib_t *iml = images[image_bg].current->iml; D_PIXMAP(("colormod_trans(p == 0x%08x, gc, w == %hu, h == %hu) called.\n", p, w, h)); @@ -1219,7 +1222,7 @@ get_desktop_pixmap(void) } else { D_PIXMAP(("get_desktop_pixmap(): Desktop pixmap has changed. Updating desktop_pixmap\n")); free_desktop_pixmap(); - if (need_colormod()) { + if (need_colormod(images[image_bg].current->iml)) { int px, py; unsigned int pw, ph, pb, pd; Window w; @@ -1234,11 +1237,11 @@ get_desktop_pixmap(void) if (pw < (unsigned int) scr->width || ph < (unsigned int) scr->height) { desktop_pixmap = XCreatePixmap(Xdisplay, TermWin.parent, pw, ph, Xdepth); XCopyArea(Xdisplay, p, desktop_pixmap, gc, 0, 0, pw, ph, 0, 0); - colormod_trans(desktop_pixmap, gc, pw, ph); + colormod_trans(desktop_pixmap, images[image_bg].current->iml, gc, pw, ph); } else { desktop_pixmap = XCreatePixmap(Xdisplay, TermWin.vt, scr->width, scr->height, Xdepth); XCopyArea(Xdisplay, p, desktop_pixmap, gc, 0, 0, scr->width, scr->height, 0, 0); - colormod_trans(desktop_pixmap, gc, scr->width, scr->height); + colormod_trans(desktop_pixmap, images[image_bg].current->iml, gc, scr->width, scr->height); } XFreeGC(Xdisplay, gc); desktop_pixmap_is_mine = 1; diff --git a/src/pixmap.h b/src/pixmap.h index 2d4b99f..8111648 100644 --- a/src/pixmap.h +++ b/src/pixmap.h @@ -170,8 +170,8 @@ extern const char *search_path(const char *, const char *, const char *); extern unsigned short load_image(const char *, short); extern void free_desktop_pixmap(void); #ifdef PIXMAP_OFFSET -extern unsigned char need_colormod(void); -extern void colormod_trans(Pixmap, GC, unsigned short, unsigned short); +extern unsigned char need_colormod(imlib_t *); +extern void colormod_trans(Pixmap, imlib_t *, GC, unsigned short, unsigned short); extern Window get_desktop_window(void); extern Pixmap get_desktop_pixmap(void); #endif diff --git a/src/scrollbar.c b/src/scrollbar.c index c97137b..d3b4ce3 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -831,7 +831,9 @@ scrollbar_show(short mouseoffset) if ((last_top != scrollBar.top) || (scrollBar.bot != last_bot)) { XMoveResizeWindow(Xdisplay, scrollBar.sa_win, scrollbar_get_shadow(), scrollBar.top, scrollBar.width, scrollbar_anchor_height()); } - render_simage(images[image_sa].current, scrollBar.sa_win, scrollbar_anchor_width(), scrollbar_anchor_height(), image_sa, 0); + if (scrollbar_anchor_height() > 1) { + render_simage(images[image_sa].current, scrollBar.sa_win, scrollbar_anchor_width(), scrollbar_anchor_height(), image_sa, 0); + } } #endif last_top = scrollBar.top;