/** Show a root menu. */ int ShowRootMenu(int index, int x, int y) { if(!rootMenu[index]) { return 0; } PatchRootMenu(rootMenu[index]); ShowMenu(rootMenu[index], RunRootCommand, x, y); UnpatchRootMenu(rootMenu[index]); return 1; }
/** Remove temporary items from a root menu. */ void UnpatchRootMenu(Menu *menu) { MenuItem *item; for(item = menu->items; item; item = item->next) { if(item->action.type == MA_DESKTOP) { DestroyMenu(item->submenu); item->submenu = NULL; } else if(item->submenu) { UnpatchRootMenu(item->submenu); } } }
/** Determine the size of a root menu. */ void GetRootMenuSize(int index, int *width, int *height) { if(!rootMenu[index]) { *width = 0; *height = 0; return; } PatchRootMenu(rootMenu[index]); *width = rootMenu[index]->width; *height = rootMenu[index]->height; UnpatchRootMenu(rootMenu[index]); }