qulogic/libgnt

merge of '463242c8c94709caaec5d86a68792c915fdd0537'

2007-11-26, Sadrul Habib Chowdhury
6175a275ef50
merge of '463242c8c94709caaec5d86a68792c915fdd0537'
and 'e218d47842e063c2f427ccb80e46e346e8669451'
  • +8 -2
    gntbox.c
  • +19 -0
    gntmenu.c
  • --- a/gntbox.c Sun Nov 25 14:16:54 2007 +0000
    +++ b/gntbox.c Mon Nov 26 05:41:09 2007 +0000
    @@ -851,8 +851,14 @@
    void gnt_box_give_focus_to_child(GntBox *box, GntWidget *widget)
    {
    - GList *find = g_list_find(box->focus, widget);
    - gpointer now = box->active;
    + GList *find;
    + gpointer now;
    +
    + while (GNT_WIDGET(box)->parent)
    + box = GNT_BOX(GNT_WIDGET(box)->parent);
    +
    + find = g_list_find(box->focus, widget);
    + now = box->active;
    if (find)
    box->active = widget;
    if (now && now != box->active)
    --- a/gntmenu.c Sun Nov 25 14:16:54 2007 +0000
    +++ b/gntmenu.c Mon Nov 26 05:41:09 2007 +0000
    @@ -47,6 +47,8 @@
    static void (*org_size_request)(GntWidget *wid);
    static gboolean (*org_key_pressed)(GntWidget *w, const char *t);
    +static void menuitem_activate(GntMenu *menu, GntMenuItem *item);
    +
    static void
    menu_hide_all(GntMenu *menu)
    {
    @@ -56,6 +58,20 @@
    }
    static void
    +show_submenu(GntMenu *menu)
    +{
    + GntMenuItem *item;
    +
    + if (menu->type != GNT_MENU_TOPLEVEL)
    + return;
    +
    + item = g_list_nth_data(menu->list, menu->selected);
    + if (!item || !item->submenu)
    + return;
    + menuitem_activate(menu, item);
    +}
    +
    +static void
    gnt_menu_draw(GntWidget *widget)
    {
    GntMenu *menu = GNT_MENU(widget);
    @@ -276,6 +292,8 @@
    gnt_widget_hide(widget);
    } else
    gnt_widget_hide(widget);
    + if (par && par->type == GNT_MENU_TOPLEVEL)
    + gnt_menu_key_pressed(GNT_WIDGET(par), text);
    return TRUE;
    }
    @@ -297,6 +315,7 @@
    GntMenu *sub = menu->submenu;
    if (sub)
    gnt_widget_hide(GNT_WIDGET(sub));
    + show_submenu(menu);
    gnt_widget_draw(widget);
    return TRUE;
    }