[gtk/wip/otte/css: 123/128] stylecontext: Remove the "changed" signal
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/css: 123/128] stylecontext: Remove the "changed" signal
- Date: Wed, 5 Feb 2020 02:49:19 +0000 (UTC)
commit 6756b835b94336ebf07525c5dec3df591e4a5114
Author: Benjamin Otte <otte redhat com>
Date: Wed Feb 5 02:54:32 2020 +0100
stylecontext: Remove the "changed" signal
Instead, always go directly to the GtkWidget::css_changed() call.
gtk/gtkcsswidgetnode.c | 8 +---
gtk/gtkstylecontext.c | 92 --------------------------------------------
gtk/gtkstylecontextprivate.h | 5 ---
3 files changed, 1 insertion(+), 104 deletions(-)
---
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 7ade48a753..7a3a37ffc1 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -95,13 +95,7 @@ gtk_css_widget_node_validate (GtkCssNode *node)
gtk_css_style_change_init (&change, widget_node->last_updated_style, style);
if (gtk_css_style_change_has_change (&change))
{
- GtkStyleContext *context;
-
- context = _gtk_widget_peek_style_context (widget_node->widget);
- if (context)
- gtk_style_context_validate (context, &change);
- else
- gtk_widget_css_changed (widget_node->widget, &change);
+ gtk_widget_css_changed (widget_node->widget, &change);
g_set_object (&widget_node->last_updated_style, style);
}
gtk_css_style_change_finish (&change);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 8566c8b644..df51d24000 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -131,15 +131,8 @@ enum {
LAST_PROP
};
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
static GParamSpec *properties[LAST_PROP] = { NULL, };
-static guint signals[LAST_SIGNAL] = { 0 };
-
static void gtk_style_context_finalize (GObject *object);
static void gtk_style_context_impl_set_property (GObject *object,
@@ -155,19 +148,6 @@ static GtkCssNode * gtk_style_context_get_root (GtkStyleContext *context);
G_DEFINE_TYPE_WITH_PRIVATE (GtkStyleContext, gtk_style_context, G_TYPE_OBJECT)
-static void
-gtk_style_context_real_changed (GtkStyleContext *context)
-{
- GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
-
- if (GTK_IS_CSS_WIDGET_NODE (priv->cssnode))
- {
- GtkWidget *widget = gtk_css_widget_node_get_widget (GTK_CSS_WIDGET_NODE (priv->cssnode));
- if (widget != NULL)
- gtk_widget_css_changed (widget, gtk_style_context_get_change (context));
- }
-}
-
static void
gtk_style_context_class_init (GtkStyleContextClass *klass)
{
@@ -177,28 +157,6 @@ gtk_style_context_class_init (GtkStyleContextClass *klass)
object_class->set_property = gtk_style_context_impl_set_property;
object_class->get_property = gtk_style_context_impl_get_property;
- klass->changed = gtk_style_context_real_changed;
-
- /**
- * GtkStyleContext::changed:
- *
- * The ::changed signal is emitted when there is a change in the
- * #GtkStyleContext.
- *
- * For a #GtkStyleContext returned by gtk_widget_get_style_context(), the
- * #GtkWidget:css-changed vfunc might be more convenient to use.
- *
- * This signal is useful when using the theming layer standalone.
- */
- signals[CHANGED] =
- g_signal_new (I_("changed"),
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GtkStyleContextClass, changed),
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 0);
-
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
P_("Display"),
@@ -1143,30 +1101,6 @@ gtk_style_context_lookup_color (GtkStyleContext *context,
return gtk_style_context_resolve_color (context, value, color);
}
-static GtkCssStyleChange magic_number;
-
-void
-gtk_style_context_validate (GtkStyleContext *context,
- GtkCssStyleChange *change)
-{
- GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
-
- g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-
- /* Avoid reentrancy */
- if (priv->invalidating_context)
- return;
-
- if (change)
- priv->invalidating_context = change;
- else
- priv->invalidating_context = &magic_number;
-
- g_signal_emit (context, signals[CHANGED], 0);
-
- priv->invalidating_context = NULL;
-}
-
/**
* gtk_style_context_get_color:
* @context: a #GtkStyleContext
@@ -1597,32 +1531,6 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
}
}
-/**
- * gtk_style_context_get_change:
- * @context: the context to query
- *
- * Queries the context for the changes for the currently executing
- * GtkStyleContext::invalidate signal. If no signal is currently
- * emitted or the signal has not been triggered by a CssNode
- * invalidation, this function returns %NULL.
- *
- * FIXME 4.0: Make this part of the signal.
- *
- * Returns: %NULL or the currently invalidating changes
- **/
-GtkCssStyleChange *
-gtk_style_context_get_change (GtkStyleContext *context)
-{
- GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
-
- g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-
- if (priv->invalidating_context == &magic_number)
- return NULL;
-
- return priv->invalidating_context;
-}
-
PangoAttrList *
_gtk_style_context_get_pango_attributes (GtkStyleContext *context)
{
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index e3cc0fff39..4074d06a96 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -44,14 +44,9 @@ void gtk_style_context_save_named (GtkStyleContext *c
void gtk_style_context_save_to_node (GtkStyleContext *context,
GtkCssNode *node);
-GtkCssStyleChange *
- gtk_style_context_get_change (GtkStyleContext *context);
-
GtkCssStyle * gtk_style_context_lookup_style (GtkStyleContext *context);
GtkCssValue * _gtk_style_context_peek_property (GtkStyleContext *context,
guint property_id);
-void gtk_style_context_validate (GtkStyleContext *context,
- GtkCssStyleChange *change);
gboolean _gtk_style_context_check_region_name (const gchar *str);
void _gtk_style_context_get_cursor_color (GtkStyleContext *context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]