Re: [g-a-devel] GAIL: Problem with is_attached_menu_window function



Marcin Lyko wrote:
I'm not soure if I understand you, but if you change
is_attached_menu_window function from gailtoplevel so as to it always
returns FALSE, an attached menu is detected normally.
This is *not* the correct solution; if you change is_attached_menu_window, the attached menu appears at the wrong place in the at-spi hierarchy.

So, the problem is not in is_attached_menu_window - the window should NOT appear there, it should appear elsewhere, as a child of the widget to which it is attached.

Bill

Marcin

It looks to me as though gailwidget should be detecting when/whether
gtk_menu_attach_to_widget has been called, and modifying
gail_widget_ref_child accordingly... I am not sure offhand if we can
detect the presence of an attached menu, but I would expect gtk+ to
provide some API for it (perhaps as a GObject property?)

Bill

Marcin Lyko wrote:

Do you have a small test program which illustrates the problem?
A test program which illustrates the problem you can find in the
attachment. In the program menu is attached to "popup menu" button and
it isn't seen by at-spi after its popup.

You could log a bug at http://bugzilla.gnome.org against atk/gail.
I raport the bug soon.

Marcin


--
Empowering business
http://webinars.comarch.com
------------------------------------------------------------------------

#include <gtk/gtk.h>

static gboolean close_app_cb( GtkWidget *widget, GdkEvent *event,
gpointer data )
{
    gtk_main_quit ();
return FALSE;
}

static void popup_menu_cb( GtkWidget *widget, gpointer data )
{
    GtkWidget *menu = (GtkWidget *) data;
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 1,
gtk_get_current_event_time ());
}

static void items_cb( GtkWidget *widget, gpointer data )
{
    g_print ("%s clicked...\n", (gchar *) data);
}

void detacher_menu (GtkWidget *widget, GtkMenu *menu)
{
    g_print ("detacher menu\n");
}

static GtkMenu *create_menu(void)
{
    GtkMenu *menu = NULL;
    GtkWidget *item = NULL;
menu = GTK_MENU (gtk_menu_new ());

    if (menu->toplevel)
    {
        GdkGeometry geometry = {0};
        geometry.win_gravity = GDK_GRAVITY_NORTH_EAST;
        gtk_window_set_geometry_hints (GTK_WINDOW (menu->toplevel),
                                                GTK_WIDGET
(menu->toplevel),
                                                &geometry,
                                                GDK_HINT_WIN_GRAVITY);
    }
item = gtk_menu_item_new_with_label ( "First item" );
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
    g_signal_connect (item, "activate", G_CALLBACK (items_cb),
(gpointer) "First item");

    item = gtk_menu_item_new_with_label ( "Second item" );
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
    g_signal_connect (item, "activate", G_CALLBACK (items_cb),
(gpointer) "Second item");
item = gtk_menu_item_new_with_label ( "Third item" );
    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
    g_signal_connect (item, "activate", G_CALLBACK (items_cb),
(gpointer) "Third item");
gtk_widget_show_all (GTK_WIDGET (menu)); return menu;
}

int main (int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *vbox;
    GtkWidget *label;
    GtkWidget *button;
    GtkWidget *menu;
gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK
(close_app_cb), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
vbox = gtk_vbox_new (FALSE, 5);
    gtk_container_add (GTK_CONTAINER (window), vbox);
label = gtk_label_new( "Some label" );
    gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(label), TRUE, TRUE, 0);
menu = (GtkWidget *) create_menu();

    button = gtk_button_new_with_label ("Popup menu");
    gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(button), TRUE, TRUE, 0);
    g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK
(popup_menu_cb), (gpointer) menu);
gtk_menu_attach_to_widget (GTK_MENU(menu), GTK_WIDGET(button),
detacher_menu);
gtk_widget_show_all (GTK_WIDGET(window)); gtk_main (); return 0;
}
------------------------------------------------------------------------

_______________________________________________
Gnome-accessibility-devel mailing list
Gnome-accessibility-devel gnome org
http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel



--
Empowering business
http://webinars.comarch.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]