static bool dock_init(WDock *dock, WWindow *parent, const WFitParams *fp) { WFitParams fp2=*fp; dock->pos=dock_param_pos.dflt; dock->grow=dock_param_grow.dflt; dock->is_auto=dock_param_is_auto.dflt; dock->brush=NULL; dock->dockapps=NULL; dock->min_w=1; dock->min_h=1; dock->max_w=1; dock->max_h=1; dock->arrange_called=FALSE; dock->save=TRUE; if(!window_init((WWindow*)dock, parent, &fp2, "WDock")) return FALSE; region_add_bindmap((WRegion*)dock, dock_bindmap); window_select_input(&(dock->win), IONCORE_EVENTMASK_CWINMGR); dock_brush_get(dock); LINK_ITEM(docks, dock, dock_next, dock_prev); return TRUE; }
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; }
bool groupws_init(WGroupWS *ws, WWindow *parent, const WFitParams *fp) { if(!group_init(&(ws->grp), parent, fp, "Notion GroupWS")) return FALSE; ws->initial_outputs=extl_create_table(); ((WRegion*)ws)->flags|=REGION_GRAB_ON_PARENT; region_add_bindmap((WRegion*)ws, ioncore_groupws_bindmap); return TRUE; }
bool menu_init(WMenu *menu, WWindow *par, const WFitParams *fp, const WMenuCreateParams *params) { Window win; int i; menu->entries=preprocess_menu(params->tab, &(menu->n_entries)); if(menu->entries==NULL){ warn(TR("Empty menu.")); return FALSE; } menu->tab=extl_ref_table(params->tab); menu->handler=extl_ref_fn(params->handler); menu->pmenu_mode=params->pmenu_mode; menu->big_mode=params->big_mode; /*menu->cycle_bindmap=NULL;*/ menu->last_fp=*fp; if(params->pmenu_mode){ menu->selected_entry=-1; }else{ menu->selected_entry=params->initial-1; if(menu->selected_entry<0) menu->selected_entry=0; if(params->initial > menu->n_entries) menu->selected_entry=0; } menu->max_entry_w=0; menu->entry_h=0; menu->brush=NULL; menu->entry_brush=NULL; menu->entry_spacing=0; menu->vis_entries=menu->n_entries; menu->first_entry=0; menu->submenu=NULL; menu->typeahead=NULL; menu->gm_kcb=0; menu->gm_state=0; if(!window_init((WWindow*)menu, par, fp)) goto fail; win=menu->win.win; if(!menu_init_gr(menu, region_rootwin_of((WRegion*)par), win)) goto fail2; init_attr(); menu_firstfit(menu, params->submenu_mode, &(params->refg)); window_select_input(&(menu->win), IONCORE_EVENTMASK_NORMAL); region_add_bindmap((WRegion*)menu, mod_menu_menu_bindmap); region_register((WRegion*)menu); return TRUE; fail2: window_deinit((WWindow*)menu); fail: extl_unref_table(menu->tab); extl_unref_fn(menu->handler); deinit_entries(menu); return FALSE; }
static bool rootwin_init(WRootWin *rootwin, int xscr) { Display *dpy=ioncore_g.dpy; WFitParams fp; Window root; WScreen *scr; /* Try to select input on the root window */ root=RootWindow(dpy, xscr); redirect_error=FALSE; XSetErrorHandler(my_redirect_error_handler); XSelectInput(dpy, root, IONCORE_EVENTMASK_ROOT); XSync(dpy, 0); XSetErrorHandler(my_error_handler); if(redirect_error){ warn(TR("Unable to redirect root window events for screen %d." "Maybe another window manager is running?"), xscr); return FALSE; } rootwin->xscr=xscr; rootwin->default_cmap=DefaultColormap(dpy, xscr); rootwin->tmpwins=NULL; rootwin->tmpnwins=0; rootwin->dummy_win=None; rootwin->xor_gc=None; fp.mode=REGION_FIT_EXACT; fp.g.x=0; fp.g.y=0; fp.g.w=DisplayWidth(dpy, xscr); fp.g.h=DisplayHeight(dpy, xscr); if(!window_do_init((WWindow*)rootwin, NULL, &fp, root, "WRootWin")){ return FALSE; } ((WWindow*)rootwin)->event_mask=IONCORE_EVENTMASK_ROOT; ((WRegion*)rootwin)->flags|=REGION_BINDINGS_ARE_GRABBED|REGION_PLEASE_WARP; ((WRegion*)rootwin)->rootwin=rootwin; REGION_MARK_MAPPED(rootwin); scan_initial_windows(rootwin); create_wm_windows(rootwin); preinit_gr(rootwin); netwm_init_rootwin(rootwin); region_add_bindmap((WRegion*)rootwin, ioncore_screen_bindmap); scr=create_screen(rootwin, &fp, xscr); if(scr==NULL){ return FALSE; } region_set_manager((WRegion*)scr, (WRegion*)rootwin); region_map((WRegion*)scr); LINK_ITEM(*(WRegion**)&ioncore_g.rootwins, (WRegion*)rootwin, p_next, p_prev); ioncore_screens_updated(rootwin); xwindow_set_cursor(root, IONCORE_CURSOR_DEFAULT); return TRUE; }