linuxmint/Cinnamon — Issue #38: St.Widget should fallback to default theme
Author: clefebvre
Created: 2011-12-24 13:20:57+00:00
State: open

That's a tricky one.

Gnome Shell assumes all themes define absolutely everything. The problem with that, is that, as new features and new style classes are introduced, existing themes don't support them. And so, new features don't look right in themes which do not define the styles they're using.

In Cinnamon this is particularly visible when you use a Gnome Shell theme. New features such as the menu, the window list, the themes selection etc.. all these don't show up properly. And even with Cinnamon themes built for 1.1.2, eventually when we introduce new features in future releases, themes will have to be updated again.

So the solution for that is simple: If the code uses a style class which isn't found in the theme's stylesheet, then we should fallback and find that style class in the default stylesheet.

St.Theme supports three stylesheets (application_stylesheet, theme_stylesheet and default_stylesheet) but they don't act as fallback to one another, they're all applied!! So for instance, if you define a BoxLayout and give it a "box" style... it gets painted according to the "box" style from both stylesheets! The result looks ugly of course (you can see the two themes paint themselves on top of each others) and there's a huge impact on performance.

The solution seems to make St.Widget smarter. When an St.Widget is given a style_class or a style_name, if it isn't found in the theme_context theme, it should use the one from the default style-sheet instead.

Once this is done, themes can then only define what they need to change, and everything they don't define looks like in the default Cinnamon theme.