[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Fix panel icon too big with high DPI (bug #13894)
noreply at xfce.org
noreply at xfce.org
Sat Oct 14 14:18:32 CEST 2017
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-pulseaudio-plugin.
commit 7c2e79ae34488c03518409651aa866614e056fbe
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sat Oct 14 08:18:26 2017 -0400
Fix panel icon too big with high DPI (bug #13894)
---
panel-plugin/pulseaudio-plugin.c | 36 ++++++++----------------------------
1 file changed, 8 insertions(+), 28 deletions(-)
diff --git a/panel-plugin/pulseaudio-plugin.c b/panel-plugin/pulseaudio-plugin.c
index ff1cd63..c4346c0 100644
--- a/panel-plugin/pulseaudio-plugin.c
+++ b/panel-plugin/pulseaudio-plugin.c
@@ -252,40 +252,20 @@ pulseaudio_plugin_size_changed (XfcePanelPlugin *plugin,
{
PulseaudioPlugin *pulseaudio_plugin = PULSEAUDIO_PLUGIN (plugin);
gint icon_size;
-#if !LIBXFCE4PANEL_CHECK_VERSION (4, 13, 0)
- GtkStyleContext *context;
- GtkBorder padding;
- GtkBorder border;
- gint width;
- gint xthickness;
- gint ythickness;
-#endif
/* The plugin only occupies a single row */
- size /= xfce_panel_plugin_get_nrows (plugin);
#if LIBXFCE4PANEL_CHECK_VERSION (4, 13, 0)
icon_size = xfce_panel_plugin_get_icon_size (plugin);
#else
// fall-back for older panel versions
- /* Get widget's padding and border to correctly calculate the button's icon size */
- context = gtk_widget_get_style_context (GTK_WIDGET (pulseaudio_plugin->button));
- gtk_style_context_get_padding (context, gtk_widget_get_state_flags (GTK_WIDGET (pulseaudio_plugin->button)), &padding);
- gtk_style_context_get_border (context, gtk_widget_get_state_flags (GTK_WIDGET (pulseaudio_plugin->button)), &border);
- xthickness = padding.left+padding.right+border.left+border.right;
- ythickness = padding.top+padding.bottom+border.top+border.bottom;
-
- width = size - 2 * MAX (xthickness, ythickness);
- /* Since symbolic icons are usually only provided in 16px we
- * try to be clever and use size steps */
-
- if (width <= 21)
- icon_size = 16;
- else if (width >=22 && width <= 29)
- icon_size = 24;
- else if (width >= 30 && width <= 40)
- icon_size = 32;
- else
- icon_size = width;
+ icon_size = size / xfce_panel_plugin_get_nrows(plugin);
+ icon_size -= 4;
+ if (icon_size < 24)
+ icon_size = 16;
+ else if (icon_size < 32)
+ icon_size = 24;
+ else if (icon_size < 36)
+ icon_size = 32;
#endif
pulseaudio_button_set_size (pulseaudio_plugin->button, size, icon_size);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list