Beispiel #1
0
static bool dock_do_attach_final(WDock *dock, WRegion *reg, void *UNUSED(unused))
{
    WDockApp *dockapp, *before_dockapp;
    WRectangle geom;
    bool draw_border=TRUE;
    int pos=INT_MAX;

    /* Create and initialise a new WDockApp struct */
    dockapp=ALLOC(WDockApp);

    if(dockapp==NULL)
        return FALSE;

    if(OBJ_IS(reg, WClientWin)){
        ExtlTab proptab=((WClientWin*)reg)->proptab;
        extl_table_gets_b(proptab, CLIENTWIN_WINPROP_BORDER, &draw_border);
        extl_table_gets_i(proptab, CLIENTWIN_WINPROP_POSITION, &pos);
    }

    dockapp->reg=reg;
    dockapp->draw_border=draw_border;
    dockapp->pos=pos;
    dockapp->tile=FALSE;

    /* Insert the dockapp at the correct relative position */
    before_dockapp=dock->dockapps;
    for(before_dockapp=dock->dockapps;
        before_dockapp!=NULL && dockapp->pos>=before_dockapp->pos;
        before_dockapp=before_dockapp->next){
    }

    if(before_dockapp!=NULL){
        LINK_ITEM_BEFORE(dock->dockapps, before_dockapp, dockapp, next, prev);
    }else{
        LINK_ITEM(dock->dockapps, dockapp, next, prev);
    }

    region_set_manager(reg, (WRegion*)dock);

    geom=REGION_GEOM(reg);
    dock_managed_rqgeom_(dock, reg,
                         REGION_RQGEOM_WEAK_X|REGION_RQGEOM_WEAK_Y,
                         &geom, NULL, FALSE);

    region_map(reg);

    return TRUE;
}
Beispiel #2
0
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);
        }
    }
}
Beispiel #3
0
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;
        }
    }
}
Beispiel #4
0
void link_thing_before(WThing *before, WThing *thing)
{
	WThing *parent=before->t_parent;
	LINK_ITEM_BEFORE(parent->t_children, before, thing, t_next, t_prev);
	thing->t_parent=parent;
}