I mostly wrote this so I could both: 1. Remove the geometry info from windowlist and 2. Still be able to tell what's iconified
What it does is it makes any menu item beginning in ~ (with the obviously ~~ to force a literal ~) uses the "Greyed" color scheme instead of the normal colors. Windowlist is also patched to accept a new argument, GreyIconic, to specify that a user wants iconic items in the windowlist to be greyed out using the above mechanism. The patch is attached. So far it seems to be behaving itself. Daniel -- /\\\----------------------------------------------------------------------///\ \ \\\ Daniel Henninger http://www.vorpalcloud.org/ /// / \_\\\ North Carolina State University - Systems Programmer ///_/ \\\ Information Technology <IT> /// """--------------------------------------------------------------"""
diff -cr fvwm-2.4.6/fvwm/fvwm2.1 fvwm-2.4.6-new/fvwm/fvwm2.1 *** fvwm-2.4.6/fvwm/fvwm2.1 Sun Mar 10 04:13:36 2002 --- fvwm-2.4.6-new/fvwm/fvwm2.1 Wed Mar 13 12:09:44 2002 *************** *** 1506,1511 **** --- 1506,1523 ---- 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. *************** *** 3308,3313 **** --- 3320,3326 ---- .IR UseIconName , .IR Alphabetic " / " NotAlphabetic , .IR NoHotkeys , + .IR GreyIconic , .IR SelectOnRelease . (Note - normal means not iconic, sticky, or on top) *************** *** 3336,3342 **** option, only windows in layers between m and n are displayed. n defaults to m. With the .I ReverseOrder ! option the order of the windows in the list is reversed. If you wanted to use the .B WindowList --- 3349,3358 ---- option, only windows in layers between m and n are displayed. n defaults to m. With the .I ReverseOrder ! option the order of the windows in the list is reversed. With the ! .I GreyIconic ! option all iconified windows use Greyed/GreyedColorset as their foreground ! color scheme. If you wanted to use the .B WindowList diff -cr fvwm-2.4.6/fvwm/menus.c fvwm-2.4.6-new/fvwm/menus.c *** fvwm-2.4.6/fvwm/menus.c Fri Mar 8 15:04:39 2002 --- fvwm-2.4.6-new/fvwm/menus.c Wed Mar 13 11:23:00 2002 *************** *** 3549,3554 **** --- 3549,3556 ---- { currentGC = (is_item_selected) ? MST_MENU_ACTIVE_GC(mr) : MST_MENU_GC(mr); + if (MI_IS_GREYED(mi)) + currentGC = MST_MENU_STIPPLE_GC(mr); if (MST_DO_HILIGHT(mr) && !MST_HAS_ACTIVE_FORE(mr) && !MST_HAS_ACTIVE_CSET(mr) && *************** *** 5101,5106 **** --- 5103,5147 ---- } + /*********************************************************************** + * Procedure: + * scanForGreyed - Look for greyed indicator in a MenuItem + * ([EMAIL PROTECTED]) + * + * Inputs: + * it - MenuItem to scan + * column - The column number in which to look for a hotkey. + * + ***********************************************************************/ + 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 */ static void scanForColor(char *instring, Pixel *p, Bool *flag, char identifier) *************** *** 5432,5437 **** --- 5473,5483 ---- 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-2.4.6/fvwm/menus.h fvwm-2.4.6-new/fvwm/menus.h *** fvwm-2.4.6/fvwm/menus.h Mon Jul 23 18:38:29 2001 --- fvwm-2.4.6-new/fvwm/menus.h Tue Mar 12 15:35:56 2002 *************** *** 360,365 **** --- 360,366 ---- unsigned has_hotkey : 1; unsigned is_hotkey_automatic : 1; unsigned is_selectable : 1; + unsigned is_greyed : 1; /* temporary flags */ unsigned was_deselected : 1; } flags; *************** *** 389,394 **** --- 390,396 ---- #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) diff -cr fvwm-2.4.6/fvwm/windowlist.c fvwm-2.4.6-new/fvwm/windowlist.c *** fvwm-2.4.6/fvwm/windowlist.c Fri Feb 22 17:07:48 2002 --- fvwm-2.4.6-new/fvwm/windowlist.c Wed Mar 13 11:50:42 2002 *************** *** 57,62 **** --- 57,63 ---- #define SHOW_ICONNAME (1<<7) #define SHOW_ALPHABETIC (1<<8) #define SHOW_INFONOTGEO (1<<9) + #define GREY_ICONIC (1<<10) #define SHOW_EVERYTHING (SHOW_GEOMETRY | SHOW_ALLDESKS | SHOW_NORMAL | SHOW_ICONIC | SHOW_STICKY) /* Function to compare window title names *************** *** 91,96 **** --- 92,98 ---- int ii; char tname[80] = ""; char loc[40]; + char tmpbuf[40]; char *name=NULL; int dwidth; int dheight; *************** *** 220,225 **** --- 222,229 ---- flags |= SHOW_STICKY; else if (StrEquals(tok,"OnlySticky")) flags = SHOW_STICKY; + else if (StrEquals(tok,"GreyIconic")) + flags |= GREY_ICONIC; else if (StrEquals(tok,"UseListSkip")) show_listskip = 1; else if (StrEquals(tok,"OnlyListSkip")) *************** *** 407,417 **** 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); if (*t_hot == 0) --- 411,428 ---- 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); if (*t_hot == 0)