static WRegion *dock_do_attach(WDock *dock, WRegionAttachData *data) { WFitParams fp; dock_get_tile_size(dock, &(fp.g)); fp.g.x=0; fp.g.y=0; fp.mode=REGION_FIT_WHATEVER|REGION_FIT_BOUNDS; return region_attach_helper((WRegion*)dock, (WWindow*)dock, &fp, (WRegionDoAttachFn*)dock_do_attach_final, NULL, data); }
bool tiling_init(WTiling *ws, WWindow *parent, const WFitParams *fp, WRegionSimpleCreateFn *create_frame_fn, bool ci) { ws->split_tree=NULL; ws->create_frame_fn=(create_frame_fn ? create_frame_fn : create_frame_tiling); ws->stdispnode=NULL; ws->managed_list=NULL; ws->batchop=FALSE; ws->dummywin=XCreateWindow(ioncore_g.dpy, parent->win, fp->g.x, fp->g.y, 1, 1, 0, CopyFromParent, InputOnly, CopyFromParent, 0, NULL); if(ws->dummywin==None) return FALSE; region_init(&(ws->reg), parent, fp); ws->reg.flags|=(REGION_GRAB_ON_PARENT| REGION_PLEASE_WARP); if(ci){ WRegionAttachData data; WRegion *res; data.type=REGION_ATTACH_NEW; data.u.n.fn=(WRegionCreateFn*)ws->create_frame_fn; data.u.n.param=NULL; res=region_attach_helper((WRegion*)ws, parent, fp, (WRegionDoAttachFn*)tiling_do_attach_initial, NULL, &data); if(res==NULL){ XDestroyWindow(ioncore_g.dpy, ws->dummywin); return FALSE; } } XSelectInput(ioncore_g.dpy, ws->dummywin, FocusChangeMask|KeyPressMask|KeyReleaseMask| ButtonPressMask|ButtonReleaseMask); XSaveContext(ioncore_g.dpy, ws->dummywin, ioncore_g.win_context, (XPointer)ws); region_register(&(ws->reg)); region_add_bindmap((WRegion*)ws, mod_tiling_tiling_bindmap); return TRUE; }