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 129747 - Theme should accept #RRGGBB as constants.
Theme should accept #RRGGBB as constants.
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: themes
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks: 102547
 
 
Reported: 2003-12-20 19:01 UTC by graeme worthy
Modified: 2006-10-07 17:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description graeme worthy 2003-12-20 19:01:23 UTC
The theme file should accept large numbers and strings as constants so as
to allow global colour information to be specified at the begining of the
file. 
Right now only small integers are allowed.
Comment 1 Thomas Thurman 2006-02-15 19:22:49 UTC
String constants would need:
 * parse_toplevel_element to know to store string constants.
 * meta_color_spec_new_from_string to be aware of the new constants
 * meta_theme_define_string_constant to be defined.

You'd then have the problem of telling whether defining a constant to be e.g. "1" is the string 1 or the integer 1. Possibly we should define every constant as a string, and then also as a float constant or an integer constant if they parsed as one.

The large integer restriction happens because of the constant
#define MAX_REASONABLE 4096

in theme-parser.c. Setting it larger (to what? 0x1000000?) would allow large integers as constants.
Comment 2 Thomas Thurman 2006-02-16 02:31:45 UTC
Looking into this I find that it would be far more sensible to allow strings as constants. Colours can be quite complex, more than can be expressed with a simple integer constant.
Comment 3 Havoc Pennington 2006-02-16 05:55:33 UTC
Could just allow color constants, that might be easiest. 

The limitation on integer sizes is probably misguided, I really have no idea what the point of it was supposed to be. Just some kind of generic paranoia I suppose. Would not want to change this limit without doing the theme format versioning though, as for all the other possible theme changes.
Comment 4 Thomas Thurman 2006-06-13 23:40:07 UTC
Fixed in metacity-theme-2.
Comment 5 Havoc Pennington 2006-06-14 04:20:43 UTC
When removing a limit like this, you're ensuring that the limit is still enforced for themes with the old filenames right? i.e. it should be impossible to accidentally use new theme features with old filenames.
Comment 6 Thomas Thurman 2006-06-14 12:02:26 UTC
That's right. There's a macro I'm using:

#define META_THEME_ALLOWS(theme, feature) (theme->format_version >= feature)

/* What version of the theme file format were various features introduced in? */
...
#define META_THEME_COLOR_CONSTANTS 2

and if that's false it pretends the feature doesn't exist.
Comment 7 Thomas Thurman 2006-10-07 17:03:09 UTC
Fixed in HEAD!