updated on Fri Jan 6 00:09:29 UTC 2012
[aur-mirror.git] / fvwm-patched / 12-FvwmButtonsTips.patch
blob933c6bc448b041e2ee23eb8e63ef15c5ca32a9d3
1 ? FvwmButtons-tips.patch
2 Index: libs/FTips.c
3 ===================================================================
4 RCS file: /home/cvs/fvwm/fvwm/libs/FTips.c,v
5 retrieving revision 1.4
6 diff -u -r1.4 FTips.c
7 --- libs/FTips.c 27 Jan 2007 11:33:16 -0000 1.4
8 +++ libs/FTips.c 21 Feb 2007 07:14:20 -0000
9 @@ -505,7 +505,7 @@
10 if (fc == NULL)
12 fc = default_config;
13 - }
14 + }
15 current_config = fc;
17 if (label != NULL)
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
25 @@ -62,6 +62,7 @@
26 #include "libs/Colorset.h"
27 #include "libs/vpacket.h"
28 #include "libs/FRender.h"
29 +#include "libs/FTips.h"
30 #include "libs/fsm.h"
31 #include "libs/ColorUtils.h"
32 #include "libs/Graphics.h"
33 @@ -932,6 +933,7 @@
34 button_info *tmp = ActiveButton;
35 ActiveButton = b;
36 RedrawButton(tmp, DRAW_FORCE, NULL);
39 if (b->flags.b_ActiveIcon || b->flags.b_ActiveTitle ||
40 UberButton->c->flags.b_ActiveColorset)
41 @@ -1085,6 +1087,9 @@
43 tmp.name = NULL;
44 tmp.name_list = NULL;
46 + FTipsInit(Dpy);
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)
54 continue;
56 + if(FTipsHandleEvents(Dpy, &event))
57 + continue;
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 @@
63 case EnterNotify:
64 b = handle_new_position(
65 b, Event.xcrossing.x, Event.xcrossing.y);
67 + if(Event.xcrossing.mode == NotifyNormal)
68 + {
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);
75 + }
76 break;
78 case MotionNotify:
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)
86 + {
87 + FTipsOn(Dpy,MyWindow,UberButton->c->tips_config, (void *)UberButton, b->tipslabel, x, y, w, h);
88 + FTipsUpdateLabel(Dpy, b->tipslabel);
89 + } else {
90 + FTipsCancel(Dpy);
91 + }
93 break;
95 case LeaveNotify:
96 @@ -1268,11 +1300,13 @@
97 b = ActiveButton;
98 ActiveButton = NULL;
99 RedrawButton(b, DRAW_FORCE, NULL);
102 if (CurrentButton)
104 RedrawButton(b, DRAW_FORCE, NULL);
106 + FTipsCancel(Dpy);
108 break;
110 @@ -1294,8 +1328,8 @@
111 Window dummy;
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);
119 if (CurrentButton)
121 @@ -1337,7 +1371,10 @@
122 RedrawButton(tmp, DRAW_FORCE, NULL);
124 else
126 RedrawButton(b, DRAW_FORCE, NULL);
129 if (!act)
131 break;
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
139 @@ -38,6 +38,8 @@
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 --------------------------------- */
148 @@ -81,6 +83,7 @@
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. */
153 } flags_type;
155 /* Flags for b->swallow */
156 @@ -130,6 +133,9 @@
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 */
166 @@ -186,6 +192,7 @@
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
181 @@ -889,7 +889,8 @@
182 "presstitle",
183 "activecolorset",
184 "presscolorset",
185 + "tipslabel",
186 "top",
187 NULL
189 s = trimleft(s);
190 @@ -1627,7 +1628,33 @@
191 b->flags.b_PressColorset = 0;
193 break;
194 + /* --------- TipsLabel ---------*/
195 + case 28:
196 + s = trimleft(s);
197 + t = seekright(&s);
198 + if(ub->c->flags.b_UseTips)
200 + if (*s == '(')
202 + fprintf(stderr,
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);
214 + } else {
215 + b->tipslabel = t;
220 + break;
221 /* --------------- --------------- */
222 default:
223 t = seekright(&s);
224 @@ -1780,6 +1807,14 @@
225 "colorset",
226 "activecolorset",
227 "presscolorset",
228 + "usetips",
229 + "tipsfont",
230 + "tipsdelay",
231 + "tipscolorset",
232 + "tipsborderwidth",
233 + "tipsplacement",
234 + "tipsjustification",
235 + "tipsoffset",
236 NULL
238 int i, j, k;
239 @@ -1927,7 +1962,97 @@
240 ub->c->flags.b_PressColorset = 0;
242 break;
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);
254 + break;
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,
261 + MyName);
264 + break;
265 + case 17: /*TipsDelay */
266 + if(ub->c->flags.b_UseTips)
268 + i = sscanf(s, "%d %d", &j, &k);
269 + if( i > 0)
271 + /* Then only one value was given. Set the
272 + * mapped_delay option to this given value
273 + * also since it's optional.
274 + */
275 + ub->c->tips_config->delay = ub->c->tips_config->mapped_delay = j;
277 + if( i > 1)
279 + /* Two values passed in. We only need to
280 + * change the value for mapped_delay here.
281 + */
283 + ub->c->tips_config->mapped_delay = k;
287 + break;
288 + case 18: /* TipsColorset */
289 + if (ub->c->flags.b_UseTips)
291 + i = sscanf(s, "%d", &j);
292 + if (i > 0)
294 + ub->c->tips_config->colorset = j;
295 + AllocColorset(j);
298 + break;
299 + case 19: /* TipsBorderWidth */
300 + if (ub->c->flags.b_UseTips)
302 + i = sscanf(s, "%d", &j);
304 + if(i > 0)
306 + ub->c->tips_config->border_width = j;
309 + break;
310 + case 20: /* TipsPlacement */
311 + if(ub->c->flags.b_UseTips)
313 + s = trimleft(s);
315 + /* Options ... */
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;
333 + break;
334 default:
335 s = trimleft(s);
336 ParseButton(ubb, s);