summaryrefslogtreecommitdiff
path: root/applets/wncklet
diff options
context:
space:
mode:
Diffstat (limited to 'applets/wncklet')
-rw-r--r--applets/wncklet/showdesktop.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index ae4afc43..534d74fd 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -132,7 +132,13 @@ static void button_size_allocated(GtkWidget* button, GtkAllocation* allocation,
static void update_icon(ShowDesktopData* sdd)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder padding;
+#else
GtkStyle* style;
+#endif
int width, height;
GdkPixbuf* icon;
GdkPixbuf* scaled;
@@ -145,6 +151,26 @@ static void update_icon(ShowDesktopData* sdd)
if (!sdd->icon_theme)
return;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ state = gtk_widget_get_state_flags (sdd->button);
+ context = gtk_widget_get_style_context (sdd->button);
+ gtk_style_context_get_padding (context, state, &padding);
+ gtk_style_context_get_style (context,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+
+ switch (sdd->orient) {
+ case GTK_ORIENTATION_HORIZONTAL:
+ thickness = padding.top + padding.bottom;
+ break;
+ case GTK_ORIENTATION_VERTICAL:
+ thickness = padding.left + padding.right;
+ break;
+ }
+
+ icon_size = sdd->size - 2 * (focus_width + focus_pad) + thickness;
+#else
gtk_widget_style_get (sdd->button, "focus-line-width", &focus_width, "focus-padding", &focus_pad, NULL);
style = gtk_widget_get_style(sdd->button);
@@ -160,6 +186,7 @@ static void update_icon(ShowDesktopData* sdd)
}
icon_size = sdd->size - 2 * (focus_width + focus_pad + thickness);
+#endif
if (icon_size < 22)
icon_size = 16;