static bool resize_handler(WRegion *reg, XEvent *xev) { XKeyEvent *ev=&xev->xkey; WBinding *binding=NULL; WMoveresMode *mode; if(ev->type==KeyRelease) return FALSE; if(reg==NULL) return FALSE; mode=moveres_mode(reg); if(mode==NULL) return FALSE; binding=bindmap_lookup_binding(ioncore_moveres_bindmap, BINDING_KEYPRESS, ev->state, ev->keycode); if(!binding) return FALSE; if(binding!=NULL){ extl_protect(&moveres_safelist); extl_call(binding->func, "oo", NULL, mode, reg); extl_unprotect(&moveres_safelist); } return (moveres_mode(reg)==NULL); }
bool extl_iter_obj(ExtlFn fn, Obj *obj) { bool ret1, ret2=FALSE; extl_protect(NULL); ret1=extl_call(fn, "o", "b", obj, &ret2); extl_unprotect(NULL); return (ret1 && ret2); }
ExtlTab ioncore_get_layout(const char *layout) { ExtlTab tab=extl_table_none(); if(get_layout_fn_set){ extl_protect(NULL); extl_call(get_layout_fn, "s", "t", layout, &tab); extl_unprotect(NULL); } return tab; }
ExtlTab ioncore_get_winprop(WClientWin *cwin) { ExtlTab tab=extl_table_none(); if(get_winprop_fn_set){ extl_protect(NULL); extl_call(get_winprop_fn, "o", "t", cwin, &tab); extl_unprotect(NULL); } return tab; }
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); }