Dear FVWM-developers!
I have a small patch for FvwmIconBox.c file which makes this module autogrowing to fit in all the icons. This feature is activated when both scrollbars are hidden that is there are two lines in configuration file :
*FvwmIconBox:HideSC Horizontal
*FvwmIconBox:HideSC Vertical
The patch is below
--- modules/FvwmIconBox/FvwmIconBox.c 2007-10-23 14:14:36.000000000 +0400
+++ ../../fvwm-2.5.26/modules/FvwmIconBox/FvwmIconBox.c 2008-06-06 03:56:43.000000000 +0400
@@ -433,6 +433,7 @@
if (!(local_flags & HIDE_V))
XResizeWindow(dpy ,v_scroll_bar,
bar_width, Height - bar_width*2);
+ if ( (local_flags & (HIDE_V|HIDE_H)) !=3) {
GetIconwinSize(&diffx, &diffy);
if (primary == BOTTOM || secondary == BOTTOM)
icon_win_y -= Height - oldh;
@@ -456,6 +457,7 @@
XClearWindow(dpy,main_win);
RedrawWindow(NULL);
}
+ }
}
else if (ready && CSET_IS_TRANSPARENT(colorset) &&
(Event.xconfigure.send_event ||
@@ -1600,6 +1602,7 @@
SetWindowBackground(
dpy, icon_win, icon_win_width, icon_win_height, &Colorset[(colorset)],
Pdepth, NormalGC, True);
+ if ((local_flags & (HIDE_V|HIDE_H))!=3){
SetWindowBackground(dpy, holder_win, main_width - h_margin,
main_height - v_margin, &Colorset[(colorset)], Pdepth, NormalGC, True);
XSetWindowBackground(dpy, h_scroll_bar, back_pix);
@@ -1607,10 +1610,12 @@
XSetWindowBackground(dpy, l_button, back_pix);
XSetWindowBackground(dpy, r_button, back_pix);
XSetWindowBackground(dpy, t_button, back_pix);
+ }
XSetWindowBackground(dpy, b_button, back_pix);
XSetForeground(dpy, ReliefGC, hilite_pix);
XSetBackground(dpy, ReliefGC, back_pix);
XSetForeground(dpy, ShadowGC, shadow_pix);
+ if ((local_flags & (HIDE_V|HIDE_H))!=3){
XSetBackground(dpy, ShadowGC, back_pix);
XClearWindow(dpy, main_win);
XClearWindow(dpy, holder_win);
@@ -1620,6 +1625,7 @@
XClearWindow(dpy, l_button);
XClearWindow(dpy, r_button);
XClearWindow(dpy, t_button);
+ }
XClearWindow(dpy, b_button);
}
if (color == Iconcolorset) {
@@ -1679,16 +1685,26 @@
{
*dx = icon_win_width;
*dy = icon_win_height;
-
if (primary == LEFT || primary == RIGHT){
- icon_win_width = max(Width, UWidth * Lines + interval - 1);
- icon_win_height = max(Height, UHeight * (max(0,
+ if ((local_flags & (HIDE_V|HIDE_H)) ==3){
+ //setting HIDE_B makes IconBox autogrowing
+ icon_win_width = UWidth*(min(Lines,num_icons)+1)+interval-1;
+ icon_win_height = UHeight * ((num_icons-1)/Lines + 2)+interval-1;
+ } else {
+ icon_win_width = max(Width, UWidth * Lines + interval - 1);
+ icon_win_height = max(Height, UHeight * (max(0,
(num_icons-1))/Lines
- + 1) - 1 + interval);
- }else{
- icon_win_width = max(Width, UWidth * (max(0,num_icons-1) / Lines +
+ + 1) - 1 + interval);
+ }
+ } else {
+ if ((local_flags & (HIDE_V|HIDE_H)) ==3){
+ icon_win_height = UHeight*(min(Lines,num_icons)+1)+interval-1;
+ icon_win_width = UWidth * ((num_icons-1)/Lines + 2)+interval-1;
+ } else {
+ icon_win_width = max(Width, UWidth * (max(0,num_icons-1) / Lines +
1) + interval - 1);
- icon_win_height = max(Height, UHeight * Lines - 1 + interval);
+ icon_win_height = max(Height, UHeight * Lines - 1 + interval);
+ }
}
*dx = icon_win_width - *dx;
*dy = icon_win_height - *dy;
@@ -2223,7 +2239,7 @@
tmp++;
if (strncasecmp(tmp, "Horizontal", 10) == 0)
local_flags |= HIDE_H;
- else if (strncasecmp(tmp, "Vertical", 8) == 0)
+ if (strncasecmp(tmp, "Vertical", 8) == 0)
local_flags |= HIDE_V;
}
else if (strncasecmp(tline,CatString3("*",MyName,
@@ -2641,11 +2657,23 @@
case M_ADD_WINDOW:
if (AddItem(cfgpacket) == True && ready){
GetIconwinSize(&diffx, &diffy);
+ if ((local_flags&(HIDE_V|HIDE_H))==3){
+ icon_win_x=0;
+ icon_win_y=0;
+ if (primary == BOTTOM || secondary == BOTTOM)
+ icon_win_y = UHeight;
+ if (primary == RIGHT || secondary == RIGHT)
+ icon_win_x = UWidth;
+ XResizeWindow(dpy, main_win,
+ icon_win_width, icon_win_height);
+ } else {
if (diffy && (primary == BOTTOM || secondary == BOTTOM))
icon_win_y += diffy;
if (diffx && (primary == RIGHT || secondary == RIGHT))
icon_win_x += diffx;
+ }
XMoveResizeWindow(dpy, icon_win, -icon_win_x, -icon_win_y,
+
icon_win_width, icon_win_height);
if ((diffx || diffy) && (colorset >= 0))
SetWindowBackground(dpy, icon_win, icon_win_width,
@@ -2656,6 +2684,16 @@
case M_DESTROY_WINDOW:
if (DeleteItem(body[0]) && ready){
GetIconwinSize(&diffx, &diffy);
+ if ( (local_flags & (HIDE_V|HIDE_H)) == 3) {
+ icon_win_x=0;
+ icon_win_y=0;
+ if (primary == BOTTOM || secondary == BOTTOM)
+ icon_win_y = UHeight;
+ if (primary == RIGHT || secondary == RIGHT)
+ icon_win_x = UWidth;
+ XResizeWindow(dpy, main_win,
+ icon_win_width, icon_win_height);
+ } else {
if (diffy && (primary == BOTTOM || secondary == BOTTOM))
icon_win_y += diffy;
if (diffx && (primary == RIGHT || secondary == RIGHT))
@@ -2668,6 +2706,7 @@
icon_win_x = icon_win_width - Width;
if (icon_win_y + Height > icon_win_height)
icon_win_y = icon_win_height - Height;
+ }
XMoveResizeWindow(dpy, icon_win, -icon_win_x, -icon_win_y,
icon_win_width, icon_win_height);
if ((diffx || diffy) && (colorset >= 0))