? FvwmButtons-tips.patch
Index: libs/FTips.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/libs/FTips.c,v
retrieving revision 1.4
diff -u -r1.4 FTips.c
--- libs/FTips.c	27 Jan 2007 11:33:16 -0000	1.4
+++ libs/FTips.c	21 Feb 2007 07:14:20 -0000
@@ -505,7 +505,7 @@
 	if (fc == NULL)
 	{
 		fc = default_config;
-	}
+	} 
 	current_config = fc;
 
 	if (label != NULL)
Index: modules/FvwmButtons/FvwmButtons.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.c,v
retrieving revision 1.204
diff -u -r1.204 FvwmButtons.c
--- modules/FvwmButtons/FvwmButtons.c	28 Jan 2007 15:38:40 -0000	1.204
+++ modules/FvwmButtons/FvwmButtons.c	21 Feb 2007 07:14:23 -0000
@@ -62,6 +62,7 @@
 #include "libs/Colorset.h"
 #include "libs/vpacket.h"
 #include "libs/FRender.h"
+#include "libs/FTips.h"
 #include "libs/fsm.h"
 #include "libs/ColorUtils.h"
 #include "libs/Graphics.h"
@@ -932,6 +933,7 @@
 			button_info *tmp = ActiveButton;
 			ActiveButton = b;
 			RedrawButton(tmp, DRAW_FORCE, NULL);
+			
 		}
 		if (b->flags.b_ActiveIcon || b->flags.b_ActiveTitle ||
 		    UberButton->c->flags.b_ActiveColorset)
@@ -1085,6 +1087,9 @@
 
 	tmp.name = NULL;
 	tmp.name_list = NULL;
+
+	FTipsInit(Dpy);
+
 	while ( !isTerminated )
 	{
 		if (My_FNextEvent(Dpy, &Event))
@@ -1210,6 +1215,10 @@
 	  if (!event.xconfigure.send_event &&
 	      Event.xconfigure.window != MyWindow)
 	    continue;
+
+	  if(FTipsHandleEvents(Dpy, &event))
+		  continue;
+
 	  Event.xconfigure.x = event.xconfigure.x;
 	  Event.xconfigure.y = event.xconfigure.y;
 	  Event.xconfigure.send_event = True;
@@ -1252,10 +1261,33 @@
 	case EnterNotify:
 		b = handle_new_position(
 			b, Event.xcrossing.x, Event.xcrossing.y);
+
+		if(Event.xcrossing.mode == NotifyNormal)
+		{
+			b = handle_new_position(
+			b, Event.xcrossing.x, Event.xcrossing.y);
+			FTipsOn(Dpy,MyWindow,UberButton->c->tips_config, 
+			    (void *)UberButton, b->tipslabel, 
+			    b->x, b->y, Width,Height);
+			FTipsUpdateLabel(Dpy, b->tipslabel);
+		}
 		break;
 
 	case MotionNotify:
+
 		b = handle_new_position(b, Event.xmotion.x, Event.xmotion.y);
+			
+		x = Event.xbutton.x;
+		y = Event.xbutton.y;	
+
+		if(b->tipslabel != NULL)
+		{
+			FTipsOn(Dpy,MyWindow,UberButton->c->tips_config, (void *)UberButton, b->tipslabel, x, y, w, h);
+			FTipsUpdateLabel(Dpy, b->tipslabel);
+		} else {
+			 FTipsCancel(Dpy);
+		}
+		
 		break;
 
 	case LeaveNotify:
@@ -1268,11 +1300,13 @@
 				b = ActiveButton;
 				ActiveButton = NULL;
 				RedrawButton(b, DRAW_FORCE, NULL);
+
 			}
 			if (CurrentButton)
 			{
 				RedrawButton(b, DRAW_FORCE, NULL);
 			}
+			FTipsCancel(Dpy);
 		}
 		break;
 	}
@@ -1294,8 +1328,8 @@
 	  Window dummy;
 
 	  XTranslateCoordinates(
-	    Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
-	    Event.xbutton.y, &x, &y, &dummy);
+			  Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
+			  Event.xbutton.y, &x, &y, &dummy);
 	}
 	if (CurrentButton)
 	{
@@ -1337,7 +1371,10 @@
 	  RedrawButton(tmp, DRAW_FORCE, NULL);
 	}
 	else
+	{
 	  RedrawButton(b, DRAW_FORCE, NULL);
+	}
+	  
 	if (!act)
 	{
 	  break;
Index: modules/FvwmButtons/FvwmButtons.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.h,v
retrieving revision 1.52
diff -u -r1.52 FvwmButtons.h
--- modules/FvwmButtons/FvwmButtons.h	10 Feb 2006 12:33:22 -0000	1.52
+++ modules/FvwmButtons/FvwmButtons.h	21 Feb 2007 07:14:23 -0000
@@ -38,6 +38,8 @@
 #include "libs/fvwmlib.h"
 #include "libs/Picture.h"
 #include "libs/Flocale.h"
+#include "libs/FTips.h"
+#define FONT_STRING "-*-fixed-medium-r-normal--13-*"
 
 /* ------------------------------- structs --------------------------------- */
 
@@ -81,6 +83,7 @@
 	unsigned b_PressIcon      : 1; /* Use alternate Icon on press */
 	unsigned b_PressColorset  : 1; /* Use alternate Colorset on press */
 	unsigned b_PressTitle     : 1; /* Use alternate Title text on press */
+	unsigned b_UseTips	  : 1; /* Whether to use tips or not. */	
 } flags_type;
 
 /* Flags for b->swallow */
@@ -130,6 +133,9 @@
 	int colorset;              /* b_Colorset */
 	int activeColorset;        /* b_ActiveColorset */
 	int pressColorset;         /* b_PressColorset */
+	char *tipsfont;		   /* b_TipsFont*/
+	ftips_config *tips_config; /* Struct that holds tips info.*/
+
 	Pixel fc;                  /* b_Fore */
 	Pixel bc, hc, sc;          /* b_Back && !b_IconBack */
 	FvwmPicture *backicon;     /* b_Back && b_IconBack */
@@ -186,6 +192,7 @@
 	FvwmPicture *pressicon;  /* b_PressIcon */
 	int activeColorset;      /* b_ActiveColorset */
 	int pressColorset;       /* b_PressColorset */
+	char *tipslabel;	 /* b_TipsLabel */
 	Window IconWin;          /* b_Swallow */
 	Window PanelWin;         /* b_Panel */
 	Window BackIconWin;      /* b_Back && b_IconBack */
Index: modules/FvwmButtons/parse.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/parse.c,v
retrieving revision 1.95
diff -u -r1.95 parse.c
--- modules/FvwmButtons/parse.c	27 Jan 2007 11:33:16 -0000	1.95
+++ modules/FvwmButtons/parse.c	21 Feb 2007 07:14:24 -0000
@@ -889,6 +889,7 @@
 			"presstitle",
 			"activecolorset",
 			"presscolorset",
+			"tipslabel",
 			NULL
 		};
 		s = trimleft(s);
@@ -1627,7 +1628,33 @@
 					b->flags.b_PressColorset = 0;
 				}
 				break;
+			/* --------- TipsLabel ---------*/
+			case 27:
+				s = trimleft(s);
+				t = seekright(&s);
+				if(ub->c->flags.b_UseTips)
+				{
+					if (*s == '(')
+					{
+						fprintf(stderr,
+						"%s: justification not allowed "
+						"for TipsLabel.\n", MyName);
+					}
+					
+					
+
+					if (t && *t && (t[0] != '-' || t[1] != 0))
+					{
+						if (b->tipslabel != NULL)
+						{
+							free(b->tipslabel);
+						} else {
+							b->tipslabel = t;
+						}
+					}
+				}
 
+				break;
 			/* --------------- --------------- */
 			default:
 				t = seekright(&s);
@@ -1780,6 +1807,14 @@
 		"colorset",
 		"activecolorset",
 		"presscolorset",
+		"usetips",
+		"tipsfont",
+		"tipsdelay",
+		"tipscolorset",
+		"tipsborderwidth",
+		"tipsplacement",
+		"tipsjustification",
+		"tipsoffset",
 		NULL
 	};
 	int i, j, k;
@@ -1927,7 +1962,97 @@
 			ub->c->flags.b_PressColorset = 0;
 		}
 		break;
+	case 15: /* UseTips */
+		/* We're using tips.*/
+		ub->c->flags.b_UseTips = 1;
+
+		/* Set the defaults up. */
+		ub->c->tips_config = FTipsNewConfig();
+
+		/* Include fonts. */
+		CopyStringWithQuotes(&ub->c->tipsfont,FONT_STRING);
+		ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy, 
+				ub->c->tipsfont, MyName);
+		break;
+	case 16: /* TipsFont */
+		if(ub->c->flags.b_UseTips)
+		{
+			CopyStringWithQuotes(&ub->c->tipsfont,s);
 
+		ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy, ub->c->tipsfont, 
+				MyName);
+		}
+				
+		break;
+	case 17: /*TipsDelay */
+		if(ub->c->flags.b_UseTips)
+		{
+			i = sscanf(s, "%d %d", &j, &k);
+			if( i > 0)
+			{
+				/* Then only one value was given.  Set the
+				 * mapped_delay option to this given value
+				 * also since it's optional. 
+				 */
+				ub->c->tips_config->delay = ub->c->tips_config->mapped_delay = j;
+			}
+			if( i > 1)
+			{
+				/* Two values passed in.  We only need to
+				 * change the value for mapped_delay here.
+				 */
+
+				ub->c->tips_config->mapped_delay = k;
+
+			}
+		}
+			break;
+	case 18: /* TipsColorset */
+		if (ub->c->flags.b_UseTips)
+		{
+			i = sscanf(s, "%d", &j);
+			if (i > 0)
+			{
+				ub->c->tips_config->colorset = j;
+				AllocColorset(j);
+			}
+		}
+		break;
+	case 19: /* TipsBorderWidth */
+		if (ub->c->flags.b_UseTips)
+		{
+			i = sscanf(s, "%d", &j);
+
+			if(i > 0)
+			{
+				ub->c->tips_config->border_width = j;
+			}
+		}
+		break;
+	case 20: /* TipsPlacement */
+		if(ub->c->flags.b_UseTips)
+		{
+			s = trimleft(s);
+
+			/* Options ... */
+			if(!strcasecmp(s, "up"))
+			{
+				i = FTIPS_PLACEMENT_UP;
+			} else if(!strcasecmp(s, "down")) {
+				i = FTIPS_PLACEMENT_DOWN;
+			} else if(!strcasecmp(s, "left")) {
+				i = FTIPS_PLACEMENT_LEFT;
+			} else if(!strcasecmp(s, "right")) {
+				i = FTIPS_PLACEMENT_RIGHT;
+			} else if(!strcasecmp(s, "updown")) {
+				i = FTIPS_PLACEMENT_AUTO_UPDOWN;
+			} else if(!strcasecmp(s, "leftright")) {
+				i = FTIPS_PLACEMENT_AUTO_LEFTRIGHT;
+			}
+
+			ub->c->tips_config->placement = i;
+		}
+			break;
 	default:
 		s = trimleft(s);
 		ParseButton(ubb, s);
