summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-11-25 11:05:49 -0800
committerJasper St. Pierre <jstpierre@mecheye.net>2014-11-25 11:05:49 -0800
commitc71e2131345c929753a0128c780d679ce0c4ce6a (patch)
tree3dfd3da9dee6ed3bb41fac5b398c63bf87be02b6
parent2cd835c0765e80ac1981a60f4641747a5e32177d (diff)
downloadgtk+-c71e2131345c929753a0128c780d679ce0c4ce6a.tar.gz
gtknotebook: Optimize GtkStyleContext usage
-rw-r--r--gtk/gtknotebook.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index acb90e5f08..916ef585cd 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2240,15 +2240,17 @@ get_padding_and_border (GtkNotebook *notebook,
GtkBorder *border)
{
GtkStyleContext *context;
+ GtkStateFlags state;
context = gtk_widget_get_style_context (GTK_WIDGET (notebook));
- gtk_style_context_get_padding (context, 0, border);
+ state = gtk_style_context_get_state (context);
+ gtk_style_context_get_padding (context, state, border);
if (notebook->priv->show_border || notebook->priv->show_tabs)
{
GtkBorder tmp;
- gtk_style_context_get_border (context, 0, &tmp);
+ gtk_style_context_get_border (context, state, &tmp);
border->top += tmp.top;
border->right += tmp.right;
border->bottom += tmp.bottom;
@@ -6247,7 +6249,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
if (page != priv->cur_page)
{
- GtkBorder active_padding, normal_padding, padding;
+ GtkBorder padding = {};
/* The active tab is by definition at least the same height as the inactive one.
* The padding we're building is the offset between the two tab states,
@@ -6259,16 +6261,11 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook,
gtk_style_context_save (context);
notebook_tab_prepare_style_context (notebook, page, context, TRUE);
- gtk_style_context_get_padding (context, GTK_STATE_FLAG_ACTIVE, &active_padding);
- gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &normal_padding);
+ /* gtk_style_context_get_padding (context, GTK_STATE_FLAG_ACTIVE, &active_padding); */
+ /* gtk_style_context_get_padding (context, GTK_STATE_FLAG_NORMAL, &normal_padding); */
gtk_style_context_restore (context);
- padding.top = MAX (0, active_padding.top - normal_padding.top);
- padding.right = MAX (0, active_padding.right - normal_padding.right);
- padding.bottom = MAX (0, active_padding.bottom - normal_padding.bottom);
- padding.left = MAX (0, active_padding.left - normal_padding.left);
-
switch (tab_pos)
{
case GTK_POS_TOP: