Subject: FVWM: icon name-changes

From: [email-masked] (Paul Boven)
Date: Sat, 9 Nov 1996 11:48:43 +0100 (MET)

Hi everyone, 

A few days ago I upgraded to 2.0.43 (from fvwm) hoping that it would solve
something I really miss in fvwm: Icons that change their name. In concreto:
I am running Fvwm2 and xconsole on my NetBSD-1.2 Sparc ELC. I like to be
able to see at a glance whether there are any new messages in my iconified
xconsole, and it changes it's icon-name to "xconsole *" just for that
purpose.  However, I do not see that happen on my screen unless I move
my mouse pointer over the icon, giving it focus.

I have, however, found a way to achieve my goal: When I start up X I
do a su with failed password, causing xconsole to change it's icon-
name. Then I give it focus to make the change visible. Next, I start the
Talk-module, and give a "recapture". Double click on the console and
iconify it again... the icon is now bigger, with xconsole neatly centered
in it.. and when something happens on my xconsole, the "xconsole *"
icon-name neatly fills it up.

My guess is that the reason the changes in icon-name  aren't
visible is that the icon doesn't get bigger when it happens, the trailing
"*" staying obscured therefore.

So: fvwm seems to support icon resizing (on focus) and also centering of
the icon name (as soon as it changes). But, when you don't give the icon
focus, and your icon-name gets longer, you lose. 

How much trouble would it be to make fvwm2 behave a bit more sane in this
regard? I think this would be nice functionality to have, especially without
the magic incantation I found for it.

Regards, Paul Boven.
----------------------------------------------------------------------
Paul Boven, <[email-masked]>  PE1NUT  QRV 145.575 JO32KF
 "Read some Kerouac,  and it put me on the tracks,  to burn a little 
    brighter now"    - Torch song, Clutching at straws, Marillion.
----------------------------------------------------------------------
--
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].

---

From: Richard Lister <[email-masked]>
Date: Thu, 28 Nov 1996 11:07:43 +0000

On Sat, 9 Nov 1996 11:48:43 +0100 (MET)
[email-masked] (Paul Boven) 
> my mouse pointer over the icon, giving it focus.

Hi Paul

This was a problem I encountered as I have lots of information in
titles: working directory in xterms, filename in emacs, doc title in
netscape, etc etc.

The solution, for me anyway, was to use
  Style "*" Icon none
which just produces the icon title bar (I like things minimalist anyway!).
This hilighted what I thought were two bugs in fvwm:

1. The icon title bar width is calculated only when the application is
iconified for the *first* time. If the title subsequently changes
this width is no longer correct.

The following patch causes the icon to be redrawn on *every* iconify
for applications with no icon pixmap (the overhead is pretty trivial).

--- fvwm/icons.c.orig   Sun Jun  9 20:57:11 1996
+++ fvwm/icons.c        Thu Jun 13 10:55:51 1996
@@ -809,6 +809,15 @@
     else
       CreateIconWindow(tmp_win, def_x, def_y);

+  /* if no pixmap we want icon width to change to text width every iconify */
+  if( (tmp_win->icon_w != None) && (tmp_win->icon_pixmap_w == None) ) {
+    tmp_win->icon_t_width =
+      XTextWidth(Scr.IconFont.font,tmp_win->icon_name,
+                 strlen(tmp_win->icon_name));
+    tmp_win->icon_p_width = tmp_win->icon_t_width+6;
+    tmp_win->icon_w_width = tmp_win->icon_p_width;
+  }
+
   AutoPlace(tmp_win);
   tmp_win->flags |= ICONIFIED;
   tmp_win->flags &= ~ICON_UNMAPPED;

2. If the icon title changes whilst the application is iconified the event
is trapped and the title changed, but the width not recalculated.

The following patch redraws the icon on such an event for icons with
no pixmap. Note that this will cause the icon to move if it gets wider and
no longer fits its current slot in the iconbox.

--- fvwm/icons.c.orig   Fri Aug 16 11:30:38 1996
+++ fvwm/icons.c        Fri Aug 16 12:38:30 1996
@@ -334,9 +334,15 @@

   Tmp_win->icon_t_width = XTextWidth(Scr.IconFont.font,Tmp_win->icon_name,
                                     strlen(Tmp_win->icon_name));
-  /* clear the icon window, and trigger a re-draw via an expose event */
-  if (Tmp_win->flags & ICONIFIED)
-    XClearArea(dpy, Tmp_win->icon_w, 0, 0, 0, 0, True);
+
+  if (Tmp_win->flags & ICONIFIED) {
+    /* if no pixmap make new icon as the title may have changed size */
+    if( Tmp_win->icon_pixmap_w == None )
+      Iconify(Tmp_win, 0, 0);
+    else
+      /* clear the icon window, and trigger a re-draw via an expose event */
+      XClearArea(dpy, Tmp_win->icon_w, 0, 0, 0, 0, True);
+  }
   return;
 }

I have my iconbox running horizontally across the top of the screen,
and a long document title in netscape can cause the icon to be almost
half the screen width. This doesn't matter as I save so much vertical
space by not having icon pixmaps. I discriminate applications by using
different colours on the decorations.

Try these patches and see if they do what you want.

BTW, Chuck, are you going to include these in the next beta? I can't
remember what you said last time.

Ric

Richard J. Lister, Research Assistant    
Neural Computing Research Group, Aston University
[email-masked] 
http://www.ncrg.aston.ac.uk/~listerrj/ 
--
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].