diff options
| author | Mikael Magnusson <mikachu@comhem.se> | 2007-05-27 17:31:22 +0000 |
|---|---|---|
| committer | Mikael Magnusson <mikachu@comhem.se> | 2007-05-27 17:31:22 +0000 |
| commit | 7f9080c6a0679aab23e7519dcc6d8498f4e28a0f (patch) | |
| tree | 976b29a796e810cad2f6eba08c5680b8c78d71ab | |
| parent | 914d18f364e3e80dde9687f902a706a64363bc28 (diff) | |
hilight the first normal entry also if there is a menuheader/separator before it
| -rw-r--r-- | openbox/menu.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/openbox/menu.c b/openbox/menu.c index 66d2ac7c..fe664d35 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -396,11 +396,19 @@ 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) { + else { /* 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); + 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; + } } } |
