Slightly better logging for font loading
[notion/jeffpc.git] / mod_tiling / main.c
blob8be2dc5063ed9757ab70d16beddd3ee6aec05da2
1 /*
2 * ion/mod_tiling/main.c
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #include <libtu/map.h>
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>
18 #include "main.h"
19 #include "tiling.h"
20 #include "placement.h"
21 #include "exports.h"
24 /*{{{ Module information */
27 #include "../version.h"
29 char mod_tiling_ion_api_version[]=NOTION_API_VERSION;
32 /*}}}*/
35 /*{{{ Bindmaps and configuration variables */
38 WBindmap *mod_tiling_tiling_bindmap=NULL;
40 int mod_tiling_raise_delay=CF_RAISE_DELAY;
43 /*}}}*/
46 /*{{{ Configuration */
49 /*EXTL_DOC
50 * Set parameters. Currently only \var{raise_delay} (in milliseconds)
51 * is supported.
53 EXTL_EXPORT
54 void mod_tiling_set(ExtlTab tab)
56 int d;
57 if(extl_table_gets_i(tab, "raise_delay", &d)){
58 if(d>=0)
59 mod_tiling_raise_delay=d;
64 /*EXTL_DOC
65 * Get parameters. For details see \fnref{mod_tiling.set}.
67 EXTL_SAFE
68 EXTL_EXPORT
69 ExtlTab mod_tiling_get()
71 ExtlTab tab=extl_create_table();
73 extl_table_sets_i(tab, "raise_delay", mod_tiling_raise_delay);
75 return tab;
80 /*}}}*/
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)){
108 return FALSE;
111 return TRUE;
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);
123 return TRUE;
127 bool mod_tiling_init()
129 if(!init_hooks())
130 goto err;
132 mod_tiling_tiling_bindmap=ioncore_alloc_bindmap("WTiling", NULL);
134 if(mod_tiling_tiling_bindmap==NULL)
135 goto err;
137 if(!mod_tiling_register_exports())
138 goto err;
140 if(!register_regions())
141 goto err;
143 extl_read_config("cfg_tiling", NULL, TRUE);
145 return TRUE;
147 err:
148 mod_tiling_deinit();
149 return FALSE;
153 /*}}}*/