summaryrefslogtreecommitdiff
blob: 9f6da79c8aa5170f1efa91c51a239b4f2482463c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
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
@@ -298,6 +298,11 @@
 
 int buttonColorset(button_info *b)
 {
+  if (b == HoverButton && UberButton->c->flags & b_HoverColorset)
+  {
+    return UberButton->c->hoverColorset;
+  }
+
   if (b->flags & b_Colorset)
     return b->colorset;
   else if (b->flags & b_Container && b->c->flags & b_Colorset)
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
@@ -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 */
 
-  /* For now, use the old routine in icons.h for buttons with icons */
-  if(b->flags&b_Icon && !(b->flags&b_IconAlpha))
-  {
-    ConfigureIconWindow(b, NULL);
-  }
   /* For now, hardcoded window centered, title bottom centered, below window */
   if(buttonSwallowCount(b)==3 && (b->flags & b_Swallow))
   {
@@ -188,13 +183,13 @@
 *** draw can be:
 *** DRAW_RELIEF: draw only the relief
 *** DRAW_CLEAN:  draw the relief, the foreground bg if any and if this
-*** the case draw the title and the icon if b_IconAlpha. This is safe
+*** the case draw the title and the icon if b_Icon. This is safe
 *** but the button background may be not repaint (if the bg of the button
 *** come from a parent button).
-*** DRAW_ALL: as above but draw the title and the icon if b_IconAlpha in
-*** any case. WARRNING: the title and the icon (b_IconAlpha) must be cleaned:
+*** DRAW_ALL: as above but draw the title and the icon if b_Icon in
+*** any case. WARRNING: the title and the icon (b_Icon) must be cleaned:
 *** if the button has a bg this is the case, but if the bg of the button
-*** come from a parent button this is not the case and xft title and alpha
+*** come from a parent button this is not the case and xft title and
 *** icons will be not draw correctly.
 *** So DRAW_ALL is ok only when you draw buttons recursively.
 *** DRAW_FORCE: draw the button and its parent fg bg. Use this only if
@@ -222,6 +217,9 @@
 	Bool clean = False;
 	Bool cleaned = False;
 	Bool clear_bg = False;
+	unsigned long iconFlag, otherIconFlag;
+	Bool has_title;
+	FvwmPicture *pic;
 
 	cset = buttonColorset(b);
 	if (cset >= 0)
@@ -246,8 +244,8 @@
 
 	/* This probably isn't the place for this, but it seems to work here
 	 * and not elsewhere, so... */
-	if((b->flags & b_Swallow) && (buttonSwallowCount(b)==3) &&
-	   b->IconWin!=None)
+	if ((b->flags & b_Swallow) && (buttonSwallowCount(b) == 3) &&
+		b->IconWin != None)
 	{
 		XSetWindowBorderWidth(Dpy,b->IconWin,0);
 	}
@@ -357,6 +355,28 @@
 	of = f;
 	f=abs(f);
 
+	iconFlag = b_Icon;
+	otherIconFlag = b_HoverIcon;
+	has_title = (b->flags & b_Title ? True : False);
+	pic = b->icon;
+	if (b == HoverButton)
+	{
+		/* If no HoverIcon is specified, we use Icon (if there is
+		   one). */
+		if (b->flags & b_HoverIcon)
+		{
+			iconFlag = b_HoverIcon;
+			otherIconFlag = b_Icon;
+			pic = b->hovericon;
+		}
+		/* If no HoverTitle is specified, we use Title (if there is
+		   one). */
+		if (b->flags & b_HoverTitle)
+		{
+			has_title = True;
+		}
+	}
+
 	if (draw == DRAW_CLEAN)
 	{
 		clean = True;
@@ -498,39 +518,60 @@
 			if (do_draw)
 			{
 				cleaned = True;
-				XFillRectangle(
-					Dpy,MyWindow,NormalGC,
-					clip.x,clip.y,clip.width,clip.height);
+				if (b == HoverButton &&
+					UberButton->c->flags & b_HoverColorset)
+				{
+					SetRectangleBackground(Dpy, MyWindow,
+						clip.x, clip.y, clip.width,
+						clip.height,
+						&Colorset[UberButton->c->hoverColorset],
+						Pdepth, NormalGC);
+				}
+				else
+				{
+					XFillRectangle(Dpy, MyWindow, NormalGC,
+						clip.x, clip.y, clip.width,
+						clip.height);
+				}
 			}
 		}
 		else if (clear_bg ||
 			 (pev && !buttonBackgroundButton(b,NULL) &&
 			  ((b->flags&b_Title && Ffont && Ffont->fftf.fftfont) ||
-			   (b->flags&b_Icon && b->flags&b_IconAlpha))))
+			   (b->flags&b_Icon))))
 		{
 			/* some times we need to clear the real bg.
 			 * The pev expose rectangle can be bigger than the real
 			 * exposed part (as we rectangle flush and pev can
 			 * be a fake event) so we need to clear with xft font
-			 * and icons with alpha */
+			 * and icons. */
 			if (do_draw)
 			{
 				cleaned = True;
-				XClearArea(
-					Dpy, MyWindow, clip.x, clip.y,
-					clip.width, clip.height, False);
+				XClearArea(Dpy, MyWindow, clip.x,
+					clip.y, clip.width, clip.height,
+					False);
+				if (b == HoverButton &&
+					UberButton->c->flags & b_HoverColorset)
+				{
+					SetRectangleBackground(Dpy, MyWindow,
+						clip.x, clip.y, clip.width,
+						clip.height,
+						&Colorset[UberButton->c->hoverColorset],
+						Pdepth, NormalGC);
+				}
 			}
 		}
 	}
 
 	/* ------------------------------------------------------------------ */
 
-	if(cleaned && (b->flags&b_Title))
+	if (cleaned && (b->flags & (b_Title|b_HoverTitle)))
 	{
 		DrawTitle(b,MyWindow,NormalGC,pev,False);
 	}
 
-	if (!(b->flags&b_Title) && (b->flags & b_Panel) &&
+	if (!has_title && (b->flags & b_Panel) &&
 	    (b->panel_flags.panel_indicator))
 	{
 		XGCValues gcv;
@@ -612,10 +653,13 @@
 		}
 	} /* panel indicator */
 
-	/* redraw icons with alpha because there are drawn on the foreground */
-	if(cleaned && (b->flags&b_Icon) && (b->flags & b_IconAlpha))
+	if (cleaned)
 	{
-		DrawForegroundIcon(b, pev);
+		if (b->flags & iconFlag)
+		{
+			/* draw icon */
+			DrawForegroundIcon(b, pev);
+		}
 	}
 
 	/* relief */
@@ -633,13 +677,26 @@
 	FlocaleFont *Ffont=buttonFont(b);
 	int justify=buttonJustify(b);
 	int l,i,xpos;
-	char *s;
+	char *s = NULL;
 	int just=justify&b_TitleHoriz; /* Left, center, right */
 	XGCValues gcv;
 	unsigned long gcm;
 	int cset;
 	XRectangle clip;
 	Region region = None;
+	FvwmPicture *pic = b->icon;
+	unsigned long iconFlag = b_Icon;
+
+	if (b == HoverButton)
+	{
+		/* If no HoverIcon is specified, we use Icon (if there is
+		   one). */
+		if (b->flags & b_HoverIcon)
+		{
+			pic = b->hovericon;
+			iconFlag = b_HoverIcon;
+		}
+	}
 
 	BH = buttonHeight(b);
 
@@ -647,7 +704,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). */
+	if (b == HoverButton && b->flags & b_HoverTitle)
+	{
+		s = b->hoverTitle;
+	}
+	else if (b->flags & b_Title)
+	{
+		s = b->title;
+	}
+
+	if (!s || !Ffont)
 	{
 		return;
 	}
@@ -676,10 +744,10 @@
 	/* If a title is to be shown, truncate it until it fits */
 	if(justify&b_Horizontal && !(b->flags & b_Right))
 	{
-		if(b->flags&b_Icon)
+		if (b->flags & iconFlag)
 		{
-			ix+=b->icon->width+buttonXPad(b);
-			iw-=b->icon->width+buttonXPad(b);
+			ix += pic->width+buttonXPad(b);
+			iw -= pic->width+buttonXPad(b);
 		}
 		else if ((b->flags & b_Swallow) && buttonSwallowCount(b)==3)
 		{
@@ -688,7 +756,6 @@
 		}
 	}
 
-	s = b->title;
 	l = strlen(s);
 	i = FlocaleTextWidth(Ffont,s,l);
 
@@ -740,7 +807,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 */
-		if((b->flags&b_Icon ||
+		if ((b->flags & iconFlag ||
 		    ((buttonSwallowCount(b)==3) && (b->flags&b_Swallow))) &&
 		   !(justify&b_Horizontal))
 		{
diff -u fvwm-2.5.10/modules/FvwmButtons/dynamic.c fvwm/modules/FvwmButtons/dynamic.c
--- fvwm-2.5.10/modules/FvwmButtons/dynamic.c	2002-11-05 12:30:29.000000000 +0000
+++ fvwm/modules/FvwmButtons/dynamic.c	2004-07-10 10:13:25.000000000 +0100
@@ -73,16 +73,12 @@
 
 static void change_button_title(button_info *b, const char *text)
 {
-	if (!(b->flags & b_Title))
-	{
-		show_error("Cannot create a title, only change one\n");
-		return;
-	}
 	if (text == NULL)
 	{
 		show_error("No title to change specified, unsupported\n");
 		return;
 	}
+	b->flags |= b_Title;
 	free(b->title);
 	CopyString(&b->title, text);
 	return;
@@ -92,11 +88,6 @@
 {
 	FvwmPicture *new_icon;
 
-	if (!(b->flags & b_Icon))
-	{
-		show_error("Cannot create an icon, only change one\n");
-		return;
-	}
 	if (file == NULL)
 	{
 		show_error("No icon to change specified, unsupported\n");
@@ -107,22 +98,12 @@
 		show_error("Cannot load icon %s\n", file);
 		return;
 	}
+	b->flags |= b_Icon;
 	free(b->icon_file);
 	PDestroyFvwmPicture(Dpy, b->icon);
-	DestroyIconWindow(b);
 	b->icon = new_icon;
 	CopyString(&b->icon_file, file);
-	CreateIconWindow(b);
-	if (b->flags&b_IconAlpha)
-	{
-		RedrawButton(b, DRAW_FORCE, NULL);
-	}
-	else
-	{
-		ConfigureIconWindow(b, NULL);
-		XMapWindow(Dpy, b->IconWin);
-	}
-	return;
+	RedrawButton(b, DRAW_FORCE, NULL);
 }
 
 #if 0
@@ -250,6 +231,8 @@
 {
 	"Silent", "ChangeButton", "ExpandButtonVars", NULL
 };
+
+/* TODO: Should probably allow the HoverIcon & HoverTitle to change one day. */
 static char *button_options[] =
 {
 	"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
@@ -67,7 +67,6 @@
 #include "FvwmButtons.h"
 #include "misc.h" /* ConstrainSize() */
 #include "parse.h" /* ParseConfiguration(), parse_window_geometry() */
-#include "icons.h" /* CreateIconWindow(), ConfigureIconWindow() */
 #include "draw.h"
 #include "dynamic.h"
 
@@ -75,6 +74,7 @@
 #define MW_EVENTS   (ExposureMask |\
 		     StructureNotifyMask |\
 		     ButtonReleaseMask | ButtonPressMask |\
+		     LeaveWindowMask | PointerMotionMask |\
 		     KeyReleaseMask | KeyPressMask | ButtonMotionMask)
 /* SW_EVENTS are for swallowed windows... */
 #define SW_EVENTS   (PropertyChangeMask | StructureNotifyMask |\
@@ -96,7 +96,7 @@
 void SetButtonSize(button_info*,int,int);
 /* main */
 void Loop(void);
-void RedrawWindow();
+void RedrawWindow(void);
 void RecursiveLoadData(button_info*,int*,int*);
 void CreateUberButtonWindow(button_info*,int,int);
 int My_FNextEvent(Display *dpy, XEvent *event);
@@ -162,7 +162,9 @@
 Bool is_transient = 0;
 Bool is_transient_panel = 0;
 
-button_info *CurrentButton = NULL;
+/* $CurrentButton is set on ButtonPress, $HoverButton is set whenever the
+   mouse is over a button that is redrawn specially. */
+button_info *CurrentButton = NULL, *HoverButton = NULL;
 Bool is_pointer_in_current_button = False;
 int fd[2];
 
@@ -842,27 +844,6 @@
 
   CreateUberButtonWindow(UberButton,maxx,maxy);
 
-#ifdef DEBUG_INIT
-  fprintf(stderr,"OK\n%s: Creating icon windows...",MyName);
-#endif
-
-  i=-1;
-  ub=UberButton;
-  while(NextButton(&ub,&b,&i,0))
-  {
-    if(b->flags&b_Icon)
-    {
-#ifdef DEBUG_INIT
-      fprintf(stderr,"0x%06x...",(ushort)b);
-#endif
-      CreateIconWindow(b);
-    }
-  }
-
-#ifdef DEBUG_INIT
-  fprintf(stderr,"OK\n%s: Configuring windows...",MyName);
-#endif
-
   if (!XGetGeometry(
     Dpy, MyWindow, &root, &x, &y, (unsigned int *)&Width,
     (unsigned int *)&Height, (unsigned int *)&border_width, &depth))
@@ -873,8 +854,6 @@
   SetButtonSize(UberButton,Width,Height);
   i=-1;
   ub=UberButton;
-  while(NextButton(&ub,&b,&i,0))
-    ConfigureIconWindow(b, NULL);
 
   if (FShapesSupported)
   {
@@ -922,6 +901,30 @@
   return 0;
 }
 
+/* We get LeaveNotify events when the mouse enters a swallowed window of
+   FvwmButtons, but we're not interested in these situations. */
+static Bool reallyLeaveWindow (const int x, const int y,
+		const Window win, const button_info *b)
+{
+	if (x < 0 || x >= Width || y < 0 || y >= Height)
+	{
+		return True;
+	}
+
+	if (b == NULL)
+	{
+		b = select_button(UberButton, x, y);
+	}
+
+	/* TODO: fix situation when mouse enters window overlapping
+	   with a b_Swallow button. */
+	if (b->flags & b_Swallow)
+	{
+		return False;
+	}
+	return True;
+}
+
 /* -------------------------------- Main Loop -------------------------------*/
 
 /**
@@ -1075,20 +1078,68 @@
       }
       break;
 
-      case MotionNotify:
+	case MotionNotify:
 	{
-	  Bool f = is_pointer_in_current_button;
+		Bool f = is_pointer_in_current_button, redraw_relief = False;
+		if (Event.xmotion.x < 0 || Event.xmotion.x >= Width ||
+			Event.xmotion.y < 0 || Event.xmotion.y >= Height)
+		{
+			/* cursor is outside of FvwmButtons window. */
+			break;
+		}
 
-	  is_pointer_in_current_button =
-	    (CurrentButton && CurrentButton ==
-	     select_button(UberButton, Event.xmotion.x, Event.xmotion.y));
-	  if (CurrentButton && is_pointer_in_current_button != f)
-	  {
-	    RedrawButton(b, DRAW_RELIEF, NULL);
-	  }
+		/* find out which button the cursor is in now. */
+		b = select_button(UberButton, Event.xmotion.x, Event.xmotion.y);
+
+		is_pointer_in_current_button =
+			(CurrentButton && CurrentButton == b);
+		if (CurrentButton && is_pointer_in_current_button != f)
+		{
+			redraw_relief = True;
+		}
+
+		if (b != HoverButton)
+		{
+			if (HoverButton)
+			{
+				button_info *tmp = HoverButton;
+				HoverButton = b;
+				RedrawButton(tmp, DRAW_FORCE, NULL);
+			}
+			if (b->flags & (b_HoverIcon | b_HoverTitle) ||
+				UberButton->c->flags & b_HoverColorset)
+			{
+				HoverButton = b;
+				RedrawButton(b, DRAW_FORCE, NULL);
+				redraw_relief = False;
+			}
+		}
+
+		if (redraw_relief)
+		{
+			RedrawButton(b, DRAW_RELIEF, NULL);
+		}
 	}
 	break;
 
+	case LeaveNotify:
+	{
+		if (reallyLeaveWindow(Event.xcrossing.x, Event.xcrossing.y,
+			Event.xcrossing.window, NULL))
+		{
+			if (HoverButton)
+			{
+				b = HoverButton;
+				HoverButton = NULL;
+				RedrawButton(b, DRAW_FORCE, NULL);
+			}
+			if (CurrentButton)
+			{
+				RedrawButton(b, DRAW_RELIEF, NULL);
+			}
+		}
+		break;
+	}
       case KeyPress:
 	XLookupString(&Event.xkey,buffer,10,&keysym,0);
 	if(keysym!=XK_Return && keysym!=XK_KP_Enter && keysym!=XK_Linefeed)
@@ -1159,8 +1210,11 @@
       case ButtonRelease:
 	if (CurrentButton == NULL || !is_pointer_in_current_button)
 	{
-	  CurrentButton = NULL;
-	  break;
+		if (CurrentButton)
+			RedrawButton(CurrentButton, DRAW_RELIEF, NULL);
+
+		CurrentButton = NULL;
+		break;
 	}
 	if (Event.xbutton.window == MyWindow)
 	{
@@ -1502,7 +1556,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;
   FlocaleFont *Ffont;
 
   if (!b)
@@ -1665,9 +1719,14 @@
     b->c->height=y;
   }
 
-
-  i=0;
-  j=0;
+  /* $ix & $iy are dimensions of Icon
+     $tx & $ty are dimensions of Title
+     $hix & $hiy are dimensions of HoverIcon
+     $htx & $hty are dimensions of HoverTitle
+
+     Note that if No HoverIcon is specified, Icon is displayed during hover.
+     Similarly for HoverTitle. */
+  ix = iy = tx = ty = hix = hiy = htx = hty = 0;
 
   /* Load the icon */
   if(b->flags&b_Icon && LoadIconFile(b->icon_file,&b->icon, buttonColorset(b)))
@@ -1675,12 +1734,31 @@
 #ifdef DEBUG_LOADDATA
     fprintf(stderr,", icon \"%s\"",b->icon_file);
 #endif
-    i=b->icon->width;
-    j=b->icon->height;
+    ix = b->icon->width;
+    iy = b->icon->height;
   }
   else
     b->flags&=~b_Icon;
 
+  /* load the hover icon. */
+  if (b->flags & b_HoverIcon &&
+      LoadIconFile(b->hover_icon_file, &b->hovericon, buttonColorset(b)))
+  {
+#ifdef DEBUG_LOADDATA
+    fprintf(stderr,", hover icon \"%s\"", b->hover_icon_file);
+#endif
+
+    hix = b->hovericon->width;
+    hiy = b->hovericon->height;
+  }
+  else
+  {
+    hix = ix;
+    hiy = iy;
+    b->flags&=~b_HoverIcon;
+  }
+
+
   if(b->flags&b_Title && (Ffont = buttonFont(b)))
   {
 #ifdef DEBUG_LOADDATA
@@ -1688,18 +1766,41 @@
 #endif
     if(buttonJustify(b)&b_Horizontal)
     {
-      i+=buttonXPad(b)+FlocaleTextWidth(Ffont,b->title,strlen(b->title));
-      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));
+      ty = Ffont->height;
+    }
+  }
+
+  if (b->flags & b_HoverTitle && (Ffont = buttonFont(b)))
+  {
+#ifdef DEBUG_LOADDATA
+    fprintf(stderr,", title \"%s\"",b->title);
+#endif
+    if (buttonJustify(b) & b_Horizontal)
+    {
+      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));
+      hty = Ffont->height;
     }
   }
+  else
+  {
+    htx = tx;
+    hty = ty;
+  }
 
-  x+=i;
-  y+=j;
+  x += max(max(ix, tx), max(hix, htx));
+  y += max(iy + ty, hiy + hty);
 
   if(b->flags&b_Size)
   {
@@ -2405,21 +2506,6 @@
 		}
 		else
 		{
-			if (Event == NULL && b->flags&b_Icon)
-			{
-				/* FIXME do that only if we have an icon
-				 * colorset */
-				DestroyIconWindow(b);
-				CreateIconWindow(b);
-				if (b->flags&b_Icon)
-				{
-					if (!(b->flags&b_IconAlpha))
-					{
-						ConfigureIconWindow(b, NULL);
-						XMapWindow(Dpy,b->IconWin);
-					}
-				}
-			}
 			RedrawButton(b, DRAW_ALL, NULL);
 		}
 	}
@@ -2463,32 +2549,12 @@
 						b, True);
 				}
 			}
-			else if (Event == NULL && b->flags&b_Icon &&
-				 buttonColorset(b) == colorset)
-			{
-				/* FIXME do that only if we have an icon
-				 * colorset */
-				DestroyIconWindow(b);
-				CreateIconWindow(b);
-				if (b->flags&b_Icon)
-				{
-					if (!(b->flags&b_IconAlpha))
-					{
-						ConfigureIconWindow(b, NULL);
-						XMapWindow(Dpy,b->IconWin);
-					}
-				}
-			}
 		}
-
 		return;
 	}
 
 	recursive_change_colorset(
 		UberButton->c, colorset, Event);
-
-
-	return;
 }
 
 static void handle_config_info_packet(unsigned long *body)
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 @@
 #define b_ActionOnPress \
 		     0x02000000 /* By default this only done on Popup */
 #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*/
 
 /* Flags for b->swallow */
 #define b_Count       0x0003 /* Init counter for swallowing */
@@ -121,6 +123,7 @@
   char *back_file;         /* b_Back && b_IconBack */
   char *fore;              /* b_Fore */
   int colorset;            /* b_Colorset */
+  int hoverColorset;       /* b_HoverColorset */
   Pixel fc;                /* b_Fore */
   Pixel bc,hc,sc;          /* b_Back && !b_IconBack */
   FvwmPicture *backicon;   /* b_Back && b_IconBack */
@@ -161,15 +164,18 @@
   byte justify_mask;       /* b_Justify */
   container_info *c;       /* b_Container */
   char *title;             /* b_Title */
+  char *hoverTitle;        /* b_HoverTitle */
   char **action;           /* b_Action */
   char *icon_file;         /* b_Icon */
+  char *hover_icon_file;   /* b_HoverIcon */
   char *hangon;            /* b_Hangon || b_Swallow */
   Pixel fc;                /* b_Fore */
   Pixel bc,hc,sc;          /* b_Back && !b_IconBack */
   ushort minx,miny;        /* b_Size */
   FvwmPicture *icon;       /* b_Icon */
   FvwmPicture *backicon;   /* b_Back && b_IconBack */
-  Window IconWin;          /* b_Icon || b_Swallow */
+  FvwmPicture *hovericon;  /* b_HoverIcon */
+  Window IconWin;          /* b_Swallow */
   Window PanelWin;         /* b_Panel */
   Window BackIconWin;      /* b_Back && b_IconBack */
 
@@ -233,7 +239,7 @@
 extern Window Root;
 extern Window MyWindow;
 extern char *MyName;
-extern button_info *UberButton,*CurrentButton;
+extern button_info *UberButton, *CurrentButton, *HoverButton;
 extern Bool is_pointer_in_current_button;
 
 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 @@
 #include "libs/Colorset.h"
 #include "libs/Rectangles.h"
 
-/*
- *
- * Creates an Icon Window
- *
- */
-void CreateIconWindow(button_info *b)
-{
-#ifndef NO_ICONS
-	unsigned long valuemask;             /* mask for create windows */
-	XSetWindowAttributes attributes;     /* attributes for create windows */
-	Pixel bc,fc;
-	int cset;
-	FvwmRenderAttributes fra;
-	Pixmap temp;
-
-	if(!(b->flags&b_Icon))
-	{
-		return;
-	}
-
-	if(b->IconWin != None)
-	{
-		fprintf(stderr,"%s: BUG: Icon window already created "
-			"for 0x%lx!\n", MyName,(unsigned long)b);
-		return;
-	}
-	if(b->icon->width<1 || b->icon->height<1)
-	{
-		fprintf(stderr,"%s: BUG: Illegal iconwindow "
-			"tried created\n",MyName);
-		exit(2);
-	}
-
-	cset = buttonColorset(b);
-	if (b->icon->alpha != None ||
-	    (cset >= 0 && Colorset[cset].icon_alpha_percent < 100 &&
-	     !(UberButton->c->flags&b_TransBack)))
-	{
-		/* in this case we drawn on the button, with a shaped
-		 * Buttons we do not load the alpha channel */
-		b->flags |= b_IconAlpha;
-		return;
-	}
-
-	cset = buttonColorset(b);
-	fra.mask = FRAM_DEST_IS_A_WINDOW;
-	if (cset >= 0)
-	{
-		bc = Colorset[cset].bg;
-		fc = Colorset[cset].fg;
-		fra.mask |= FRAM_HAVE_ICON_CSET;
-		fra.colorset = &Colorset[cset];
-		if (Colorset[cset].icon_alpha_percent < 100)
-		{
-			fra.added_alpha_percent = 100;
-			fra.mask |= FRAM_HAVE_ADDED_ALPHA;
-		}
-	}
-	else
-	{
-		bc = buttonBack(b);
-		fc = buttonFore(b);
-		fra.mask = 0;
-	}
-
-	valuemask = CWColormap | CWBorderPixel | CWBackPixel |
-		CWEventMask | CWBackPixmap;
-	attributes.colormap = Pcmap;
-	attributes.border_pixel = 0;
-	attributes.background_pixel = bc;
-	attributes.background_pixmap = None;
-	attributes.event_mask = ExposureMask;
-
-	b->IconWin=XCreateWindow(
-		Dpy, MyWindow, 0, 0, b->icon->width, b->icon->height, 0,
-		Pdepth, InputOutput, Pvisual, valuemask, &attributes);
-	if (attributes.background_pixel != None)
-	{
-		XSetWindowBackground(
-			Dpy, b->IconWin, attributes.background_pixel);
-	}
-
-	if (FShapesSupported)
-	{
-		if (b->icon->mask!=None)
-		{
-			FShapeCombineMask(Dpy, b->IconWin, FShapeBounding,
-					  0, 0, b->icon->mask, FShapeSet);
-		}
-	}
-
-	if(b->icon->depth != Pdepth)
-	{
-		/* bitmap icon */
-		XGCValues gcv;
-
-		gcv.background= bc;
-		gcv.foreground= fc;
-		XChangeGC(Dpy,NormalGC,GCForeground | GCBackground,&gcv);
-
-		if (FShapesSupported)
-		{
-			FShapeCombineMask(Dpy, b->IconWin, FShapeBounding,
-					  0, 0, b->icon->picture, FShapeSet);
-		}
-	}
-
-	if (cset >= 0 && Colorset[cset].icon_tint_percent > 0)
-	{
-		temp = XCreatePixmap(
-			Dpy, MyWindow, b->icon->width, b->icon->height, Pdepth);
-		PGraphicsRenderPicture(
-			Dpy, MyWindow, b->icon, &fra, temp,
-			NormalGC, None, None,
-			0, 0, b->icon->width, b->icon->height,
-			0, 0, 0, 0, False);
-		XSetWindowBackgroundPixmap(Dpy, b->IconWin, temp);
-		XFreePixmap(Dpy,temp);
-	}
-	else
-	{
-		/* pixmap icon */
-		XSetWindowBackgroundPixmap(Dpy, b->IconWin, b->icon->picture);
-	}
-
-	return;
-#endif
-}
-
-void DestroyIconWindow(button_info *b)
-{
-#ifndef NO_ICONS
-	if(!(b->flags&b_Icon) || (b->flags&b_IconAlpha))
-	{
-		b->flags &= ~b_IconAlpha;
-		return;
-	}
-	XDestroyWindow(Dpy, b->IconWin);
-	b->IconWin = None;
-#endif
-}
 
 /*
  *
  * Combines icon shape masks after a resize
  *
  */
-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)
 {
 #ifdef NO_ICONS
-	return 0;
+	return False;
 #else
-	int x,y,w,h;
+	int x,y,width,height;
 	int xoff,yoff;
 	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))
-		return 0;
-
-	if(!b->IconWin && !(b->flags&b_IconAlpha))
+	if (iconFlag & b_HoverIcon)
 	{
-		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;
+		}
 	}
 
 	buttonInfo(b,&x,&y,&xpad,&ypad,&framew);
 	framew=abs(framew);
 	Ffont = buttonFont(b);
 
-	w = b->icon->width;
-	h = b->icon->height;
+	width = pic->width;
+	height = pic->height;
 	BW = buttonWidth(b);
 	BH = buttonHeight(b);
 
-	w=min(w,BW-2*(xpad+framew));
+	width=min(width,BW-2*(xpad+framew));
 
-	if(b->flags&b_Title && Ffont && !(buttonJustify(b)&b_Horizontal))
-		h = min(h,BH-2*(ypad+framew)-Ffont->ascent-Ffont->descent);
+	if (has_title == True && Ffont && !(buttonJustify(b)&b_Horizontal))
+	{
+		height = min(height,BH-2*(ypad+framew)-Ffont->ascent-Ffont->descent);
+	}
 	else
-		h = min(h,BH-2*(ypad+framew));
+	{
+		height = min(height,BH-2*(ypad+framew));
+	}
 
 	if (b->flags & b_Right)
-		xoff = BW-framew-xpad-w;
+		xoff = BW-framew-xpad-width;
 	else if (b->flags & b_Left)
 		xoff = framew+xpad;
 	else
@@ -252,15 +123,15 @@
 		if(buttonJustify(b)&b_Horizontal)
 			xoff=0;
 		else
-			xoff=(BW-w)>>1;
+			xoff=(BW-width)>>1;
 		if(xoff < framew+xpad)
 			xoff = framew+xpad;
 	}
 
-	if(b->flags&b_Title && Ffont && !(buttonJustify(b)&b_Horizontal))
-		yoff=(BH-(h+Ffont->height))>>1;
+	if (has_title == True && Ffont && !(buttonJustify(b)&b_Horizontal))
+		yoff=(BH-(height+Ffont->height))>>1;
 	else
-		yoff=(BH-h)>>1;
+		yoff=(BH-height)>>1;
 
 	if(yoff < framew+ypad)
 		yoff = framew+ypad;
@@ -270,10 +141,10 @@
 
 	*r_x = x;
 	*r_y = y;
-	*r_w = w;
-	*r_h = h;
+	*r_w = width;
+	*r_h = height;
 
-	return 1;
+	return True;
 #endif
 }
 
@@ -284,20 +155,24 @@
 	int cset;
 	XRectangle clip;
 	FvwmRenderAttributes fra;
+	unsigned long iconFlag = b_Icon;
+	unsigned long flag = (b == HoverButton ? b_HoverIcon : b_Icon);
 
-	if (!GetIconWindowPosition(b,&x,&y,&w,&h))
+	FvwmPicture *pic = b->icon;
+	if (b == HoverButton && b->flags & b_HoverIcon)
 	{
-		return;
+		iconFlag = b_HoverIcon;
+		pic = b->hovericon;
 	}
 
-	if(w < 1 || h < 1)
+	if (!GetIconPosition(b, flag, &x,&y,&w,&h))
 	{
-		return; /* No need drawing to this */
+		return;
 	}
 
-	if (!(b->flags & b_IconAlpha))
+	if(w < 1 || h < 1)
 	{
-		return;
+		return; /* No need drawing to this */
 	}
 
 	clip.x = x;
@@ -331,50 +206,11 @@
 		fra.mask |= FRAM_HAVE_ICON_CSET;
 		fra.colorset = &Colorset[cset];
 	}
+
 	PGraphicsRenderPicture(
-		Dpy, MyWindow, b->icon, &fra, MyWindow,
+		Dpy, MyWindow, pic, &fra, MyWindow,
 		NormalGC, None, None,
 		clip.x - x, clip.y - y, clip.width, clip.height,
 		clip.x, clip.y, clip.width, clip.height, False);
 #endif
 }
-
-void ConfigureIconWindow(button_info *b, XEvent *pev)
-{
-#ifndef NO_ICONS
-	int x,y,w,h;
-
-	if (!b->IconWin)
-	{
-		return;
-	}
-	if (!GetIconWindowPosition(b,&x,&y,&w,&h))
-	{
-		return;
-	}
-	if (!b->IconWin)
-	{
-		return;
-	}
-
-	if(w < 1 || h < 1)
-	{
-		if (b->IconWin)
-			XMoveResizeWindow(Dpy, b->IconWin, 2000,2000,1,1);
-		return; /* No need drawing to this */
-	}
-
-	if (!pev && b->IconWin)
-	{
-		XMoveResizeWindow(Dpy, b->IconWin, x,y,w,h);
-	}
-
-	return;
-
-	if (!(b->flags & b_IconAlpha))
-	{
-		return;
-	}
-
-#endif
-}
diff -u fvwm-2.5.10/modules/FvwmButtons/icons.h fvwm/modules/FvwmButtons/icons.h
--- fvwm-2.5.10/modules/FvwmButtons/icons.h	2003-06-29 20:53:24.000000000 +0100
+++ fvwm/modules/FvwmButtons/icons.h	2004-07-10 10:13:25.000000000 +0100
@@ -13,7 +13,4 @@
  *
  */
 
-void CreateIconWindow(button_info*);
-void DestroyIconWindow(button_info *b);
 void DrawForegroundIcon(button_info *b, XEvent *pev);
-void ConfigureIconWindow(button_info*, XEvent *pev);
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
@@ -751,8 +751,7 @@
 
     default:
       t=seekright(&s);
-      fprintf(stderr,"%s: Illegal container option \"%s\"\n",MyName,
-	      (t)?t:"");
+      fprintf(stderr,"%s: Illegal container option \"%s\"\n",MyName, (t)?t:"");
       if (t)
 	free(t);
     }
@@ -803,6 +802,8 @@
       "colorset",
       "action",
       "id",
+      "hovericon",
+      "hovertitle",
       NULL
     };
     s = trimleft(s);
@@ -937,7 +938,6 @@
 	    if (b->icon_file)
 	      free(b->icon_file);
 	    b->icon_file=t;
-	    b->IconWin=None;
 	    b->flags|=b_Icon;
 	  }
 	}
@@ -1251,6 +1251,69 @@
 	}
 	break;
 
+	/* ---------------------------- HoverIcon ------------------------- */
+	case 21: /* HoverIcon */
+		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.",
+					MyName);
+			}
+			else
+			{
+				if (b->hover_icon_file)
+					free(b->hover_icon_file);
+				b->hover_icon_file = t;
+				b->flags |= b_HoverIcon;
+			}
+		}
+		else
+		{
+			fprintf(stderr,"%s: Missing hover icon argument\n",
+				MyName);
+			if(t)
+			{
+				free(t);
+			}
+		}
+		break;
+
+	/* ------------------------- HoverTitle ------------------------- */
+	case 22: /* HoverTitle */
+		s = trimleft(s);
+		if (*s=='(')
+		{
+			fprintf(stderr,"%s: justification not allowed for "
+				"HoverTitle.\n", MyName);
+		}
+		t = seekright(&s);
+		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);
+#endif
+			b->flags |= b_HoverTitle;
+		}
+		else
+		{
+			fprintf(stderr,"%s: Missing HoverTitle argument\n",MyName);
+			if (t)
+			{
+				free(t);
+			}
+		}
+		break;
+
+	/* ------------------------- ------------------------- */
       default:
 	t=seekright(&s);
 	fprintf(stderr,"%s: Illegal button option \"%s\"\n",MyName,
@@ -1292,7 +1355,6 @@
        ((b->icon_file)[0]!='-'||(b->icon_file)[1]!=0))
     {
       b->flags|=b_Icon;
-      b->IconWin=None;
     }
     else
       if(b->icon_file)free(b->icon_file);
@@ -1370,6 +1432,7 @@
     "pixmap",
     "boxsize",
     "colorset",
+    "hovercolorset",
     NULL
   };
   int i,j,k;
@@ -1468,6 +1531,20 @@
       ub->c->flags &= ~b_Colorset;
     }
     break;
+  case 13: /* HoverColorset */
+    i = sscanf(s, "%d", &j);
+    if (i > 0)
+    {
+      ub->c->hoverColorset = j;
+      ub->c->flags |= b_HoverColorset;
+      AllocColorset(j);
+    }
+    else
+    {
+      ub->c->flags &= ~b_HoverColorset;
+    }
+    break;
+
   default:
     s = trimleft(s);
     ParseButton(ubb,s);