g_hash_table_remove(menu_hash, menu->name);
}
-void menu_show(gchar *name, gint x, gint y, ObClient *client)
+void menu_show(gchar *name, gint x, gint y, gint button, ObClient *client)
{
ObMenu *self;
ObMenuFrame *frame;
menu_frame_hide_all();
frame = menu_frame_new(self, client);
- if (!menu_frame_show_topmenu(frame, x, y))
+ 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 &&
- e->entry->data.normal.enabled)
- menu_frame_select(frame, e, FALSE);
+ if (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL)
+ menu_frame_select(frame, e, FALSE);
}
}
self->destroy_func = func;
}
+void menu_set_place_func(ObMenu *self, ObMenuPlaceFunc func)
+{
+ self->place_func = func;
+}
+
ObMenuEntry* menu_find_entry_id(ObMenu *self, gint id)
{
ObMenuEntry *ret = NULL;