Hi,
The way to go for Wine theming is to use Windows XP themes. Unfortunately the file format itself is not documented. Based on Wine its uxtheme code (BTW our uxtheme is quite complete) and an analysis of some 'free' XP themes like 'ClearLook' I was able to write my own theme template.
First of all for I want to warn all people who want to write Wine themes. A Windows theme consists of colors, font sizes, bitmaps and dimensions of controls. Windows theme editors use XP themes as a template for creating new themes, so even if you find a 'free' theme it is in the end derived from a Microsoft theme and most of the time Luna. Myself I analyzed the clearlooks and some other free ones just to understand Wine's uxtheme code. If you want to write themes use the uxtheme code as your reference. For instance dlls/uxtheme/stylemap.c shows which properties are allowed on each control. If a property on lets say a button is called 'CONTENTMARGINS' themes useally type 'ContentMargins',
Anyway now to the theme file I created. A theme file is a resource file which contains various sections. They contain the names of the builtin color schemes, font sizes and of course the actual theme data. The theme data itself is stored in ini files. Most themes offer differ font sizes and colors and for each combination there is a ini file.
The theme file I made only consists of a 'SysMetrics' section which contains the 'classic' color names which can also be adjusted from the Control Panel\Colors registry location. The difference is that in XP Microsoft cleaned up the names, so some of the names have changed. The theme is compiled using mingw because right now winecfg seems to need a real 'MZ' header.
A lot of work is needed especially in comctl32 and also in uxtheme its drawing code to optimize the drawing performance and to properly render themes. For this purpose you should use some free native XP themes and try them to render properly in Wine. The uxtheme drawing code needs to handle margins, locations and positions properly. Right now in case of a button comctl32 is making assumptions about text locations and I don't think that belongs there.
Hopefully some people will step up to create Wine themes and improve utheme and our theme drawing. Myself I envision a 'winetheme.msstyles' which contains some GTK and QT color themes.
Roderick
2008/11/4 Roderick Colenbrander thunderbird2k@gmx.net:
Hi,
The way to go for Wine theming is to use Windows XP themes. Unfortunately the file format itself is not documented. Based on Wine its uxtheme code (BTW our uxtheme is quite complete) and an analysis of some 'free' XP themes like 'ClearLook' I was able to write my own theme template.
The format has completely changed with Vista. It is similar in that it is a DLL, but all the theme metrics and stuff are in unintelligible binary blocks. Whereas it is possible to read the XP configurations, it is not possible in Vista.
The Vista theming format (from the Platform SDK) adds support for theming Menus, so this would allow the menus to better fit into the native platform (e.g. Mac OSX). Since the format is largely unknown, I doubt Wine will support it.
The theme file I made only consists of a 'SysMetrics' section which contains the 'classic' color names which can also be adjusted from the Control Panel\Colors registry location. The difference is that in XP Microsoft cleaned up the names, so some of the names have changed. The theme is compiled using mingw because right now winecfg seems to need a real 'MZ' header.
A DLL requires a proper image header, irrespective of whether it actually contains any code.
A lot of work is needed especially in comctl32 and also in uxtheme its drawing code to optimize the drawing performance and to properly render themes. For this purpose you should use some free native XP themes and try them to render properly in Wine. The uxtheme drawing code needs to handle margins, locations and positions properly. Right now in case of a button comctl32 is making assumptions about text locations and I don't think that belongs there.
This is true.
There are still some controls (scrollbar and static come to mind) that do not have theiming support yet.
The button theming support only supports normal and disabled states. It also does not update properly when the button changes state (e.g. when it gains the focus) - it reverts back to the non-themed rendering (this requires tests for the user32 button control to validate that a WM_PAINT message is sent whenever the state changes; I have the patch to change the code, but not the tests).
The button control is still a work in progress w.r.t. theming, so don't expect much at this point.
I am using the following themes for testing: Zune -- http://go.microsoft.com/fwlink/?LinkID=75078 Human -- http://fioressj.deviantart.com/art/Human-for-Windows-37743373 ClearLooks -- http://schmoove.deviantart.com/art/ClearLooks-for-Windows-XP-18591720
In addition to this, StyleXP (http://www.tgtsoft.com/prod_sxp.php) has a set of themes that are useful for testing the current capabilities of uxtheme and comctl32 (some of the themes don't render correctly, and some are slow).
Also, the theme switching does not quite work, w.r.t. updating winecfg to reflect the new theme; this may be a winecfg problem, though, not necessarily a uxtheme problem.
- Reece
For Wine's purposes the WinXP file format is fine for now. It will allow better integration into the linux desktop. Support for all those fancy animation features and others which are offered in Vista would also require major changes in Wine's rendering system. Sure some might not be hard to support in software but offering all those features in an accelerated way in Wine's current rendering mechanism might be very tricky.
My goal with a sample theme file was to give others an impression how theme files can be build (except for using a theme editor which relies on native themes) there is no legal and public method for generating 100% free themes. The files can later on be extended with bitmap data to theme controls. Right now the theme just offers the colors which uxtheme translates back to 'legacy' colors and it basically bypasses 'uxtheme' right now. (which is fine anyway as for plain coloring we don't have to request uxtheme to render the controls which will be a lot faster)
Roderick
2008/11/4 Roderick Colenbrander thunderbird2k@gmx.net:
Hi,
The way to go for Wine theming is to use Windows XP themes.
Unfortunately the file format itself is not documented. Based on Wine its uxtheme code (BTW our uxtheme is quite complete) and an analysis of some 'free' XP themes like 'ClearLook' I was able to write my own theme template.
The format has completely changed with Vista. It is similar in that it is a DLL, but all the theme metrics and stuff are in unintelligible binary blocks. Whereas it is possible to read the XP configurations, it is not possible in Vista.
The Vista theming format (from the Platform SDK) adds support for theming Menus, so this would allow the menus to better fit into the native platform (e.g. Mac OSX). Since the format is largely unknown, I doubt Wine will support it.
The theme file I made only consists of a 'SysMetrics' section which
contains the 'classic' color names which can also be adjusted from the Control Panel\Colors registry location. The difference is that in XP Microsoft cleaned up the names, so some of the names have changed. The theme is compiled using mingw because right now winecfg seems to need a real 'MZ' header.
A DLL requires a proper image header, irrespective of whether it actually contains any code.
A lot of work is needed especially in comctl32 and also in uxtheme its
drawing code to optimize the drawing performance and to properly render themes. For this purpose you should use some free native XP themes and try them to render properly in Wine. The uxtheme drawing code needs to handle margins, locations and positions properly. Right now in case of a button comctl32 is making assumptions about text locations and I don't think that belongs there.
This is true.
There are still some controls (scrollbar and static come to mind) that do not have theiming support yet.
The button theming support only supports normal and disabled states. It also does not update properly when the button changes state (e.g. when it gains the focus) - it reverts back to the non-themed rendering (this requires tests for the user32 button control to validate that a WM_PAINT message is sent whenever the state changes; I have the patch to change the code, but not the tests).
The button control is still a work in progress w.r.t. theming, so don't expect much at this point.
I am using the following themes for testing: Zune -- http://go.microsoft.com/fwlink/?LinkID=75078 Human -- http://fioressj.deviantart.com/art/Human-for-Windows-37743373 ClearLooks -- http://schmoove.deviantart.com/art/ClearLooks-for-Windows-XP-18591720
In addition to this, StyleXP (http://www.tgtsoft.com/prod_sxp.php) has a set of themes that are useful for testing the current capabilities of uxtheme and comctl32 (some of the themes don't render correctly, and some are slow).
Also, the theme switching does not quite work, w.r.t. updating winecfg to reflect the new theme; this may be a winecfg problem, though, not necessarily a uxtheme problem.
- Reece