Subject: FVWM: FvwmWinList Bugs

From: Nadim Saeed <[email-masked]>
Date: Tue, 26 Aug 1997 14:35:11 -0700

As stated in an earlier email, I've noticed a couple of strange things about
FvwmWinList (in 2.0.46)

  1. The entries are always left justified (instead of center)
  2. WinList is wider than it used to be (was " name ", now is "  name  ")
  3. Windows that have focus are displayed pressed in WinList

so I investigated further (you know, to improve my C skills :-) and have added
an option to turn the button-pressed-on-focus look (patch for both module and
man-pages below; not much of a change - an if/else clause), yet I have more
questions.  I'm not familiar with mini-icons (patch added to FvwmWinList in
2.0.46 which introduced features/bugs above), and so I would REALLY
appreciate some pointers (HELP) on the following couple of things.

 a. How does a module know whether mini-icons are enabled (ie. if user is
    using 'em) or are they static (always there) - .fvwm2rc examples ?
 b. bugs listed above (#1,#2) both relate to variable 'newx' within the
    DoButton function (in FvwmWinList/ButtonArray.c) - can someone shed
    some light to how this works (I've been comparing 2.0.45's code vs.
    2.0.46).

    for example,
     I've uncommented line (348) in FvwmWinList/ButtonArray.c

    	newx=max((w-button->tw)/2,4);

     and this solved the left justification problem, yet the width didn't get
     affected (there are lots of other newx lines commented out)

Any HELP would really be appreciated..

BTW: let me know how the patch goes (this is my first one :-D )

 - Nadim

#<<** patch for FvwmWinList to enable/disable Pressed-button-focus-look **>>#
*** FvwmWinList.c	Tue Aug 26 13:46:30 1997
--- FvwmWinList.c.new	Tue Aug 26 14:12:07 1997
***************
*** 116,122 ****
        *ForeColor[MAX_COLOUR_SETS] = { "black" },
        *geometry="";
  char *font_string = "fixed";
! int UseSkipList=0,Anchor=1,UseIconNames=0,LeftJustify=0,TruncateLeft=1;
  
  long CurrentDesk = 0;
  int ShowCurrentDesk = 0;
--- 116,122 ----
        *ForeColor[MAX_COLOUR_SETS] = { "black" },
        *geometry="";
  char *font_string = "fixed";
! int UseSkipList=0,FocusPressed=0,Anchor=1,UseIconNames=0,LeftJustify=0,TruncateLeft=1;
  
  long CurrentDesk = 0;
  int ShowCurrentDesk = 0;
***************
*** 364,395 ****
        free(name);
        break;
      case M_FOCUS_CHANGE:
! 
! /* old coded, before Task bar code spliced in
! 
!       i=FindItem(&windows,body[0]);
!       if (i==current_focus) break;
!       if (current_focus!=-1)
! 	if ((ItemFlags(&windows,ItemID(&windows,current_focus))&ICONIFIED)==0)
! 	  if (UpdateButtonSet(&buttons,current_focus,0)!=-1) redraw=1;
!       current_focus=-1;
!       if (i!=-1&&(ItemFlags(&windows,body[0])&ICONIFIED)) break;
!       current_focus=i;
!       if (current_focus!=-1)
! 	if (UpdateButtonSet(&buttons,current_focus,2)!=-1) redraw=1;
! * end of old code */
! 
! /* Code copied Straight from TaskBar */
! 
!     if ((i=FindItem(&windows,body[0]))!=-1)
!     {
! 	    flags=ItemFlags(&windows,body[0]);
!  	    UpdateItemFlags(&windows,body[0],flags);
!     }
!     RadioButton(&buttons,i);
!     redraw = 1;
!     break;
! 
        break;
      case M_END_WINDOWLIST:
        if (!WindowIsUp) MakeMeWindow();
--- 364,395 ----
        free(name);
        break;
      case M_FOCUS_CHANGE:
!       if (FocusPressed)
! 	{
! 	  /* Code to show a pressed button when the window has focus
! 	     - by Don Mahurin "Code copied Straight from TaskBar"
! 	   */
! 	  if ((i=FindItem(&windows,body[0]))!=-1)
! 	    {
! 	      flags=ItemFlags(&windows,body[0]);
! 	      UpdateItemFlags(&windows,body[0],flags);
! 	    }
! 	  RadioButton(&buttons,i);
! 	  redraw = 1;
! 	}
!       else
! 	{
! 	  i=FindItem(&windows,body[0]);
! 	  if (i==current_focus) break;
! 	  if (current_focus!=-1)
! 	    if ((ItemFlags(&windows,ItemID(&windows,current_focus))&ICONIFIED)==0)
! 	      if (UpdateButtonSet(&buttons,current_focus,0)!=-1) redraw=1;
! 	  current_focus=-1;
! 	  if (i!=-1&&(ItemFlags(&windows,body[0])&ICONIFIED)) break;
! 	  current_focus=i;
! 	  if (current_focus!=-1)
! 	    if (UpdateButtonSet(&buttons,current_focus,2)!=-1) redraw=1;
! 	}
        break;
      case M_END_WINDOWLIST:
        if (!WindowIsUp) MakeMeWindow();
***************
*** 551,556 ****
--- 551,558 ----
  				Clength+8)==0) Anchor=0;
  	  else if(mystrncasecmp(tline,CatString3(Module, "Action",""), Clength+6)==0)
  	    LinkAction(&tline[Clength+6]);
+ 	  else if(mystrncasecmp(tline,CatString3(Module, "FocusPressed",""),
+ 				Clength+11)==0) FocusPressed=1;
  	  else if(mystrncasecmp(tline,CatString3(Module, "UseSkipList",""),
  				Clength+11)==0) UseSkipList=1;
  	  else if(mystrncasecmp(tline,CatString3(Module, "UseIconNames",""),

#<<** patch for man pages due to new flag **>>#
*** FvwmWinList.man	Tue Aug 26 13:47:15 1997
--- FvwmWinList.man.new	Tue Aug 26 14:12:28 1997
***************
*** 78,83 ****
--- 78,87 ----
  are iconified. If omitted, the color from \fBFvwmWinListBack\fP
  is used.
  
+ .IP "*FvwmWinListFocusPressed
+ Tells FvwmWinList to show a window's corresponding button as pressed
+ when that window captures focus.
+ 
  .IP "*FvwmWinListUseSkipList
  Tells FvwmWinList to not show the windows that are listed on a WindowListSkip
  line if the configuration file.
***************
*** 91,98 ****
  name.  This is useful to keep the width of the window small.
  
  .IP "*FvwmWinListLeftJustify
! By default, FvwmWinList will center the icon text in the icon.  This option
! causes it to be justified flush with the left edge of the icon.
  
  .IP "*FvwmWinListMinWidth \fIwidth\fP"
  .IP "*FvwmWinListMaxWidth \fIwidth\fP"
--- 95,102 ----
  name.  This is useful to keep the width of the window small.
  
  .IP "*FvwmWinListLeftJustify
! By default, FvwmWinList will center the icon text in the button.  This option
! causes it to be justified flush with the left edge of the button.
  
  .IP "*FvwmWinListMinWidth \fIwidth\fP"
  .IP "*FvwmWinListMaxWidth \fIwidth\fP"
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].