Re: FVWM: icon name-changes

From: Richard Lister <listerrj_at_helios.aston.ac.uk>
Date: Thu, 28 Nov 1996 11:07:43 +0000

On Sat, 9 Nov 1996 11:48:43 +0100 (MET)
e.p.boven_at_student.utwente.nl (Paul Boven)
wrote concerning 'FVWM: icon name-changes':
> 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.

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
_at_@ -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
_at_@ -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
r.j.lister_at_aston.ac.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 majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Thu Nov 28 1996 - 05:12:54 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST