Subject: UseStyle Problem

From: Andrew Veliath <[email-masked]>
Date: Thu, 16 Jan 1997 18:20:21 -0500 (EST)

The problem:

	- UseStyle only uses the first instance of a Style command

	For instance,
	Style "Boo" ClickToFocus
	Style "Boo" Icon test.xpm

	Style "Boo2" UseStyle "Boo"
	
	Then Boo2 will only get ClickToFocus.  Clearly it should have
	everything defined in Boo.

The patch:

	- Change UseStyle to accumulate all of the same Style
	definitions. The method of style accumulation is the same as in
	LookInList. With this patch, the above will work as expected.

--- orig/fvwm-2.0.44/fvwm/style.c	Tue Jan 14 09:06:35 1997
+++ use/fvwm-2.0.44/fvwm/style.c	Thu Jan 16 18:17:07 1997
@@ -628,37 +628,72 @@
           if (tmp && (*tmp == '"')) ++tmp;
           if (len > 0)
           {
-            nptr = Scr.TheList;
-            while(nptr && mystrncasecmp(restofline,nptr->name,len) )
-              nptr = nptr->next;
-            if (nptr&& !mystrncasecmp(restofline,nptr->name,len))
-            {
-              on_flags      = nptr->on_flags;
-              off_flags     = nptr->off_flags;
-              icon_name     = nptr->value;
+	    int hit = 0;            
+	    /* changed to accumulate multiple Style definitions ([email-masked]) */
+            for ( nptr = Scr.TheList; nptr; nptr = nptr->next ) {
+		if (!mystrncasecmp(restofline,nptr->name,len))
+		{
+		    if (!hit) {
+			on_flags      = nptr->on_flags;
+			off_flags     = nptr->off_flags;
+			icon_name     = nptr->value;
+#ifdef MINI_ICONS
+			miniicon_name = nptr->mini_value;
+#endif
+#ifdef USEDECOR
+			decor	    = nptr->Decor;
+#endif
+			desknumber    = nptr->Desk;
+			bw            = nptr->border_width;
+			nobw          = nptr->resize_width;
+			forecolor     = nptr->ForeColor;
+			backcolor     = nptr->BackColor;
+			BoxFillMethod = nptr->BoxFillMethod;
+			IconBox[0]    = nptr->IconBox[0];
+			IconBox[1]    = nptr->IconBox[1];
+			IconBox[2]    = nptr->IconBox[2];
+			IconBox[3]    = nptr->IconBox[3];
+			off_buttons   = nptr->off_buttons;
+			on_buttons    = nptr->on_buttons;
+			hit = 1;
+		    } else {
+			off_flags     |= nptr->off_flags;
+			on_flags      &= ~(nptr->on_flags);
+			off_buttons   |= nptr->off_buttons;
+			on_buttons    &= ~(nptr->on_buttons);
+			if(nptr->value) icon_name = nptr->value;
 #ifdef MINI_ICONS
-              miniicon_name = nptr->mini_value;
+			if(nptr->mini_value) miniicon_name = nptr->mini_value;
 #endif
 #ifdef USEDECOR
-              decor	    = nptr->Decor;
+			if(nptr->Decor) decor = nptr->Decor;
 #endif
-              desknumber    = nptr->Desk;
-              bw            = nptr->border_width;
-              nobw          = nptr->resize_width;
-              forecolor     = nptr->ForeColor;
-              backcolor     = nptr->BackColor;
-              BoxFillMethod = nptr->BoxFillMethod;
-              IconBox[0]    = nptr->IconBox[0];
-              IconBox[1]    = nptr->IconBox[1];
-              IconBox[2]    = nptr->IconBox[2];
-              IconBox[3]    = nptr->IconBox[3];
-              off_buttons   = nptr->off_buttons;
-              on_buttons    = nptr->on_buttons;
-              restofline = tmp;
-            }
-            else 
+			if(nptr->off_flags & STARTSONDESK_FLAG)
+			    desknumber = nptr->Desk;
+			if(nptr->off_flags & BW_FLAG)
+			    bw = nptr->border_width;
+			if(nptr->off_flags & NOBW_FLAG)
+			    nobw = nptr->resize_width;
+			if(nptr->off_flags & FORE_COLOR_FLAG)
+			    forecolor = nptr->ForeColor;
+			if(nptr->off_flags & BACK_COLOR_FLAG)
+			    backcolor = nptr->BackColor;
+
+			if(nptr->BoxFillMethod != 0)
+			    BoxFillMethod = nptr->BoxFillMethod;
+			if(nptr->IconBox[0] >= 0)
+			{
+			    IconBox[0] = nptr->IconBox[0];
+			    IconBox[1] = nptr->IconBox[1];
+			    IconBox[2] = nptr->IconBox[2];
+			    IconBox[3] = nptr->IconBox[3];
+			}
+		    }
+		}
+	    }
+	    restofline = tmp;
+	    if (!hit)
             {
-              restofline = tmp;
               tmp=safemalloc(500);
               strcat(tmp,"UseStyle: ");
               strncat(tmp,restofline-len,len);

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].