summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/clock/clock.c4
-rw-r--r--mate-panel/panel-toplevel.c30
2 files changed, 18 insertions, 16 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 4e56192d..cdc17f01 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -392,10 +392,10 @@ calculate_minimum_height (GtkWidget *widget,
MatePanelAppletOrient orientation)
{
#if GTK_CHECK_VERSION (3, 0, 0)
- GtkStyleContext *style_context;
GtkStateFlags state;
- GtkBorder padding;
+ GtkStyleContext *style_context;
const PangoFontDescription *font_desc;
+ GtkBorder padding;
#else
GtkStyle *style;
#endif
diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c
index 711d9ede..a52622ec 100644
--- a/mate-panel/panel-toplevel.c
+++ b/mate-panel/panel-toplevel.c
@@ -2334,13 +2334,14 @@ calculate_minimum_height (GtkWidget *widget,
PanelOrientation orientation)
{
#if GTK_CHECK_VERSION (3, 0, 0)
- GtkStyleContext *style_context;
GtkStateFlags state;
- GtkBorder border;
+ GtkStyleContext *style_context;
+ const PangoFontDescription *font_desc;
+ GtkBorder padding;
#else
GtkStyle *style;
#endif
- PangoContext *context;
+ PangoContext *pango_context;
PangoFontMetrics *metrics;
int focus_width = 0;
int focus_pad = 0;
@@ -2349,21 +2350,22 @@ calculate_minimum_height (GtkWidget *widget,
int thickness;
#if GTK_CHECK_VERSION (3, 0, 0)
- style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
+ style_context = gtk_widget_get_style_context (widget);
+ font_desc = gtk_style_context_get_font (style_context, state);
- context = gtk_widget_get_pango_context (widget);
- metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
- pango_context_get_language (context));
- gtk_style_context_get_border (style_context, state, &border);
+ pango_context = gtk_widget_get_pango_context (widget);
+ metrics = pango_context_get_metrics (pango_context,
+ font_desc,
+ pango_context_get_language (pango_context));
+ gtk_style_context_get_padding (style_context, state, &padding);
#else
style = gtk_widget_get_style (widget);
- context = gtk_widget_get_pango_context (widget);
- metrics = pango_context_get_metrics (context,
+ pango_context = gtk_widget_get_pango_context (widget);
+ metrics = pango_context_get_metrics (pango_context,
style->font_desc,
- pango_context_get_language (context));
+ pango_context_get_language (pango_context));
#endif
ascent = pango_font_metrics_get_ascent (metrics);
descent = pango_font_metrics_get_descent (metrics);
@@ -2377,8 +2379,8 @@ calculate_minimum_height (GtkWidget *widget,
#if GTK_CHECK_VERSION (3, 0, 0)
thickness = orientation & PANEL_HORIZONTAL_MASK ?
- border.top + border.bottom :
- border.left + border.right;
+ padding.top + padding.bottom :
+ padding.left + padding.right;
return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad) + thickness;
}