gtk_window_set_icons



Hi,

I attached a patch to http://bugzilla.gnome.org/show_bug.cgi?id=59240

The API docs and prototype are appended. I decided to allow passing in
three standard sizes, rather than just one icon, in case people want
to hand-draw the small one.

It should perhaps be called gtk_window_set_icon() even though it takes
three args, since it's one icon, just in three sizes.

I don't have a getter because it would get some generated/scaled
icons, it would be kind of strange.

I don't have a property because I'm not sure how it would work. (A
separate property for each size?)

I just went ahead and required three stock sizes rather than allowing
an arbitrary list to be passed in, because I think this is simpler to
use and will result in more consistency. I know KDE sets 16x16 and
32x32 for _NET_WM_ICON, and 48x48 is the size of most GNOME icons and
should be large enough for windowmaker/afterstep. So we provide those
three in _NET_WM_ICON.

I wasn't sure what size to use for the WM_NORMAL_HINTS pixmap though.

Also, this patch changes gdk_window_set_icon_list() to unconditionally
set the icons, rationale from ChangeLog:

        * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): don't
          check whether the hint is supported, just always set the
          icon. A task list might want to use it even if the WM
          doesn't, and the WM may change over time. Also,
          XDeleteProperty() if list == NULL.

Havoc


/**
 * gtk_window_set_icons:
 * @window: a #GtkWindow
 * @icon_16_by_16: pixbuf to use for 16x16 icon
 * @icon_32_by_32: pixbuf to use for 32x32 icon
 * @icon_48_by_48: pixbuf to use for 48x48 icon
 *
 * Sets up the icon representing a #GtkWindow. This icon is used when
 * the window is minimized (also known as iconified).  Some window
 * managers or desktop environments may also place it in the window
 * frame, or display it in other contexts.
 *
 * The icon may be provided in three different sizes, to allow you to
 * hand-draw the icon for each size and avoid scaling.  This improves
 * the visual quality of the icon.
 *
 * Ideally, you would provide hand-drawn versions of the icon for
 * 16x16, 32x32, and 48x48. However, if you only have your icon in one
 * size, pass that size in for the closest standard size, and pass
 * %NULL for the other two standard sizes. For example, if you have a
 * 34x34 icon, pass it in for @icon_32_by_32, and pass %NULL for
 * @icon_16_by_16 and @icon_48_by_48. Then the 34x34 icon will be
 * scaled to the three standard sizes.
 *
 * Similarly, if you have two sizes available, then pass them in for
 * the two closest standard sizes; for example, you might pass in an
 * 18x18 icon for @icon_16_by_16, and a 44x44 icon for @icon_48_by_48.
 * GTK+ would then scale the 44x44 icon in order to create a 32x32
 * icon, scale the 18x18 to create the 16x16 icon, and scale the 44x44
 * to create the 48x48 icon.
 *
 * It's best not to scale the icon images yourself before handing them
 * to gtk_window_set_icons(); always pass GTK+ the images in their
 * natural size, and let gtk_window_set_icons() figure out the
 * scaling.
 * 
 **/
void
gtk_window_set_icons (GtkWindow  *window,
                      GdkPixbuf  *icon_16_by_16,
                      GdkPixbuf  *icon_32_by_32,
                      GdkPixbuf  *icon_48_by_48)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]