[gtk+/gtk-3-16] a11y: Only emit signals when cells change; not upon creation
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-16] a11y: Only emit signals when cells change; not upon creation
- Date: Fri, 10 Apr 2015 14:44:35 +0000 (UTC)
commit 06efce6fa2de8d7b77050a37a22ec20e355e2914
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Apr 8 20:08:25 2015 -0400
a11y: Only emit signals when cells change; not upon creation
This is a workaround for atspi-atk behaviour.
atspi-atk uses signal emission hooks. So it to already catches
signal emissions on creation of objects, before anyone could even
think of g_signal_connect()ing.
https://bugzilla.gnome.org/show_bug.cgi?id=746706
gtk/a11y/gtkbooleancellaccessible.c | 9 ++++++---
gtk/a11y/gtkcellaccessible.c | 10 +++++++---
gtk/a11y/gtkcellaccessible.h | 3 ++-
gtk/a11y/gtkcellaccessibleprivate.h | 3 ++-
gtk/a11y/gtkcontainercellaccessible.c | 5 +++--
gtk/a11y/gtktextcellaccessible.c | 12 +++++++-----
gtk/a11y/gtktreeviewaccessible.c | 4 ++--
7 files changed, 29 insertions(+), 17 deletions(-)
---
diff --git a/gtk/a11y/gtkbooleancellaccessible.c b/gtk/a11y/gtkbooleancellaccessible.c
index f12ff31..694f867 100644
--- a/gtk/a11y/gtkbooleancellaccessible.c
+++ b/gtk/a11y/gtkbooleancellaccessible.c
@@ -113,7 +113,8 @@ gtk_boolean_cell_accessible_ref_state_set (AtkObject *accessible)
}
static void
-gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell)
+gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell,
+ gboolean emit_signal)
{
GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell);
gboolean active;
@@ -131,14 +132,16 @@ gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell)
{
boolean_cell->priv->cell_value = !boolean_cell->priv->cell_value;
- atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, active);
+ if (emit_signal)
+ atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, active);
}
if (boolean_cell->priv->cell_sensitive != sensitive)
{
boolean_cell->priv->cell_sensitive = !boolean_cell->priv->cell_sensitive;
- atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_SENSITIVE, sensitive);
+ if (emit_signal)
+ atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_SENSITIVE, sensitive);
}
}
diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c
index 11775e4..ad76014 100644
--- a/gtk/a11y/gtkcellaccessible.c
+++ b/gtk/a11y/gtkcellaccessible.c
@@ -419,19 +419,23 @@ _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
/*
* gtk_cell_accessible_update_cache:
* @cell: the cell that is changed
+ * @emit_signal: whether or not to notify the ATK bridge
*
* Notifies the cell that the values in the data in the row that
* is used to feed the cell renderer with has changed. The
* cell_changed function of @cell is called to send update
* notifications for the properties it takes from its cell
- * renderer.
+ * renderer. If @emit_signal is TRUE, also notify the ATK bridge
+ * of the change. The bridge should be notified when an existing
+ * cell changes; not when a newly-created cell is being set up.
*
* Note that there is no higher granularity available about which
* properties changed, so you will need to make do with this
* function.
**/
void
-_gtk_cell_accessible_update_cache (GtkCellAccessible *cell)
+_gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
+ gboolean emit_signal)
{
GtkCellAccessibleClass *klass;
@@ -440,5 +444,5 @@ _gtk_cell_accessible_update_cache (GtkCellAccessible *cell)
klass = GTK_CELL_ACCESSIBLE_GET_CLASS (cell);
if (klass->update_cache)
- klass->update_cache (cell);
+ klass->update_cache (cell, emit_signal);
}
diff --git a/gtk/a11y/gtkcellaccessible.h b/gtk/a11y/gtkcellaccessible.h
index 169216f..1195a38 100644
--- a/gtk/a11y/gtkcellaccessible.h
+++ b/gtk/a11y/gtkcellaccessible.h
@@ -48,7 +48,8 @@ struct _GtkCellAccessible
struct _GtkCellAccessibleClass
{
GtkAccessibleClass parent_class;
- void (*update_cache) (GtkCellAccessible *cell);
+ void (*update_cache) (GtkCellAccessible *cell,
+ gboolean emit_signal);
};
GDK_AVAILABLE_IN_ALL
diff --git a/gtk/a11y/gtkcellaccessibleprivate.h b/gtk/a11y/gtkcellaccessibleprivate.h
index e4417fa..80fb143 100644
--- a/gtk/a11y/gtkcellaccessibleprivate.h
+++ b/gtk/a11y/gtkcellaccessibleprivate.h
@@ -25,7 +25,8 @@ G_BEGIN_DECLS
void _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
GtkCellRendererState added,
GtkCellRendererState removed);
-void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell);
+void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
+ gboolean emit_signal);
void _gtk_cell_accessible_initialize (GtkCellAccessible *cell,
GtkWidget *widget,
AtkObject *parent);
diff --git a/gtk/a11y/gtkcontainercellaccessible.c b/gtk/a11y/gtkcontainercellaccessible.c
index ad9fb81..a756e3c 100644
--- a/gtk/a11y/gtkcontainercellaccessible.c
+++ b/gtk/a11y/gtkcontainercellaccessible.c
@@ -64,13 +64,14 @@ gtk_container_cell_accessible_ref_child (AtkObject *obj,
}
static void
-gtk_container_cell_accessible_update_cache (GtkCellAccessible *cell)
+gtk_container_cell_accessible_update_cache (GtkCellAccessible *cell,
+ gboolean emit_signal)
{
GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (cell);
GList *l;
for (l = container->priv->children; l; l = l->next)
- _gtk_cell_accessible_update_cache (l->data);
+ _gtk_cell_accessible_update_cache (l->data, emit_signal);
}
static void
diff --git a/gtk/a11y/gtktextcellaccessible.c b/gtk/a11y/gtktextcellaccessible.c
index aca9693..e6a0df2 100644
--- a/gtk/a11y/gtktextcellaccessible.c
+++ b/gtk/a11y/gtktextcellaccessible.c
@@ -87,7 +87,8 @@ static void add_attr (PangoAttrList *attr_li
/* Misc */
-static void gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell);
+static void gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell,
+ gboolean emit_signal);
static void atk_text_interface_init (AtkTextIface *iface);
@@ -132,7 +133,8 @@ gtk_text_cell_accessible_get_name (AtkObject *atk_obj)
}
static void
-gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell)
+gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell,
+ gboolean emit_signal)
{
GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (cell);
AtkObject *obj = ATK_OBJECT (cell);
@@ -154,7 +156,7 @@ gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell)
if (g_strcmp0 (text_cell->priv->cell_text, text) != 0)
{
- if (text_cell->priv->cell_length)
+ if (text_cell->priv->cell_length && emit_signal)
{
g_signal_emit_by_name (cell, "text-changed::delete",
0, text_cell->priv->cell_length);
@@ -164,13 +166,13 @@ gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell)
text_cell->priv->cell_text = g_strdup (text);
text_cell->priv->cell_length = text_length;
- if (text_length)
+ if (text_length && emit_signal)
{
g_signal_emit_by_name (cell, "text-changed::insert",
0, text_cell->priv->cell_length);
}
- if (obj->name == NULL)
+ if (obj->name == NULL && emit_signal)
g_object_notify (G_OBJECT (obj), "accessible-name");
}
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index cba51c4..a95054d 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -425,7 +425,7 @@ create_cell (GtkTreeView *treeview,
cell_info_new (accessible, tree, node, column, cell);
set_cell_data (treeview, accessible, cell);
- _gtk_cell_accessible_update_cache (cell);
+ _gtk_cell_accessible_update_cache (cell, FALSE);
return cell;
}
@@ -1705,7 +1705,7 @@ _gtk_tree_view_accessible_changed (GtkTreeView *treeview,
continue;
set_cell_data (treeview, accessible, cell);
- _gtk_cell_accessible_update_cache (cell);
+ _gtk_cell_accessible_update_cache (cell, TRUE);
}
g_signal_emit_by_name (accessible, "visible-data-changed");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]