WStacking *stacking_unweave(WStacking **stacking, WStackingFilter *filt, void *filt_data) { WStacking *np=NULL; WStacking *st, *next; for(st=*stacking; st!=NULL; st=st->next){ st->to_unweave=2; if(st->above==NULL && cf(filt, filt_data, st)) st->to_unweave=1; } for(st=*stacking; st!=NULL; st=st->next) check_unweave(st); for(st=*stacking; st!=NULL; st=next){ next=st->next; if(st->to_unweave==1){ UNLINK_ITEM(*stacking, st, next, prev); LINK_ITEM(np, st, next, prev); } } return np; }
WStacking *stacking_unstack(WWindow *par, WStacking *regst) { WStacking *nxt=NULL, *st; /*st=regst->next;*/ UNLINK_ITEM(par->stacking, regst, next, prev); /*while(st!=NULL){*/ for(st=par->stacking; st!=NULL; st=st->next){ if(st->above==regst){ st->above=NULL; nxt=st; } /*st=st->next;*/ } if(nxt==NULL) nxt=regst->above; if(regst->above==NULL) regst->above=NULL; return nxt; }
static void destroy_item(WHook *hk, WHookItem *item) { if(item->fn==NULL) extl_unref_fn(item->efn); UNLINK_ITEM(hk->items, item, next, prev); free(item); }
static void region_focuslist_deinit(WRegion *reg) { WRegion *replace=region_manager_or_parent(reg); if(replace!=NULL) region_focuslist_move_after(replace, reg); UNLINK_ITEM(ioncore_g.focuslist, reg, active_next, active_prev); }
void region_focuslist_remove_with_mgrs(WRegion *reg) { WRegion *mgrp=region_manager_or_parent(reg); UNLINK_ITEM(ioncore_g.focuslist, reg, active_next, active_prev); if(mgrp!=NULL) region_focuslist_remove_with_mgrs(mgrp); }
void unlink_thing(WThing *thing) { WThing *parent=thing->t_parent; if(parent==NULL) return; UNLINK_ITEM(parent->t_children, thing, t_next, t_prev); }
static void dock_deinit(WDock *dock) { while(dock->dockapps!=NULL) destroy_obj((Obj*)dock->dockapps->reg); UNLINK_ITEM(docks, dock, dock_next, dock_prev); dock_brush_release(dock); window_deinit((WWindow*) dock); }
static ObjList *reuse_first(ObjList **objlist) { ObjList *node=*objlist; if(node!=NULL && node->watch.obj==NULL){ UNLINK_ITEM(*objlist, node, next, prev); return node; } return NULL; }
void ioncore_unregister_regclass(ClassDescr *descr) { WRegClassInfo *info; for(info=reg_class_infos; info!=NULL; info=info->next){ if(descr==info->descr){ UNLINK_ITEM(reg_class_infos, info, next, prev); free(info); return; } } }
static void dock_managed_remove(WDock *dock, WRegion *reg) { WDockApp *dockapp=dock_find_dockapp(dock, reg); if(dockapp==NULL) return; UNLINK_ITEM(dock->dockapps, dockapp, next, prev); free(dockapp); region_unset_manager(reg, (WRegion*)dock); dock_resize(dock); }
void de_free_font(DEFont *font) { if(--font->refcount!=0) return; if(font->fontset!=NULL) XFreeFontSet(ioncore_g.dpy, font->fontset); if(font->fontstruct!=NULL) XFreeFont(ioncore_g.dpy, font->fontstruct); if(font->pattern!=NULL) free(font->pattern); UNLINK_ITEM(fonts, font, next, prev); free(font); }
bool objlist_reinsert_first(ObjList **objlist, Obj *obj) { ObjList *node; optimise(objlist); node=objlist_find_node(*objlist, obj); if(node==NULL) return objlist_insert_first(objlist, obj); UNLINK_ITEM(*objlist, node, next, prev); LINK_ITEM_FIRST(*objlist, node, next, prev); return TRUE; }
void rootwin_deinit(WRootWin *rw) { WScreen *scr, *next; FOR_ALL_SCREENS_W_NEXT(scr, next){ if(REGION_MANAGER(scr)==(WRegion*)rw) destroy_obj((Obj*)scr); } UNLINK_ITEM(*(WRegion**)&ioncore_g.rootwins, (WRegion*)rw, p_next, p_prev); XSelectInput(ioncore_g.dpy, WROOTWIN_ROOT(rw), 0); XFreeGC(ioncore_g.dpy, rw->xor_gc); window_deinit((WWindow*)rw); }
void gr_unregister_engine(const char *engine) { GrEngine *eng; for(eng=engines; eng!=NULL; eng=eng->next){ if(strcmp(eng->name, engine)==0) break; } if(eng==NULL) return; UNLINK_ITEM(engines, eng, next, prev); free(eng->name); if(current_engine==eng) current_engine=NULL; free(eng); }
void de_free_font(DEFont *font) { if(--font->refcount!=0) return; #ifdef HAVE_X11_XFT if(font->font!=NULL) XftFontClose(ioncore_g.dpy, font->font); #else /* HAVE_X11_XFT */ if(font->fontset!=NULL) XFreeFontSet(ioncore_g.dpy, font->fontset); if(font->fontstruct!=NULL) XFreeFont(ioncore_g.dpy, font->fontstruct); #endif /* HAVE_X11_XFT */ if(font->pattern!=NULL) free(font->pattern); UNLINK_ITEM(fonts, font, next, prev); free(font); }
void grouppholder_do_unlink(WGroupPHolder *ph) { WGroup *group=ph->group; watch_reset(&(ph->stack_above_watch)); if(ph->recreate_pholder!=NULL){ if(ph->next!=NULL){ ph->next->recreate_pholder=ph->recreate_pholder; }else{ /* It might be in use in attach chain! So defer. */ mainloop_defer_destroy((Obj*)ph->recreate_pholder); } ph->recreate_pholder=NULL; } if(group!=NULL){ UNLINK_ITEM(group->phs, ph, next, prev); }else if(ph->prev!=NULL){ WGroupPHolder *next=ph->next; ph->prev->next=next; if(next==NULL){ next=get_head(ph); assert(next->prev==ph); } next->prev=ph->prev; }else{ /* ph should not be on a list, if prev pointer is NULL (whereas * next alone can be NULL in our semi-doubly-linked lists). */ assert(ph->next==NULL); } ph->group=NULL; ph->next=NULL; ph->prev=NULL; }
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); } } }
static void enforce_level_sanity(WStacking **np) { WStacking *st; /* Make sure that the levels of stuff stacked 'above' match * the level of the thing stacked above. */ for(st=*np; st!=NULL; st=st->next) check_above_lvl(st); /* And now make sure things are ordered by levels. */ st=*np; while(st->next!=NULL){ if(st->next->level < st->level){ WStacking *st2=st->next; UNLINK_ITEM(*np, st2, next, prev); LINK_ITEM_BEFORE(*np, st2, st, next, prev); if(st2->prev!=NULL) st=st2->prev; }else{ st=st->next; } } }
void unregister_menudata(WMenuData *menudata) { if(menudata->menudata_prev!=NULL){ UNLINK_ITEM(menudata_list, menudata, menudata_next, menudata_prev); } }
static void collect_last(WStacking **dst, WStacking **src, WStacking *st) { UNLINK_ITEM(*src, st, next, prev); LINK_ITEM_LAST(*dst, st, next, prev); }
static void free_node(ObjList **objlist, ObjList *node) { watch_reset(&(node->watch)); UNLINK_ITEM(*objlist, node, next, prev); free(node); }