2 * ion/mod_tiling/main.c
4 * Copyright (c) Tuomo Valkonen 1999-2007.
6 * Ion is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
12 #include <libtu/map.h>
14 #include <ioncore/common.h>
15 #include <ioncore/reginfo.h>
16 #include <libextl/readconfig.h>
17 #include <ioncore/framep.h>
18 #include <ioncore/bindmaps.h>
19 #include <ioncore/bindmaps.h>
23 #include "placement.h"
27 /*{{{ Module information */
30 #include "../version.h"
32 char mod_tiling_ion_api_version[]=ION_API_VERSION;
38 /*{{{ Bindmaps and configuration variables */
41 WBindmap *mod_tiling_tiling_bindmap=NULL;
43 int mod_tiling_raise_delay=CF_RAISE_DELAY;
49 /*{{{ Configuration */
53 * Set parameters. Currently only \var{raise_delay} (in milliseconds)
57 void mod_tiling_set(ExtlTab tab)
60 if(extl_table_gets_i(tab, "raise_delay", &d)){
62 mod_tiling_raise_delay=d;
68 * Get parameters. For details see \fnref{mod_tiling.set}.
72 ExtlTab mod_tiling_get()
74 ExtlTab tab=extl_create_table();
76 extl_table_sets_i(tab, "raise_delay", mod_tiling_raise_delay);
87 /*{{{ Module init & deinit */
90 void mod_tiling_deinit()
92 mod_tiling_unregister_exports();
93 ioncore_unregister_regclass(&CLASSDESCR(WTiling));
95 if(mod_tiling_tiling_bindmap!=NULL){
96 ioncore_free_bindmap("WTiling", mod_tiling_tiling_bindmap);
97 mod_tiling_tiling_bindmap=NULL;
100 if(tiling_placement_alt!=NULL){
101 destroy_obj((Obj*)tiling_placement_alt);
102 tiling_placement_alt=NULL;
107 static bool register_regions()
109 if(!ioncore_register_regclass(&CLASSDESCR(WTiling),
110 (WRegionLoadCreateFn*)tiling_load)){
118 #define INIT_HOOK_(NM) \
119 NM=mainloop_register_hook(#NM, create_hook()); \
120 if(NM==NULL) return FALSE;
123 static bool init_hooks()
125 INIT_HOOK_(tiling_placement_alt);
130 bool mod_tiling_init()
135 mod_tiling_tiling_bindmap=ioncore_alloc_bindmap("WTiling", NULL);
137 if(mod_tiling_tiling_bindmap==NULL)
140 if(!mod_tiling_register_exports())
143 if(!register_regions())
146 extl_read_config("cfg_tiling", NULL, TRUE);