Subject: window titles with '*' in them

From: Austin Donnelly <[email-masked]>
Date: Sat, 3 May 1997 20:15:43 +0100 (BST)

Debian bug number 8774 is quite interesting:

A user was using emacs with multiple frames, and so happened to have a
window called "emacs: *scratch*"

The fvwm2 window list sees this "*scratch*", and attempts to replace
it with a pixmap centered above the entry, as is the case for any
other menu.

This unfortunate user happened to have a scratch.xpm on his pixmap
path, and was thus a little bewildered!  :)

Is this "feature" one which anyone is relying on?  If not, it should
probably disappear.

I may have time to look at adding a flag to specify whether '*' and
'%' should be honoured.

The original Debian bug report can by found at:
    http://www.cl.cam.ac.uk/users/iwj10/debian-bugs/db/8774.html
It includes a base64 encoded gif of the offending WindowList menu.

Austin
--
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].

---

From: Greg Badros <[email-masked]>
Date: 08 May 1997 12:52:42 -0700

> Is this "feature" one which anyone is relying on?  If not, it should

Sounds like a bug to me.  Anyone who is using it probably shouldn't be.

> I may have time to look at adding a flag to specify whether '*' and

I've got a patch that fixes this.  I actually noticed the problem too
for a different reason-- when you get a window list, the menu is
actually made on the fly-- making a menu when you've got a long pixmap
path takes some time (if you are scanning the window title for pixmaps,
and your disk is slow, e.g. NFS mounted).  There was an unacceptable
delay when my window list had multiple windows with titles with special
characters in them.

Patch is included below. Note that it applies *on top of* the menu
improvements I posted a couple of weeks ago.  Both of these are
available from my web page.

http://www.cs.washington.edu/homes/gjb/patches

Greg J. Badros
[email-masked]
Seattle, WA  USA
http://www.cs.washington.edu/homes/gjb

Index: fvwm/builtins.c
===================================================================
RCS file: /homes/gws/gjb/.CVS/fvwm/fvwm/builtins.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -c -r1.15 -r1.16
/uns/gnu/bin/diff: conflicting specifications of output style
*** builtins.c	1997/04/21 22:59:01	1.15
--- builtins.c	1997/05/07 23:09:15	1.16
***************
*** 488,494 ****
    last_menu = mr;
    rest = GetNextToken(rest,&item);
  
!   AddToMenu(mr, item,rest);
    free(item);
    
    MakeMenu(mr);
--- 488,494 ----
    last_menu = mr;
    rest = GetNextToken(rest,&item);
  
!   AddToMenu(mr, item,rest, TRUE /* fPixmapScan */);
    free(item);
    
    MakeMenu(mr);
***************
*** 514,520 ****
  	  return;
        rest = GetNextToken(action,&item);
        
!       AddToMenu(mr, item,rest);
        free(item);
        
        MakeMenu(mr);
--- 514,520 ----
  	  return;
        rest = GetNextToken(action,&item);
        
!       AddToMenu(mr, item,rest, TRUE /* fPixmapScan */);
        free(item);
        
        MakeMenu(mr);
***************
*** 568,574 ****
    last_menu = mr;
    rest = GetNextToken(rest,&item);
  
!   AddToMenu(mr, item,rest);
    free(item);
    
    return;
--- 568,574 ----
    last_menu = mr;
    rest = GetNextToken(rest,&item);
  
!   AddToMenu(mr, item,rest, FALSE);
    free(item);
    
    return;
Index: fvwm/menus.c
===================================================================
RCS file: /homes/gws/gjb/.CVS/fvwm/fvwm/menus.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -c -r1.26 -r1.27
/uns/gnu/bin/diff: conflicting specifications of output style
*** menus.c	1997/04/21 22:59:20	1.26
--- menus.c	1997/05/07 23:10:14	1.27
***************
*** 1557,1563 ****
  	cur = cur_prev;
  
  	/* And add the entry pointing to the new menu */
! 	AddToMenu(mr,"More&...",szMenuContinuationActionAndName);
  	MakeMenu(menuContinuation);
  
  	}
--- 1557,1563 ----
  	cur = cur_prev;
  
  	/* And add the entry pointing to the new menu */
! 	AddToMenu(mr,"More&...",szMenuContinuationActionAndName,FALSE /* no pixmap scan */);
  	MakeMenu(menuContinuation);
  
  	}
***************
*** 1820,1826 ****
   *       so built in window list can handle windows w/ * and % in title.
   *
   ***********************************************************************/
! void AddToMenu(MenuRoot *menu, char *item, char *action)
  {
    MenuItem *tmp;
    char *start,*end;
--- 1820,1826 ----
   *       so built in window list can handle windows w/ * and % in title.
   *
   ***********************************************************************/
! void AddToMenu(MenuRoot *menu, char *item, char *action, Bool fPixmapsOk)
  {
    MenuItem *tmp;
    char *start,*end;
***************
*** 1875,1882 ****
    if (item != (char *)0)
      {
        char ch;
!       scanForPixmap(tmp->item,&tmp->picture,'*');
!       scanForPixmap(tmp->item,&tmp->lpicture,'%');
        ch = scanForHotkeys(tmp, 1);	/* [email-masked] */
        if (ch != '\0')
  	{
--- 1875,1885 ----
    if (item != (char *)0)
      {
        char ch;
!       if (fPixmapsOk)
! 	{
! 	scanForPixmap(tmp->item,&tmp->picture,'*');
! 	scanForPixmap(tmp->item,&tmp->lpicture,'%');
! 	}
        ch = scanForHotkeys(tmp, 1);	/* [email-masked] */
        if (ch != '\0')
  	{
***************
*** 1898,1907 ****
  
    if (tmp->item2 != (char *)0)
      {
!       if(!tmp->picture)
!         scanForPixmap(tmp->item2,&tmp->picture,'*');
!       if(!tmp->lpicture)
!         scanForPixmap(tmp->item2,&tmp->lpicture,'%');
        if (tmp->hotkey == 0) {
          char ch = scanForHotkeys(tmp, -1);	/* [email-masked] */
  	if (ch != '\0')
--- 1901,1912 ----
  
    if (tmp->item2 != (char *)0)
      {
!       if (fPixmapsOk) {
!         if(!tmp->picture)
! 	  scanForPixmap(tmp->item2,&tmp->picture,'*');
! 	if(!tmp->lpicture)
! 	  scanForPixmap(tmp->item2,&tmp->lpicture,'%');
!       }
        if (tmp->hotkey == 0) {
          char ch = scanForHotkeys(tmp, -1);	/* [email-masked] */
  	if (ch != '\0')
Index: fvwm/misc.h
===================================================================
RCS file: /homes/gws/gjb/.CVS/fvwm/fvwm/misc.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -c -r1.9 -r1.10
/uns/gnu/bin/diff: conflicting specifications of output style
*** misc.h	1997/04/21 22:10:31	1.9
--- misc.h	1997/05/07 23:11:16	1.10
***************
*** 225,231 ****
  extern Bool       GrabEm(int);
  extern void       UngrabEm(void);
  extern MenuRoot   *NewMenuRoot(char *name, int function_or_popup);
! extern void       AddToMenu(MenuRoot *, char *, char *);
  extern void       MakeMenu(MenuRoot *);
  extern void       CaptureAllWindows(void);
  extern void       SetTimer(int);
--- 225,231 ----
  extern Bool       GrabEm(int);
  extern void       UngrabEm(void);
  extern MenuRoot   *NewMenuRoot(char *name, int function_or_popup);
! extern void       AddToMenu(MenuRoot *, char *, char *, Bool fPixmapsOk);
  extern void       MakeMenu(MenuRoot *);
  extern void       CaptureAllWindows(void);
  extern void       SetTimer(int);
Index: fvwm/windows.c
===================================================================
RCS file: /homes/gws/gjb/.CVS/fvwm/fvwm/windows.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -c -r1.5 -r1.6
/uns/gnu/bin/diff: conflicting specifications of output style
*** windows.c	1997/04/21 22:10:35	1.5
--- windows.c	1997/05/07 23:11:40	1.6
***************
*** 135,141 ****
      sprintf(tlabel,"Desk: %d",desk);
    }
    mr=NewMenuRoot(tlabel,0);
!   AddToMenu(mr, tlabel, "TITLE");      
  
    next_desk = 0;
    while(next_desk != INT_MAX)
--- 135,141 ----
      sprintf(tlabel,"Desk: %d",desk);
    }
    mr=NewMenuRoot(tlabel,0);
!   AddToMenu(mr, tlabel, "TITLE", FALSE /* no pixmap scan */);
  
    next_desk = 0;
    while(next_desk != INT_MAX)
***************
*** 227,233 ****
            sprintf(tlabel,"%s %ld",func,t->w);
          else
            sprintf(tlabel,"WindowListFunc %ld",t->w);
!         AddToMenu(mr, t_hot, tlabel);
  #ifdef MINI_ICONS
          /* Add the title pixmap */
          if (t->mini_icon) {
--- 227,233 ----
            sprintf(tlabel,"%s %ld",func,t->w);
          else
            sprintf(tlabel,"WindowListFunc %ld",t->w);
!         AddToMenu(mr, t_hot, tlabel, FALSE /* no pixmap scan */);
  #ifdef MINI_ICONS
          /* Add the title pixmap */
          if (t->mini_icon) {
--
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].