Exemple #1
0
static void dock_do_set(WDock *dock, ExtlTab conftab, bool resize)
{
    char *s;
    bool b;
    bool growset=FALSE;
    bool posset=FALSE;
    bool save=FALSE;

    if(extl_table_gets_s(conftab, dock_param_name.key, &s)){
        if(!region_set_name((WRegion*)dock, s)){
            warn_obj(modname, "Can't set name to \"%s\"", s);
        }
        free(s);
    }

    if(extl_table_gets_b(conftab, "save", &save))
        dock->save=save;

    if(dock_param_extl_table_set(&dock_param_pos, conftab, &dock->pos))
        posset=TRUE;

    if(dock_param_extl_table_set(&dock_param_grow, conftab, &dock->grow))
        growset=TRUE;

    if(extl_table_gets_b(conftab, dock_param_is_auto.key, &b))
        dock->is_auto=b;

    if(resize && (growset || posset)){
        WMPlex *par=OBJ_CAST(REGION_PARENT(dock), WMPlex);
        WRegion *stdisp=NULL;
        WMPlexSTDispInfo din;

        if(par!=NULL){
            mplex_get_stdisp(par, &stdisp, &din);
            din.fullsize=FALSE; /* not supported. */
            if(stdisp==(WRegion*)dock){
                if(posset)
                    mplexpos(dock->pos, &din.pos);
                if(growset){
                    /* Update min/max first */
                    dock_managed_rqgeom_(dock, NULL, 0, NULL, NULL, TRUE);
                }
                mplex_set_stdisp(par, (WRegion*)dock, &din);
            }else if((WRegion*)par==REGION_MANAGER(dock)){
                WSizePolicy szplcy;
                mplexszplcy(dock->pos, &szplcy);
                mplex_set_szplcy(par, (WRegion*)dock, szplcy);
            }
        }

        dock_resize(dock);
    }
}
Exemple #2
0
/*EXTL_DOC
 * Set module configuration. The following are supported:
 *
 * \begin{tabularx}{\linewidth}{lX}
 *  \tabhead{Field & Description}
 *  \var{autoshowcompl} & (boolean) Is auto-show-completions enabled?
 *      (default: true). \\
 *  \var{autoshowcompl_delay} & (integer) auto-show-completions delay
 *      in milliseconds (default: 250). \\
 *  \var{caseicompl} & (boolean) Turn some completions case-insensitive
 *      (default: false). \\
 *  \var{substrcompl} & (boolean) Complete on sub-strings in some cases
 *      (default: ftrue). \\
 * \end{tabularx}
 */
EXTL_EXPORT
void mod_query_set(ExtlTab tab)
{
    ModQueryConfig *c=&mod_query_config;

    extl_table_gets_b(tab, "autoshowcompl", &c->autoshowcompl);
    extl_table_gets_b(tab, "caseicompl", &c->caseicompl);
    extl_table_gets_b(tab, "substrcompl", &c->substrcompl);
    
    if(extl_table_gets_i(tab, "autoshowcompl_delay",
                         &c->autoshowcompl_delay)){
        c->autoshowcompl_delay=maxof(c->autoshowcompl_delay, 0);
    }
}
Exemple #3
0
void de_get_transparent_background(uint *mode, ExtlTab tab)
{
    bool b;
    
    if(extl_table_gets_b(tab, "transparent_background", &b))
        *mode=b;
}
Exemple #4
0
bool extl_table_is_bool_set(ExtlTab tab, const char *entry)
{
    bool b;

    if(extl_table_gets_b(tab, entry, &b))
        return b;
    return FALSE;
}
Exemple #5
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;
}
Exemple #6
0
static void netwm_active_window_rq(WClientWin *cwin, 
                                   const XClientMessageEvent *ev)
{
    long source=ev->data.l[0];
    /**
     * By default we ignore non-pager activity requests, as they're known to 
     * steal focus from newly-created windows :(
     */
    bool ignore=source!=SOURCE_PAGER;
    
    extl_table_gets_b(cwin->proptab, "ignore_net_active_window", &ignore);
    
    if(!ignore)
        region_goto((WRegion*)cwin);
    else
        region_set_activity((WRegion*)cwin, SETPARAM_SET);
}
Exemple #7
0
static bool try_fullscreen(WClientWin *cwin, WScreen *dflt,
                           const WManageParams *param)
{
    WScreen *fs_scr=NULL;
    bool fs=FALSE, tmp;

    /* Check fullscreen mode. (This is intentionally not done
     * for transients and windows with target winprops.)
     */
    if(extl_table_gets_b(cwin->proptab, "fullscreen", &tmp)){
        if(!tmp)
            return FALSE;
        fs_scr=dflt;
    }

    if(fs_scr==NULL && netwm_check_initial_fullscreen(cwin))
        fs_scr=dflt;

    if(fs_scr==NULL)
        fs_scr=clientwin_fullscreen_chkrq(cwin, param->geom.w, param->geom.h);

    if(fs_scr!=NULL){
        WPHolder *fs_ph=region_prepare_manage((WRegion*)fs_scr, cwin, param,
                                              MANAGE_PRIORITY_NOREDIR);

        if(fs_ph!=NULL){
            int swf=(param->switchto ? PHOLDER_ATTACH_SWITCHTO : 0);

            cwin->flags|=CLIENTWIN_FS_RQ;

            fs=pholder_attach(fs_ph, swf, (WRegion*)cwin);

            if(!fs)
                cwin->flags&=~CLIENTWIN_FS_RQ;

            destroy_obj((Obj*)fs_ph);
        }
    }

    return fs;
}
Exemple #8
0
/*EXTL_DOC
 * Set ioncore basic settings. The table \var{tab} may contain the
 * following fields.
 * 
 * \begin{tabularx}{\linewidth}{lX}
 *  \tabhead{Field & Description}
 *  \var{opaque_resize} & (boolean) Controls whether interactive move and
 *                        resize operations simply draw a rubberband during
 *                        the operation (false) or immediately affect the 
 *                        object in question at every step (true). \\
 *  \var{warp} &          (boolean) Should focusing operations move the 
 *                        pointer to the object to be focused? \\
 *  \var{warp_margin} &   (integer) Border offset in pixels to apply
 *                        to the cursor when warping. \\
 *  \var{warp_factor} &   (double[2]) X & Y factor to offset the cursor.
 *                        between 0 and 1, where 0.5 is the center. \\
 *  \var{switchto} &      (boolean) Should a managing \type{WMPlex} switch
 *                        to a newly mapped client window? \\
 *  \var{screen_notify} & (boolean) Should notification tooltips be displayed
 *                        for hidden workspaces with activity? \\
 *  \var{frame_default_index} & (string) Specifies where to add new regions
 *                        on the mutually exclusive list of a frame. One of
 *                        \codestr{last}, \codestr{next}, (for after current),
 *                        or \codestr{next-act}
 *                        (for after current and anything with activity right
 *                        after it). \\
 *  \var{dblclick_delay} & (integer) Delay between clicks of a double click.\\
 *  \var{kbresize_delay} & (integer) Delay in milliseconds for ending keyboard
 *                         resize mode after inactivity. \\
 *  \var{kbresize_t_max} & (integer) Controls keyboard resize acceleration. 
 *                         See description below for details. \\
 *  \var{kbresize_t_min} & (integer) See below. \\
 *  \var{kbresize_step} & (floating point) See below. \\
 *  \var{kbresize_maxacc} & (floating point) See below. \\
 *  \var{edge_resistance} & (integer) Resize edge resistance in pixels. \\
 *  \var{framed_transients} & (boolean) Put transients in nested frames. \\
 *  \var{float_placement_method} & (string) How to place floating frames.
 *                          One of \codestr{udlr} (up-down, then left-right), 
 *                          \codestr{lrud} (left-right, then up-down), or 
 *                          \codestr{random}. \\
 *  \var{float_placement_padding} & (integer) Pixels between frames when 
 *                          \var{float_placement_method} is \codestr{udlr} or
 *                          \codestr{lrud}. \\
 *  \var{mousefocus} & (string) Mouse focus mode: 
 *                     \codestr{disabled} or \codestr{sloppy}. \\
 *  \var{unsqueeze} & (boolean) Auto-unsqueeze transients/menus/queries/etc. \\
 *  \var{autoraise} & (boolean) Autoraise regions in groups on goto. \\
 *  \var{usertime_diff_current} & (integer) Controls switchto timeout. \\
 *  \var{usertime_diff_new} & (integer) Controls switchto timeout. \\
 *  \var{autosave_layout} & (boolean) Automatically save layout on restart and exit. \\
 *  \var{window_stacking_request} & (string) How to respond to window-stacking
 *                          requests. \codestr{ignore} to do nothing,
 *                          \codestr{activate} to set the activity flag on a
 *                          window requesting to be stacked Above. \\
 *  \var{focuslist_insert_delay} & (integer) Time (in ms) that a window must
 *                          stay focused in order to be added to the focus list.
 *                          If this value is set <=0, this logic is disabled:
 *                          the focus list is updated immediately \\
 *  \var{activity_notification_on_all_screens} & (boolean) If enabled, activity
 *                          notifiers are displayed on ALL the screens, not just
 *                          the screen that contains the window producing the
 *                          notification. This is only relevant on multi-head
 *                          setups. By default this is disabled \\
 *  \var{workspace_indicator_timeout} & (integer) If enabled, a workspace
 *                          indicator comes up at the bottom-left of the screen
 *                          when a new workspace is selected. This indicator
 *                          stays active for only as long as indicated by this
 *                          variable (in ms). Timeout values <=0 disable the
 *                          indicator altogether. This is disabled by default \\
 * \end{tabularx}
 * 
 * When a keyboard resize function is called, and at most \var{kbresize_t_max} 
 * milliseconds has passed from a previous call, acceleration factor is reset 
 * to 1.0. Otherwise, if at least \var{kbresize_t_min} milliseconds have 
 * passed from the from previous acceleration update or reset the squere root
 * of the acceleration factor is incremented by \var{kbresize_step}. The 
 * maximum acceleration factor (pixels/call modulo size hints) is given by 
 * \var{kbresize_maxacc}. The default values are (200, 50, 30, 100). 
 */
EXTL_EXPORT
void ioncore_set(ExtlTab tab)
{
    int dd;
    char *tmp;
    ExtlFn fn;
    
    extl_table_gets_b(tab, "opaque_resize", &(ioncore_g.opaque_resize));
    extl_table_gets_b(tab, "warp", &(ioncore_g.warp_enabled));
    extl_table_gets_i(tab, "warp_margin", &(ioncore_g.warp_margin));
    extl_table_gets_d(tab, "warp_factor_x", &(ioncore_g.warp_factor[0]));
    extl_table_gets_d(tab, "warp_factor_y", &(ioncore_g.warp_factor[1]));
    extl_table_gets_b(tab, "switchto", &(ioncore_g.switchto_new));
    extl_table_gets_b(tab, "screen_notify", &(ioncore_g.screen_notify));
    extl_table_gets_b(tab, "framed_transients", &(ioncore_g.framed_transients));
    extl_table_gets_b(tab, "unsqueeze", &(ioncore_g.unsqueeze_enabled));
    extl_table_gets_b(tab, "autoraise", &(ioncore_g.autoraise));
    extl_table_gets_b(tab, "autosave_layout", &(ioncore_g.autosave_layout));

    if(extl_table_gets_s(tab, "window_stacking_request", &tmp)){
        ioncore_g.window_stacking_request=stringintmap_value(win_stackrq, 
                                                         tmp,
                                                         ioncore_g.window_stacking_request);
        free(tmp);
    }
    
    if(extl_table_gets_s(tab, "frame_default_index", &tmp)){
        ioncore_g.frame_default_index=stringintmap_value(frame_idxs, 
                                                         tmp,
                                                         ioncore_g.frame_default_index);
        free(tmp);
    }

    if(extl_table_gets_s(tab, "mousefocus", &tmp)){
        if(strcmp(tmp, "disabled")==0)
            ioncore_g.no_mousefocus=TRUE;
        else if(strcmp(tmp, "sloppy")==0)
            ioncore_g.no_mousefocus=FALSE;
        free(tmp);
    }
    
    if(extl_table_gets_i(tab, "dblclick_delay", &dd))
        ioncore_g.dblclick_delay=MAXOF(0, dd);

    if(extl_table_gets_i(tab, "usertime_diff_current", &dd))
        ioncore_g.usertime_diff_current=MAXOF(0, dd);

    if(extl_table_gets_i(tab, "usertime_diff_new", &dd))
        ioncore_g.usertime_diff_new=MAXOF(0, dd);

    if(extl_table_gets_i(tab, "focuslist_insert_delay", &dd))
        ioncore_g.focuslist_insert_delay=MAXOF(0, dd);

    if(extl_table_gets_i(tab, "workspace_indicator_timeout", &dd))
        ioncore_g.workspace_indicator_timeout=MAXOF(0, dd);

    extl_table_gets_b(tab, "activity_notification_on_all_screens",
                      &(ioncore_g.activity_notification_on_all_screens));

    ioncore_set_moveres_accel(tab);
    
    ioncore_groupws_set(tab);
    
    /* Internal -- therefore undocumented above */
    if(extl_table_gets_f(tab, "_get_winprop", &fn)){
        if(get_winprop_fn_set)
            extl_unref_fn(get_winprop_fn);
        get_winprop_fn=fn;
        get_winprop_fn_set=TRUE;
    }
    
    if(extl_table_gets_f(tab, "_get_layout", &fn)){
        if(get_layout_fn_set)
            extl_unref_fn(get_layout_fn);
        get_layout_fn=fn;
        get_layout_fn_set=TRUE;
    }
    
}