X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmenu.c;h=71eb0591bc211b2e46cb6bcb071f63290a95d5f7;hb=56b01b73a808ccf51991a0aeb5362d5eb6bbfaaa;hp=66d2ac7cd9fd4b1a878278e12a64440130c6d25a;hpb=883bad43869c6fe55b4409a25d4283a941f8778d;p=chaz%2Fopenbox diff --git a/openbox/menu.c b/openbox/menu.c index 66d2ac7c..71eb0591 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -396,11 +396,20 @@ void menu_show(gchar *name, gint x, gint y, gint button, ObClient *client) frame = menu_frame_new(self, 0, client); if (!menu_frame_show_topmenu(frame, x, y, button)) menu_frame_free(frame); - else if (frame->entries) { - /* select the first entry if it's not a submenu */ - ObMenuEntryFrame *e = frame->entries->data; - if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) - menu_frame_select(frame, e, FALSE); + else if (!button) { + /* select the first entry if it's not a submenu and we opened + * the menu with the keyboard, and skip all headers */ + GList *it = frame->entries; + while (it) { + ObMenuEntryFrame *e = it->data; + if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) { + menu_frame_select(frame, e, FALSE); + break; + } else if (e->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR) + it = g_list_next(it); + else + break; + } } }