Ethereal-dev: Re: [ethereal-dev] Ethereal does not register an icon for when it is minimized?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Mon, 13 Mar 2000 02:05:14 -0800
> It seems that Ethereal does not register an icon for when it is minimized ...

Correct, it doesn't.

At one point, I tried using the icon from "image/icon-ethereal.xpm";
that looks OK if you have a window manager that displays reasonably
large icons, but on Exceed on NT 4.0, and in KDE, the icon is a small
image in the window title bar and in the taskbar entry, and the "e"
looks a bit ugly when mechanically scaled down to that low a resolution
by the window manager.

Even more unfortunately, whilst there is a way for a window manager to
indicate the constraints it places on the size of an icon pixmap or
window by putting a WM_ICON_SIZE property on the root window, giving
minimum and maximum widths and heights, and increments on the width and
height (so that the heights and widths are of the form (min + n*inc)), I
couldn't find any such properties on the root window under Exceed or KDE
(perhaps I wasn't looking in the right place) - if window managers all
indicated the icon sizes they preferred via that property, an
application could have several different sizes of icons, hand-tuned if
necessary, and put up the appropriate one.

In case anybody wants to try it, I've attached a patch to use that icon.

(Note that the ICCCM indicates that icon pixmaps must be one bit deep;
however, the "e" icon isn't one bit deep - however, I suspect that many
window managers don't care and will happily let you have a colorful
icon.)
*** main.c	Sat Mar 11 20:01:31 2000
--- main.c.ICON	Mon Mar 13 01:55:26 2000
***************
*** 113,118 ****
--- 113,120 ----
  #include "gtkglobals.h"
  #include "plugins.h"
  
+ #include "image/icon-ethereal.xpm"
+ 
  FILE        *data_out_file = NULL;
  packet_info  pi;
  capture_file cf;
***************
*** 140,145 ****
--- 142,148 ----
  static void follow_print_stream(GtkWidget *w, gpointer parent_w);
  static char* hfinfo_numeric_format(header_field_info *hfinfo);
  static void create_main_window(gint, gint, gint, e_prefs*);
+ static void realize_main_window(void);
  
  /* About Ethereal window */
  void
***************
*** 1521,1526 ****
--- 1524,1531 ----
    set_menus_for_capture_in_progress(FALSE);
  #endif
  
+   realize_main_window();
+ 
    gtk_main();
  
    ethereal_proto_cleanup();
***************
*** 1685,1688 ****
--- 1690,1710 ----
    gtk_statusbar_push(GTK_STATUSBAR(info_bar), main_ctx, DEF_READY_MESSAGE);
    gtk_box_pack_start(GTK_BOX(stat_hbox), info_bar, TRUE, TRUE, 0);
    gtk_widget_show(info_bar);
+ }
+ 
+ static void
+ realize_main_window(void)
+ {
+   GtkWidget           *icon_pm;
+   GdkBitmap           *mask;
+   GtkStyle            *style;
+   GdkColormap         *cmap;
+   GdkPixmap           *pixmap;
+ 
+   style = gtk_widget_get_style(top_level);
+   cmap  = gdk_colormap_get_system();
+   pixmap = gdk_pixmap_colormap_create_from_xpm_d(NULL, cmap,  &mask,
+     &style->bg[GTK_STATE_NORMAL], icon_ethereal_xpm);
+   icon_pm = gtk_pixmap_new(pixmap, mask);
+   gdk_window_set_icon(top_level->window, NULL, pixmap, mask);
  }