1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
/*
* ion/mod_floatws/main.c
*
* Copyright (c) Tuomo Valkonen 1999-2005.
*
* 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.
*/
#include <libextl/readconfig.h>
#include <libextl/extl.h>
#include <libmainloop/hooks.h>
#include <ioncore/bindmaps.h>
#include <ioncore/framep.h>
#include <ioncore/frame-pointer.h>
#include <ioncore/reginfo.h>
#include <ioncore/clientwin.h>
#include "floatws.h"
#include "floatframe.h"
#include "exports.h"
/*{{{ Module information */
#include "../version.h"
char mod_floatws_ion_api_version[]=ION_API_VERSION;
/*}}}*/
/*{{{ Bindmaps */
WBindmap *mod_floatws_floatws_bindmap=NULL;
WBindmap *mod_floatws_floatframe_bindmap=NULL;
static StringIntMap frame_areas[]={
{"border", FRAME_AREA_BORDER},
{"tab", FRAME_AREA_TAB},
{"empty_tab", FRAME_AREA_TAB},
{"client", FRAME_AREA_CLIENT},
END_STRINGINTMAP
};
/*}}}*/
/*{{{ Init & deinit */
void mod_floatws_deinit()
{
hook_remove(clientwin_do_manage_alt,
(WHookDummy*)mod_floatws_clientwin_do_manage);
if(mod_floatws_floatws_bindmap!=NULL){
ioncore_free_bindmap("WFloatWS", mod_floatws_floatws_bindmap);
mod_floatws_floatws_bindmap=NULL;
}
if(mod_floatws_floatframe_bindmap!=NULL){
ioncore_free_bindmap("WFloatFrame", mod_floatws_floatframe_bindmap);
mod_floatws_floatframe_bindmap=NULL;
}
ioncore_unregister_regclass(&CLASSDESCR(WFloatWS));
ioncore_unregister_regclass(&CLASSDESCR(WFloatFrame));
mod_floatws_unregister_exports();
}
bool mod_floatws_init()
{
mod_floatws_floatws_bindmap=ioncore_alloc_bindmap("WFloatWS", NULL);
mod_floatws_floatframe_bindmap=ioncore_alloc_bindmap("WFloatFrame",
frame_areas);
if(mod_floatws_floatws_bindmap==NULL ||
mod_floatws_floatframe_bindmap==NULL){
goto err;
}
if(!mod_floatws_register_exports())
goto err;
if(!ioncore_register_regclass(&CLASSDESCR(WFloatWS),
(WRegionLoadCreateFn*) floatws_load) ||
!ioncore_register_regclass(&CLASSDESCR(WFloatFrame),
(WRegionLoadCreateFn*) floatframe_load)){
goto err;
}
extl_read_config("cfg_floatws", NULL, TRUE);
hook_add(clientwin_do_manage_alt,
(WHookDummy*)mod_floatws_clientwin_do_manage);
return TRUE;
err:
mod_floatws_deinit();
return FALSE;
}
/*}}}*/
|