Here is the very same patch from yesterday, applied to todays snapshot.
It's behaving itself so far.  =)

Daniel

-- 
/\\\----------------------------------------------------------------------///\
\ \\\      Daniel Henninger           http://www.vorpalcloud.org/        /// /
 \_\\\      North Carolina State University - Systems Programmer        ///_/
    \\\                   Information Technology <IT>                  ///
     """--------------------------------------------------------------"""
diff -cr fvwm-snap-20020314.old/fvwm/fvwm2.1 fvwm-snap-20020314/fvwm/fvwm2.1
*** fvwm-snap-20020314.old/fvwm/fvwm2.1 Sun Mar 10 07:30:02 2002
--- fvwm-snap-20020314/fvwm/fvwm2.1     Thu Mar 14 09:41:01 2002
***************
*** 1792,1797 ****
--- 1792,1809 ----
  creates a menu with a picture in its bottom left corner and
  colors with blue the region of the menu containing the picture.
  
+ If a menu-label starts with '~', then it is greyed out.  This might be useful
+ if you are creating a menu on the fly and want to be able to grey out items
+ if they don't exist in a particular host.  If you want a literal '~', you
+ should insert "~~".  Example:
+ .EX
+ AddToMenu "~~Local Netscape Install"
+ .EE
+ puts Local Netscape Install in the menu, but has it greyed out.  There is no
+ restriction as to whether this greyed-out status will still do something if
+ it is clicked on.  It's up to the user to make the menu item Nop if that is
+ what is desired.
+ 
  In all the above cases, the name of the resulting menu is name
  specified, stripped of the substrings between the various
  delimiters.
***************
*** 3694,3700 ****
  .IR UseIconName ,
  .IR Alphabetic " / " NotAlphabetic ,
  .IR NoHotkeys ,
! .IR SelectOnRelease .
  
  (Note - normal means not iconic, sticky, or on top)
  
--- 3706,3713 ----
  .IR UseIconName ,
  .IR Alphabetic " / " NotAlphabetic ,
  .IR NoHotkeys ,
! .IR SelectOnRelease ,
! .IR GreyIconic
  
  (Note - normal means not iconic, sticky, or on top)
  
***************
*** 3708,3713 ****
--- 3721,3732 ----
  key.  To switch it off, use
  .I SelectOnRelease
  without a key name.
+ 
+ The
+ .I GreyIconic
+ option causes any windows that are iconified to show up using the
+ .B Greyed / GreyedColorset
+ color scheme.
  
  If you pass in a function via
  .IR "Function funcname" ,
diff -cr fvwm-snap-20020314.old/fvwm/menuitem.c 
fvwm-snap-20020314/fvwm/menuitem.c
*** fvwm-snap-20020314.old/fvwm/menuitem.c      Wed Mar 13 07:30:02 2002
--- fvwm-snap-20020314/fvwm/menuitem.c  Thu Mar 14 09:28:31 2002
***************
*** 550,555 ****
--- 550,557 ----
        {
                currentGC = (is_item_selected) ?
                        ST_MENU_ACTIVE_GC(ms) : ST_MENU_GC(ms);
+               if (MI_IS_GREYED(mi))
+                       currentGC = ST_MENU_STIPPLE_GC(ms);
                if (ST_DO_HILIGHT(ms) &&
                    !ST_HAS_ACTIVE_FORE(ms) &&
                    !ST_HAS_ACTIVE_CSET(ms) &&
diff -cr fvwm-snap-20020314.old/fvwm/menuitem.h 
fvwm-snap-20020314/fvwm/menuitem.h
*** fvwm-snap-20020314.old/fvwm/menuitem.h      Sun Mar  3 12:11:06 2002
--- fvwm-snap-20020314/fvwm/menuitem.h  Thu Mar 14 09:20:12 2002
***************
*** 50,55 ****
--- 50,56 ----
  #define MI_HAS_HOTKEY(i)        ((i)->flags.has_hotkey)
  #define MI_IS_HOTKEY_AUTOMATIC(i) ((i)->flags.is_hotkey_automatic)
  #define MI_IS_SELECTABLE(i)     ((i)->flags.is_selectable)
+ #define MI_IS_GREYED(i)               ((i)->flags.is_greyed)
  /* temporary flags */
  #define MI_WAS_DESELECTED(i)    ((i)->flags.was_deselected)
  
***************
*** 100,105 ****
--- 101,107 ----
                unsigned has_hotkey : 1;
                unsigned is_hotkey_automatic : 1;
                unsigned is_selectable : 1;
+               unsigned is_greyed : 1;
                /* temporary flags */
                unsigned was_deselected : 1;
        } flags;
diff -cr fvwm-snap-20020314.old/fvwm/menus.c fvwm-snap-20020314/fvwm/menus.c
*** fvwm-snap-20020314.old/fvwm/menus.c Wed Mar 13 07:30:02 2002
--- fvwm-snap-20020314/fvwm/menus.c     Thu Mar 14 09:24:30 2002
***************
*** 5048,5053 ****
--- 5048,5085 ----
        return;
  }
  
+ /*
+    scans for a "grey this menu item out" indicator, which is a ~ at the
+    beginning of it.           <[EMAIL PROTECTED]>
+ */
+ static void scanForGreyed(MenuItem *it, int column)
+ {
+   char *txt;
+ 
+   txt = MI_LABEL(it)[column]; /* Get start of string  */
+   /* Scan first character of string   */
+   if (*txt == '~')
+   {           /* A greyed indicator?          */
+     if (txt[1] == '~')
+     { /* Just an escaped ~                    */
+       char *tmp;              /* Copy the string down over it */
+       for (tmp = txt; *tmp != '\0';
+            tmp++) tmp[0] = tmp[1];
+     }
+     else
+     {
+       /* It's a greyed indicator */
+       MI_IS_GREYED(it) = 1;
+       for (; *txt != '\0'; txt++)
+       {
+         /* Copy down.. */
+         txt[0] = txt[1];
+       }
+     }
+   }
+   return;
+ }
+ 
  
  /* Side picture support: this scans for a color int the menu name
     for colorization */
***************
*** 6634,6639 ****
--- 6666,6676 ----
                                        MI_HAS_HOTKEY(tmp) = 1;
                                        MI_IS_HOTKEY_AUTOMATIC(tmp) = 1;
                                }
+                       }
+                       if (!MI_IS_GREYED(tmp))
+                       {
+                               /* [EMAIL PROTECTED] */
+                               scanForGreyed(tmp, i);
                        }
                        if (*(MI_LABEL(tmp)[i]))
                        {
diff -cr fvwm-snap-20020314.old/fvwm/windowlist.c 
fvwm-snap-20020314/fvwm/windowlist.c
*** fvwm-snap-20020314.old/fvwm/windowlist.c    Wed Mar 13 07:30:03 2002
--- fvwm-snap-20020314/fvwm/windowlist.c        Thu Mar 14 09:18:21 2002
***************
*** 64,69 ****
--- 64,70 ----
  #define NO_CURRENT_DESK_TITLE   (1<<11)
  #define TITLE_FOR_ALL_DESKS     (1<<12)
  #define NO_NUM_IN_DESK_TITLE    (1<<13)
+ #define GREY_ICONIC             (1<<14)
  #define SHOW_EVERYTHING (SHOW_GEOMETRY | SHOW_ALLDESKS | SHOW_NORMAL | 
SHOW_ICONIC | SHOW_STICKY)
  
  /* Function to compare window title names
***************
*** 123,128 ****
--- 124,130 ----
    int ii;
    char tname[80];
    char loc[40];
+   char tmpbuf[40];
    char *name=NULL;
    int dwidth;
    int dheight;
***************
*** 260,265 ****
--- 262,269 ----
        show_listskip = 1;
        else if (StrEquals(tok,"OnlyListSkip"))
        show_listskip = 2;
+       else if (StrEquals(tok,"GreyIconic"))
+       flags |= GREY_ICONIC;
        else if (StrEquals(tok,"NoDeskNum"))
        flags |= NO_DESK_NUM;
        else if (StrEquals(tok,"NoCurrentDeskTitle"))
***************
*** 471,481 ****
          if (!name)
            name = "NULL_NAME";
  
!         t_hot = safemalloc(strlen(name) + 48);
!       if (use_hotkey)
!           sprintf(t_hot, "&%c. ", scut);         /* Generate label */
!       else
!         *t_hot = 0;
          if(!(flags & SHOW_INFONOTGEO))
            strcat(t_hot, name);
  
--- 475,492 ----
          if (!name)
            name = "NULL_NAME";
  
!         t_hot = safemalloc(strlen(name) + 49);
! 
!         if (IS_ICONIFIED(t) && (flags & GREY_ICONIC))
!           sprintf(t_hot, "~");
!         else
!           *t_hot = 0;
! 
!       if (use_hotkey) {
!           sprintf(tmpbuf, "&%c. ", scut);         /* Generate label */
!           strcat(t_hot, tmpbuf);
!       } 
! 
          if(!(flags & SHOW_INFONOTGEO))
            strcat(t_hot, name);
  

Reply via email to