[gtk+/wip/cssvalue: 30/165] gtk: Make widget only invalidate widget positions
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssvalue: 30/165] gtk: Make widget only invalidate widget positions
- Date: Fri, 13 Apr 2012 23:05:19 +0000 (UTC)
commit 25559b8d3ea00e89942049f6fbd34e9b13b793b3
Author: Benjamin Otte <otte redhat com>
Date: Wed Mar 21 09:37:09 2012 +0100
gtk: Make widget only invalidate widget positions
Instead of resetting them completely
gtk/gtkbox.c | 9 ++++++++-
gtk/gtkcombobox.c | 9 ++++++++-
gtk/gtknotebook.c | 3 ++-
gtk/gtkoverlay.c | 13 -------------
gtk/gtkpathbar.c | 10 +++++++---
gtk/gtktoolbar.c | 9 ++++++++-
gtk/gtktreeview.c | 2 +-
7 files changed, 34 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 96bc318..9276a71 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 53fe1b1..0272924 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 5ebdf70..5978e3d 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,
¤t_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 ff046e9..d22ac88 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 3c290bc..fdcd337 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 3974810..be66900 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 01194b1..f48d61e 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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]