Hi everyone,

this small patch allows the content of a button to be vertically aligned at the top of the button. This is useful for aligning swallowed stuff that grows (like gkrellm) at the top of a bigger button, so that it can grow at the bottom.

Example:

*FvwmButtons: (1x30, Swallow(UseOld,NoClose) 'gkrellm' 'Exec gkrellm --geometry +0+0',top)


This is my first patch so bear with me. :-)

Best wishes,

 Pietro
diff -ur -U3 FvwmButtons-/draw.c FvwmButtons/draw.c
--- FvwmButtons-/draw.c 2008-03-24 11:27:06.000000000 +0100
+++ FvwmButtons/draw.c  2008-03-24 11:14:48.000000000 +0100
@@ -171,8 +171,9 @@
        ix += iw-b->icon_w;
       else if (!b->flags.b_Left)
        ix += (iw-b->icon_w)/2;
-      XMoveResizeWindow(Dpy,b->IconWin,ix,iy+(ih-b->icon_h)/2,
-                       b->icon_w,b->icon_h);
+      if (!b->flags.b_Top)
+       iy += (ih-b->icon_h)/2;
+      XMoveResizeWindow(Dpy,b->IconWin,ix,iy,b->icon_w,b->icon_h);
     }
     else
     {
diff -ur -U3 FvwmButtons-/FvwmButtons.1 FvwmButtons/FvwmButtons.1
--- FvwmButtons-/FvwmButtons.1  2008-03-24 11:27:06.000000000 +0100
+++ FvwmButtons/FvwmButtons.1   2008-03-24 11:29:08.000000000 +0100
@@ -270,6 +270,10 @@
 The contents of the button is centered on the button. This is the
 default but may be changed by \fILeft\fP or \fIRight\fP.
 
+.IP "Top"
+The contents of the button is vertically aligned at the top of the 
+button. The default is to vertically center it.
+
 .IP "Colorset \fIcolorset\fP"
 The given colorset can be applied to a container, a swallowed
 application and a simple button.  To apply it to a button or
diff -ur -U3 FvwmButtons-/FvwmButtons.h FvwmButtons/FvwmButtons.h
--- FvwmButtons-/FvwmButtons.h  2008-03-24 11:27:06.000000000 +0100
+++ FvwmButtons/FvwmButtons.h   2008-03-24 11:14:48.000000000 +0100
@@ -63,6 +63,7 @@
        unsigned b_TransBack  : 1;     /* Transparent background */
        unsigned b_Left       : 1;     /* Button is left-aligned */
        unsigned b_Right      : 1;     /* Button is right-aligned */
+       unsigned b_Top        : 1;     /* Button is aligned at the top */
        unsigned b_SizeFixed  : 1;     /* User provided rows/columns may not be
                                          altered */
        unsigned b_PosFixed   : 1;     /* User provided button position */
Only in FvwmButtons/: fvwmbuttons-valign.patch
diff -ur -U3 FvwmButtons-/parse.c FvwmButtons/parse.c
--- FvwmButtons-/parse.c        2008-03-24 11:27:06.000000000 +0100
+++ FvwmButtons/parse.c 2008-03-24 11:14:48.000000000 +0100
@@ -889,6 +889,7 @@
                        "presstitle",
                        "activecolorset",
                        "presscolorset",
+                       "top",
                        NULL
                };
                s = trimleft(s);
@@ -1628,6 +1629,9 @@
                                }
                                break;
 
+                       case 27 : /* top */
+                               b->flags.b_Top = 1;
+                               break;
                        /* --------------- --------------- */
                        default:
                                t = seekright(&s);

Reply via email to