1 /*
2  * Copyright (C) 2003-2021 Kim Woelders
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies of the Software, its documentation and marketing & publicity
13  * materials, and acknowledgment shall be given in the documentation, materials
14  * and software packages that this Software was used.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 #ifndef _EMODULE_H_
24 #define _EMODULE_H_
25 
26 #include "econfig.h"
27 #include "ipc.h"
28 
29 typedef struct {
30    const char         *name;
31    const char         *nick;
32    void                (*Signal)(int sig, void *prm);
33    IpcItemList         ipc;
34    CfgItemList         cfg;
35 } EModule;
36 
37 #define MOD_ITEMS(x) { E_ARRAY_SIZE(x), x }
38 
39 typedef enum {
40    ESIGNAL_NONE,
41    ESIGNAL_INIT,
42    ESIGNAL_CONFIGURE,
43    ESIGNAL_START,
44    ESIGNAL_EXIT,
45    ESIGNAL_AREA_CONFIGURED,
46    ESIGNAL_AREA_SWITCH_START,
47    ESIGNAL_AREA_SWITCH_DONE,
48    ESIGNAL_DESK_ADDED,
49    ESIGNAL_DESK_REMOVED,
50    ESIGNAL_DESK_SWITCH_START,
51    ESIGNAL_DESK_SWITCH_DONE,
52    ESIGNAL_DESK_RESIZE,
53    ESIGNAL_BACKGROUND_CHANGE,
54    ESIGNAL_ANIMATION_SUSPEND,
55    ESIGNAL_ANIMATION_RESUME,
56    ESIGNAL_EWIN_CREATE,
57    ESIGNAL_EWIN_DESTROY,
58    ESIGNAL_EWIN_UNMAP,
59    ESIGNAL_EWIN_ICONIFY,
60    ESIGNAL_EWIN_DEICONIFY,
61    ESIGNAL_EWIN_CHANGE_ICON,
62    ESIGNAL_EWIN_CHANGE,
63    ESIGNAL_EWIN_DAMAGE,
64    ESIGNAL_THEME_TRANS_CHANGE,
65 } esignal_e;
66 
67 #if 0				/* Maybe later */
68 void                EModuleRegister(EModule * em);
69 #endif
70 
71 extern const EModule *const p_modules[];
72 extern int          n_modules;
73 
74 #define MODULE_LIST_GET(lst, num) \
75     do { lst = p_modules; num = n_modules; } while (0)
76 #define MODULE_LIST_FREE(lst)
77 
78 int                 ModuleConfigSet(const char *name, const char *item,
79 				    const char *params);
80 int                 ModuleConfigShow(const char *name, const char *item);
81 
82 void                ModulesSignal(int signal, void *prm);
83 void                ModulesConfigShow(void);
84 
85 #if 0
86 void                ModulesGetCfgItems(const CfgItem *** pi, int *ni);
87 #endif
88 void                ModulesGetIpcItems(const IpcItem *** pi, int *ni);
89 
90 #endif /* _EMODULE_H_ */
91