Without a button Title text, monochrome bitmap icons are drawn with
a foreground color identical to the specified background color. The
background color from a container specific colorset is on the other
hand completely ignored.
Colorset 1 bg yellow
Colorset 2 fg red, bg blue
*FvwmButtons: Colorset 1
*FvwmButtons: (Colorset 2, Icon bitmap.xbm)
==> blue foreground, yellow background
A fix is attached.
/Simon Griph
Index: NEWS
===================================================================
RCS file: /home/cvs/fvwm/fvwm/NEWS,v
retrieving revision 1.706
diff -u -r1.706 NEWS
--- NEWS 22 Jul 2007 17:54:54 -0000 1.706
+++ NEWS 23 Jul 2007 14:00:46 -0000
@@ -69,6 +69,8 @@
multi-worded.
- FvwmButtons now handles container specific ActiveColorset
correctly when neither ActiveIcon nor ActiveTitle is used.
+ - FvwmButtons now draws bitmap icons using the correct colors
+ even with a container specific Colorset and no Title text.
-------------------------------------------------------------------
Index: modules/ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/ChangeLog,v
retrieving revision 1.1262
diff -u -r1.1262 ChangeLog
--- modules/ChangeLog 22 Jul 2007 23:01:50 -0000 1.1262
+++ modules/ChangeLog 23 Jul 2007 14:00:55 -0000
@@ -1,3 +1,10 @@
+2007-07-23 Simon Griph <simon(at)griph(dot)se>
+
+ * FvwmButtons/draw.h (RedrawButton):
+ * FvwmButtons/draw.c (RedrawButton):
+ (DrawTitle):
+ draw monochrome bimap icons with the correct colors.
+
2007-07-22 Simon Griph <simon(at)griph(dot)se>
* FvwmButtons/FvwmButtons.c (Loop):
Index: modules/FvwmButtons/draw.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/draw.c,v
retrieving revision 1.68
diff -u -r1.68 draw.c
--- modules/FvwmButtons/draw.c 8 Feb 2007 21:45:39 -0000 1.68
+++ modules/FvwmButtons/draw.c 23 Jul 2007 14:00:55 -0000
@@ -525,9 +525,6 @@
else if (b->flags.b_Back &&
!UberButton->c->flags.b_Colorset)
{
- gcv.background = b->bc;
- XChangeGC(Dpy,NormalGC,GCBackground,
- &gcv);
XFillRectangle(Dpy, MyWindow, NormalGC,
clip.x, clip.y, clip.width,
clip.height);
@@ -574,8 +571,7 @@
}
if (buttonTitle(b))
{
- DrawTitle(b, shapeMask, transGC, NULL,
- True);
+ DrawTitle(b, shapeMask, transGC, NULL);
}
FShapeCombineMask(Dpy, MyWindow, FShapeBounding,
0, 0, shapeMask, FShapeSet);
@@ -586,9 +582,15 @@
/* ------------------------------------------------------------------ */
title = buttonTitle(b);
- if (cleaned && title)
+ if (cleaned)
{
- DrawTitle(b,MyWindow,NormalGC,pev,False);
+ gcv.foreground = fc;
+ gcv.background = bc;
+ XChangeGC(Dpy, NormalGC, GCForeground | GCBackground, &gcv);
+ if (title)
+ {
+ DrawTitle(b, MyWindow, NormalGC, pev);
+ }
}
if (title == NULL && b->flags.b_Panel &&
@@ -689,8 +691,7 @@
/**
*** Writes out title.
**/
-void DrawTitle(
- button_info *b,Window win,GC gc, XEvent *pev, Bool do_not_modify_fg)
+void DrawTitle(button_info *b,Window win,GC gc, XEvent *pev)
{
int BH;
int ix,iy,iw,ih;
@@ -700,8 +701,6 @@
char *s = NULL;
int just=justify&b_TitleHoriz; /* Left, center, right */
XGCValues gcv;
- unsigned long gcm;
- int cset;
XRectangle clip;
Region region = None;
FvwmPicture *pic;
@@ -718,26 +717,11 @@
if (!s || !Ffont)
return;
- cset = buttonColorset(b);
- gcm = 0;
- if (do_not_modify_fg == False)
- {
- gcm |= GCForeground;
- if (cset >= 0)
- {
- gcv.foreground = Colorset[cset].fg;
- }
- else
- {
- gcv.foreground = buttonFore(b);
- }
- }
if (Ffont->font)
{
gcv.font = Ffont->font->fid;
- gcm |= GCFont;
+ XChangeGC(Dpy, gc, GCFont, &gcv);
}
- XChangeGC(Dpy,gc,gcm,&gcv);
pic = buttonIcon(b);
bIconFlagSet = iconFlagSet(b);
Index: modules/FvwmButtons/draw.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/draw.h,v
retrieving revision 1.13
diff -u -r1.13 draw.h
--- modules/FvwmButtons/draw.h 9 Feb 2006 23:17:05 -0000 1.13
+++ modules/FvwmButtons/draw.h 23 Jul 2007 14:00:55 -0000
@@ -22,6 +22,5 @@
void RelieveButton(Window, int, int, int, int, int, Pixel, Pixel, int);
void MakeButton(button_info *);
void RedrawButton(button_info *, int draw, XEvent *pev);
-void DrawTitle(
- button_info *b, Window win, GC gc, XEvent *pev, Bool do_not_modify_fg);
+void DrawTitle(button_info *b, Window win, GC gc, XEvent *pev);