Subject: FVWM: Patch for icon title width

From: Richard Lister <[email-masked]>
Date: Sun, 09 Jun 1996 21:38:23 +0100

Hi Folks

This is something that's been bugging me for a long time, so I finally
lost my fvwm-hacking virginity and fixed it :-) 

On some applications I use the titlebar/icon name to convey useful
information: e.g. current working directory for xterms, buffer name for
emacs, etc. In the hope of being able to see this info even when iconised
I prefer not to use a pixmap for the icon, using:

Style "XTerm"       Icon none.xpm

My icon box runs across the top of the screen, so the icons take up little
(vertical) space and it actually looks quite smart (IMHO). 

When the app is first iconised the icon title bar is made just the right
width for the icon's title text (in CreateIconWindow()). However, if the
title changes and the window re-iconised its width doesn't change and it
is now either too wide or too narrow.

This patch to icons.c fixes this in every Iconify() without the overhead
of another call to CreateIconWindow().

Ric

--- icons.c	Sun Jun  9 20:57:11 1996
+++ icons.c.new	Sun Jun  9 21:05:19 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;

 ~~~~~~~~~~~~~~ Richard J. Lister    [email-masked] ~~~~~~~~~~~~~~~~
            Research Assistant, Neural Computing Research Group
                  Aston University, Birmingham B4 7ET, UK
 ~~~~~~~~~~~~~~~~~ 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].