1 ? FvwmButtons-tips.patch
3 ===================================================================
4 RCS file: /home/cvs/fvwm/fvwm/libs/FTips.c,v
5 retrieving revision 1.4
7 --- libs/FTips.c 27 Jan 2007 11:33:16 -0000 1.4
8 +++ libs/FTips.c 21 Feb 2007 07:14:20 -0000
18 Index: modules/FvwmButtons/FvwmButtons.c
19 ===================================================================
20 RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.c,v
21 retrieving revision 1.204
22 diff -u -r1.204 FvwmButtons.c
23 --- modules/FvwmButtons/FvwmButtons.c 28 Jan 2007 15:38:40 -0000 1.204
24 +++ modules/FvwmButtons/FvwmButtons.c 21 Feb 2007 07:14:23 -0000
26 #include "libs/Colorset.h"
27 #include "libs/vpacket.h"
28 #include "libs/FRender.h"
29 +#include "libs/FTips.h"
31 #include "libs/ColorUtils.h"
32 #include "libs/Graphics.h"
34 button_info *tmp = ActiveButton;
36 RedrawButton(tmp, DRAW_FORCE, NULL);
39 if (b->flags.b_ActiveIcon || b->flags.b_ActiveTitle ||
40 UberButton->c->flags.b_ActiveColorset)
48 while ( !isTerminated )
50 if (My_FNextEvent(Dpy, &Event))
51 @@ -1210,6 +1215,10 @@
52 if (!event.xconfigure.send_event &&
53 Event.xconfigure.window != MyWindow)
56 + if(FTipsHandleEvents(Dpy, &event))
59 Event.xconfigure.x = event.xconfigure.x;
60 Event.xconfigure.y = event.xconfigure.y;
61 Event.xconfigure.send_event = True;
62 @@ -1252,10 +1261,33 @@
64 b = handle_new_position(
65 b, Event.xcrossing.x, Event.xcrossing.y);
67 + if(Event.xcrossing.mode == NotifyNormal)
69 + b = handle_new_position(
70 + b, Event.xcrossing.x, Event.xcrossing.y);
71 + FTipsOn(Dpy,MyWindow,UberButton->c->tips_config,
72 + (void *)UberButton, b->tipslabel,
73 + b->x, b->y, Width,Height);
74 + FTipsUpdateLabel(Dpy, b->tipslabel);
80 b = handle_new_position(b, Event.xmotion.x, Event.xmotion.y);
82 + x = Event.xbutton.x;
83 + y = Event.xbutton.y;
85 + if(b->tipslabel != NULL)
87 + FTipsOn(Dpy,MyWindow,UberButton->c->tips_config, (void *)UberButton, b->tipslabel, x, y, w, h);
88 + FTipsUpdateLabel(Dpy, b->tipslabel);
96 @@ -1268,11 +1300,13 @@
99 RedrawButton(b, DRAW_FORCE, NULL);
104 RedrawButton(b, DRAW_FORCE, NULL);
110 @@ -1294,8 +1328,8 @@
113 XTranslateCoordinates(
114 - Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
115 - Event.xbutton.y, &x, &y, &dummy);
116 + Dpy, Event.xbutton.window, MyWindow, Event.xbutton.x,
117 + Event.xbutton.y, &x, &y, &dummy);
121 @@ -1337,7 +1371,10 @@
122 RedrawButton(tmp, DRAW_FORCE, NULL);
126 RedrawButton(b, DRAW_FORCE, NULL);
132 Index: modules/FvwmButtons/FvwmButtons.h
133 ===================================================================
134 RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.h,v
135 retrieving revision 1.52
136 diff -u -r1.52 FvwmButtons.h
137 --- modules/FvwmButtons/FvwmButtons.h 10 Feb 2006 12:33:22 -0000 1.52
138 +++ modules/FvwmButtons/FvwmButtons.h 21 Feb 2007 07:14:23 -0000
140 #include "libs/fvwmlib.h"
141 #include "libs/Picture.h"
142 #include "libs/Flocale.h"
143 +#include "libs/FTips.h"
144 +#define FONT_STRING "-*-fixed-medium-r-normal--13-*"
146 /* ------------------------------- structs --------------------------------- */
149 unsigned b_PressIcon : 1; /* Use alternate Icon on press */
150 unsigned b_PressColorset : 1; /* Use alternate Colorset on press */
151 unsigned b_PressTitle : 1; /* Use alternate Title text on press */
152 + unsigned b_UseTips : 1; /* Whether to use tips or not. */
155 /* Flags for b->swallow */
157 int colorset; /* b_Colorset */
158 int activeColorset; /* b_ActiveColorset */
159 int pressColorset; /* b_PressColorset */
160 + char *tipsfont; /* b_TipsFont*/
161 + ftips_config *tips_config; /* Struct that holds tips info.*/
163 Pixel fc; /* b_Fore */
164 Pixel bc, hc, sc; /* b_Back && !b_IconBack */
165 FvwmPicture *backicon; /* b_Back && b_IconBack */
167 FvwmPicture *pressicon; /* b_PressIcon */
168 int activeColorset; /* b_ActiveColorset */
169 int pressColorset; /* b_PressColorset */
170 + char *tipslabel; /* b_TipsLabel */
171 Window IconWin; /* b_Swallow */
172 Window PanelWin; /* b_Panel */
173 Window BackIconWin; /* b_Back && b_IconBack */
174 Index: modules/FvwmButtons/parse.c
175 ===================================================================
176 RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/parse.c,v
177 retrieving revision 1.95
178 diff -u -r1.95 parse.c
179 --- modules/FvwmButtons/parse.c 27 Jan 2007 11:33:16 -0000 1.95
180 +++ modules/FvwmButtons/parse.c 21 Feb 2007 07:14:24 -0000
190 @@ -1627,7 +1628,33 @@
191 b->flags.b_PressColorset = 0;
194 + /* --------- TipsLabel ---------*/
198 + if(ub->c->flags.b_UseTips)
203 + "%s: justification not allowed "
204 + "for TipsLabel.\n", MyName);
209 + if (t && *t && (t[0] != '-' || t[1] != 0))
211 + if (b->tipslabel != NULL)
213 + free(b->tipslabel);
221 /* --------------- --------------- */
224 @@ -1780,6 +1807,14 @@
234 + "tipsjustification",
239 @@ -1927,7 +1962,97 @@
240 ub->c->flags.b_PressColorset = 0;
243 + case 15: /* UseTips */
244 + /* We're using tips.*/
245 + ub->c->flags.b_UseTips = 1;
247 + /* Set the defaults up. */
248 + ub->c->tips_config = FTipsNewConfig();
250 + /* Include fonts. */
251 + CopyStringWithQuotes(&ub->c->tipsfont,FONT_STRING);
252 + ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy,
253 + ub->c->tipsfont, MyName);
255 + case 16: /* TipsFont */
256 + if(ub->c->flags.b_UseTips)
258 + CopyStringWithQuotes(&ub->c->tipsfont,s);
260 + ub->c->tips_config->Ffont = FlocaleLoadFont(Dpy, ub->c->tipsfont,
265 + case 17: /*TipsDelay */
266 + if(ub->c->flags.b_UseTips)
268 + i = sscanf(s, "%d %d", &j, &k);
271 + /* Then only one value was given. Set the
272 + * mapped_delay option to this given value
273 + * also since it's optional.
275 + ub->c->tips_config->delay = ub->c->tips_config->mapped_delay = j;
279 + /* Two values passed in. We only need to
280 + * change the value for mapped_delay here.
283 + ub->c->tips_config->mapped_delay = k;
288 + case 18: /* TipsColorset */
289 + if (ub->c->flags.b_UseTips)
291 + i = sscanf(s, "%d", &j);
294 + ub->c->tips_config->colorset = j;
299 + case 19: /* TipsBorderWidth */
300 + if (ub->c->flags.b_UseTips)
302 + i = sscanf(s, "%d", &j);
306 + ub->c->tips_config->border_width = j;
310 + case 20: /* TipsPlacement */
311 + if(ub->c->flags.b_UseTips)
316 + if(!strcasecmp(s, "up"))
318 + i = FTIPS_PLACEMENT_UP;
319 + } else if(!strcasecmp(s, "down")) {
320 + i = FTIPS_PLACEMENT_DOWN;
321 + } else if(!strcasecmp(s, "left")) {
322 + i = FTIPS_PLACEMENT_LEFT;
323 + } else if(!strcasecmp(s, "right")) {
324 + i = FTIPS_PLACEMENT_RIGHT;
325 + } else if(!strcasecmp(s, "updown")) {
326 + i = FTIPS_PLACEMENT_AUTO_UPDOWN;
327 + } else if(!strcasecmp(s, "leftright")) {
328 + i = FTIPS_PLACEMENT_AUTO_LEFTRIGHT;
331 + ub->c->tips_config->placement = i;