Wine integration with native (Gtk, Qt, Cocoa/Carbon) themes

Roderick Colenbrander thunderbird2k at gmx.net
Mon Nov 3 17:48:30 CST 2008


I made some progress. As I mentioned last time a .msstyles theme is just a resource file wrapped into a dll. Windows tools try to edit real themes or create themes by injecting resource data into a blank dll. 

In order to obtain a resource file I used a tool called resource hacker to retrieve one from a GPLed clearlooks theme (most windows theme tools only provide binaries or some usefuless xml files). A msstyles file contains various section which contain the msstyles version (PACKTHEM_VERSION), the different color version of the theme (COLORNAMES). The real info is burried inside 'ini files' which are stored inside the 'TEXTFILES' section of the file (the names of the ini files correspond to FILERESNAMES). Each ini file contains a bunch of sections for buttons, textboxes and all other controls. There's also a generic 'SysMetrics' section which contains some classic properties like ActiveCaption and others. The control specific ones are the most important and they contain the dimensions of lets say a button, where to position text, what DPI to use and more.

Initially my idea was to create a sample .msstyles project but this looks like a huge task as I would need to fill in every attribute of each control. If I would provide an incomplete theme (which might be legal not sure) the current theming code in Wine will fail as it expects theme info to be around. 

As everyone is aware of big improvements are needed to the comctl32 theming code and other places which need to draw using themes. For example in case of a button the current drawing code calculates the position for drawing text iself while it should get this info from the theme. The same for other controls.

Roderick

> For fun I looked a bit at the format. An msstyles file is just a win32
> resource file. It contains various sections each containing strings, colors or
> bitmaps. Colors are just stored in a text file. Uxtheme parses this text
> file and loads the colors 1:1 from this section into the registry.
> 
> The main issue is creating a resource file it can either be compiled using
> wrc or it could an empty file could be created from a program and then
> updated using UpdateResource and friends. The first solution is the nicest way
> but not everyone might install wrc.
> 
> Anyway desktops will never move to this microsoft format. I think both gtk
> and qt are now moving to xml based formats. We could define our own spec
> for that but I doubt they will move to this. They attempted before to use
> the same theme format but it didn't work out well.
> 
> Roderick
> 
> > On Sun, Nov 2, 2008 at 3:01 PM, Dan Kegel <dank at kegel.com> wrote:
> > > FWIW, my opinion is that any deep integration
> > > is going to be hard, and that for the moment
> > > we should go with something much simpler:
> > > simply support mstheme files well, and provide
> > > themes that look like the default themes on
> > > Ubuntu / OpenSuse / Fedora.
> > 
> > I agree. I simply think any outside tools we develop should be used in
> > conjunction with a proposed formal standard. If the MS formats are
> > open there is no reason we cannot propose the usage of them, or a
> > variation on them as part of FreeDesktop making Wine play nicer with
> > everyone (mono and moonlight prove MS standards and formats can be of
> > use for Linux). I'll spend some of the copious amounts of free-time I
> > have at work researching for formats and we can continue the propose
> > standard discussion off list later in the week.
> > 
> > -- 
> > Steven Edwards
> > 
> > "There is one thing stronger than all the armies in the world, and
> > that is an idea whose time has come." - Victor Hugo
> > 
> 
> -- 
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
> Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
> 

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger



More information about the wine-devel mailing list