After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740447 - support symbolic Application icons for high contrast theme
support symbolic Application icons for high contrast theme
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
3.15.x
Other Linux
: Normal normal
: 3.16
Assigned To: gnome-shell-maint
gnome-shell-maint
: 618888 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-11-20 17:10 UTC by Jakub Steiner
Modified: 2014-11-29 17:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtk3demo, widget factory: provide a symbolic variant of the app icon (12.54 KB, patch)
2014-11-28 14:48 UTC, Jakub Steiner
none Details | Review
icontheme: Pick up default lookup flags from theme (2.22 KB, patch)
2014-11-29 00:24 UTC, Florian Müllner
none Details | Review
app: Use StIcon as icon_texture for GIcons (1.88 KB, patch)
2014-11-29 00:40 UTC, Florian Müllner
none Details | Review
main: Slightly refactor loading of the default stylesheet (1.63 KB, patch)
2014-11-29 16:29 UTC, Florian Müllner
needs-work Details | Review
main: Add support for -high-contrast theme variants (2.57 KB, patch)
2014-11-29 16:30 UTC, Florian Müllner
committed Details | Review
st-texture-cache: Remove load_gicon_with_colors() (3.53 KB, patch)
2014-11-29 16:30 UTC, Florian Müllner
committed Details | Review
st-theme-node: Add support for -st-icon-style property (5.59 KB, patch)
2014-11-29 16:30 UTC, Florian Müllner
committed Details | Review
app: Use StIcon as icon_texture for GIcons (1.88 KB, patch)
2014-11-29 16:30 UTC, Florian Müllner
committed Details | Review
app: Respect icon-style for faded icon texture (2.69 KB, patch)
2014-11-29 16:30 UTC, Florian Müllner
committed Details | Review
theme: Add high-contrast variant (2.07 KB, patch)
2014-11-29 16:30 UTC, Florian Müllner
committed Details | Review
classic: Install high-contrast theme variant (1.84 KB, patch)
2014-11-29 16:36 UTC, Florian Müllner
committed Details | Review
main: Slightly refactor loading of the default stylesheet (1.97 KB, patch)
2014-11-29 16:44 UTC, Florian Müllner
reviewed Details | Review

Description Jakub Steiner 2014-11-20 17:10:07 UTC
As the high contrast theme has been moved into gtk+3 itself and icons are recolored scalable -symbolic variants [1], I'd like to mandate apps to ship their symbolic variant of the app/launcher icon. Some core GNOME3 apps are doing it already.

We need to make sure the app-symbolic icon is used and colored properly when HC theme is selected.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=732521
Comment 1 Florian Müllner 2014-11-27 16:43:34 UTC
(In reply to comment #0)
> We need to make sure the app-symbolic icon is used and colored properly when HC
> theme is selected.

I'm not sure we want this in gnome-shell - we currently get a GIcon from the AppInfo, tell GTK+ to look up the corresponding GtkIconInfo and ask GTK+ to load it. That's fairly generic, so I tend to think that GTK is a better place to implement this. In particular, we have no knowledge at all about which icon theme is currently in use ("the one used by GTK"), so just special-casing the HighContrast theme would already be hacky ...
Comment 2 Matthias Clasen 2014-11-28 05:13:51 UTC
Would be good to have symbolic app icons for gtk3-demo, gtk3-widget-factory and gtk3-icon-browser to test this.
Comment 3 Jakub Steiner 2014-11-28 14:48:52 UTC
Created attachment 291724 [details] [review]
gtk3demo, widget factory: provide a symbolic variant of the app icon

- necessary for HC theme
Comment 4 Jakub Steiner 2014-11-28 14:49:37 UTC
I wasn't able to find any fullcolor icon for gtk3-icon-browser. Does that mean we need one as well?
Comment 5 Matthias Clasen 2014-11-28 19:44:20 UTC
yes, icon-browser has no icon yet
Comment 6 Matthias Clasen 2014-11-28 21:22:07 UTC
Turns out these symbolic icons just work, for GTK+ about dialogs.
This is because we have 

* {
  -gtk-icon-style: symbolic; //force symbolic style icons
}

In the HighContrast theme. This gets translated into passing GTK_ICON_LOOKUP_FORCE_SYMBOLIC when loading with GtkIconTheme.

This stuff is hidden pretty deeply in the gtkcssimage machinery. Not sure how easy it is to get at that from the shell.
Comment 7 Florian Müllner 2014-11-29 00:24:30 UTC
Created attachment 291757 [details] [review]
icontheme: Pick up default lookup flags from theme

(In reply to comment #6)
> This gets translated into passing
> GTK_ICON_LOOKUP_FORCE_SYMBOLIC when loading with GtkIconTheme.

That happens in GtkIconHelper though, so we don't get the magic in the shell :-(


> This stuff is hidden pretty deeply in the gtkcssimage machinery. Not sure how
> easy it is to get at that from the shell.

I don't think we can, unless we use something like gtk_css_provider_to_string() and parse the -gtk-icon-style property outselves. The most convenient for us would be GtkIconTheme taking care of this automatically. I'm attaching a POC patch, though the mix-up of gtk- and icon theme is questionable. An alternative would be to allow querying the -gtk-icon-style property via gtk_style_context_get_property() (it's registered without a query_value function, so afaics that's currently not possible) and do the create-fake-style-context dance in the shell (that's still mixing gtk- and icon theme, but at least it's not in the general purpose toolkit - on the other hand, it's exposing an internal property publicly) ...

Comments/thoughts?
Comment 8 Florian Müllner 2014-11-29 00:40:54 UTC
Created attachment 291759 [details] [review]
app: Use StIcon as icon_texture for GIcons

Themes - namely the HighContrast one - may now request symbolic
icons rather than fullcolor ones. In order to have recoloring
work as expected in that case, we will need a theme node to pick
up colors from - using an StIcon instead of manually loading a
texture from the cache gives us that for free, so do that.


Independent from where the FORCE_SYMBOLIC magic should happen, we'll still need something like this on the shell side to pick up the correct colors.
Comment 9 Florian Müllner 2014-11-29 00:47:55 UTC
(In reply to comment #8)
> Independent from where the FORCE_SYMBOLIC magic should happen ...

We could also make this decidedly non-magical by adding FORCE_SYMBOLIC to the lookup flags if GtkSettings:gtk-theme-name equals "HighContrast".
Comment 10 Matthias Clasen 2014-11-29 03:19:10 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > Independent from where the FORCE_SYMBOLIC magic should happen ...
> 
> We could also make this decidedly non-magical by adding FORCE_SYMBOLIC to the
> lookup flags if GtkSettings:gtk-theme-name equals "HighContrast".

Lo-tech, but that might be the best
Comment 11 Florian Müllner 2014-11-29 16:28:51 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > We could also make this decidedly non-magical by adding FORCE_SYMBOLIC to the
> > lookup flags if GtkSettings:gtk-theme-name equals "HighContrast".
> 
> Lo-tech, but that might be the best

OK, let's move this back to the shell then. I'll attach a patch set to implement a slightly more general variation of this approach.
Comment 12 Florian Müllner 2014-11-29 16:29:53 UTC
Created attachment 291783 [details] [review]
main: Slightly refactor loading of the default stylesheet

We will soon add support a -high-contrast theme variant when GTK+'s
HighContrast theme is used. Prepare for this by moving stuff around
a bit.
Comment 13 Florian Müllner 2014-11-29 16:30:12 UTC
Created attachment 291784 [details] [review]
main: Add support for -high-contrast theme variants

While the default Shell style is fairly decent with regard to
accessibility requirements, having the ability to tweak certain
aspects where the regular style works less well is still useful.
For this purpose, try to load a -high-contrast theme variant of
the default stylesheet when a high-contrast theme is requested
(as determined by the GTK+ theme name).
Comment 14 Florian Müllner 2014-11-29 16:30:22 UTC
Created attachment 291785 [details] [review]
st-texture-cache: Remove load_gicon_with_colors()

The split between st_texture_cache_load_gicon() and load_gicon_with_colors()
no longer makes any sense, so just move the code into the public method.
Comment 15 Florian Müllner 2014-11-29 16:30:32 UTC
Created attachment 291786 [details] [review]
st-theme-node: Add support for -st-icon-style property

GTK+ added support for a -gtk-icon-style property in themes to
enforce a particular icon style. Do the same for shell themes
with an -st-icon-style property, with the same set of possible
values as the GTK+ variant:
  'requested' - use symbolic or fullcolor icon depending on the
                icon name (default)
  'regular'   - enforce fullcolor icons
  'symbolic'  - enforce symbolic icons
Comment 16 Florian Müllner 2014-11-29 16:30:40 UTC
Created attachment 291787 [details] [review]
app: Use StIcon as icon_texture for GIcons

Themes - namely the HighContrast one - may now request symbolic
icons rather than fullcolor ones. In order to have recoloring
work as expected in that case, we will need a theme node to pick
up colors from - using an StIcon instead of manually loading a
texture from the cache gives us that for free, so do that.
Comment 17 Florian Müllner 2014-11-29 16:30:50 UTC
Created attachment 291788 [details] [review]
app: Respect icon-style for faded icon texture

Just like regular application icons, the faded icon texture used
in the app menu should follow the theme's icon style setting.
Comment 18 Florian Müllner 2014-11-29 16:30:59 UTC
Created attachment 291789 [details] [review]
theme: Add high-contrast variant

For now, simply enforce symbolic icons.
Comment 19 Florian Müllner 2014-11-29 16:36:35 UTC
Created attachment 291790 [details] [review]
classic: Install high-contrast theme variant

The classic style is decidedly lower contrast than the default
style, so the high-contrast variant could prove really useful
here. However for now, just override the default icon style as
in the default session.
Comment 20 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:42:14 UTC
Review of attachment 291783 [details] [review]:

::: js/ui/main.js
@@ +77,3 @@
 function _sessionUpdated() {
+    if (sessionMode.isPrimary)
+        _loadDefaultStylesheet();

Seems unrelated.

@@ +230,3 @@
     let stylesheet;
 
     stylesheet = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/' + sessionMode.stylesheetName);

name isn't actually used
Comment 21 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:43:02 UTC
Review of attachment 291784 [details] [review]:

::: js/ui/main.js
@@ +249,3 @@
+
+    if (Gtk.Settings.get_default().gtk_theme_name == 'HighContrast')
+        stylesheet = _getStylesheet(name.replace('.css', '-high-contrast.css'));

A comment here would be nice.
Comment 22 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:43:26 UTC
Review of attachment 291785 [details] [review]:

Yay.
Comment 23 Florian Müllner 2014-11-29 16:44:59 UTC
Created attachment 291791 [details] [review]
main: Slightly refactor loading of the default stylesheet

We will soon add support a -high-contrast theme variant when GTK+'s
HighContrast theme is used. Prepare for this by moving stuff around
a bit.
Comment 24 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:47:46 UTC
Review of attachment 291786 [details] [review]:

Heh, I wrote a very similar patch for bug #739864.

::: src/st/st-theme-node.c
@@ +2415,3 @@
+              if (strcmp (term->content.str->stryng->str, "requested") == 0)
+                {
+                  return ST_ICON_STYLE_REQUESTED;

Remove the braces around this.

@@ +2424,3 @@
+                {
+                  return ST_ICON_STYLE_SYMBOLIC;
+                }

else g_warning("Unknown -st-icon-style"); ?
Comment 25 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:48:51 UTC
Review of attachment 291787 [details] [review]:

I think you mean "Use StIcon as icon_texture for ShellApps"
Comment 26 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:49:35 UTC
Review of attachment 291788 [details] [review]:

A bit frustrating that we can't merge this with the TextureCache, but oh well.
Comment 27 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:49:53 UTC
Review of attachment 291789 [details] [review]:

OK.
Comment 28 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:50:20 UTC
Review of attachment 291790 [details] [review]:

OK.
Comment 29 Jasper St. Pierre (not reading bugmail) 2014-11-29 16:52:30 UTC
Review of attachment 291791 [details] [review]:

I think this patch might be better squashed with the one that adds -high-contrast.css. It's a bit weird why some things were changed here and some in the next patch. That said, treat it as ACN if you disagree.
Comment 30 Florian Müllner 2014-11-29 17:06:22 UTC
(In reply to comment #25)
> I think you mean "Use StIcon as icon_texture for ShellApps"

No, I meant "for apps with GAppInfo" - window-backed apps still get a plain texture, StIcon is only used when we have a GIcon. I'll try to clarify a bit (without exceeding the line limit).
Comment 31 Florian Müllner 2014-11-29 17:14:55 UTC
Attachment 291784 [details] pushed as f4cc332 - main: Add support for -high-contrast theme variants
Attachment 291785 [details] pushed as deddac8 - st-texture-cache: Remove load_gicon_with_colors()
Attachment 291786 [details] pushed as 2940ef0 - st-theme-node: Add support for -st-icon-style property
Attachment 291788 [details] pushed as cad56c8 - app: Respect icon-style for faded icon texture
Attachment 291789 [details] pushed as 4eb0a67 - theme: Add high-contrast variant
Comment 32 Florian Müllner 2014-11-29 17:16:31 UTC
Attachment 291790 [details] pushed as 5ba4e68 - classic: Install high-contrast theme variant
Comment 33 Florian Müllner 2014-11-29 17:17:56 UTC
*** Bug 618888 has been marked as a duplicate of this bug. ***