gail: Use accessor functions to access GtkWindow

This commit is contained in:
Javier Jardón
2010-08-17 15:01:02 +02:00
parent a0e0c9e89c
commit fe16bdd8d4
5 changed files with 16 additions and 18 deletions

View File

@ -213,10 +213,15 @@ gail_focus_watcher (GSignalInvocationHint *ihint,
{ {
if (GTK_IS_WINDOW (widget)) if (GTK_IS_WINDOW (widget))
{ {
GtkWidget *focus_widget;
GtkWindow *window; GtkWindow *window;
GtkWindowType type;
window = GTK_WINDOW (widget); window = GTK_WINDOW (widget);
if (window->focus_widget) focus_widget = gtk_window_get_focus (window);
g_object_get (window, "type", &type, NULL);
if (focus_widget)
{ {
/* /*
* If we already have a potential focus widget set this * If we already have a potential focus widget set this
@ -229,15 +234,15 @@ gail_focus_watcher (GSignalInvocationHint *ihint,
!focus_before_menu) !focus_before_menu)
{ {
void *vp_focus_before_menu = &focus_before_menu; void *vp_focus_before_menu = &focus_before_menu;
focus_before_menu = window->focus_widget; focus_before_menu = focus_widget;
g_object_add_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu); g_object_add_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
} }
return TRUE; return TRUE;
} }
widget = window->focus_widget; widget = focus_widget;
} }
else if (window->type == GTK_WINDOW_POPUP) else if (type == GTK_WINDOW_POPUP)
{ {
if (GTK_IS_BIN (widget)) if (GTK_IS_BIN (widget))
{ {

View File

@ -500,8 +500,8 @@ window_removed (AtkObject *atk_obj,
* Deactivate window if it is still focused and we are removing it. This * Deactivate window if it is still focused and we are removing it. This
* can happen when a dialog displayed by gok is removed. * can happen when a dialog displayed by gok is removed.
*/ */
if (window->is_active && if (gtk_window_is_active (window) &&
window->has_toplevel_focus) gtk_window_has_toplevel_focus (window))
{ {
gchar *signal_name; gchar *signal_name;
AtkObject *atk_obj; AtkObject *atk_obj;
@ -556,11 +556,6 @@ configure_event_watcher (GSignalInvocationHint *hint,
event = g_value_get_boxed (param_values + 1); event = g_value_get_boxed (param_values + 1);
if (event->type != GDK_CONFIGURE) if (event->type != GDK_CONFIGURE)
return FALSE; return FALSE;
if (GTK_WINDOW (object)->configure_request_count)
/*
* There is another ConfigureRequest pending so we ignore this one.
*/
return TRUE;
widget = GTK_WIDGET (object); widget = GTK_WIDGET (object);
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
if (allocation.x == ((GdkEventConfigure *)event)->x && if (allocation.x == ((GdkEventConfigure *)event)->x &&

View File

@ -228,7 +228,7 @@ gail_window_real_initialize (AtkObject *obj,
obj->role = ATK_ROLE_TOOL_TIP; obj->role = ATK_ROLE_TOOL_TIP;
else if (GTK_IS_PLUG (widget)) else if (GTK_IS_PLUG (widget))
obj->role = ATK_ROLE_PANEL; obj->role = ATK_ROLE_PANEL;
else if (GTK_WINDOW (widget)->type == GTK_WINDOW_POPUP) else if (gtk_window_get_window_type (GTK_WINDOW (widget)) == GTK_WINDOW_POPUP)
obj->role = ATK_ROLE_WINDOW; obj->role = ATK_ROLE_WINDOW;
else else
obj->role = ATK_ROLE_FRAME; obj->role = ATK_ROLE_FRAME;
@ -445,7 +445,7 @@ gail_window_ref_state_set (AtkObject *accessible)
window = GTK_WINDOW (widget); window = GTK_WINDOW (widget);
if (window->has_focus) if (gtk_window_has_toplevel_focus (window) && gtk_window_is_active (window))
atk_state_set_add_state (state_set, ATK_STATE_ACTIVE); atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);
gdk_window = gtk_widget_get_window (widget); gdk_window = gtk_widget_get_window (widget);

View File

@ -1479,7 +1479,7 @@ _mouse_watcher (GSignalInvocationHint *ihint,
widget = GTK_WIDGET (object); widget = GTK_WIDGET (object);
if (GTK_IS_WINDOW (widget)) if (GTK_IS_WINDOW (widget))
{ {
GtkWidget *focus_widget = GTK_WINDOW (widget)->focus_widget; GtkWidget *focus_widget = gtk_window_get_focus (GTK_WINDOW (widget));
if (focus_widget != NULL) if (focus_widget != NULL)
widget = focus_widget; widget = focus_widget;
} }

View File

@ -49,10 +49,8 @@ static void _check_text (AtkObject *in_obj)
title = NULL; title = NULL;
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (toplevel) && GTK_WINDOW (toplevel)->title) if (GTK_IS_WINDOW (toplevel))
{ title = (gchar *) gtk_window_get_title (GTK_WINDOW (toplevel));
title = GTK_WINDOW (toplevel)->title;
}
else else
title = NULL; title = NULL;
} }