summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTavis Ormandy <taviso@gentoo.org>2004-07-10 18:02:41 +0000
committerTavis Ormandy <taviso@gentoo.org>2004-07-10 18:02:41 +0000
commit30b5cb6c2882336a78c1406319aecde3f398f263 (patch)
tree14aced07bce1980d64291827a2acf926c195c250
parentnew maintainer (Manifest recommit) (diff)
downloadgentoo-2-30b5cb6c2882336a78c1406319aecde3f398f263.tar.gz
gentoo-2-30b5cb6c2882336a78c1406319aecde3f398f263.tar.bz2
gentoo-2-30b5cb6c2882336a78c1406319aecde3f398f263.zip
updated patch
-rw-r--r--x11-wm/fvwm/files/fvwm-2.5.10-fvwmbuttonshover.diff463
1 files changed, 348 insertions, 115 deletions
diff --git a/x11-wm/fvwm/files/fvwm-2.5.10-fvwmbuttonshover.diff b/x11-wm/fvwm/files/fvwm-2.5.10-fvwmbuttonshover.diff
index 9f6da79c8aa5..072b7d9e357f 100644
--- a/x11-wm/fvwm/files/fvwm-2.5.10-fvwmbuttonshover.diff
+++ b/x11-wm/fvwm/files/fvwm-2.5.10-fvwmbuttonshover.diff
@@ -1,14 +1,14 @@
diff -u fvwm-2.5.10/modules/FvwmButtons/button.c fvwm/modules/FvwmButtons/button.c
--- fvwm-2.5.10/modules/FvwmButtons/button.c 2003-06-29 20:53:24.000000000 +0100
-+++ fvwm/modules/FvwmButtons/button.c 2004-07-10 10:13:25.000000000 +0100
++++ fvwm/modules/FvwmButtons/button.c 2004-07-10 18:50:13.074019368 +0100
@@ -298,6 +298,11 @@
int buttonColorset(button_info *b)
{
+ if (b == HoverButton && UberButton->c->flags & b_HoverColorset)
-+ {
+ return UberButton->c->hoverColorset;
-+ }
++ if (b == CurrentButton && UberButton->c->flags & b_PressColorset)
++ return UberButton->c->pressColorset;
+
if (b->flags & b_Colorset)
return b->colorset;
@@ -17,7 +17,7 @@ Only in fvwm/modules/FvwmButtons: CVS
Only in fvwm/modules/FvwmButtons: .cvsignore
diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
--- fvwm-2.5.10/modules/FvwmButtons/draw.c 2003-06-29 20:53:24.000000000 +0100
-+++ fvwm/modules/FvwmButtons/draw.c 2004-07-10 10:13:25.000000000 +0100
++++ fvwm/modules/FvwmButtons/draw.c 2004-07-10 18:50:13.078018760 +0100
@@ -139,11 +139,6 @@
/* At this point iw,ih,ix and iy should be correct. Now all we have to do is
place title and iconwin in their proper positions */
@@ -98,7 +98,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
if (draw == DRAW_CLEAN)
{
clean = True;
-@@ -498,39 +518,60 @@
+@@ -498,39 +518,78 @@
if (do_draw)
{
cleaned = True;
@@ -114,6 +114,15 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
+ &Colorset[UberButton->c->hoverColorset],
+ Pdepth, NormalGC);
+ }
++ else if (b == CurrentButton &&
++ UberButton->c->flags & b_PressColorset)
++ {
++ SetRectangleBackground(Dpy, MyWindow,
++ clip.x, clip.y, clip.width,
++ clip.height,
++ &Colorset[UberButton->c->pressColorset],
++ Pdepth, NormalGC);
++ }
+ else
+ {
+ XFillRectangle(Dpy, MyWindow, NormalGC,
@@ -152,6 +161,15 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
+ &Colorset[UberButton->c->hoverColorset],
+ Pdepth, NormalGC);
+ }
++ else if (b == CurrentButton &&
++ UberButton->c->flags & b_PressColorset)
++ {
++ SetRectangleBackground(Dpy, MyWindow,
++ clip.x, clip.y, clip.width,
++ clip.height,
++ &Colorset[UberButton->c->pressColorset],
++ Pdepth, NormalGC);
++ }
}
}
}
@@ -159,7 +177,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
/* ------------------------------------------------------------------ */
- if(cleaned && (b->flags&b_Title))
-+ if (cleaned && (b->flags & (b_Title|b_HoverTitle)))
++ if (cleaned && (b->flags & (b_Title|b_HoverTitle|b_PressTitle)))
{
DrawTitle(b,MyWindow,NormalGC,pev,False);
}
@@ -169,7 +187,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
(b->panel_flags.panel_indicator))
{
XGCValues gcv;
-@@ -612,10 +653,13 @@
+@@ -612,10 +671,13 @@
}
} /* panel indicator */
@@ -186,7 +204,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
}
/* relief */
-@@ -633,13 +677,26 @@
+@@ -633,13 +695,36 @@
FlocaleFont *Ffont=buttonFont(b);
int justify=buttonJustify(b);
int l,i,xpos;
@@ -211,30 +229,42 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
+ iconFlag = b_HoverIcon;
+ }
+ }
++ else if (b == CurrentButton)
++ {
++ /* If no PressIcon is specified, we use Icon (if there is
++ one). */
++ if (b->flags & b_PressIcon)
++ {
++ pic = b->pressicon;
++ iconFlag = b_PressIcon;
++ }
++ }
BH = buttonHeight(b);
-@@ -647,7 +704,18 @@
+@@ -647,10 +732,18 @@
/* ------------------------------------------------------------------ */
- if(!(b->flags&b_Title) || !Ffont)
+- {
+ /* If this is the current hover button but no explicit HoverTitle was
-+ specified, use the Title (if there is one). */
++ specified, use the Title (if there is one).
++ Similarly for PressTitle. */
+ if (b == HoverButton && b->flags & b_HoverTitle)
-+ {
+ s = b->hoverTitle;
-+ }
++ else if (b == CurrentButton && b->flags & b_PressTitle)
++ s = b->pressTitle;
+ else if (b->flags & b_Title)
-+ {
+ s = b->title;
-+ }
+
+ if (!s || !Ffont)
- {
return;
- }
-@@ -676,10 +744,10 @@
+- }
+
+ cset = buttonColorset(b);
+ gcm = 0;
+@@ -676,10 +769,10 @@
/* If a title is to be shown, truncate it until it fits */
if(justify&b_Horizontal && !(b->flags & b_Right))
{
@@ -248,7 +278,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
}
else if ((b->flags & b_Swallow) && buttonSwallowCount(b)==3)
{
-@@ -688,7 +756,6 @@
+@@ -688,7 +781,6 @@
}
}
@@ -256,7 +286,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/draw.c fvwm/modules/FvwmButtons/draw.c
l = strlen(s);
i = FlocaleTextWidth(Ffont,s,l);
-@@ -740,7 +807,7 @@
+@@ -740,7 +832,7 @@
FwinString.x = xpos;
/* If there is more than the title, put it at the bottom */
/* Unless stack flag is set, put it to the right of icon */
@@ -334,7 +364,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/dynamic.c fvwm/modules/FvwmButtons/dynam
"Title", "Icon", NULL
diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/FvwmButtons.c
--- fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c 2004-02-16 10:18:30.000000000 +0000
-+++ fvwm/modules/FvwmButtons/FvwmButtons.c 2004-07-10 10:13:25.000000000 +0100
++++ fvwm/modules/FvwmButtons/FvwmButtons.c 2004-07-10 18:50:13.059021648 +0100
@@ -67,7 +67,6 @@
#include "FvwmButtons.h"
#include "misc.h" /* ConstrainSize() */
@@ -472,7 +502,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
+ redraw_relief = True;
+ }
+
-+ if (b != HoverButton)
++ if (b != HoverButton && CurrentButton == NULL)
+ {
+ if (HoverButton)
+ {
@@ -509,7 +539,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
+ }
+ if (CurrentButton)
+ {
-+ RedrawButton(b, DRAW_RELIEF, NULL);
++ RedrawButton(b, DRAW_FORCE, NULL);
+ }
+ }
+ break;
@@ -517,30 +547,84 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
case KeyPress:
XLookupString(&Event.xkey,buffer,10,&keysym,0);
if(keysym!=XK_Return && keysym!=XK_KP_Enter && keysym!=XK_Linefeed)
-@@ -1159,8 +1210,11 @@
+@@ -1099,7 +1150,7 @@
+ {
+ b = CurrentButton;
+ CurrentButton = 0;
+- RedrawButton(b, DRAW_RELIEF, NULL);
++ RedrawButton(b, DRAW_FORCE, NULL);
+ break;
+ }
+ if (Event.xbutton.state & DEFAULT_ALL_BUTTONS_MASK)
+@@ -1132,7 +1183,17 @@
+ CurrentButton=NULL;
+ break;
+ }
+- RedrawButton(b, DRAW_RELIEF, NULL);
++
++ /* Undraw HoverButton (if there is one). */
++ if (HoverButton)
++ {
++ /* $b & $HoverButton are always the same button. */
++ button_info *tmp = HoverButton;
++ HoverButton = NULL;
++ RedrawButton(tmp, DRAW_FORCE, NULL);
++ }
++ else
++ RedrawButton(b, DRAW_FORCE, NULL);
+ if (!act)
+ {
+ break;
+@@ -1159,8 +1220,11 @@
case ButtonRelease:
if (CurrentButton == NULL || !is_pointer_in_current_button)
{
- CurrentButton = NULL;
- break;
+ if (CurrentButton)
-+ RedrawButton(CurrentButton, DRAW_RELIEF, NULL);
++ RedrawButton(CurrentButton, DRAW_FORCE, NULL);
+
+ CurrentButton = NULL;
+ break;
}
if (Event.xbutton.window == MyWindow)
{
-@@ -1502,7 +1556,7 @@
+@@ -1176,6 +1240,16 @@
+ Event.xbutton.y, &x, &y, &dummy);
+ }
+ b = select_button(UberButton, x, y);
++ if (b->flags & (b_HoverIcon | b_HoverTitle) ||
++ UberButton->c->flags & b_HoverColorset)
++ {
++ if (Event.xbutton.x >= 0 && Event.xbutton.x < Width &&
++ Event.xbutton.y >= 0 && Event.xbutton.y < Height)
++ {
++ HoverButton = b;
++ RedrawButton(b, DRAW_FORCE, NULL);
++ }
++ }
+ act = GetButtonAction(b,Event.xbutton.button);
+ if (b && !act && (b->flags & b_Panel))
+ {
+@@ -1283,7 +1357,7 @@
+ b = CurrentButton;
+ CurrentButton=NULL;
+ if (b)
+- RedrawButton(b, DRAW_RELIEF, NULL);
++ RedrawButton(b, DRAW_FORCE, NULL);
+ break;
+
+ case ClientMessage:
+@@ -1502,7 +1576,7 @@
**/
void RecursiveLoadData(button_info *b,int *maxx,int *maxy)
{
- int i,j,x=0,y=0;
-+ int i, x=0, y=0, ix, iy, tx, ty, hix, hiy, htx, hty;
++ int i, x=0, y=0, ix, iy, tx, ty, hix, hiy, htx, hty, pix, piy, ptx, pty;
FlocaleFont *Ffont;
if (!b)
-@@ -1665,9 +1719,14 @@
+@@ -1665,9 +1739,16 @@
b->c->height=y;
}
@@ -551,14 +635,16 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
+ $tx & $ty are dimensions of Title
+ $hix & $hiy are dimensions of HoverIcon
+ $htx & $hty are dimensions of HoverTitle
++ $pix & $piy are dimensions of PressIcon
++ $ptx & $pty are dimensions of PressTitle
+
+ Note that if No HoverIcon is specified, Icon is displayed during hover.
-+ Similarly for HoverTitle. */
-+ ix = iy = tx = ty = hix = hiy = htx = hty = 0;
++ Similarly for HoverTitle, PressIcon & PressTitle. */
++ ix = iy = tx = ty = hix = hiy = htx = hty = pix = piy = ptx = pty = 0;
/* Load the icon */
if(b->flags&b_Icon && LoadIconFile(b->icon_file,&b->icon, buttonColorset(b)))
-@@ -1675,12 +1734,31 @@
+@@ -1675,12 +1756,49 @@
#ifdef DEBUG_LOADDATA
fprintf(stderr,", icon \"%s\"",b->icon_file);
#endif
@@ -566,10 +652,10 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
- j=b->icon->height;
+ ix = b->icon->width;
+ iy = b->icon->height;
- }
- else
- b->flags&=~b_Icon;
-
++ }
++ else
++ b->flags &= ~b_Icon;
++
+ /* load the hover icon. */
+ if (b->flags & b_HoverIcon &&
+ LoadIconFile(b->hover_icon_file, &b->hovericon, buttonColorset(b)))
@@ -580,19 +666,38 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
+
+ hix = b->hovericon->width;
+ hiy = b->hovericon->height;
-+ }
-+ else
+ }
+ else
+- b->flags&=~b_Icon;
+ {
+ hix = ix;
+ hiy = iy;
-+ b->flags&=~b_HoverIcon;
++ b->flags &= ~b_HoverIcon;
+ }
+
++ /* load the press icon. */
++ if (b->flags & b_PressIcon &&
++ LoadIconFile(b->press_icon_file, &b->pressicon, buttonColorset(b)))
++ {
++#ifdef DEBUG_LOADDATA
++ fprintf(stderr,", press icon \"%s\"", b->press_icon_file);
++#endif
+
++ pix = b->pressicon->width;
++ piy = b->pressicon->height;
++ }
++ else
++ {
++ pix = ix;
++ piy = iy;
++ b->flags &= ~b_PressIcon;
++ }
+
++ /* calculate Title dimensions. */
if(b->flags&b_Title && (Ffont = buttonFont(b)))
{
#ifdef DEBUG_LOADDATA
-@@ -1688,18 +1766,41 @@
+@@ -1688,18 +1806,66 @@
#endif
if(buttonJustify(b)&b_Horizontal)
{
@@ -600,14 +705,19 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
- j=max(j,Ffont->height);
+ tx = buttonXPad(b) + FlocaleTextWidth(Ffont, b->title, strlen(b->title));
+ ty = Ffont->height;
-+ }
-+ else
-+ {
-+ tx = FlocaleTextWidth(Ffont,b->title,strlen(b->title));
+ }
+ else
+ {
+- i=max(i,FlocaleTextWidth(Ffont,b->title,strlen(b->title)));
+- j+=Ffont->height;
++ tx = FlocaleTextWidth(Ffont, b->title, strlen(b->title));
+ ty = Ffont->height;
-+ }
-+ }
-+
+ }
+ }
+
+- x+=i;
+- y+=j;
++ /* calculate HoverTitle dimensions. */
+ if (b->flags & b_HoverTitle && (Ffont = buttonFont(b)))
+ {
+#ifdef DEBUG_LOADDATA
@@ -618,29 +728,49 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
+ htx = buttonXPad(b) + FlocaleTextWidth(Ffont, b->hoverTitle,
+ strlen(b->hoverTitle));
+ hty = Ffont->height;
- }
- else
- {
-- i=max(i,FlocaleTextWidth(Ffont,b->title,strlen(b->title)));
-- j+=Ffont->height;
-+ htx = FlocaleTextWidth(Ffont,b->hoverTitle,strlen(b->hoverTitle));
++ }
++ else
++ {
++ htx = FlocaleTextWidth(Ffont, b->hoverTitle, strlen(b->hoverTitle));
+ hty = Ffont->height;
- }
- }
++ }
++ }
+ else
+ {
+ htx = tx;
+ hty = ty;
+ }
-
-- x+=i;
-- y+=j;
++
++ /* calculate PressTitle dimensions. */
++ if (b->flags & b_PressTitle && (Ffont = buttonFont(b)))
++ {
++#ifdef DEBUG_LOADDATA
++ fprintf(stderr,", title \"%s\"",b->title);
++#endif
++ if (buttonJustify(b) & b_Horizontal)
++ {
++ ptx = buttonXPad(b) + FlocaleTextWidth(Ffont, b->pressTitle,
++ strlen(b->pressTitle));
++ pty = Ffont->height;
++ }
++ else
++ {
++ ptx = FlocaleTextWidth(Ffont, b->pressTitle, strlen(b->pressTitle));
++ pty = Ffont->height;
++ }
++ }
++ else
++ {
++ ptx = tx;
++ pty = ty;
++ }
++
+ x += max(max(ix, tx), max(hix, htx));
+ y += max(iy + ty, hiy + hty);
if(b->flags&b_Size)
{
-@@ -2405,21 +2506,6 @@
+@@ -2405,21 +2571,6 @@
}
else
{
@@ -662,7 +792,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
RedrawButton(b, DRAW_ALL, NULL);
}
}
-@@ -2463,32 +2549,12 @@
+@@ -2463,32 +2614,12 @@
b, True);
}
}
@@ -695,36 +825,56 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.c fvwm/modules/FvwmButtons/F
}
static void handle_config_info_packet(unsigned long *body)
+@@ -2530,7 +2661,7 @@
+ ub=UberButton;
+ while(NextButton(&ub,&b,&button,1))
+ {
+- RedrawButton(b, DRAW_RELIEF, NULL);
++ RedrawButton(b, DRAW_FORCE, NULL);
+ }
+ }
+ break;
diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.h fvwm/modules/FvwmButtons/FvwmButtons.h
--- fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.h 2003-08-07 10:34:27.000000000 +0100
-+++ fvwm/modules/FvwmButtons/FvwmButtons.h 2004-07-10 10:13:25.000000000 +0100
-@@ -74,7 +74,9 @@
++++ fvwm/modules/FvwmButtons/FvwmButtons.h 2004-07-10 18:50:13.062021192 +0100
+@@ -73,8 +73,16 @@
+ * button with a swallowed app. */
#define b_ActionOnPress \
0x02000000 /* By default this only done on Popup */
- #define b_Id 0x04000000 /* Has a user defined id for referencing */
+-#define b_Id 0x04000000 /* Has a user defined id for referencing */
-#define b_IconAlpha 0x08000000 /* Icon has an alpha chanel */
-+#define b_HoverIcon 0x08000000 /* Contains HoverIcon */
-+#define b_HoverColorset 0x10000000 /* Use alternate colorset for button on hover*/
-+#define b_HoverTitle 0x20000000 /* Use alternate Title text on hover*/
++#define b_Id 0x04000000 /* Has a user defined id for referencing */
++#define b_HoverIcon 0x08000000 /* Use alternate Icon on hover */
++#define b_HoverColorset 0x10000000 /* Use alternate colorset on hover */
++#define b_HoverTitle 0x20000000 /* Use alternate Title text on hover */
++#define b_PressIcon 0x40000000 /* Use alternate Icon on press */
++#define b_PressColorset 0x80000000 /* Use alternate Colorset on press */
++/* FIXME: We're out of bits!
++ Nasty hack: b_PressColorset is used by UberButton & it would never use
++ b_PressTitle (& vice-versa) so they have the same bit-value. */
++#define b_PressTitle 0x80000000 /* Use alternate Title text on press */
/* Flags for b->swallow */
#define b_Count 0x0003 /* Init counter for swallowing */
-@@ -121,6 +123,7 @@
+@@ -121,6 +129,8 @@
char *back_file; /* b_Back && b_IconBack */
char *fore; /* b_Fore */
int colorset; /* b_Colorset */
+ int hoverColorset; /* b_HoverColorset */
++ int pressColorset; /* b_PressColorset */
Pixel fc; /* b_Fore */
Pixel bc,hc,sc; /* b_Back && !b_IconBack */
FvwmPicture *backicon; /* b_Back && b_IconBack */
-@@ -161,15 +164,18 @@
+@@ -161,15 +171,21 @@
byte justify_mask; /* b_Justify */
container_info *c; /* b_Container */
char *title; /* b_Title */
+ char *hoverTitle; /* b_HoverTitle */
++ char *pressTitle; /* b_PressTitle */
char **action; /* b_Action */
char *icon_file; /* b_Icon */
+ char *hover_icon_file; /* b_HoverIcon */
++ char *press_icon_file; /* b_PressIcon */
char *hangon; /* b_Hangon || b_Swallow */
Pixel fc; /* b_Fore */
Pixel bc,hc,sc; /* b_Back && !b_IconBack */
@@ -733,11 +883,12 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.h fvwm/modules/FvwmButtons/F
FvwmPicture *backicon; /* b_Back && b_IconBack */
- Window IconWin; /* b_Icon || b_Swallow */
+ FvwmPicture *hovericon; /* b_HoverIcon */
++ FvwmPicture *pressicon; /* b_PressIcon */
+ Window IconWin; /* b_Swallow */
Window PanelWin; /* b_Panel */
Window BackIconWin; /* b_Back && b_IconBack */
-@@ -233,7 +239,7 @@
+@@ -233,7 +249,7 @@
extern Window Root;
extern Window MyWindow;
extern char *MyName;
@@ -748,8 +899,8 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/FvwmButtons.h fvwm/modules/FvwmButtons/F
extern char *imagePath;
diff -u fvwm-2.5.10/modules/FvwmButtons/icons.c fvwm/modules/FvwmButtons/icons.c
--- fvwm-2.5.10/modules/FvwmButtons/icons.c 2003-06-29 20:53:24.000000000 +0100
-+++ fvwm/modules/FvwmButtons/icons.c 2004-07-10 10:13:25.000000000 +0100
-@@ -58,193 +58,64 @@
++++ fvwm/modules/FvwmButtons/icons.c 2004-07-10 18:50:13.080018456 +0100
+@@ -58,193 +58,60 @@
#include "libs/Colorset.h"
#include "libs/Rectangles.h"
@@ -902,8 +1053,8 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/icons.c fvwm/modules/FvwmButtons/icons.c
*/
-Bool GetIconWindowPosition(
- button_info *b, int *r_x, int *r_y, int *r_w, int *r_h)
-+Bool GetIconPosition(button_info *b, unsigned long iconFlag, int *r_x,
-+ int *r_y, int *r_w, int *r_h)
++Bool GetIconPosition(button_info *b, unsigned long iconFlag,
++ FvwmPicture *pic, int *r_x, int *r_y, int *r_w, int *r_h)
{
#ifdef NO_ICONS
- return 0;
@@ -915,7 +1066,6 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/icons.c fvwm/modules/FvwmButtons/icons.c
int framew,xpad,ypad;
FlocaleFont *Ffont;
int BW,BH;
-+ FvwmPicture *pic = b->icon;
+ Bool has_title = (b->flags & b_Title ? True : False);
- if(!b || !(b->flags&b_Icon))
@@ -927,18 +1077,15 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/icons.c fvwm/modules/FvwmButtons/icons.c
- fprintf(stderr,"%s: DEBUG: Tried to configure erroneous "
- "iconwindow\n", MyName);
- exit(2);
-+ /* If no HoverIcon is specified, we use Icon (if there is
-+ one). */
-+ if (b->flags & b_HoverIcon)
-+ {
-+ pic = b->hovericon;
-+ }
+ /* If no HoverTitle is specified, we use Title (if there is
+ one). */
+ if (b->flags & b_HoverTitle)
-+ {
+ has_title = True;
-+ }
++ }
++ else if (iconFlag & b_PressIcon)
++ {
++ if (b->flags & b_PressTitle)
++ has_title = True;
}
buttonInfo(b,&x,&y,&xpad,&ypad,&framew);
@@ -973,7 +1120,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/icons.c fvwm/modules/FvwmButtons/icons.c
else if (b->flags & b_Left)
xoff = framew+xpad;
else
-@@ -252,15 +123,15 @@
+@@ -252,15 +119,15 @@
if(buttonJustify(b)&b_Horizontal)
xoff=0;
else
@@ -993,7 +1140,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/icons.c fvwm/modules/FvwmButtons/icons.c
if(yoff < framew+ypad)
yoff = framew+ypad;
-@@ -270,10 +141,10 @@
+@@ -270,10 +137,10 @@
*r_x = x;
*r_y = y;
@@ -1007,38 +1154,46 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/icons.c fvwm/modules/FvwmButtons/icons.c
#endif
}
-@@ -284,20 +155,24 @@
+@@ -284,22 +151,32 @@
int cset;
XRectangle clip;
FvwmRenderAttributes fra;
-+ unsigned long iconFlag = b_Icon;
-+ unsigned long flag = (b == HoverButton ? b_HoverIcon : b_Icon);
++ unsigned long flag = b_Icon;
- if (!GetIconWindowPosition(b,&x,&y,&w,&h))
+ FvwmPicture *pic = b->icon;
-+ if (b == HoverButton && b->flags & b_HoverIcon)
++ if (b == HoverButton)
{
- return;
-+ iconFlag = b_HoverIcon;
-+ pic = b->hovericon;
++ flag = b_HoverIcon;
++ if (b->flags & b_HoverIcon)
++ pic = b->hovericon;
}
-
+-
- if(w < 1 || h < 1)
-+ if (!GetIconPosition(b, flag, &x,&y,&w,&h))
++ else if (b == CurrentButton)
{
- return; /* No need drawing to this */
-+ return;
++ flag = b_PressIcon;
++ if (b->flags & b_PressIcon)
++ pic = b->pressicon;
}
- if (!(b->flags & b_IconAlpha))
-+ if(w < 1 || h < 1)
++ if (!GetIconPosition(b, flag, pic, &x,&y,&w,&h))
{
-- return;
-+ return; /* No need drawing to this */
+ return;
}
++ if(w < 1 || h < 1)
++ {
++ return; /* No need drawing to this */
++ }
++
clip.x = x;
-@@ -331,50 +206,11 @@
+ clip.y = y;
+ clip.width = w;
+@@ -331,50 +208,11 @@
fra.mask |= FRAM_HAVE_ICON_CSET;
fra.colorset = &Colorset[cset];
}
@@ -1105,7 +1260,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/icons.h fvwm/modules/FvwmButtons/icons.h
Only in fvwm-2.5.10/modules/FvwmButtons: Makefile.in
diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
--- fvwm-2.5.10/modules/FvwmButtons/parse.c 2003-08-25 07:47:08.000000000 +0100
-+++ fvwm/modules/FvwmButtons/parse.c 2004-07-10 10:13:25.000000000 +0100
++++ fvwm/modules/FvwmButtons/parse.c 2004-07-10 18:50:13.121012224 +0100
@@ -751,8 +751,7 @@
default:
@@ -1116,16 +1271,18 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
if (t)
free(t);
}
-@@ -803,6 +802,8 @@
+@@ -803,6 +802,10 @@
"colorset",
"action",
"id",
+ "hovericon",
+ "hovertitle",
++ "pressicon",
++ "presstitle",
NULL
};
s = trimleft(s);
-@@ -937,7 +938,6 @@
+@@ -937,13 +940,12 @@
if (b->icon_file)
free(b->icon_file);
b->icon_file=t;
@@ -1133,20 +1290,27 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
b->flags|=b_Icon;
}
}
-@@ -1251,6 +1251,69 @@
+ else
+ {
+- fprintf(stderr,"%s: Missing icon argument\n",MyName);
++ fprintf(stderr,"%s: Missing Icon argument\n",MyName);
+ if(t)free(t);
+ }
+ break;
+@@ -1251,6 +1253,123 @@
}
break;
+ /* ---------------------------- HoverIcon ------------------------- */
+ case 21: /* HoverIcon */
-+ t=seekright(&s);
-+ if(t && *t && (t[0] != '-' || t[1] != 0))
++ t = seekright(&s);
++ if (t && *t && (t[0] != '-' || t[1] != 0))
+ {
+ if (b->flags & b_Swallow)
+ {
+ fprintf(stderr,"%s: a button can not have a "
-+ "hover icon and a swallowed window at "
-+ "the same time. Ignoring hover icon.",
++ "HoverIcon and a swallowed window at "
++ "the same time. Ignoring HoverIcon.",
+ MyName);
+ }
+ else
@@ -1159,12 +1323,10 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
+ }
+ else
+ {
-+ fprintf(stderr,"%s: Missing hover icon argument\n",
++ fprintf(stderr,"%s: Missing HoverIcon argument\n",
+ MyName);
-+ if(t)
-+ {
++ if (t)
+ free(t);
-+ }
+ }
+ break;
+
@@ -1180,22 +1342,78 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
+ if(t && *t && (t[0] != '-' || t[1] != 0))
+ {
+ if (b->hoverTitle)
-+ {
+ free(b->hoverTitle);
-+ }
+ b->hoverTitle = t;
+#ifdef DEBUG_PARSER
-+ fprintf(stderr,"PARSE: HoverTitle \"%s\"\n", b->hoverTitle);
++ fprintf(stderr,"PARSE: HoverTitle \"%s\"\n",
++ b->hoverTitle);
+#endif
+ b->flags |= b_HoverTitle;
+ }
+ else
+ {
-+ fprintf(stderr,"%s: Missing HoverTitle argument\n",MyName);
++ fprintf(stderr,"%s: Missing HoverTitle argument\n",
++ MyName);
+ if (t)
-+ {
+ free(t);
++ }
++ break;
++
++ /* ------------------------- PressIcon ------------------------- */
++ case 23: /* PressIcon */
++ t = seekright(&s);
++ if (t && *t && (t[0] != '-' || t[1] != 0))
++ {
++ if (b->flags & b_Swallow)
++ {
++ fprintf(stderr,"%s: a button can not have a "
++ "PressIcon and a swallowed window at "
++ "the same time. Ignoring PressIcon.",
++ MyName);
+ }
++ else
++ {
++ if (b->press_icon_file)
++ free(b->press_icon_file);
++ b->press_icon_file = t;
++ b->flags |= b_PressIcon;
++ }
++ }
++ else
++ {
++ fprintf(stderr,"%s: Missing PressIcon argument\n",
++ MyName);
++ if (t)
++ free(t);
++ }
++ break;
++
++ /* ------------------------- PressTitle ------------------------- */
++ case 24: /* PressTitle */
++ s = trimleft(s);
++ if (*s=='(')
++ {
++ fprintf(stderr,"%s: justification not allowed for "
++ "PressTitle.\n", MyName);
++ }
++ t = seekright(&s);
++ if (t && *t && (t[0] != '-' || t[1] != 0))
++ {
++ if (b->pressTitle)
++ free(b->pressTitle);
++ b->pressTitle = t;
++#ifdef DEBUG_PARSER
++ fprintf(stderr,"PARSE: PressTitle \"%s\"\n",
++ b->pressTitle);
++#endif
++ b->flags |= b_PressTitle;
++ }
++ else
++ {
++ fprintf(stderr,"%s: Missing PressTitle argument\n",
++ MyName);
++ if (t)
++ free(t);
+ }
+ break;
+
@@ -1203,7 +1421,7 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
default:
t=seekright(&s);
fprintf(stderr,"%s: Illegal button option \"%s\"\n",MyName,
-@@ -1292,7 +1355,6 @@
+@@ -1292,7 +1411,6 @@
((b->icon_file)[0]!='-'||(b->icon_file)[1]!=0))
{
b->flags|=b_Icon;
@@ -1211,15 +1429,16 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
}
else
if(b->icon_file)free(b->icon_file);
-@@ -1370,6 +1432,7 @@
+@@ -1370,6 +1488,8 @@
"pixmap",
"boxsize",
"colorset",
+ "hovercolorset",
++ "presscolorset",
NULL
};
int i,j,k;
-@@ -1468,6 +1531,20 @@
+@@ -1468,6 +1588,34 @@
ub->c->flags &= ~b_Colorset;
}
break;
@@ -1237,6 +1456,20 @@ diff -u fvwm-2.5.10/modules/FvwmButtons/parse.c fvwm/modules/FvwmButtons/parse.c
+ }
+ break;
+
++ case 14: /* PressColorset */
++ i = sscanf(s, "%d", &j);
++ if (i > 0)
++ {
++ ub->c->pressColorset = j;
++ ub->c->flags |= b_PressColorset;
++ AllocColorset(j);
++ }
++ else
++ {
++ ub->c->flags &= ~b_PressColorset;
++ }
++ break;
++
default:
s = trimleft(s);
ParseButton(ubb,s);