After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 70648 - GTK+ stock icon sizes cannot be themed
GTK+ stock icon sizes cannot be themed
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: [obsolete] stock-icons
1.3.x
Other Linux
: Low normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 74274
 
 
Reported: 2002-02-06 01:03 UTC by bill.haneman
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to provide themeability of icon sizes (when rescaling) (9.12 KB, patch)
2002-02-06 01:04 UTC, bill.haneman
none Details | Review
Patch to implement theming of icon sizes, without interfering with non-wildcarded icons (5.08 KB, patch)
2002-05-30 07:45 UTC, bill.haneman
none Details | Review
new patch that resizes icons dynamically when themes are changed (10.88 KB, patch)
2002-08-27 13:37 UTC, Brian Cameron
none Details | Review
updated patch that corrects null-pointer core dump error (10.98 KB, patch)
2002-08-27 15:01 UTC, Brian Cameron
none Details | Review
Updated patch that works with gtk_icon_size_register, like gnome-panel. (13.78 KB, patch)
2002-08-28 10:51 UTC, Brian Cameron
none Details | Review
one-liner fix to make patch work when program is started after theme with icon-sizes was specified (14.04 KB, patch)
2002-08-29 10:30 UTC, Brian Cameron
none Details | Review

Description bill.haneman 2002-02-06 01:03:07 UTC
The existing GTK+ stock icon theming mechanism does not allow theming of
the "standard" stock icon sizes.  The current API only allows implicit
sizing by specifying bitmaps for each stock icons at each size; otherwise
the icons are rescaled to the "standard" sizes for various GTK+ components.

There are several practical obstacles here:

(1) the stock pixmaps aren't installed, so there is no way to reuse them in
an RC-file theme this way (unless one manually installs the pixmaps from
the GTK+ sources);

(2) specifying a new stock icons for every size would require about 300
separate icon entries in the RC file;

(3) the stock pixmaps don't provide all the sizes one would need in the
previous case, and the standard rescaling technique can't be used since it
would defeat the purpose of "theming the size".

What would of course be a straightforward solution would be to allow
theming of the icon size constants in gtkiconfactory.c.  This breaks down
for those icons which are specified in the default theme via "add_sized"
but single stock icon entries in the RC file may be used to work around
this, with a relatively compact result.

A patch is attached which does this; however it also replaces occurrences
of add_sized with add_sized_with_fallback.  However this means that the
original stock icons will *not* be resized for those built-in sizes for
which they are added (i.e. if add_sized_with_fallback specified
GTK_ICON_SIZE_BUTTON as the standard for the pixmap, the pixmap will be
used "as-is" when rendered onto buttons, without regard for the themed
"gtk-icon-button-size" property).

This patch should probably be discussed before being applied, even though
it does not alter the look and feel of the default theme.

-Bill
Comment 1 bill.haneman 2002-02-06 01:04:20 UTC
Created attachment 6614 [details] [review]
patch to provide themeability of icon sizes (when rescaling)
Comment 2 Havoc Pennington 2002-02-14 20:41:43 UTC
 - we need to get rid of the ICONS_RESIZEABLE thing, just 
   delete the old code
 - the way the settings are done doesn't really work, since 
   new icon sizes can be registered. Suggest perhaps 
   a single "gtk-icon-sizes" setting containing something 
   like "menu 20,20:button 24,24" or along those lines.
 - need to handle dynamic notification on the setting, 
   which means incrementing the GtkIconSet cache validity 
   stamp and queuing a resize on all toplevel windows
 - it's possible this should really be part of the theme, 
   though I don't know; some accessibility things 
   require a specific theme already (e.g. high-contrast). 
   Maybe if someone is providing an icon collection 
   with their theme they would want to be able to specify 
   the natural sizes of the icon collection.
Comment 3 Owen Taylor 2002-02-14 23:01:42 UTC
Leaving this on 2.0.0 for now.
Comment 4 bill.haneman 2002-05-30 07:45:47 UTC
Created attachment 8844 [details] [review]
Patch to implement theming of icon sizes, without interfering with non-wildcarded icons
Comment 5 bill.haneman 2002-05-30 07:46:46 UTC
2.0.0 is long gone, and this bug is still marked "LOW" priority. 
However it is a blocker for accessibility.

If the one-line change to gtkstyle.c at line 1963 (or so) is backed
out of the previous patch, it causes no changes to gtk+ default icon
set behavior unless icon sizes are explicitly resized in the RC file.
 I attach a fresh version of the patch which should apply fine against
HEAD.
Comment 6 Mark McLoughlin 2002-08-14 00:38:02 UTC
Owen: I know this isn't an easy one ... but I agree with Bill that its
 a must have for accessibility.

The panel now registers its own icon size for its menus, so allowing
it to be themed would change the size of the icons on the panel menus.

Cheers :)
Comment 7 Owen Taylor 2002-08-14 05:33:13 UTC
Is it still on the 2.2 milestone? Then don't worry about it.

Comment 8 Brian Cameron 2002-08-27 13:37:21 UTC
Created attachment 10732 [details] [review]
new patch that resizes icons dynamically when themes are changed
Comment 9 Brian Cameron 2002-08-27 13:40:03 UTC
I have updated this patch so that it dynamically resizes the
icons whenever the theme changes.  This corrects problems where
the icon sizes would not properly update, especially for themes
that did not specify gtk-icon-sizes in the gtkrc file.

Without this newer patch you would have to quit & restart a
program to see the changed icon size.
Comment 10 Brian Cameron 2002-08-27 15:01:14 UTC
Created attachment 10737 [details] [review]
updated patch that corrects null-pointer core dump error
Comment 11 Brian Cameron 2002-08-27 15:01:51 UTC
updated patch.  found it caused a null-pointer core dump with
gnome-terminal.  Now this is fixed.
Comment 12 Brian Cameron 2002-08-28 10:51:35 UTC
Created attachment 10761 [details] [review]
Updated patch that works with gtk_icon_size_register, like gnome-panel.
Comment 13 Brian Cameron 2002-08-28 10:52:36 UTC
Sorry about updating the patch so much.  The latest patch gets the
icons to resize properly even if the size is non-default (e.g.
registered with the gtk_icon_size_register function).  This also
fixes bugzilla bug #71700.
Comment 14 Brian Cameron 2002-08-29 10:30:59 UTC
Created attachment 10784 [details] [review]
one-liner fix to make patch work when program is started after theme with icon-sizes was specified
Comment 15 Brian Cameron 2002-08-29 10:32:00 UTC
Updated the patch with a one-line fix.  Due to bad testing I 
didn't notice that my previous patch only worked when the
theme was changed after the program was started.  If a theme
was selected with non-default icon sizes and *then* the program
started, the icons weren't sized properly.  This is now fixed.
Comment 16 Calum Benson 2002-08-30 15:31:12 UTC
I'm also seeing another problem on RH7.2, which I'm not sure is due to
Mark's recent panel icon work, Brian's updated icon sizing patch, or
neither :)  What I'm seeing is:

1. Choose HighContrastLargePrint theme.  Stock panel menu icons get
bigger, but other icons on Applications/Actions menu don't.  Panel
doesn't resize either (bug #91686).

2. Restart panel so it resizes to fit the bigger font.  Now the icons
on the top level of the Applications/Actions menu are still small, but
the ones in the *submenus* are big, as they should be.  (Also, the
GNOME foot icon beside the Applications menu title is clipped).

3. Switch back to default theme.  The font switches back to normal
size, but the menu panel doesn't resize (as per bug #91686), and none
of the icon sizes on the Applications/Action menus change.  They're
still small on the top level, big in the submenus.

4.  Restart panel.  Now everything is back to default as it should be
:)

Can anyone else confirm they see this behaviour (using Brian's latest
patch above, and panel from head), or is it just me...?
Comment 17 Brian Cameron 2002-08-30 17:02:29 UTC
I tested this running Gnome on my Solaris9 and on my RedHat 7.2
machines, and it works fine for me on both.
Comment 18 Calum Benson 2002-09-10 13:52:34 UTC
Can confirm it's working fine for me on Solaris now too (GNOME 2 build
6), other than the issue raised in bug #92852.
Comment 19 Owen Taylor 2002-09-24 21:05:33 UTC
Tue Sep 24 16:40:14 2002  Owen Taylor  <otaylor@redhat.com>

	Make icon sizes configurable (#70648, slightly based
	on a patch from Bill Haneman, Brian Cameron)

	* gtk/gtkiconfactory.[ch]: Add 
	gtk_icon_size_lookup_for_settings().

	* gtk/gtksettings.c: Add gtk-icon-sizes XSETTING

	* gtk/gtkiconfactory.c: Make icon sizes per-GtkSettings.

	* gtk/gtkstyle.c: Use gtk_icon_size_lookup_for_settings()

	* gtk/gtkrc.[ch]: Privately export _gtk_rc_reset_styles()
	to force all the widgets to recompute their appearance.
Comment 20 Calum Benson 2002-10-01 11:08:41 UTC
I'm seeing problems with Owen's fix on RH7.2 and Solaris, can somebody
else confirm I don't just have two separate but identically-behaving
dodgy builds?  :)

E.g. starting from default gtk theme:

- Open gedit, select LargePrint theme (from gnome-themes); text gets
bigger, toolbar icons don't.

See also the problems in bug #92852.
Comment 21 Calum Benson 2002-10-01 14:56:56 UTC
Ok, both these problems are rectified by changing 'dnd=x,y' to
'gtk-dnd=x,y' in the gtkrc files, as Owen pointed out.

Still have one problem: changing from a theme with icon sizes
specified to one without doesn't change the icon size back to default
until you restart the app.  Have pinged Owen by email on whether this
a bug or a feature :)