Subject: Patch to FvwmButtons

From: Jui-Hsuan Joshua Feng <[email-masked]>
Date: Wed, 09 Dec 1998 21:00:30 -0600

Hi Dominik,

Here is the patch to adjust the behavior of subpanels and correct their
pixmap background problem
in FvwmButtons. Could you take a look at it? If it's ok, please merge it
into the CVS tree (It's built
against the current CVS tree 2.1.5). Thank you very much. The subpanels
still have problems to
swallow application windows. I am working on this.

Regards

--
J Joshua Feng                            (O)608/262-3640
Electrical & Computer Engr, Univ. of Wisconsin - Madison
http://www.cae.wisc.edu/~fengj [email-masked]

? Makefile
? .deps
? FvwmButtons
? bc
? newpatch
Index: FvwmButtons.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.c,v
retrieving revision 1.9
diff -u -r1.9 FvwmButtons.c
--- FvwmButtons.c	1998/11/30 10:34:06	1.9
+++ FvwmButtons.c	1998/12/10 02:44:48
@@ -575,6 +575,10 @@
   if(UberButton->c->flags&b_TransBack)
     SetTransparentBackground(UberButton,Width,Height);
 # endif
+  
+    i=-1;ub=UberButton;
+    while(NextButton(&ub,&b,&i,0))
+      MakeButton(b);
 
     CurrentPanel = CurrentPanel->next;
   }
@@ -582,7 +586,6 @@
   UberButton   = CurrentPanel->uber;
   MyWindow     = UberButton->IconWinParent;
 
-
 # ifdef DEBUG_INIT
   fprintf(stderr,"OK\n%s: Mapping windows...",MyName);
 # endif
@@ -713,7 +716,7 @@
             PanelIndex = MainPanel;
             b = NULL;
             do
-              if (PanelIndex->uber->swallow)
+              if (PanelIndex->uber->swallow) /* is the panel shown? */
               {
                 UberButton = PanelIndex->uber;
                 MyWindow   = UberButton->IconWinParent;
@@ -749,15 +752,14 @@
 	  case ButtonRelease:
             PanelIndex = MainPanel;
             b = NULL;
-            while (PanelIndex && !b)
+            do
             { if (PanelIndex->uber->swallow)
               { UberButton = PanelIndex->uber;
                 MyWindow   = UberButton->IconWinParent;
                 if (Event.xany.window == MyWindow)
 		  b=select_button(UberButton,Event.xbutton.x,Event.xbutton.y);
               }
-              PanelIndex = PanelIndex->next;
-            }
+            } while (!b && (PanelIndex = PanelIndex->next));
 
 	    if(!(act=GetButtonAction(b,Event.xbutton.button)))
 	      act=GetButtonAction(b,0);
@@ -765,12 +767,8 @@
 	      {
 		if(strncasecmp(act,"Exec",4)==0)
 		  {
-                    /* close all subpanels */
-                    PanelIndex = MainPanel->next;
-                    while (PanelIndex)
-                    { if (PanelIndex->uber->swallow) Slide(PanelIndex, NULL);
-                      PanelIndex = PanelIndex->next;
-                    }
+		    /* close current subpanel */  
+		    if (PanelIndex != MainPanel) Slide(PanelIndex, NULL);
 
 		    /* Look for Exec "identifier", in which case the button
 		       stays down until window "identifier" materializes */
Index: output.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/output.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 output.c
--- output.c	1998/10/14 00:03:22	1.1.1.1
+++ output.c	1998/12/10 02:44:48
@@ -69,8 +69,8 @@
   if(b->flags&b_Container)
     {
       int i=0;
-      fprintf(stderr,"  Container(%ix%i=%i buttons (alloc %i), size %ix%i, pos %i,%i\n",
-	      b->c->num_columns,b->c->num_rows,b->c->num_buttons,
+      fprintf(stderr,"  Container(%ix%i=%i buttons 0x%04x (alloc %i), size %ix%i, pos %i,%i)\n{ ",
+	      b->c->num_columns,b->c->num_rows,b->c->num_buttons,b->c->flags,
 	      b->c->allocated_buttons,
 	      b->c->ButtonWidth,b->c->ButtonHeight,b->c->xpos,b->c->ypos);
 /*
Index: parse.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/parse.c,v
retrieving revision 1.12
diff -u -r1.12 parse.c
--- parse.c	1998/12/07 15:33:30	1.12
+++ parse.c	1998/12/10 02:44:48
@@ -886,7 +886,7 @@
       UberButton->BHeight = 1;
       UberButton->swallow = 0; /* subpanel is hidden initially */
       MakeContainer(UberButton);
-      *ubb = UberButton;
+      ub = *ubb = UberButton;
       break;
     case 11: /* BoxSize */
       ParseBoxSize(&s, &ub->c->flags);