static void stack_restack_reg(WRegion *reg, Window *other, int *mode) { Window b=None, t=None; if(reg!=NULL){ region_restack(reg, *other, *mode); region_stacking(reg, &b, &t); if(t!=None){ *other=t; *mode=Above; } } }
static void stacking_do_weave(WStacking **stacking, WStacking **np, bool below, Window fb_win) { WStacking *st, *ab; uint lvl; Window other; int mode; if(*np==NULL) return; /* Should do nothing.. */ enforce_level_sanity(np); ab=*stacking; while(*np!=NULL){ lvl=(*np)->level; while(ab!=NULL){ if(ab->level>lvl || (below && ab->level==lvl)) break; ab=ab->next; } get_bottom(ab, fb_win, &other, &mode); st=*np; UNLINK_ITEM(*np, st, next, prev); region_restack(st->reg, other, mode); if(ab!=NULL){ LINK_ITEM_BEFORE(*stacking, ab, st, next, prev); }else{ LINK_ITEM_LAST(*stacking, st, next, prev); } } }
void menu_restack(WMenu *menu, Window other, int mode) { xwindow_restack(MENU_WIN(menu), other, mode); if(menu->submenu!=NULL) region_restack((WRegion*)(menu->submenu), MENU_WIN(menu), Above); }
static void show_sub(WMenu *menu, int n) { WFitParams fp; WMenuCreateParams fnp; WMenu *submenu; WWindow *par; par=REGION_PARENT(menu); if(par==NULL) return; fp=menu->last_fp; fnp.pmenu_mode=menu->pmenu_mode; fnp.big_mode=menu->big_mode; fnp.submenu_mode=TRUE; if(menu->pmenu_mode){ fnp.refg.x=REGION_GEOM(menu).x+REGION_GEOM(menu).w; fnp.refg.y=REGION_GEOM(menu).y+get_sub_y_off(menu, n); fnp.refg.w=0; fnp.refg.h=0; }else{ fnp.refg=REGION_GEOM(menu); } fnp.tab=extl_table_none(); { ExtlFn fn; if(extl_table_getis(menu->tab, n+1, "submenu_fn", 'f', &fn)){ extl_protect(NULL); extl_call(fn, NULL, "t", &(fnp.tab)); extl_unprotect(NULL); extl_unref_fn(fn); }else{ extl_table_getis(menu->tab, n+1, "submenu", 't', &(fnp.tab)); } if(fnp.tab==extl_table_none()) return; } fnp.handler=extl_ref_fn(menu->handler); fnp.initial=0; { ExtlFn fn; if(extl_table_getis(menu->tab, n+1, "initial", 'f', &fn)){ extl_protect(NULL); extl_call(fn, NULL, "i", &(fnp.initial)); extl_unprotect(NULL); extl_unref_fn(fn); }else{ extl_table_getis(menu->tab, n+1, "initial", 'i', &(fnp.initial)); } } submenu=create_menu(par, &fp, &fnp); if(submenu==NULL) return; menu->submenu=submenu; region_set_manager((WRegion*)submenu, (WRegion*)menu); region_restack((WRegion*)submenu, MENU_WIN(menu), Above); region_map((WRegion*)submenu); if(!menu->pmenu_mode && region_may_control_focus((WRegion*)menu)) region_do_set_focus((WRegion*)submenu, FALSE); }