diff options
author | lukefromdc <[email protected]> | 2019-02-07 18:27:37 -0500 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-03-22 09:55:47 +0100 |
commit | b704bb5ef3bf67d9f78d5d4d8591fb316bee11c1 (patch) | |
tree | e19faf774bfb46f550efacb61f52267ee2b5ab1b | |
parent | 897643c70861373393ac9f387ddc244930e16aeb (diff) | |
download | mate-media-b704bb5ef3bf67d9f78d5d4d8591fb316bee11c1.tar.bz2 mate-media-b704bb5ef3bf67d9f78d5d4d8591fb316bee11c1.tar.xz |
Ensure volume icon is always correctly scaled
Correctly size and scale the icon so doesn't get rendered oversize/ cut at certain panel sizes or on first start. Also set the GTK_ICON_LOOKUP_FORCE_SIZE flag in gtk_icon_theme_load_surface so that when icon theme provides only a single scalable icon it renders the correct size. Otherwise such icons render seriously undersize.
-rw-r--r-- | mate-volume-control/gvc-applet.c | 12 | ||||
-rw-r--r-- | mate-volume-control/gvc-stream-status-icon.c | 16 |
2 files changed, 27 insertions, 1 deletions
diff --git a/mate-volume-control/gvc-applet.c b/mate-volume-control/gvc-applet.c index f39d989..2d91725 100644 --- a/mate-volume-control/gvc-applet.c +++ b/mate-volume-control/gvc-applet.c @@ -385,6 +385,18 @@ gvc_applet_set_size(GtkWidget* widget, int size, gpointer user_data) { GvcApplet *applet = user_data; + /*Iterate through the icon sizes so they can be kept sharp*/ + if (size < 22) + size = 16; + else if (size < 24) + size = 22; + else if (size < 32) + size = 24; + else if (size < 48) + size = 32; + else + size = 48; + gvc_stream_status_icon_set_size (applet->priv->icon_input, size); gvc_stream_status_icon_set_size (applet->priv->icon_output, size); } diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c index d4c1509..8b4c80b 100644 --- a/mate-volume-control/gvc-stream-status-icon.c +++ b/mate-volume-control/gvc-stream-status-icon.c @@ -320,7 +320,9 @@ gvc_stream_status_icon_set_icon_from_name (GvcStreamStatusIcon *icon, cairo_surface_t* surface = gtk_icon_theme_load_surface (icon_theme, icon_name, icon->priv->size, - icon_scale, NULL, 0, NULL); + icon_scale, NULL, + GTK_ICON_LOOKUP_FORCE_SIZE, + NULL); gtk_image_set_from_surface (GTK_IMAGE (icon->priv->image), surface); cairo_surface_destroy (surface); @@ -417,6 +419,18 @@ void gvc_stream_status_icon_set_size (GvcStreamStatusIcon *icon, guint size) { + + /*Iterate through the icon sizes so they can be kept sharp*/ + if (size < 22) + size = 16; + else if (size < 24) + size = 22; + else if (size < 32) + size = 24; + else if (size < 48) + size = 32; + else + size = 48; icon->priv->size = size; gvc_stream_status_icon_set_icon_from_name (icon, icon->priv->icon_names[icon->priv->current_icon]); |