diff options
| author | Richard White <rwhite8282@gmail.com> | 2016-05-19 01:17:29 +0000 |
|---|---|---|
| committer | Richard White <rwhite8282@gmail.com> | 2016-05-19 01:17:29 +0000 |
| commit | 1fe9c2603c33fddcd9f2688b30e843f91e1a86fa (patch) | |
| tree | 13289cbe033a46a40eb829437e115b5393e2ca84 /src/widgets/button.cpp | |
| parent | Corrected frame extension stroke and fill values on 64 bit machine. (diff) | |
| parent | GTK3: Another widget named. (diff) | |
| download | inkscape-1fe9c2603c33fddcd9f2688b30e843f91e1a86fa.tar.gz inkscape-1fe9c2603c33fddcd9f2688b30e843f91e1a86fa.zip | |
Merge from Inkscape trunk.
(bzr r14668.1.3)
Diffstat (limited to 'src/widgets/button.cpp')
| -rw-r--r-- | src/widgets/button.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index 1776e28c4..6ea8c1360 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -96,7 +96,6 @@ static void sp_button_dispose(GObject *object) static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width) { GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget)); - GtkStyle *style = gtk_widget_get_style(widget); if (child) { gtk_widget_get_preferred_width(GTK_WIDGET(child), minimal_width, natural_width); @@ -105,14 +104,20 @@ static void sp_button_get_preferred_width(GtkWidget *widget, gint *minimal_width *natural_width = 0; } - *minimal_width += 2 + 2 * MAX(2, style->xthickness); - *natural_width += 2 + 2 * MAX(2, style->xthickness); + GtkStyleContext *context = gtk_widget_get_style_context (widget); + GtkBorder padding; + GtkBorder border; + + gtk_style_context_get_padding(context, GTK_STATE_FLAG_NORMAL, &padding); + gtk_style_context_get_border( context, GTK_STATE_FLAG_NORMAL, &border ); + + *minimal_width += MAX(2, padding.left + padding.right + border.left + border.right); + *natural_width += MAX(2, padding.left + padding.right + border.left + border.right); } static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height) { GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget)); - GtkStyle *style = gtk_widget_get_style(widget); if (child) { gtk_widget_get_preferred_height(GTK_WIDGET(child), minimal_height, natural_height); @@ -121,8 +126,15 @@ static void sp_button_get_preferred_height(GtkWidget *widget, gint *minimal_heig *natural_height = 0; } - *minimal_height += 2 + 2 * MAX(2, style->ythickness); - *natural_height += 2 + 2 * MAX(2, style->ythickness); + GtkStyleContext *context = gtk_widget_get_style_context (widget); + GtkBorder padding; + GtkBorder border; + + gtk_style_context_get_padding(context, GTK_STATE_FLAG_NORMAL, &padding); + gtk_style_context_get_border( context, GTK_STATE_FLAG_NORMAL, &border ); + + *minimal_height += MAX(2, padding.top + padding.bottom + border.top + border.bottom); + *natural_height += MAX(2, padding.top + padding.bottom + border.top + border.bottom); } #else static void sp_button_size_request(GtkWidget *widget, GtkRequisition *requisition) |
