Don't use object data for layer

Just add a regular member in GtkWidgetAccessible for it.
This commit is contained in:
Matthias Clasen 2011-07-17 23:17:38 -04:00
parent 6d33c783d0
commit 3bfa69fa53
5 changed files with 8 additions and 20 deletions

View File

@ -32,7 +32,7 @@ gtk_menu_accessible_initialize (AtkObject *obj,
obj->role = ATK_ROLE_MENU; obj->role = ATK_ROLE_MENU;
_gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP); GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_POPUP;
} }
static AtkObject * static AtkObject *

View File

@ -63,7 +63,7 @@ gtk_menu_item_accessible_initialize (AtkObject *obj,
atk_object_set_parent (obj, gtk_widget_get_accessible (parent_widget)); atk_object_set_parent (obj, gtk_widget_get_accessible (parent_widget));
} }
_gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP); GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_POPUP;
if (GTK_IS_TEAROFF_MENU_ITEM (data)) if (GTK_IS_TEAROFF_MENU_ITEM (data))
obj->role = ATK_ROLE_TEAR_OFF_MENU_ITEM; obj->role = ATK_ROLE_TEAR_OFF_MENU_ITEM;

View File

@ -127,6 +127,7 @@ gtk_widget_accessible_initialize (AtkObject *obj,
g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL); g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL);
g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL); g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL);
GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_WIDGET;
obj->role = ATK_ROLE_UNKNOWN; obj->role = ATK_ROLE_UNKNOWN;
} }
@ -620,21 +621,9 @@ gtk_widget_accessible_get_size (AtkComponent *component,
static AtkLayer static AtkLayer
gtk_widget_accessible_get_layer (AtkComponent *component) gtk_widget_accessible_get_layer (AtkComponent *component)
{ {
gint layer; GtkWidgetAccessible *accessible = GTK_WIDGET_ACCESSIBLE (component);
layer = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (component), "atk-component-layer")); return accessible->layer;
if (layer == 0)
return ATK_LAYER_WIDGET;
else
return (AtkLayer) layer;
}
void
_gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible,
AtkLayer layer)
{
g_object_set_data (G_OBJECT (accessible), "atk-component-layer", GINT_TO_POINTER (layer));
} }
static gboolean static gboolean

View File

@ -37,6 +37,8 @@ typedef struct _GtkWidgetAccessibleClass GtkWidgetAccessibleClass;
struct _GtkWidgetAccessible struct _GtkWidgetAccessible
{ {
GtkAccessible parent; GtkAccessible parent;
AtkLayer layer;
}; };
struct _GtkWidgetAccessibleClass struct _GtkWidgetAccessibleClass
@ -53,9 +55,6 @@ struct _GtkWidgetAccessibleClass
GType _gtk_widget_accessible_get_type (void); GType _gtk_widget_accessible_get_type (void);
void _gtk_widget_accessible_set_layer (GtkWidgetAccessible *obj,
AtkLayer layer);
G_END_DECLS G_END_DECLS
#endif /* __GTK_WIDGET_ACCESSIBLE_H__ */ #endif /* __GTK_WIDGET_ACCESSIBLE_H__ */

View File

@ -107,7 +107,7 @@ gtk_window_accessible_initialize (AtkObject *obj,
ATK_OBJECT_CLASS (_gtk_window_accessible_parent_class)->initialize (obj, data); ATK_OBJECT_CLASS (_gtk_window_accessible_parent_class)->initialize (obj, data);
g_signal_connect (data, "window-state-event", G_CALLBACK (window_state_event_cb), NULL); g_signal_connect (data, "window-state-event", G_CALLBACK (window_state_event_cb), NULL);
_gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_WINDOW); GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_WINDOW;
if (GTK_IS_FILE_CHOOSER_DIALOG (widget)) if (GTK_IS_FILE_CHOOSER_DIALOG (widget))
obj->role = ATK_ROLE_FILE_CHOOSER; obj->role = ATK_ROLE_FILE_CHOOSER;