Subject: WindowNames in Pager Balloons

From: Andreas Dischinger <[email-masked]>
Date: Thu, 14 Jan 1999 12:57:43 +0100 (MET)

Hi,

I wrote a little patch that displays the icon name or the window name
inside the balloons of FvwmPager. The patch below is against 2.1.7. It 
already contains changes to the manpage to document the newly created
Pager-command "*FvwmPagerBalloonDisplayType"

Hope this patch finds its way into fvwm before 2.2

--8<------------------------------------------------
diff -c -r fvwm-2.1.7.orig/modules/FvwmPager/FvwmPager.1 fvwm-2.1.7/modules/FvwmPager/FvwmPager.1
*** fvwm-2.1.7.orig/modules/FvwmPager/FvwmPager.1	Sat Dec 12 02:33:14 1998
--- fvwm-2.1.7/modules/FvwmPager/FvwmPager.1	Thu Jan 14 12:44:51 1999
***************
*** 236,241 ****
--- 236,244 ----
  loop. Defaults to +2. The offset will change sign automatically, as needed,
  to keep the balloon on the screen.
  
+ .IP "*FvwmPagerBalloonDisplayType [\fItype\fP]"
+ Show the icon name (the default) or the window name depending on the value of
+ \fItype\fP. \fItype\fP may be \fIIconName\fP or \fIWinName\fP.
  
  .SH AUTHOR
  Robert Nation 
diff -c -r fvwm-2.1.7.orig/modules/FvwmPager/FvwmPager.c fvwm-2.1.7/modules/FvwmPager/FvwmPager.c
*** fvwm-2.1.7.orig/modules/FvwmPager/FvwmPager.c	Thu Dec 17 23:51:20 1998
--- fvwm-2.1.7/modules/FvwmPager/FvwmPager.c	Thu Jan 14 12:39:49 1999
***************
*** 79,84 ****
--- 79,86 ----
  char *BalloonBorderColor = NULL;
  int BalloonBorderWidth = 1;
  int BalloonYOffset = 2;
+ /* 0 stands for icon_name and 1 stands for window_name */
+ int BalloonNameType = 0;
  
  int window_w=0, window_h=0, window_x=0, window_y=0;
  int icon_x=-10000, icon_y=-10000, icon_w=0, icon_h=0;
***************
*** 232,237 ****
--- 234,240 ----
                   M_ICONIFY|
  		 M_ICON_LOCATION|
  		 M_DEICONIFY|
+ 		 M_WINDOW_NAME|
  		 M_ICON_NAME|
  		 M_CONFIG_INFO|
  		 M_END_CONFIG_INFO|
***************
*** 327,332 ****
--- 330,338 ----
      case M_DEICONIFY:
        list_deiconify(body);
        break;
+     case M_WINDOW_NAME:
+       list_window_name(body);
+       break;
      case M_ICON_NAME:
        list_icon_name(body);
        break;
***************
*** 399,404 ****
--- 405,411 ----
    (*prev)->icon_view_width = 0;
    (*prev)->icon_view_height = 0;
    (*prev)->icon_name = NULL;
+   (*prev)->window_name = NULL;
    (*prev)->mini_icon.picture = 0;
    (*prev)->title_height = body[9];
    (*prev)->border_width = body[10];
***************
*** 817,822 ****
--- 824,850 ----
  }

+ void list_window_name(unsigned long *body)
+ {
+   PagerWindow *t;
+   Window target_w;
+ 
+   target_w = body[0];
+   t = Start;
+   while((t!= NULL)&&(t->w != target_w))
+     {
+       t = t->next;
+     }
+   if(t!= NULL)
+     {
+       if(t->window_name != NULL)
+ 	free(t->window_name);
+       CopyString(&t->window_name,(char *)(&body[3]));
+       //LabelWindow(t);
+       //LabelIconWindow(t);
+     }
+ }
+ 
  /***********************************************************************
   *
   *  Procedure:
***************
*** 1315,1320 ****
--- 1343,1355 ----
        else if (StrEquals(resource, "BalloonYOffset"))
  	{
  	  sscanf(arg1, "%d", &BalloonYOffset);
+ 	}
+       else if (StrEquals(resource,"BalloonDisplayType"))
+ 	{
+ 	  if ( strncasecmp(arg1,"IconName",8) == 0 )
+ 	    BalloonNameType = 0;
+ 	  else if  ( strncasecmp(arg1,"WinName",7) == 0 )
+ 	    BalloonNameType = 1;
  	}
  
        free(resource);
diff -c -r fvwm-2.1.7.orig/modules/FvwmPager/FvwmPager.h fvwm-2.1.7/modules/FvwmPager/FvwmPager.h
*** fvwm-2.1.7.orig/modules/FvwmPager/FvwmPager.h	Wed Dec  9 00:40:57 1998
--- fvwm-2.1.7/modules/FvwmPager/FvwmPager.h	Thu Jan 14 12:24:38 1999
***************
*** 55,60 ****
--- 55,61 ----
    Window icon_w;
    Window icon_pixmap_w;
    char *icon_name;
+   char *window_name;
    Picture mini_icon;
    int pager_view_width;
    int pager_view_height;
diff -c -r fvwm-2.1.7.orig/modules/FvwmPager/x_pager.c fvwm-2.1.7/modules/FvwmPager/x_pager.c
*** fvwm-2.1.7.orig/modules/FvwmPager/x_pager.c	Sat Dec 12 02:33:14 1998
--- fvwm-2.1.7/modules/FvwmPager/x_pager.c	Thu Jan 14 12:39:12 1999
***************
*** 35,40 ****
--- 35,41 ----
  extern int StartIconic;
  extern int MiniIcons;
  extern int ShowBalloons, ShowPagerBalloons, ShowIconBalloons;
+ extern int BalloonNameType;
  
  extern int icon_w, icon_h, icon_x, icon_y;
  XFontStruct *font, *windowFont;
***************
*** 1936,1944 ****
    /* associate balloon with its pager window */
    balloon.pw = t;
  
!   /* calculate window width to accommodate string */
!   window_changes.width = 4 + XTextWidth(balloon.font, t->icon_name,
!                                         strlen(t->icon_name));
  
    /* get x and y coords relative to pager window */
    x = (view_width / 2) - (window_changes.width / 2) - balloon.border;
--- 1937,1947 ----
    /* associate balloon with its pager window */
    balloon.pw = t;
  
!   { /* calculate window width to accommodate string */
!     char *displayString = (BalloonNameType==0) ? t->icon_name : t->window_name;
!     window_changes.width = 4 + XTextWidth(balloon.font, displayString,
! 					  strlen(displayString));
!   }
  
    /* get x and y coords relative to pager window */
    x = (view_width / 2) - (window_changes.width / 2) - balloon.border;
***************
*** 2012,2018 ****
    if ( BalloonFore == NULL )
      XSetForeground(dpy, BalloonGC, balloon.pw->text);
  
!   XDrawString(dpy, balloon.w, BalloonGC,
!               2, balloon.font->ascent,
!               balloon.pw->icon_name, strlen(balloon.pw->icon_name));
  }
--- 2015,2025 ----
    if ( BalloonFore == NULL )
      XSetForeground(dpy, BalloonGC, balloon.pw->text);
  
!   {
!     char *displayString = (BalloonNameType==0) ? balloon.pw->icon_name : balloon.pw->window_name;
! 
!     XDrawString(dpy, balloon.w, BalloonGC,
! 		2, balloon.font->ascent,
! 		displayString, strlen(displayString));
!   }
  }
--8<------------------------------------------------

-- 
   //|       |\\
  //||       ||\\         http://degnet.de/~awd/
 //=||       ||//         email: [email-masked]
//  ||ndreas |//ischinger PGP-Key by finger.

There are two kinds of knowledge, you either know the answer or
you know where to find it.
--
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: Dominik Vogt <[email-masked]>
Date: Thu, 14 Jan 1999 14:59:52 +0100

> Pager-command "*FvwmPagerBalloonDisplayType"

Does this address only the balloon labels? If this is so, could you
enhance your patch that it affects the window labels that are
printed into the mini windows? Have a look at how the syntax of
FvwmIconMan looks. If you could do it the same way that would be
great.

> Hope this patch finds its way into fvwm before 2.2

No, no more new patches are accepted into 2.2, only bugfixes. But soon
after I want it in.

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.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: Richard Lister <[email-masked]>
Date: Thu, 14 Jan 1999 11:41:04 -0500

On Thu, 14 Jan 1999 14:59:52 +0100
Dominik Vogt <[email-masked]> 
> FvwmIconMan looks. If you could do it the same way that would be

Andreas

Good effort. Dominik and I had a brief discussion about doing something
like this about a month ago. Just to clarify the FvwmIconMan-like
solution, here is how I described the syntax then. I favour using
something like this for consistency between modules:

> How about something similar to the format in FvwmIconMan? So we
> can say:
> 
> *FvwmPagerStringFormat formatstring
> 
> where formatstring is some printf-like string containing %i, %t, %c, %r, for
> icon, title, class and resource. We could use this for both mini-labels
> and balloons, or maybe also have:
> 
> *FvwmPagerBalloonStringFormat formatstring
> 
> and let people have different strings shown by each.

I've not looked at the relevant part of FvwmIconMan, but I would guess
much of the parsing code could just be lifted from there.

Cheers
Ric

Richard J Lister, Georgetown Institute for Cognitive and Computational Sciences
Georgetown University Medical Center, Washington, DC 20007, USA
Phone: +1 202-687 2878
Email: [email-masked] 
Web: http://www.giccs.georgetown.edu/~ric/
--
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: Andreas Dischinger <[email-masked]>
Date: Fri, 15 Jan 1999 10:24:52 +0100 (MET)

>>>>> "Dominik" == Dominik Vogt <[email-masked]> writes:

Dominik> Does this address only the balloon labels? If this is so,
Dominik> could you enhance your patch that it affects the window
Dominik> labels that are printed into the mini windows? Have a look at
Dominik> how the syntax of FvwmIconMan looks. If you could do it the
Dominik> same way that would be great.

This addresses only the Balloon Labels, but I'm working on extending
it to change the labels printed into the mini windows. The next patch 
version should support the syntax known from IconMan for both the
balloons and the mini windows

Andreas

I personally attend service at the "If it's not source, it's not
software" church.

---

From: Dominik Vogt <[email-masked]>
Date: Fri, 15 Jan 1999 21:48:47 +0100

> balloons and the mini windows

Great. That's exactly what I was hoping to hear :-)

Thanks

Dominik

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]