GNOME Bugzilla – Bug 645458
styleproperties: don't replace when merging if the source is GtkSettings
Last modified: 2011-05-19 21:15:04 UTC
This fixes a regression I introduced before 3.0.4. My bad; the rationale is in the commit message.
Created attachment 183999 [details] [review] styleproperties: don't replace when merging if the source is GtkSettings This fixes a regression introduced with commit 89c1d93b68aaaebeb5db0dc2a58895721c6665aa. The rationale is the following - GtkSettings have the last-fallback code for style properties - always forcing replace to FALSE in pango_font_description_merge() causes application's CSS font settings to be ignored, as they are usually parsed after the global theme CSS - there's no guarantee for the order in which the theme CSS and GtkSettings are parsed, so we have to special case GtkSettings not to replace style settings defined elsewhere.
Review of attachment 183999 [details] [review]: ::: gtk/gtkstylecontext.c @@ +1046,3 @@ + */ + gtk_style_properties_merge (style_data->store, provider_style, + !GTK_IS_SETTINGS (data->provider)); Do we need to look more generally at priorities here ? I guess we never want to override settings that have come from a higher priority provider ?
(In reply to comment #2) > Do we need to look more generally at priorities here ? > I guess we never want to override settings that have come from a higher > priority provider ? So, the problem here is actually with the priority of style providers: - the theme provider has a priority of 200 - GtkSettings has a priority of 400 - application-installed CSS has a priority of 600 What we would like to support is: - the default font setting should be taken from GtkSettings - themes should override the default by setting e.g. "font: bold;" in a widget CSS section - application CSS should be able to override both This doesn't seem to play nice with style priorities at all, as currently, if we respect all the priorities when merging, what we get is: - the theme sets the custom widget font style - GtkSettings will always override it with the default - application CSS override still works, as it has an higher priority, but it's currently broken in gtk-3-0 and master as a result of commit 89c1d93b68aaaebeb5db0dc2a58895721c6665aa
Created attachment 184095 [details] [review] patch It feels to me like a better fix is to filter out the relevant fields from the GtkSettings' font description, so lower level styles get a say about the overall font style. I did oversight that pango_font_description_from_string() actually sets all fields.
Created attachment 184113 [details] [review] Revert "styleproperties: don't force replacing the font description" It turns out the bug is more complicated than I originally understood. Not replacing the font description fields while merging here makes it impossible for application's CSS to override fonts. This reverts commit 89c1d93b68aaaebeb5db0dc2a58895721c6665aa.
Created attachment 184114 [details] [review] gtksettings: unset attributes set to normal from font description So that they do not override values coming from the theme. Based on a patch by Carlos Garnacho.
Created attachment 184115 [details] [review] switch: hardcode 10 as font size for the switch label This should not really be done here, but we can't override font size from the theme just yet.
This patchset should make things "good enough" for 3.0. What still doesn't work is overriding font size and family from the theme CSS. We should fix that properly for 3.2, which would also include https://bugzilla.gnome.org/show_bug.cgi?id=325767
This can be closed, all the patches have been committed a while ago. (Maybe we already closed it and it got reopened back with the pre-3.0 bugzilla outage, or I committed the patches during the outage and forgot to close).