]> Dogcows Code - chaz/openbox/commitdiff
hilight the first normal entry also if there is a menuheader/separator before it
authorMikael Magnusson <mikachu@comhem.se>
Sun, 27 May 2007 17:31:22 +0000 (17:31 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Sun, 27 May 2007 17:31:22 +0000 (17:31 +0000)
openbox/menu.c

index 66d2ac7cd9fd4b1a878278e12a64440130c6d25a..fe664d3516ac58250e530b063eec2ac2a70208b1 100644 (file)
@@ -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;
+        }
     }
 }
 
This page took 0.025353 seconds and 4 git commands to generate.