summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <infirit@gmail.com>2014-11-23 14:47:35 +0100
committerinfirit <infirit@gmail.com>2014-11-23 14:56:13 +0100
commitc3763a0b869a8a77d1ecbb5b3689e0399cbf1d49 (patch)
treefad453b4762af297138dbcac5559f45ba27d28ec
parentc354cea0424964e496601074a7678995750fa275 (diff)
downloadmate-panel-c3763a0b869a8a77d1ecbb5b3689e0399cbf1d49.tar.bz2
mate-panel-c3763a0b869a8a77d1ecbb5b3689e0399cbf1d49.tar.xz
Gtk3: panel, clock: Synchronize calculate_minimum_height() code
Also change the panel version to use the padding instead of the border. We're interested in the padding here. I believe. Taken from gnome-panel commit: 0b5d9e57451dff3a25b3fbcc8dec671cac469cb From: Vincent Untz <vuntz@gnome.org>
-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;
}