1 diff -U3 -r libs/FTips.c libs/FTips.c
2 --- libs/FTips.c 2007-01-27 12:33:16.000000000 +0100
3 +++ libs/FTips.c 2011-12-09 21:42:01.022148670 +0100
13 diff -U3 -r modules/FvwmButtons/FvwmButtons.c modules/FvwmButtons/FvwmButtons.c
14 --- modules/FvwmButtons/FvwmButtons.c 2011-08-27 23:51:29.000000000 +0200
15 +++ modules/FvwmButtons/FvwmButtons.c 2011-12-09 21:42:01.022148670 +0100
17 #include "libs/Colorset.h"
18 #include "libs/vpacket.h"
19 #include "libs/FRender.h"
20 +#include "libs/FTips.h"
22 #include "libs/ColorUtils.h"
23 #include "libs/Graphics.h"
25 button_info *tmp = ActiveButton;
27 RedrawButton(tmp, DRAW_FORCE, NULL);
31 b->flags.b_ActiveIcon ||
39 while ( !isTerminated )
41 if (My_FNextEvent(Dpy, &Event))
42 @@ -1186,6 +1191,10 @@
43 if (!event.xconfigure.send_event &&
44 Event.xconfigure.window != MyWindow)
47 + if(FTipsHandleEvents(Dpy, &event))
50 Event.xconfigure.x = event.xconfigure.x;
51 Event.xconfigure.y = event.xconfigure.y;
52 Event.xconfigure.send_event = True;
53 @@ -1228,10 +1237,33 @@
55 b = handle_new_position(
56 b, Event.xcrossing.x, Event.xcrossing.y);
58 + if(Event.xcrossing.mode == NotifyNormal)
60 + b = handle_new_position(
61 + b, Event.xcrossing.x, Event.xcrossing.y);
62 + FTipsOn(Dpy,MyWindow,UberButton->c->tips_config,
63 + (void *)UberButton, b->tipslabel,
64 + b->x, b->y, Width,Height);
65 + FTipsUpdateLabel(Dpy, b->tipslabel);
71 b = handle_new_position(b, Event.xmotion.x, Event.xmotion.y);
73 + x = Event.xbutton.x;
74 + y = Event.xbutton.y;
76 + if(b->tipslabel != NULL)
78 + FTipsOn(Dpy,MyWindow,UberButton->c->tips_config, (void *)UberButton, b->tipslabel, x, y, w, h);
79 + FTipsUpdateLabel(Dpy, b->tipslabel);
87 @@ -1254,11 +1286,13 @@
90 RedrawButton(b, DRAW_FORCE, NULL);
95 RedrawButton(b, DRAW_FORCE, NULL);
101 @@ -1280,8 +1314,8 @@
104 XTranslateCoordinates(
105 - Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
106 - Event.xbutton.y, &x, &y, &dummy);
107 + Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
108 + Event.xbutton.y, &x, &y, &dummy);
112 @@ -1323,7 +1357,10 @@
113 RedrawButton(tmp, DRAW_FORCE, NULL);
117 RedrawButton(b, DRAW_FORCE, NULL);
123 diff -U3 -r modules/FvwmButtons/FvwmButtons.h modules/FvwmButtons/FvwmButtons.h
124 --- modules/FvwmButtons/FvwmButtons.h 2008-04-05 12:02:45.000000000 +0200
125 +++ modules/FvwmButtons/FvwmButtons.h 2011-12-09 21:42:01.022148670 +0100
127 #include "libs/fvwmlib.h"
128 #include "libs/Picture.h"
129 #include "libs/Flocale.h"
130 +#include "libs/FTips.h"
131 +#define FONT_STRING "-*-fixed-medium-r-normal--13-*"
133 /* ------------------------------- structs --------------------------------- */
136 unsigned b_PressIcon : 1; /* Use alternate Icon on press */
137 unsigned b_PressColorset : 1; /* Use alternate Colorset on press */
138 unsigned b_PressTitle : 1; /* Use alternate Title text on press */
139 + unsigned b_UseTips : 1; /* Whether to use tips or not. */
142 /* Flags for b->swallow */
144 int colorset; /* b_Colorset */
145 int activeColorset; /* b_ActiveColorset */
146 int pressColorset; /* b_PressColorset */
147 + char *tipsfont; /* b_TipsFont*/
148 + ftips_config *tips_config; /* Struct that holds tips info.*/
150 Pixel fc; /* b_Fore */
151 Pixel bc, hc, sc; /* b_Back && !b_IconBack */
152 FvwmPicture *backicon; /* b_Back && b_IconBack */
154 FvwmPicture *pressicon; /* b_PressIcon */
155 int activeColorset; /* b_ActiveColorset */
156 int pressColorset; /* b_PressColorset */
157 + char *tipslabel; /* b_TipsLabel */
158 Window IconWin; /* b_Swallow */
159 Window PanelWin; /* b_Panel */
160 Window BackIconWin; /* b_Back && b_IconBack */
161 diff -U3 -r modules/FvwmButtons/parse.c modules/FvwmButtons/parse.c
162 --- modules/FvwmButtons/parse.c 2008-04-05 12:02:45.000000000 +0200
163 +++ modules/FvwmButtons/parse.c 2011-12-09 21:42:01.025481917 +0100
172 @@ -1612,7 +1613,33 @@
173 b->flags.b_ActiveColorset = 0;
176 + /* --------- TipsLabel ---------*/
180 + if(ub->c->flags.b_UseTips)
185 + "%s: justification not allowed "
186 + "for TipsLabel.\n", MyName);
191 + if (t && *t && (t[0] != '-' || t[1] != 0))
193 + if (b->tipslabel != NULL)
195 + free(b->tipslabel);
203 /* --------------- --------------- */
204 case 26: /* PressColorset */
205 i = strtol(s, &t, 10);
206 @@ -1784,6 +1811,14 @@
216 + "tipsjustification",
221 @@ -1931,7 +1966,97 @@
222 ub->c->flags.b_PressColorset = 0;
225 + case 15: /* UseTips */
226 + /* We're using tips.*/
227 + ub->c->flags.b_UseTips = 1;
229 + /* Set the defaults up. */
230 + ub->c->tips_config = FTipsNewConfig();
232 + /* Include fonts. */
233 + CopyStringWithQuotes(&ub->c->tipsfont,FONT_STRING);
234 + ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy,
235 + ub->c->tipsfont, MyName);
237 + case 16: /* TipsFont */
238 + if(ub->c->flags.b_UseTips)
240 + CopyStringWithQuotes(&ub->c->tipsfont,s);
242 + ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy, ub->c->tipsfont,
247 + case 17: /*TipsDelay */
248 + if(ub->c->flags.b_UseTips)
250 + i = sscanf(s, "%d %d", &j, &k);
253 + /* Then only one value was given. Set the
254 + * mapped_delay option to this given value
255 + * also since it's optional.
257 + ub->c->tips_config->delay = ub->c->tips_config->mapped_delay = j;
261 + /* Two values passed in. We only need to
262 + * change the value for mapped_delay here.
265 + ub->c->tips_config->mapped_delay = k;
270 + case 18: /* TipsColorset */
271 + if (ub->c->flags.b_UseTips)
273 + i = sscanf(s, "%d", &j);
276 + ub->c->tips_config->colorset = j;
281 + case 19: /* TipsBorderWidth */
282 + if (ub->c->flags.b_UseTips)
284 + i = sscanf(s, "%d", &j);
288 + ub->c->tips_config->border_width = j;
292 + case 20: /* TipsPlacement */
293 + if(ub->c->flags.b_UseTips)
298 + if(!strcasecmp(s, "up"))
300 + i = FTIPS_PLACEMENT_UP;
301 + } else if(!strcasecmp(s, "down")) {
302 + i = FTIPS_PLACEMENT_DOWN;
303 + } else if(!strcasecmp(s, "left")) {
304 + i = FTIPS_PLACEMENT_LEFT;
305 + } else if(!strcasecmp(s, "right")) {
306 + i = FTIPS_PLACEMENT_RIGHT;
307 + } else if(!strcasecmp(s, "updown")) {
308 + i = FTIPS_PLACEMENT_AUTO_UPDOWN;
309 + } else if(!strcasecmp(s, "leftright")) {
310 + i = FTIPS_PLACEMENT_AUTO_LEFTRIGHT;
313 + ub->c->tips_config->placement = i;