summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-03-21 09:37:09 +0100
committerBenjamin Otte <otte@redhat.com>2012-04-17 08:59:10 +0200
commitece9d2fd92b228503bc450dd2778f8d673dbfa18 (patch)
treeb35db4b944d7960cd85251c0563e9cd0a0e89779
parente7a984b33762a3edd787294b012b4524cb8fd606 (diff)
downloadgtk+-ece9d2fd92b228503bc450dd2778f8d673dbfa18.tar.gz
gtk: Make widget only invalidate widget positions
Instead of resetting them completely
-rw-r--r--gtk/gtkbox.c9
-rw-r--r--gtk/gtkcombobox.c9
-rw-r--r--gtk/gtknotebook.c3
-rw-r--r--gtk/gtkoverlay.c13
-rw-r--r--gtk/gtkpathbar.c10
-rw-r--r--gtk/gtktoolbar.c9
-rw-r--r--gtk/gtktreeview.c2
7 files changed, 34 insertions, 21 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 96bc318694..9276a71e6c 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -85,6 +85,7 @@
#include "gtktypebuiltins.h"
#include "gtksizerequest.h"
#include "gtkwidgetpath.h"
+#include "gtkwidgetprivate.h"
#include "a11y/gtkboxaccessible.h"
@@ -938,10 +939,16 @@ gtk_box_get_path_for_child (GtkContainer *container,
}
static void
+gtk_box_invalidate_order_foreach (GtkWidget *widget)
+{
+ _gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
+}
+
+static void
gtk_box_invalidate_order (GtkBox *box)
{
gtk_container_foreach (GTK_CONTAINER (box),
- (GtkCallback) gtk_widget_reset_style,
+ (GtkCallback) gtk_box_invalidate_order_foreach,
NULL);
}
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 53fe1b1ea3..0272924b47 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -41,6 +41,7 @@
#include "gtktreeselection.h"
#include "gtkseparator.h"
#include "gtkwidgetpath.h"
+#include "gtkwidgetprivate.h"
#include "gtkwindow.h"
#include "gtktypebuiltins.h"
#include "gtkprivate.h"
@@ -1382,10 +1383,16 @@ gtk_combo_box_button_state_flags_changed (GtkWidget *widget,
}
static void
+gtk_combo_box_invalidate_order_foreach (GtkWidget *widget)
+{
+ _gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
+}
+
+static void
gtk_combo_box_invalidate_order (GtkComboBox *combo_box)
{
gtk_container_forall (GTK_CONTAINER (combo_box),
- (GtkCallback) gtk_widget_reset_style,
+ (GtkCallback) gtk_combo_box_invalidate_order_foreach,
NULL);
}
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 5ebdf707a7..5978e3dac6 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -42,6 +42,7 @@
#include "gtkbuildable.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetpath.h"
+#include "gtkwidgetprivate.h"
#include "a11y/gtknotebookaccessible.h"
@@ -6536,7 +6537,7 @@ gtk_notebook_update_tab_states (GtkNotebook *notebook)
GTK_STYLE_REGION_TAB,
&current_flags)
|| current_flags != _gtk_notebook_get_tab_flags (notebook, page))
- gtk_widget_reset_style (page->tab_label);
+ _gtk_widget_invalidate_style_context (page->tab_label, GTK_CSS_CHANGE_PARENT_STATE);
}
}
}
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index ff046e9852..d22ac88dfd 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -183,7 +183,6 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom;
GtkStyleContext *context;
- gint changed;
context = gtk_widget_get_style_context (child);
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
@@ -192,7 +191,6 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
is_left = is_right = is_top = is_bottom = FALSE;
- changed = 4;
gtk_overlay_get_main_widget_allocation (overlay, &main_allocation);
gtk_widget_get_allocation (GTK_WIDGET (overlay), &overlay_allocation);
@@ -221,32 +219,21 @@ gtk_overlay_child_update_style_classes (GtkOverlay *overlay,
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
else if (!has_left && is_left)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
- else
- changed--;
if (has_right && !is_right)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
else if (!has_right && is_right)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
- else
- changed--;
if (has_top && !is_top)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
else if (!has_top && is_top)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
- else
- changed--;
if (has_bottom && !is_bottom)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
else if (!has_bottom && is_bottom)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
- else
- changed--;
-
- if (changed > 0)
- gtk_widget_reset_style (child);
}
static void
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 3c290bc5e1..fdcd337384 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -35,6 +35,7 @@
#include "gtksettings.h"
#include "gtktogglebutton.h"
#include "gtkwidgetpath.h"
+#include "gtkwidgetprivate.h"
enum {
@@ -494,15 +495,18 @@ child_ordering_changed (GtkPathBar *path_bar)
GList *l;
if (path_bar->up_slider_button)
- gtk_widget_reset_style (path_bar->up_slider_button);
+ _gtk_widget_invalidate_style_context (path_bar->up_slider_button,
+ GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
if (path_bar->down_slider_button)
- gtk_widget_reset_style (path_bar->down_slider_button);
+ _gtk_widget_invalidate_style_context (path_bar->down_slider_button,
+ GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
for (l = path_bar->button_list; l; l = l->next)
{
ButtonData *data = l->data;
- gtk_widget_reset_style (data->button);
+ _gtk_widget_invalidate_style_context (data->button,
+ GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
}
}
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 3974810f29..be669008fb 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -55,6 +55,7 @@
#include "gtkintl.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetpath.h"
+#include "gtkwidgetprivate.h"
/**
@@ -3965,10 +3966,16 @@ gtk_toolbar_get_path_for_child (GtkContainer *container,
}
static void
+gtk_toolbar_invalidate_order_foreach (GtkWidget *widget)
+{
+ _gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
+}
+
+static void
gtk_toolbar_invalidate_order (GtkToolbar *toolbar)
{
gtk_container_forall (GTK_CONTAINER (toolbar),
- (GtkCallback) gtk_widget_reset_style,
+ (GtkCallback) gtk_toolbar_invalidate_order_foreach,
NULL);
}
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 73cd0ae157..52c7aa34cc 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -11946,7 +11946,7 @@ _gtk_tree_view_reset_header_styles (GtkTreeView *tree_view)
if (!header_widget)
header_widget = gtk_tree_view_column_get_button (column);
- gtk_widget_reset_style (header_widget);
+ _gtk_widget_invalidate_style_context (header_widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION);
}
}