mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-06 16:50:11 +00:00
Get rid of the focus_gtk vfunc
Only GtkWidgetAccessible and GtkWindowAccessible had implementations, and they could easily be converted to focus_event handlers.
This commit is contained in:
parent
2b5140c974
commit
6d33c783d0
@ -37,19 +37,17 @@ static void atk_component_interface_init (AtkComponentIface *iface);
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkWidgetAccessible, _gtk_widget_accessible, GTK_TYPE_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
|
||||
|
||||
/* Translate GtkWidget::focus-in/out-event to the focus_gtk vfunc */
|
||||
/* Translate GtkWidget::focus-in/out-event to AtkObject::focus-event */
|
||||
static gboolean
|
||||
focus_cb (GtkWidget *widget,
|
||||
GdkEventFocus *event)
|
||||
{
|
||||
GtkWidgetAccessible *accessible;
|
||||
GtkWidgetAccessibleClass *klass;
|
||||
AtkObject *obj;
|
||||
|
||||
obj = gtk_widget_get_accessible (widget);
|
||||
|
||||
g_signal_emit_by_name (obj, "focus-event", event->in);
|
||||
|
||||
accessible = GTK_WIDGET_ACCESSIBLE (gtk_widget_get_accessible (widget));
|
||||
klass = GTK_WIDGET_ACCESSIBLE_GET_CLASS (accessible);
|
||||
if (klass->focus_gtk)
|
||||
return klass->focus_gtk (widget, event);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -99,7 +97,7 @@ map_cb (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
focus_event (AtkObject *obj,
|
||||
gtk_widget_accessible_focus_event (AtkObject *obj,
|
||||
gboolean focus_in)
|
||||
{
|
||||
AtkObject *focus_obj;
|
||||
@ -129,8 +127,6 @@ gtk_widget_accessible_initialize (AtkObject *obj,
|
||||
g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL);
|
||||
g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL);
|
||||
|
||||
g_signal_connect (accessible, "focus-event", G_CALLBACK (focus_event), NULL);
|
||||
|
||||
obj->role = ATK_ROLE_UNKNOWN;
|
||||
}
|
||||
|
||||
@ -512,25 +508,6 @@ gtk_widget_accessible_notify_gtk (GObject *obj,
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_VERTICAL, !value);
|
||||
}
|
||||
|
||||
/* This function is the default implementation for the focus_gtk
|
||||
* vfunc which gets called for focus_in/out_event.
|
||||
*
|
||||
* It emits a focus-event signal on the GtkWidgetAccessible.
|
||||
*/
|
||||
static gboolean
|
||||
gtk_widget_accessible_focus_gtk (GtkWidget *widget,
|
||||
GdkEventFocus *event)
|
||||
{
|
||||
AtkObject* accessible;
|
||||
gboolean return_val;
|
||||
return_val = FALSE;
|
||||
|
||||
accessible = gtk_widget_get_accessible (widget);
|
||||
|
||||
g_signal_emit_by_name (accessible, "focus-event", event->in, &return_val);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static AtkAttributeSet *
|
||||
gtk_widget_accessible_get_attributes (AtkObject *obj)
|
||||
{
|
||||
@ -553,7 +530,6 @@ _gtk_widget_accessible_class_init (GtkWidgetAccessibleClass *klass)
|
||||
GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_CLASS (klass);
|
||||
|
||||
klass->notify_gtk = gtk_widget_accessible_notify_gtk;
|
||||
klass->focus_gtk = gtk_widget_accessible_focus_gtk;
|
||||
|
||||
accessible_class->connect_widget_destroyed = gtk_widget_accessible_connect_widget_destroyed;
|
||||
|
||||
@ -564,6 +540,7 @@ _gtk_widget_accessible_class_init (GtkWidgetAccessibleClass *klass)
|
||||
class->get_index_in_parent = gtk_widget_accessible_get_index_in_parent;
|
||||
class->initialize = gtk_widget_accessible_initialize;
|
||||
class->get_attributes = gtk_widget_accessible_get_attributes;
|
||||
class->focus_event = gtk_widget_accessible_focus_event;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -48,11 +48,6 @@ struct _GtkWidgetAccessibleClass
|
||||
*/
|
||||
void (*notify_gtk) (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
/*
|
||||
* Signal handler for focus_in_event and focus_out_event signal on GTK widget
|
||||
*/
|
||||
gboolean (*focus_gtk) (GtkWidget *widget,
|
||||
GdkEventFocus *event);
|
||||
|
||||
};
|
||||
|
||||
|
@ -58,16 +58,11 @@ G_DEFINE_TYPE_WITH_CODE (GtkWindowAccessible, _gtk_window_accessible, GTK_TYPE_C
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
|
||||
|
||||
|
||||
static gboolean
|
||||
gtk_window_accessible_focus_gtk (GtkWidget *widget,
|
||||
GdkEventFocus *event)
|
||||
static void
|
||||
gtk_window_accessible_focus_event (AtkObject *obj,
|
||||
gboolean focus_in)
|
||||
{
|
||||
AtkObject* obj;
|
||||
|
||||
obj = gtk_widget_get_accessible (widget);
|
||||
atk_object_notify_state_change (obj, ATK_STATE_ACTIVE, event->in);
|
||||
|
||||
return FALSE;
|
||||
atk_object_notify_state_change (obj, ATK_STATE_ACTIVE, focus_in);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -321,7 +316,6 @@ _gtk_window_accessible_class_init (GtkWindowAccessibleClass *klass)
|
||||
GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
widget_class->focus_gtk = gtk_window_accessible_focus_gtk;
|
||||
widget_class->notify_gtk = gtk_window_accessible_notify_gtk;
|
||||
|
||||
class->get_name = gtk_window_accessible_get_name;
|
||||
@ -329,6 +323,7 @@ _gtk_window_accessible_class_init (GtkWindowAccessibleClass *klass)
|
||||
class->ref_relation_set = gtk_window_accessible_ref_relation_set;
|
||||
class->ref_state_set = gtk_window_accessible_ref_state_set;
|
||||
class->initialize = gtk_window_accessible_initialize;
|
||||
class->focus_event = gtk_window_accessible_focus_event;
|
||||
|
||||
gtk_window_accessible_signals [ACTIVATE] =
|
||||
g_signal_new ("activate",
|
||||
|
Loading…
Reference in New Issue
Block a user