Subject: [PATCH] swallow in subpanel

From: Jui-Hsuan Joshua Feng <[email-masked]>
Date: Wed, 09 Dec 1998 23:53:52 -0600

Hi Dominik,

Forget about my last patch. I got the 'swallow' work in subpanels. This new patch

also contains the last patch I just sent you (correcting the pixmap problem, etc.).

What's new in this patch compared with the last one is that I add some lines

in the function 'process_message(...)' in the file 'FvwmButtons.c'. Hope it can

merge into the CVS tree. Thank you.

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

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 05:37: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 */
@@ -1519,6 +1517,12 @@
 # ifdef DEBUG_FVWM
   DebugFvwmEvents(type);
 # endif
+  panel_info *PanelIndex = MainPanel;
+  do
+  {
+    UberButton = PanelIndex->uber;
+    MyWindow   = UberButton->IconWinParent;
+
   switch(type)
     {
     case M_NEW_DESK:
@@ -1540,6 +1544,8 @@
     default:
       break;
     }
+
+  } while (PanelIndex = PanelIndex->next);
 }

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 05:37: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 05:37: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);