2 * ion/mod_tiling/main.c
4 * Copyright (c) Tuomo Valkonen 1999-2007.
6 * See the included file LICENSE for details.
11 #include <ioncore/common.h>
12 #include <ioncore/reginfo.h>
13 #include <libextl/readconfig.h>
14 #include <ioncore/framep.h>
15 #include <ioncore/bindmaps.h>
16 #include <ioncore/bindmaps.h>
20 #include "placement.h"
24 /*{{{ Module information */
27 #include "../version.h"
29 char mod_tiling_ion_api_version[]=ION_API_VERSION;
35 /*{{{ Bindmaps and configuration variables */
38 WBindmap *mod_tiling_tiling_bindmap=NULL;
40 int mod_tiling_raise_delay=CF_RAISE_DELAY;
46 /*{{{ Configuration */
50 * Set parameters. Currently only \var{raise_delay} (in milliseconds)
54 void mod_tiling_set(ExtlTab tab)
57 if(extl_table_gets_i(tab, "raise_delay", &d)){
59 mod_tiling_raise_delay=d;
65 * Get parameters. For details see \fnref{mod_tiling.set}.
69 ExtlTab mod_tiling_get()
71 ExtlTab tab=extl_create_table();
73 extl_table_sets_i(tab, "raise_delay", mod_tiling_raise_delay);
84 /*{{{ Module init & deinit */
87 void mod_tiling_deinit()
89 mod_tiling_unregister_exports();
90 ioncore_unregister_regclass(&CLASSDESCR(WTiling));
92 if(mod_tiling_tiling_bindmap!=NULL){
93 ioncore_free_bindmap("WTiling", mod_tiling_tiling_bindmap);
94 mod_tiling_tiling_bindmap=NULL;
97 if(tiling_placement_alt!=NULL){
98 destroy_obj((Obj*)tiling_placement_alt);
99 tiling_placement_alt=NULL;
104 static bool register_regions()
106 if(!ioncore_register_regclass(&CLASSDESCR(WTiling),
107 (WRegionLoadCreateFn*)tiling_load)){
115 #define INIT_HOOK_(NM) \
116 NM=mainloop_register_hook(#NM, create_hook()); \
117 if(NM==NULL) return FALSE;
120 static bool init_hooks()
122 INIT_HOOK_(tiling_placement_alt);
127 bool mod_tiling_init()
132 mod_tiling_tiling_bindmap=ioncore_alloc_bindmap("WTiling", NULL);
134 if(mod_tiling_tiling_bindmap==NULL)
137 if(!mod_tiling_register_exports())
140 if(!register_regions())
143 extl_read_config("cfg_tiling", NULL, TRUE);