Subject: Don't ignore OLDecor patch

From: Neil Bird <[email-masked]>
Date: Fri, 03 Sep 1999 14:49:56 +0100

OK, here's a patch to fvwm/decorations.c that seems to stop it ignoring
OLDecor hints when there aren't a full set of MWM hints.

  Don't ask me why it works, I don't understand what I've done (i.e.,
what's the diff. between the flags i nt->functions & decor?). But it works
for me.

  Anyone want to comment?

Tim Phipps wrote:
> Maybe all it takes is to add:
> 
>   if(!(t->functions & MWM_DECOR_TITLE))
>     decor &= ~MWM_DECOR_TITLE;
> 
> between the two blocks.

  I dunno. I can try it, but from looking at it, I think it's probably
more complicated than that. It really depends upon what functions/decor
relate to.

-- 
=====================- http://www.racaldefence.com/ -===================
 Neil Bird                   |   This is who we are     The time is near
                             |
 mailto:[email-masked] |        There are 120 days remaining

--- decorations.c.orig	Sun Jun 27 12:30:18 1999
+++ decorations.c	Fri Sep  3 14:37:41 1999
@@ -315,12 +315,22 @@
   if (SHAS_OL_DECOR(sflags))
     {
       if (!(t->ol_hints & OL_DECOR_CLOSE))
+      {
         t->functions &= ~MWM_FUNC_MINIMIZE;
+	decor        &= ~MWM_FUNC_MINIMIZE;
+      }
       if (!(t->ol_hints & OL_DECOR_RESIZEH))
+      {
         t->functions &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+	decor        &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+      }
       if (!(t->ol_hints & OL_DECOR_HEADER))
+      {
         t->functions &= ~(MWM_DECOR_MENU | MWM_FUNC_MINIMIZE |
                           MWM_FUNC_MAXIMIZE | MWM_DECOR_TITLE);
+	decor        &= ~(MWM_DECOR_MENU | MWM_FUNC_MINIMIZE |
+			  MWM_FUNC_MAXIMIZE | MWM_DECOR_TITLE);
+      }
       if (!(t->ol_hints & OL_DECOR_ICON_NAME))
 	SET_HAS_NO_ICON_TITLE(t, 1);
     }

---

From: Neil Bird <[email-masked]>
Date: Mon, 06 Sep 1999 12:12:57 +0100

> >     decor &= ~MWM_DECOR_TITLE;

  Nope, it'll fail for the same reason as my patch is still failing: this
segment of code only /removes/ things according to OL decor hints. I've
just come across a case where an OL app. of mine pops up a transient but
gets no header. It specifically requests a header (within the OL_DECOR_ADD
atom), but all fvwm will do is /not/ display a header if OL_DECOR_DEL asks
for such.

  I really don't want to extend this if-sequence any more (to add stuff
that OLDecor wants) wince I don't really understand what I did in the
first place!

  Is there anyone still out there who knows what this bit of code's about?

-- 
=====================- http://www.racaldefence.com/ -===================
 Neil Bird                   |   This is who we are     The time is near
                             |
 mailto:[email-masked] |        There are 117 days remaining
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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]

---

From: Neil Bird <[email-masked]>
Date: Mon, 06 Sep 1999 12:19:42 +0100

> that OLDecor wants) wince I don't really understand what I did in the

  But, to preserve my sanity, this is what I'm using here now. It *seems*
to work with what I've got, but again, I can't vouch for it since I'm
still uncertain as to the distinction between the t->functions flags & the
decor flags.

  [patches on top of original decorations.c, not my patched one]

--- decorations.c.orig	Sun Jun 27 12:30:18 1999
+++ decorations.c	Mon Sep  6 12:16:36 1999
@@ -244,6 +244,7 @@
       if (hints)
         XFree (hints);
     }
+// fprintf(stderr,"Got OLDecor 0x%08X\n", t->ol_hints); fflush(stderr);
 
 }
 
@@ -311,19 +312,53 @@
 	& (~decor);
     }
 
-  /* now remove any functions specified in the OL hints */
+  /* now add/remove any functions specified in the OL hints */
   if (SHAS_OL_DECOR(sflags))
     {
-      if (!(t->ol_hints & OL_DECOR_CLOSE))
+      if (t->ol_hints & OL_DECOR_CLOSE)
+      {
+        t->functions |= MWM_FUNC_MINIMIZE;
+	decor        |= MWM_FUNC_MINIMIZE;
+      }
+      else
+      {
         t->functions &= ~MWM_FUNC_MINIMIZE;
-      if (!(t->ol_hints & OL_DECOR_RESIZEH))
+	decor        &= ~MWM_FUNC_MINIMIZE;
+      }
+      if (t->ol_hints & OL_DECOR_RESIZEH)
+      {
+        t->functions |= (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+	decor        |= (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+      }
+      else
+      {
         t->functions &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
-      if (!(t->ol_hints & OL_DECOR_HEADER))
+	decor        &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+      }
+      if (t->ol_hints & OL_DECOR_HEADER)
+      {
+        t->functions |= (MWM_DECOR_MENU | MWM_FUNC_MINIMIZE |
+                         MWM_FUNC_MAXIMIZE | MWM_DECOR_TITLE);
+	decor        |= (MWM_DECOR_MENU | MWM_FUNC_MINIMIZE |
+			 MWM_FUNC_MAXIMIZE | MWM_DECOR_TITLE);
+      }
+      else
+      {
         t->functions &= ~(MWM_DECOR_MENU | MWM_FUNC_MINIMIZE |
                           MWM_FUNC_MAXIMIZE | MWM_DECOR_TITLE);
-      if (!(t->ol_hints & OL_DECOR_ICON_NAME))
+	decor        &= ~(MWM_DECOR_MENU | MWM_FUNC_MINIMIZE |
+			  MWM_FUNC_MAXIMIZE | MWM_DECOR_TITLE);
+      }
+      if (t->ol_hints & OL_DECOR_ICON_NAME)
+      {
+	SET_HAS_NO_ICON_TITLE(t, 0);
+      }
+      else
+      {
 	SET_HAS_NO_ICON_TITLE(t, 1);
+      }
     }
+// fprintf(stderr,"Got functions/decor 0x%08X, 0x%08X\n", t->functions, decor); fflush(stderr);
 
   /* Now I have the un-altered decor and functions, but with the
    * ALL attribute cleared and interpreted. I need to modify the
@@ -342,6 +377,7 @@
   if(decor & (MWM_DECOR_MENU| MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE))
     decor |= MWM_DECOR_TITLE;
 
+// fprintf(stderr,"Now got functions/decor 0x%08X, 0x%08X\n", t->functions, decor); fflush(stderr);
   /* Selected the mwm-decor field, now trim down, based on
    * .fvwmrc entries */
   if (SHAS_NO_TITLE(sflags) ||
@@ -380,6 +416,7 @@
     }
   if(decor & MWM_DECOR_TITLE)
     {
+// fprintf(stderr,"Got title\n"); fflush(stderr);
       /*  A title barm with no buttons in it
        * window gets a 1 pixel wide black border. */
       SET_HAS_TITLE(t, 1);

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 6 Sep 1999 14:22:27 +0200

>   [patches on top of original decorations.c, not my patched one]

Neil, that patch doesn't apply to the CVS code. I guess you did not
take into account that I already applied your last patch.

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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]

---

From: Neil Bird <[email-masked]>
Date: Mon, 06 Sep 1999 13:41:06 +0100

> take into account that I already applied your last patch.

  Ooeer. I wouldn't have done that :-)  (I filter CVS emails to Trash, so
I missed it going in) Leastways, not without having a quick butchers at
it, anyway! Like I said, I don't *really* know what I'm doing in that
code.

  However, if you reckon it looks OK, and it doesn't cause anyone else any
problems, I'll attach the second-half of the patch here.

--- decorations.c.orig	Mon Sep  6 13:35:43 1999
+++ decorations.c	Mon Sep  6 13:39:37 1999
@@ -311,29 +311,52 @@
 	& (~decor);
     }
 
 	decor        &= ~MWM_FUNC_MINIMIZE;
 	decor        &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
 	decor        &= ~(MWM_DECOR_MENU | MWM_FUNC_MINIMIZE |