X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fconf.c;h=258f563078132cc7f3d794dc3c2efd6bca3db7b9;hb=29aae1975d46f66b97a2b873f1875eded8c6fbc3;hp=207c1c1c471ed610a77cc491ecf51f892e968fe1;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/conf.c b/ioncore/conf.c index 207c1c1..258f563 100644 --- a/ioncore/conf.c +++ b/ioncore/conf.c @@ -1,12 +1,9 @@ /* * ion/ioncore/conf.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2008. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -36,6 +33,12 @@ StringIntMap frame_idxs[]={ END_STRINGINTMAP }; +static bool get_winprop_fn_set=FALSE; +static ExtlFn get_winprop_fn; + +static bool get_layout_fn_set=FALSE; +static ExtlFn get_layout_fn; + /*EXTL_DOC * Set ioncore basic settings. The table \var{tab} may contain the @@ -55,7 +58,8 @@ StringIntMap frame_idxs[]={ * 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 - * ''last'', ''next'' (for after current), ''next-act'' + * \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.\\ @@ -66,12 +70,16 @@ StringIntMap frame_idxs[]={ * \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 ''udlr'' (up-down, then left-right), - * ''lrud'' (left-right, then up-down) or ''random''. \\ - * \var{default_ws_params} & (table) Default workspace layout; the - * attach/creation parameters for a \type{WGroup}. \\ + * One of \codestr{udlr} (up-down, then left-right), + * \codestr{lrud} (left-right, then up-down), or + * \codestr{random}. \\ + * \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. \\ * \end{tabularx} * * When a keyboard resize function is called, and at most \var{kbresize_t_max} @@ -88,12 +96,15 @@ void ioncore_set(ExtlTab tab) int dd, rd; char *wst, *tmp; ExtlTab t; + 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_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)); if(extl_table_gets_s(tab, "frame_default_index", &tmp)){ ioncore_g.frame_default_index=stringintmap_value(frame_idxs, @@ -101,6 +112,14 @@ void ioncore_set(ExtlTab tab) 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); @@ -108,6 +127,22 @@ void ioncore_set(ExtlTab tab) 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; + } + } @@ -125,22 +160,59 @@ ExtlTab ioncore_get() extl_table_sets_b(tab, "switchto", ioncore_g.switchto_new); extl_table_sets_i(tab, "dblclick_delay", ioncore_g.dblclick_delay); extl_table_sets_b(tab, "screen_notify", ioncore_g.screen_notify); + extl_table_sets_b(tab, "framed_transients", ioncore_g.framed_transients); + extl_table_sets_b(tab, "unsqueeze", ioncore_g.unsqueeze_enabled); + extl_table_sets_b(tab, "autoraise", ioncore_g.autoraise); + extl_table_sets_s(tab, "frame_default_index", stringintmap_key(frame_idxs, ioncore_g.frame_default_index, NULL)); + extl_table_sets_s(tab, "mousefocus", (ioncore_g.no_mousefocus + ? "disabled" + : "sloppy")); + ioncore_get_moveres_accel(tab); ioncore_groupws_get(tab); return tab; } - + + +ExtlTab ioncore_get_winprop(WClientWin *cwin) +{ + ExtlTab tab=extl_table_none(); + + if(get_winprop_fn_set){ + extl_protect(NULL); + extl_call(get_winprop_fn, "o", "t", cwin, &tab); + extl_unprotect(NULL); + } + + return tab; +} + + +ExtlTab ioncore_get_layout(const char *layout) +{ + ExtlTab tab=extl_table_none(); + + if(get_layout_fn_set){ + extl_protect(NULL); + extl_call(get_layout_fn, "s", "t", layout, &tab); + extl_unprotect(NULL); + } + + return tab; +} + /*EXTL_DOC - * Get important directories (userdir, sessiondir, searchpath). + * Get important directories (the fields \var{userdir}, + * \var{sessiondir}, \var{searchpath} in the returned table). */ EXTL_SAFE EXTL_EXPORT @@ -155,7 +227,8 @@ ExtlTab ioncore_get_paths(ExtlTab tab) /*EXTL_DOC - * Set important directories (sessiondir, searchpath). + * Set important directories (the fields \var{sessiondir}, \var{searchpath} + * of \var{tab}). */ EXTL_EXPORT bool ioncore_set_paths(ExtlTab tab) @@ -232,7 +305,7 @@ bool ioncore_read_main_config(const char *cfgfile) ret=extl_read_config(cfgfile, ".", TRUE); - unset+=(ioncore_rootwin_bindmap->nbindings==0); + unset+=(ioncore_screen_bindmap->nbindings==0); unset+=(ioncore_mplex_bindmap->nbindings==0); unset+=(ioncore_frame_bindmap->nbindings==0);