From 77785ac321252fe4312e48f6b49004623ab99254 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Wed, 22 Oct 2008 05:29:48 +0000 Subject: [PATCH] Fixed various tags to make this validate. Bug #557337: 2008-10-22 Murray Cumming * doc/creating_themes/C/creating_metacity_themes.xml: Fixed various tags to make this validate. Bug #557337: svn path=/trunk/; revision=3978 --- ChangeLog | 5 ++++ .../C/creating_metacity_themes.xml | 23 +++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7983ab29c..9593ff041 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-10-22 Murray Cumming + + * doc/creating_themes/C/creating_metacity_themes.xml: + Fixed various tags to make this validate. + 2008-10-22 Thomas Thurman * NEWS: 2.25.2 release. diff --git a/doc/creating_themes/C/creating_metacity_themes.xml b/doc/creating_themes/C/creating_metacity_themes.xml index ba84f9ab9..f795af1b2 100644 --- a/doc/creating_themes/C/creating_metacity_themes.xml +++ b/doc/creating_themes/C/creating_metacity_themes.xml @@ -47,7 +47,7 @@ Introduction This is an article about how to theme Metacity. It is a work in progress, and I have had to dig deeply to find some answers; I may well have made mistakes and I welcome corrections and suggestions. -GNOME lets you theme a bunch of different things, but we're only talking about window border themes here, which some people call Metacity themes; Wikipedia begins a sentence with "Despite the incomplete state of Metacity theme development documentation", and though there is documentation in the source, apparently not many people find it, and it's written more for programmers than theme designers. Glynn Foster also wrote a very good introduction to Metacity themes [de] six years ago, but things have changed a little since then. Metacity themes can also be used by Compiz, and perhaps by other window managers for all I know. +GNOME lets you theme a bunch of different things, but we're only talking about window border themes here, which some people call Metacity themes; Wikipedia begins a sentence with "Despite the incomplete state of Metacity theme development documentation", and though there is documentation in the source, apparently not many people find it, and it's written more for programmers than theme designers. Glynn Foster also wrote a very good introduction to Metacity themes ([de]) six years ago, but things have changed a little since then. Metacity themes can also be used by Compiz, and perhaps by other window managers for all I know. So, a Metacity theme is a set of instructions about how to "decorate" (draw the borders around) a window. Presumably you don't want to style all windows identically, so the format lets you specify details for different kinds of window: @@ -91,9 +91,9 @@ for a theme installed for all users. -where N is the name of the theme and V is the version of the format. Version 2, introduced in October 2006, adds a few extra features, but it's rarely used. Version 1 is the original format. The formats are fixed once they're stable for both backwards and forwards compatibility; new features can't be added without introducing a new version number, which is why improvements come out rarely and in large clumps. metacity-1 in the names is a fossil and doesn't mean version 1 of anything. +where N is the name of the theme and V is the version of the format. Version 2, introduced in October 2006, adds a few extra features, but it's rarely used. Version 1 is the original format. The formats are fixed once they're stable for both backwards and forwards compatibility; new features can't be added without introducing a new version number, which is why improvements come out rarely and in large clumps. metacity-1 in the names is a fossil and doesn't mean version 1 of anything. -The metacity-theme-V.xml files are GMarkup files, which are very similar to XML. For now, you actually have to write these in a text editor or something; you can either start with a blank page, or modify a theme someone else has made. (I am thinking of writing a general theme editor program, but that'll have to wait until I've reduced Metacity's open bug queue a little.) If you want to see a fully-fledged one, you can look at the current version of "Atlanta", one of the simplest themes, but even that is quite complicated-looking at first. +The metacity-theme-V.xml files are GMarkup files, which are very similar to XML. For now, you actually have to write these in a text editor or something; you can either start with a blank page, or modify a theme someone else has made. (I am thinking of writing a general theme editor program, but that'll have to wait until I've reduced Metacity's open bug queue a little.) If you want to see a fully-fledged one, you can look at the current version of "Atlanta", one of the simplest themes, but even that is quite complicated-looking at first. So, let's talk about what actually goes inside the files. As in any XML file, <!-- … > are comments. At its most basic, it would go: @@ -139,6 +139,7 @@ for a theme installed for all users. frame_style_set:tells Metacity how to draw windows according to whether they're focused or not, maximised or not, shaded or not, and allowing resizing vertically, horizontally, both, or neither. It looks like this: + @@ -167,7 +168,9 @@ for a theme installed for all users. + N is the name of a frame_style to apply to a window which has these attributes. + A frame_style_set tag may also have a "parent" tag, which should be the name of another frame_style_set. This means that if Metacity wants to know about a kind of window which that frame_style_set doesn't describe, it should look in the parent. Most of the more complicated tags in Metacity theme files also have a "parent" attribute which work the same way. This is particularly useful because, taken together, all the frame_style_sets in a theme file must be capable of matching every possible kind of window; if a window turns up that they can't match, there will be an error at runtime. Let's recap what we've seen so far. The combination of a window, which matches a window's state (normal, dialog, and so forth), with an entry in the corresponding frame_style_set, which matches its focus, shadedness, maximisedness, and resize permissions where relevant, will allow you to make a list of rules to match any window against. The next piece of this puzzle lets you specify what Metacity should do with such windows once it's matched them. @@ -213,7 +216,7 @@ for a theme installed for all users. -What Metacity draws in these pieces is decided by the theme. If a frame_style or its parents don't specify a particular piece, nothing will be drawn for that piece. You have two ways to specify what to draw: one is that the piece tag can have a draw_ops tag inside it which lists a sequence of drawing operations in Metacity's custom format. You might ask why we don't use SVG; one answer is that SVG support wasn't very strong when this format was designed, and another answer is that these days you can use SVG all you like; just include it as an image and Metacity will know what to do. +What Metacity draws in these pieces is decided by the theme. If a frame_style or its parents don't specify a particular piece, nothing will be drawn for that piece. You have two ways to specify what to draw: one is that the piece tag can have a draw_ops tag inside it which lists a sequence of drawing operations in Metacity's custom format. You might ask why we don't use SVG; one answer is that SVG support wasn't very strong when this format was designed, and another answer is that these days you can use SVG all you like; just include it as an image and Metacity will know what to do. An alternative to including a draw_ops tag inside a piece tag is to add a draw_ops attribute to the piece tag. Then you can add a draw_ops tag at top level (inside the metacity_theme tag) with a name attribute, and Metacity will use that. This is useful if you use similar draw_ops over and over. I'm not going to document draw_ops at present, because this is already very long. I will write it up later and link it from here. @@ -228,7 +231,7 @@ for a theme installed for all users. menu is the menu button you can click to get a list of actions you can perform on the window. shade, above, stick are similar to the original buttons but only allowed in version 2 -unshade, unabove, unstick are the toggled versions of these buttons. Again, version 2 only. It is not immediately apparent to me how the toggled version of maximize is generated, though I suppose I must have known at some point. +unshade, unabove, unstick are the toggled versions of these buttons. Again, version 2 only. @@ -250,10 +253,10 @@ for a theme installed for all users. Other things which lie around a file -The most important other thing in a theme file is the metadata held in the info tag. This contains a set of tags each of which contains some text explaining something about the theme itself, in a sort of Dublin Core sort of way. (Next time around, we should probably use the actual Dublin Core.) The tags are name, author, copyright, date, and description. +The most important other thing in a theme file is the metadata held in the info tag. This contains a set of tags each of which contains some text explaining something about the theme itself, in a sort of Dublin Core sort of way. (Next time around, we should probably use the actual Dublin Core.) The tags are name, author, copyright, date, and description. Version 1 of the format had a menu_icon tag at top level, which let themes specify the icons beside options in the menu you get from the menu icon. This has become redundant; the icons are taken from the icon theme! The tag can still be used in all formats, but does nothing and is deprecated. -Version 2 of the format has a fallback tag at top level, which let the theme specify what icon a window should be considered to have if it doesn't provide an icon of its own. This should also be taken from the icon theme, if anyone fancies fixing it, and the tag should also then be deprecated. It shouldn't be hard. +Version 2 of the format has a fallback tag at top level, which let the theme specify what icon a window should be considered to have if it doesn't provide an icon of its own. This should also be taken from the icon theme, if anyone fancies fixing it, and the tag should also then be deprecated. It shouldn't be hard. @@ -261,13 +264,13 @@ for a theme installed for all users. When you're working on a theme When you're editing a theme, you can view it without using it on the whole desktop using -metacity-theme-viewer YourThemeName +metacity-theme-viewer YourThemeName and view it on the whole desktop using -gconftool --type=string --set /apps/metacity/general/theme YourThemeName +gconftool --type=string --set /apps/metacity/general/theme YourThemeName Whenever you change the selected theme in GConf, Metacity will load the newly-chosen theme. This is how control-center does it. But when you change a theme, as you're working on it, you might want to ask Metacity to reload the theme which is currently used on the whole desktop to reflect your changes. You can do this using the little-known metacity-message program, with the command metacity-message reload-theme. This works by sending the ClientMessage _METACITY_RELOAD_THEME_MESSAGE to the root window, in case you're interested. -Once you're done with your theme, consider submitting it to the art.gnome.org site, or the gnome-look site. +Once you're done with your theme, consider submitting it to the art.gnome.org site, or the gnome-look site.