this is VERY evil - VERY evil. but its the sanest solution other than code

generation tools (scripts etc.) for generating wads of repetitive code
easily, and keeping the codec higher level logic per ipc call in 1 place.


SVN revision: 15026
This commit is contained in:
Carsten Haitzler 2005-05-31 03:01:53 +00:00
parent 99fd1febf4
commit d59acfc65f
14 changed files with 974 additions and 826 deletions

View File

@ -1,2 +1,2 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = lib bin modules
SUBDIRS = bin modules lib

View File

@ -11,6 +11,8 @@ bin_PROGRAMS = enlightenment enlightenment_remote enlightenment_eapp
ENLIGHTENMENTHEADERS = \
e.h \
e_includes.h \
e_ipc_handlers.h \
e_ipc_handlers_list.h \
e_user.h \
e_manager.h \
e_path.h \

View File

@ -66,6 +66,12 @@ typedef struct _E_Rect E_Rect;
#define E_NEW_BIG(s, n) malloc(n * sizeof(s))
#define E_FREE(p) { if (p) {free(p); p = NULL;} }
#define E_REMOTE_OPTIONS 1
#define E_REMOTE_OUT 2
#define E_WM_IN 3
#define E_REMOTE_IN 4
#define E_ENUM 5
#define E_TYPEDEFS 1
#include "e_includes.h"
#undef E_TYPEDEFS

View File

@ -100,7 +100,7 @@ e_font_available_list(void)
}
void
e_font_available_list_free(Evas_List * available)
e_font_available_list_free(Evas_List *available)
{
E_Font_Available *efa;
@ -319,7 +319,7 @@ e_font_default_string_get(const char *text_class, int *size_ret)
}
static Evas_List *
_e_font_font_dir_available_get(Evas_List * available_fonts, const char *font_dir)
_e_font_font_dir_available_get(Evas_List *available_fonts, const char *font_dir)
{
char buf[4096];
FILE *f;

View File

@ -13,39 +13,39 @@ typedef struct _E_Font_Fallback E_Font_Available;
struct _E_Font_Default
{
char * text_class;
char * font;
int size;
char *text_class;
char *font;
int size;
};
struct _E_Font_Fallback
{
char * name;
char *name;
};
struct _E_Font_Available
{
char * name;
char *name;
};
EAPI int e_font_init(void);
EAPI int e_font_shutdown(void);
EAPI void e_font_apply(void);
EAPI Evas_List * e_font_available_list(void);
EAPI void e_font_available_list_free(Evas_List * available);
EAPI Evas_List *e_font_available_list(void);
EAPI void e_font_available_list_free(Evas_List *available);
/* global font fallbacks */
EAPI void e_font_fallback_clear(void);
EAPI void e_font_fallback_append(const char * font);
EAPI void e_font_fallback_prepend(const char * font);
EAPI void e_font_fallback_remove(const char * font);
EAPI Evas_List * e_font_fallback_list(void);
EAPI void e_font_fallback_append(const char *font);
EAPI void e_font_fallback_prepend(const char *font);
EAPI void e_font_fallback_remove(const char *font);
EAPI Evas_List *e_font_fallback_list(void);
/* setup edje text classes */
EAPI void e_font_default_set(const char * text_class, const char * font, int size);
EAPI E_Font_Default * e_font_default_get(const char * text_class);
EAPI void e_font_default_remove(const char * text_class);
EAPI Evas_List * e_font_default_list(void);
EAPI void e_font_default_set(const char *text_class, const char *font, int size);
EAPI E_Font_Default *e_font_default_get(const char *text_class);
EAPI void e_font_default_remove(const char *text_class);
EAPI Evas_List *e_font_default_list(void);
EAPI const char *e_font_default_string_get(const char *text_class, int *size_ret);
#endif

View File

@ -7,27 +7,10 @@ static int _e_ipc_cb_client_data(void *data, int type, void *event);
static void _e_ipc_reply_double_send(Ecore_Ipc_Client *client, double val, int opcode);
static void _e_ipc_reply_int_send(Ecore_Ipc_Client *client, int val, int opcode);
static void _e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode);
static char *_e_ipc_str_list_get(Evas_List *strs, int *bytes);
static char *_e_ipc_simple_str_dec(char *data, int bytes);
static char **_e_ipc_multi_str_dec(char *data, int bytes, int str_count);
static int _e_ipc_double_dec(char *data, int bytes, double *dest);
static int _e_ipc_int_dec(char *data, int bytes, int *dest);
/* encode functions, Should these be global? */
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_module_list_enc);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_available_list_enc);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_enc);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_default_list_enc);
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_mouse_binding_list_enc);
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_mouse_binding_enc);
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_mouse_binding_dec);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_enc);
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc);
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec);
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_path_list_enc);
/* local subsystem globals */
static Ecore_Ipc_Server *_e_ipc_server = NULL;
@ -96,150 +79,81 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return 1;
switch (e->minor)
{
case E_IPC_OP_MODULE_LOAD:
if (e->data)
{
char *name;
name = _e_ipc_simple_str_dec(e->data, e->size);
if (!e_module_find(name))
{
e_module_new(name);
}
free(name);
e_config_save_queue();
}
break;
case E_IPC_OP_MODULE_UNLOAD:
if (e->data)
{
char *name;
E_Module *m;
name = _e_ipc_simple_str_dec(e->data, e->size);
if ((m = e_module_find(name)))
{
if (e_module_enabled_get(m))
e_module_disable(m);
e_object_del(E_OBJECT(m));
}
free(name);
e_config_save_queue();
}
break;
case E_IPC_OP_MODULE_ENABLE:
{
char *name;
E_Module *m;
name = _e_ipc_simple_str_dec(e->data, e->size);
if ((m = e_module_find(name)))
{
if (!e_module_enabled_get(m))
e_module_enable(m);
}
free(name);
e_config_save_queue();
}
break;
case E_IPC_OP_MODULE_DISABLE:
{
char *name;
E_Module *m;
name = _e_ipc_simple_str_dec(e->data, e->size);
if ((m = e_module_find(name)))
{
if (e_module_enabled_get(m))
e_module_disable(m);
}
free(name);
e_config_save_queue();
}
break;
case E_IPC_OP_MODULE_LIST:
{
/* encode module list (str,8-bit) */
Evas_List *modules;
char * data;
int bytes;
modules = e_module_list();
data = _e_ipc_module_list_enc(modules, &bytes);
/* send reply data */
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_MODULE_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
break;
#define TYPE E_WM_IN
#include "e_ipc_handlers.h"
#undef TYPE
/* here to steal from to port over to the new e_ipc_handlers.h */
#if 0
case E_IPC_OP_BG_SET:
{
char *file;
Evas_List *managers, *l;
file = _e_ipc_simple_str_dec(e->data, e->size);
char *file = NULL;
E_FREE(e_config->desktop_default_background);
e_config->desktop_default_background = file;
managers = e_manager_list();
for (l = managers; l; l = l->next)
if (e_ipc_codec_str_dec(e->data, e->size, &file))
{
Evas_List *ll;
E_Manager *man;
man = l->data;
for (ll = man->containers; ll; ll = ll->next)
Evas_List *managers, *l;
E_FREE(e_config->desktop_default_background);
e_config->desktop_default_background = file;
managers = e_manager_list();
for (l = managers; l; l = l->next)
{
E_Container *con;
E_Zone *zone;
Evas_List *ll;
E_Manager *man;
con = ll->data;
zone = e_zone_current_get(con);
e_zone_bg_reconfigure(zone);
man = l->data;
for (ll = man->containers; ll; ll = ll->next)
{
E_Container *con;
E_Zone *zone;
con = ll->data;
zone = e_zone_current_get(con);
e_zone_bg_reconfigure(zone);
}
}
e_config_save_queue();
}
e_config_save_queue();
}
break;
case E_IPC_OP_BG_GET:
{
char *bg;
void *data;
int bytes;
bg = e_config->desktop_default_background;
if (!bg) bg = "";
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_BG_GET_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
bg, strlen(bg) + 1);
data = e_ipc_codec_str_enc(e_config->desktop_default_background, &bytes);
if (data)
{
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_BG_GET_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
}
break;
case E_IPC_OP_FONT_AVAILABLE_LIST:
{
/* encode font available list (str) */
Evas_List *fonts_available;
E_Font_Available *fa;
Evas_List *dat = NULL, *l, *fa_list;
void *data;
int bytes;
char *data;
fonts_available = e_font_available_list();
data = _e_ipc_font_available_list_enc(fonts_available, &bytes);
fa_list = e_font_available_list();
for (l = fa_list; l; l = l->next)
{
fa = l->data;
dat = evas_list_append(dat, fa->name);
}
data = e_ipc_codec_str_list_enc(dat, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_FONT_AVAILABLE_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
e_font_available_list_free(fonts_available);
free(data);
evas_list_free(dat);
e_font_available_list_free(fa_list);
}
break;
case E_IPC_OP_FONT_APPLY:
@ -256,118 +170,139 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
break;
case E_IPC_OP_FONT_FALLBACK_APPEND:
{
char * font_name;
char *font_name = NULL;
font_name = _e_ipc_simple_str_dec(e->data, e->size);
e_font_fallback_append(font_name);
free(font_name);
e_config_save_queue();
if (e_ipc_codec_str_dec(e->data, e->size, &font_name))
{
e_font_fallback_append(font_name);
free(font_name);
e_config_save_queue();
}
}
break;
case E_IPC_OP_FONT_FALLBACK_PREPEND:
{
char * font_name;
font_name = _e_ipc_simple_str_dec(e->data, e->size);
e_font_fallback_prepend(font_name);
free(font_name);
e_config_save_queue();
char *font_name = NULL;
if (e_ipc_codec_str_dec(e->data, e->size, &font_name))
{
e_font_fallback_prepend(font_name);
free(font_name);
e_config_save_queue();
}
}
break;
case E_IPC_OP_FONT_FALLBACK_LIST:
{
/* encode font fallback list (str) */
Evas_List *fallbacks;
E_Font_Fallback *ff;
Evas_List *dat = NULL, *l;
void *data;
int bytes;
char *data;
fallbacks = e_font_fallback_list();
data = _e_ipc_font_fallback_list_enc(fallbacks, &bytes);
for (l = e_font_available_list(); l; l = l->next)
{
ff = l->data;
dat = evas_list_append(dat, ff->name);
}
data = e_ipc_codec_str_list_enc(dat, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_FONT_FALLBACK_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
evas_list_free(dat);
}
break;
case E_IPC_OP_FONT_FALLBACK_REMOVE:
{
char * font_name;
font_name = _e_ipc_simple_str_dec(e->data, e->size);
e_font_fallback_remove(font_name);
free(font_name);
e_config_save_queue();
char *font_name = NULL;
if (e_ipc_codec_str_dec(e->data, e->size, &font_name))
{
e_font_fallback_remove(font_name);
free(font_name);
e_config_save_queue();
}
}
break;
case E_IPC_OP_FONT_DEFAULT_SET:
{
char ** argv;
int argc;
E_Ipc_2Str_Int *v = NULL;
argc = 3;
argv = _e_ipc_multi_str_dec(e->data, e->size, argc);
e_font_default_set(argv[0], argv[1], atoi(argv[2]));
free(argv);
e_config_save_queue();
if (e_ipc_codec_2str_int_dec(e->data, e->size, &v))
{
e_font_default_set(v->str1, v->str2, v->val);
free(v->str1);
free(v->str2);
free(v);
e_config_save_queue();
}
}
break;
case E_IPC_OP_FONT_DEFAULT_GET:
{
/* encode font default struct (str,str,32-bits)(E_Font_Default) */
E_Font_Default *efd;
char *data, *text_class;
char *tclass = NULL;
void *data;
int bytes;
text_class = _e_ipc_simple_str_dec(e->data, e->size);
efd = e_font_default_get(text_class);
free(text_class);
data = _e_ipc_font_default_enc(efd, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_FONT_DEFAULT_GET_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
if (e_ipc_codec_str_dec(e->data, e->size, &tclass))
{
efd = e_font_default_get(tclass);
data = e_ipc_codec_2str_int_enc(efd->text_class, efd->font, efd->size, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_FONT_DEFAULT_GET_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
free(tclass);
}
}
break;
case E_IPC_OP_FONT_DEFAULT_REMOVE:
{
char * text_class;
char *tclass = NULL;
text_class = _e_ipc_simple_str_dec(e->data, e->size);
e_font_default_remove(text_class);
free(text_class);
e_config_save_queue();
if (e_ipc_codec_str_dec(e->data, e->size, &tclass))
{
e_font_default_remove(tclass);
free(tclass);
e_config_save_queue();
}
}
break;
case E_IPC_OP_FONT_DEFAULT_LIST:
{
/* encode font default struct list (str,str,32-bits)(E_Font_Default) */
Evas_List *defaults;
E_Ipc_2Str_Int *v;
E_Font_Default *efd;
Evas_List *dat = NULL, *l;
void *data;
int bytes;
char *data;
defaults = e_font_default_list();
data = _e_ipc_font_default_list_enc(defaults, &bytes);
for (l = e_font_default_list(); l; l = l->next)
{
efd = l->data;
v = calloc(1, sizeof(E_Ipc_2Str_Int));
v->str1 = efd->text_class;
v->str2 = efd->font;
v->val = efd->size;
dat = evas_list_append(dat, v);
}
data = e_ipc_codec_2str_int_list_enc(dat, &bytes);
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_FONT_DEFAULT_LIST_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
while (dat)
{
v = dat->data;
free(v);
dat = evas_list_remove_list(dat, dat);
}
free(data);
}
break;
case E_IPC_OP_RESTART:
@ -1171,7 +1106,7 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
e_config_save_queue();
break;
}
#endif
default:
break;
}
@ -1234,269 +1169,3 @@ _e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode)
free(data);
}
}
/**
* Encode a list of strings into a flattened data block that looks like
* <str>0<str>0... (ie string chars - nul byte in between until the end)
*/
static char *
_e_ipc_str_list_get(Evas_List *strs, int *bytes)
{
char *data = NULL;
int pos = 0;
Evas_List *l;
*bytes = 0;
for (l = strs; l; l = l->next)
{
char *p;
p = l->data;
*bytes += strlen(p) + 1;
data = realloc(data, *bytes);
memcpy(data + pos, p, strlen(p));
pos = *bytes;
data[pos - 1] = 0;
}
return data;
}
/**
* Decode a simple string that was passed by an IPC client
*
* The returned string must be freed
*/
static char *
_e_ipc_simple_str_dec(char *data, int bytes)
{
char *str;
str = malloc(bytes + 1);
str[bytes] = 0;
memcpy(str, data, bytes);
return str;
}
/**
* Decode a list of strings and return an array, you need to pass
* the string count that you are expecting back.
*
* Strings are encoded <str>0<str>0...
*
* free up the array that you get back
*/
static char **
_e_ipc_multi_str_dec(char *data, int bytes, int str_count)
{
char **str_array;
int i;
/* Make sure our data is packed for us <str>0<str>0 */
if (data[bytes - 1] != 0)
return NULL;
str_array = malloc(sizeof(char *) * str_count);
for (i = 0; i < str_count; i++)
{
str_array[i] = data;
data += strlen(str_array[i]) + 1;
}
return str_array;
}
/* FIXME: just use eet for this - saves a lot of hassle */
/* list/struct encoding functions */
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_module_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Module);
ECORE_IPC_CNTS(name);
ECORE_IPC_CNT8();
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1;
ECORE_IPC_SLEN(l1, name);
ECORE_IPC_PUTS(name, l1);
ECORE_IPC_PUT8(enabled);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_available_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Font_Available);
ECORE_IPC_CNTS(name);
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1;
ECORE_IPC_SLEN(l1, name);
ECORE_IPC_PUTS(name, l1);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Font_Fallback);
ECORE_IPC_CNTS(name);
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1;
ECORE_IPC_SLEN(l1, name);
ECORE_IPC_PUTS(name, l1);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_default_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Font_Default);
ECORE_IPC_CNTS(text_class);
ECORE_IPC_CNTS(font);
ECORE_IPC_CNT32();
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1, l2;
ECORE_IPC_SLEN(l1, text_class);
ECORE_IPC_SLEN(l2, font);
ECORE_IPC_PUTS(text_class, l1);
ECORE_IPC_PUTS(font, l2);
ECORE_IPC_PUT32(size);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc)
{
int l1, l2;
ECORE_IPC_ENC_STRUCT_HEAD(E_Font_Default,
ECORE_IPC_SLEN(l1, text_class) +
ECORE_IPC_SLEN(l2, font) +
4);
ECORE_IPC_PUTS(text_class, l1);
ECORE_IPC_PUTS(font, l2);
ECORE_IPC_PUT32(size);
ECORE_IPC_ENC_STRUCT_FOOT();
}
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_mouse_binding_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Config_Binding_Mouse);
ECORE_IPC_CNT32();
ECORE_IPC_CNT32();
ECORE_IPC_CNTS(action);
ECORE_IPC_CNTS(params);
ECORE_IPC_CNT8();
ECORE_IPC_CNT8();
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1, l2;
ECORE_IPC_PUT32(context);
ECORE_IPC_PUT32(modifiers);
ECORE_IPC_SLEN(l1, action);
ECORE_IPC_SLEN(l2, params);
ECORE_IPC_PUTS(action, l1);
ECORE_IPC_PUTS(params, l2);
ECORE_IPC_PUT8(button);
ECORE_IPC_PUT8(any_mod);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_mouse_binding_enc)
{
int l1, l2;
ECORE_IPC_ENC_STRUCT_HEAD(E_Config_Binding_Mouse,
4 + 4 +
ECORE_IPC_SLEN(l1, action) +
ECORE_IPC_SLEN(l2, params) +
1 + 1);
ECORE_IPC_PUT32(context);
ECORE_IPC_PUT32(modifiers);
ECORE_IPC_PUTS(action, l1);
ECORE_IPC_PUTS(params, l2);
ECORE_IPC_PUT8(button);
ECORE_IPC_PUT8(any_mod);
ECORE_IPC_ENC_STRUCT_FOOT();
}
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_mouse_binding_dec)
{
ECORE_IPC_DEC_STRUCT_HEAD_MIN(E_Config_Binding_Mouse,
4 + 4 +
1 +
1 +
1 + 1);
ECORE_IPC_CHEKS();
ECORE_IPC_GET32(context);
ECORE_IPC_GET32(modifiers);
ECORE_IPC_GETS(action);
ECORE_IPC_GETS(params);
ECORE_IPC_GET8(button);
ECORE_IPC_GET8(any_mod);
ECORE_IPC_DEC_STRUCT_FOOT();
}
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Config_Binding_Key);
ECORE_IPC_CNT32();
ECORE_IPC_CNT32();
ECORE_IPC_CNTS(key);
ECORE_IPC_CNTS(action);
ECORE_IPC_CNTS(params);
ECORE_IPC_CNT8();
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1, l2, l3;
ECORE_IPC_PUT32(context);
ECORE_IPC_PUT32(modifiers);
ECORE_IPC_SLEN(l1, key);
ECORE_IPC_SLEN(l2, action);
ECORE_IPC_SLEN(l3, params);
ECORE_IPC_PUTS(key, l1);
ECORE_IPC_PUTS(action, l2);
ECORE_IPC_PUTS(params, l3);
ECORE_IPC_PUT8(any_mod);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc)
{
int l1, l2, l3;
ECORE_IPC_ENC_STRUCT_HEAD(E_Config_Binding_Key,
4 + 4 +
ECORE_IPC_SLEN(l1, key) +
ECORE_IPC_SLEN(l2, action) +
ECORE_IPC_SLEN(l3, params) +
1);
ECORE_IPC_PUT32(context);
ECORE_IPC_PUT32(modifiers);
ECORE_IPC_PUTS(key, l1);
ECORE_IPC_PUTS(action, l2);
ECORE_IPC_PUTS(params, l3);
ECORE_IPC_PUT8(any_mod);
ECORE_IPC_ENC_STRUCT_FOOT();
}
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec)
{
ECORE_IPC_DEC_STRUCT_HEAD_MIN(E_Config_Binding_Key,
4 + 4 +
1 +
1 +
1 +
1);
ECORE_IPC_CHEKS();
ECORE_IPC_GET32(context);
ECORE_IPC_GET32(modifiers);
ECORE_IPC_GETS(key);
ECORE_IPC_GETS(action);
ECORE_IPC_GETS(params);
ECORE_IPC_GET8(any_mod);
ECORE_IPC_DEC_STRUCT_FOOT();
}
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_path_list_enc)
{
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Path_Dir);
ECORE_IPC_CNTS(dir);
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
int l1;
ECORE_IPC_SLEN(l1, dir);
ECORE_IPC_PUTS(dir, l1);
ECORE_IPC_ENC_EVAS_LIST_FOOT();
}

View File

@ -3,6 +3,8 @@
*/
#ifdef E_TYPEDEFS
#include "e_ipc_handlers_list.h"
typedef enum _E_Ipc_Domain
{
E_IPC_DOMAIN_NONE,
@ -13,151 +15,7 @@ typedef enum _E_Ipc_Domain
E_IPC_DOMAIN_LAST
} E_Ipc_Domain;
typedef enum _E_Ipc_Op
{
E_IPC_OP_NONE,
E_IPC_OP_MODULE_LOAD,
E_IPC_OP_MODULE_UNLOAD,
E_IPC_OP_MODULE_ENABLE,
E_IPC_OP_MODULE_DISABLE,
E_IPC_OP_MODULE_LIST,
E_IPC_OP_MODULE_LIST_REPLY,
E_IPC_OP_BG_SET,
E_IPC_OP_BG_GET,
E_IPC_OP_BG_GET_REPLY,
E_IPC_OP_FONT_AVAILABLE_LIST,
E_IPC_OP_FONT_AVAILABLE_LIST_REPLY,
E_IPC_OP_FONT_APPLY,
E_IPC_OP_FONT_FALLBACK_CLEAR,
E_IPC_OP_FONT_FALLBACK_APPEND,
E_IPC_OP_FONT_FALLBACK_PREPEND,
E_IPC_OP_FONT_FALLBACK_LIST,
E_IPC_OP_FONT_FALLBACK_LIST_REPLY,
E_IPC_OP_FONT_FALLBACK_REMOVE,
E_IPC_OP_FONT_DEFAULT_SET,
E_IPC_OP_FONT_DEFAULT_GET,
E_IPC_OP_FONT_DEFAULT_GET_REPLY,
E_IPC_OP_FONT_DEFAULT_REMOVE,
E_IPC_OP_FONT_DEFAULT_LIST,
E_IPC_OP_FONT_DEFAULT_LIST_REPLY,
E_IPC_OP_RESTART,
E_IPC_OP_SHUTDOWN,
E_IPC_OP_LANG_LIST,
E_IPC_OP_LANG_LIST_REPLY,
E_IPC_OP_LANG_SET,
E_IPC_OP_LANG_GET,
E_IPC_OP_LANG_GET_REPLY,
E_IPC_OP_BINDING_MOUSE_LIST,
E_IPC_OP_BINDING_MOUSE_LIST_REPLY,
E_IPC_OP_BINDING_MOUSE_ADD,
E_IPC_OP_BINDING_MOUSE_DEL,
E_IPC_OP_BINDING_KEY_LIST,
E_IPC_OP_BINDING_KEY_LIST_REPLY,
E_IPC_OP_BINDING_KEY_ADD,
E_IPC_OP_BINDING_KEY_DEL,
E_IPC_OP_MENUS_SCROLL_SPEED_SET,
E_IPC_OP_MENUS_SCROLL_SPEED_GET,
E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY,
E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET,
E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET,
E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET_REPLY,
E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_SET,
E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET,
E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET_REPLY,
E_IPC_OP_BORDER_SHADE_ANIMATE_SET,
E_IPC_OP_BORDER_SHADE_ANIMATE_GET,
E_IPC_OP_BORDER_SHADE_ANIMATE_GET_REPLY,
E_IPC_OP_BORDER_SHADE_TRANSITION_SET,
E_IPC_OP_BORDER_SHADE_TRANSITION_GET,
E_IPC_OP_BORDER_SHADE_TRANSITION_GET_REPLY,
E_IPC_OP_BORDER_SHADE_SPEED_SET,
E_IPC_OP_BORDER_SHADE_SPEED_GET,
E_IPC_OP_BORDER_SHADE_SPEED_GET_REPLY,
E_IPC_OP_FRAMERATE_SET,
E_IPC_OP_FRAMERATE_GET,
E_IPC_OP_FRAMERATE_GET_REPLY,
E_IPC_OP_IMAGE_CACHE_SET,
E_IPC_OP_IMAGE_CACHE_GET,
E_IPC_OP_IMAGE_CACHE_GET_REPLY,
E_IPC_OP_FONT_CACHE_SET,
E_IPC_OP_FONT_CACHE_GET,
E_IPC_OP_FONT_CACHE_GET_REPLY,
E_IPC_OP_USE_EDGE_FLIP_SET,
E_IPC_OP_USE_EDGE_FLIP_GET,
E_IPC_OP_USE_EDGE_FLIP_GET_REPLY,
E_IPC_OP_EDGE_FLIP_TIMEOUT_SET,
E_IPC_OP_EDGE_FLIP_TIMEOUT_GET,
E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY,
/* Module PATH IPC */
E_IPC_OP_MODULE_DIRS_LIST,
E_IPC_OP_MODULE_DIRS_LIST_REPLY,
E_IPC_OP_MODULE_DIRS_APPEND,
E_IPC_OP_MODULE_DIRS_PREPEND,
E_IPC_OP_MODULE_DIRS_REMOVE,
/* Theme PATH IPC */
E_IPC_OP_THEME_DIRS_LIST,
E_IPC_OP_THEME_DIRS_LIST_REPLY,
E_IPC_OP_THEME_DIRS_APPEND,
E_IPC_OP_THEME_DIRS_PREPEND,
E_IPC_OP_THEME_DIRS_REMOVE,
/* Font Path IPC */
E_IPC_OP_FONT_DIRS_LIST,
E_IPC_OP_FONT_DIRS_LIST_REPLY,
E_IPC_OP_FONT_DIRS_APPEND,
E_IPC_OP_FONT_DIRS_PREPEND,
E_IPC_OP_FONT_DIRS_REMOVE,
/* data Path IPC */
E_IPC_OP_DATA_DIRS_LIST,
E_IPC_OP_DATA_DIRS_LIST_REPLY,
E_IPC_OP_DATA_DIRS_APPEND,
E_IPC_OP_DATA_DIRS_PREPEND,
E_IPC_OP_DATA_DIRS_REMOVE,
/* Images Path IPC */
E_IPC_OP_IMAGE_DIRS_LIST,
E_IPC_OP_IMAGE_DIRS_LIST_REPLY,
E_IPC_OP_IMAGE_DIRS_APPEND,
E_IPC_OP_IMAGE_DIRS_PREPEND,
E_IPC_OP_IMAGE_DIRS_REMOVE,
/* Init Path IPC */
E_IPC_OP_INIT_DIRS_LIST,
E_IPC_OP_INIT_DIRS_LIST_REPLY,
E_IPC_OP_INIT_DIRS_APPEND,
E_IPC_OP_INIT_DIRS_PREPEND,
E_IPC_OP_INIT_DIRS_REMOVE,
/* Icon Path IPC */
E_IPC_OP_ICON_DIRS_LIST,
E_IPC_OP_ICON_DIRS_LIST_REPLY,
E_IPC_OP_ICON_DIRS_APPEND,
E_IPC_OP_ICON_DIRS_PREPEND,
E_IPC_OP_ICON_DIRS_REMOVE,
/* Background Path IPC */
E_IPC_OP_BG_DIRS_LIST,
E_IPC_OP_BG_DIRS_LIST_REPLY,
E_IPC_OP_BG_DIRS_APPEND,
E_IPC_OP_BG_DIRS_PREPEND,
E_IPC_OP_BG_DIRS_REMOVE,
E_IPC_OP_DESKS_SET,
E_IPC_OP_DESKS_GET,
E_IPC_OP_DESKS_GET_REPLY,
E_IPC_OP_FOCUS_POLICY_SET,
E_IPC_OP_FOCUS_POLICY_GET,
E_IPC_OP_FOCUS_POLICY_GET_REPLY,
E_IPC_OP_LAST
/* FIXME: add ipc: */
/* get list of actions */
} E_Ipc_Op;
typedef int E_Ipc_Op;
#else
#ifndef E_IPC_H

View File

@ -10,6 +10,10 @@ static Eet_Data_Descriptor *_e_ipc_double_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_str_int_list_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2str_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2str_int_list_edd = NULL;
/* externally accessible functions */
int
@ -28,8 +32,23 @@ e_ipc_codec_init(void)
_e_ipc_str_edd = E_CONFIG_DD_NEW("str", E_Ipc_Str);
E_CONFIG_VAL(_e_ipc_str_edd, E_Ipc_Str, str, STR);
_e_ipc_str_list_edd = E_CONFIG_DD_NEW("str_list", E_Ipc_Str_List);
E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_Str_List, list, _e_ipc_str_list_edd);
_e_ipc_str_list_edd = E_CONFIG_DD_NEW("str_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_str_list_edd, E_Ipc_List, list, _e_ipc_str_edd);
_e_ipc_str_int_edd = E_CONFIG_DD_NEW("str_int", E_Ipc_Str_Int);
E_CONFIG_VAL(_e_ipc_str_int_edd, E_Ipc_Str_Int, str, STR);
E_CONFIG_VAL(_e_ipc_str_int_edd, E_Ipc_Str_Int, val, INT);
_e_ipc_str_int_list_edd = E_CONFIG_DD_NEW("str_int_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_str_int_list_edd, E_Ipc_List, list, _e_ipc_str_int_edd);
_e_ipc_2str_int_edd = E_CONFIG_DD_NEW("2str_int", E_Ipc_2Str_Int);
E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, str1, STR);
E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, str2, STR);
E_CONFIG_VAL(_e_ipc_2str_int_edd, E_Ipc_2Str_Int, val, INT);
_e_ipc_2str_int_list_edd = E_CONFIG_DD_NEW("2str_int_list", E_Ipc_List);
E_CONFIG_LIST(_e_ipc_2str_int_list_edd, E_Ipc_List, list, _e_ipc_2str_int_edd);
return 1;
}
@ -41,6 +60,10 @@ e_ipc_codec_shutdown(void)
E_CONFIG_DD_FREE(_e_ipc_2int_edd);
E_CONFIG_DD_FREE(_e_ipc_str_edd);
E_CONFIG_DD_FREE(_e_ipc_str_list_edd);
E_CONFIG_DD_FREE(_e_ipc_str_int_edd);
E_CONFIG_DD_FREE(_e_ipc_str_int_list_edd);
E_CONFIG_DD_FREE(_e_ipc_2str_int_edd);
E_CONFIG_DD_FREE(_e_ipc_2str_int_list_edd);
}
int
@ -136,7 +159,7 @@ e_ipc_codec_str_enc(char *str, int *size_ret)
int
e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest)
{
E_Ipc_Str_List *dat;
E_Ipc_List *dat;
Evas_List *list = NULL, *l;
if (!data) return 0;
@ -162,7 +185,7 @@ e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest)
void *
e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret)
{
E_Ipc_Str_List dat;
E_Ipc_List dat;
Evas_List *l;
void *data;
@ -184,5 +207,93 @@ e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret)
return data;
}
int
e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest)
{
E_Ipc_Str_Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
void *
e_ipc_codec_str_int_enc(char *str, int val, int *size_ret)
{
E_Ipc_Str_Int dat;
dat.str = str;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_str_int_edd, &dat, size_ret);
}
int
e_ipc_codec_str_int_list_dec(char *data, int bytes, Evas_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_str_int_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
void *
e_ipc_codec_str_int_list_enc(Evas_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_str_int_list_edd, &dat, size_ret);
}
int
e_ipc_codec_2str_int_dec(char *data, int bytes, E_Ipc_2Str_Int **dest)
{
E_Ipc_2Str_Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2str_int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat;
return 1;
}
void *
e_ipc_codec_2str_int_enc(char *str1, char *str2, int val, int *size_ret)
{
E_Ipc_2Str_Int dat;
dat.str1 = str1;
dat.str2 = str2;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_2str_int_edd, &dat, size_ret);
}
int
e_ipc_codec_2str_int_list_dec(char *data, int bytes, Evas_List **dest)
{
E_Ipc_List *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2str_int_list_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->list;
free(dat);
return 1;
}
void *
e_ipc_codec_2str_int_list_enc(Evas_List *list, int *size_ret)
{
E_Ipc_List dat;
dat.list = list;
return eet_data_descriptor_encode(_e_ipc_2str_int_list_edd, &dat, size_ret);
}
/* local subsystem globals */

View File

@ -3,11 +3,15 @@
*/
#ifdef E_TYPEDEFS
typedef struct _E_Ipc_Int E_Ipc_Int;
typedef struct _E_Ipc_Double E_Ipc_Double;
typedef struct _E_Ipc_2Int E_Ipc_2Int;
typedef struct _E_Ipc_Str E_Ipc_Str;
typedef struct _E_Ipc_Str_List E_Ipc_Str_List;
typedef struct _E_Ipc_Int E_Ipc_Int;
typedef struct _E_Ipc_Double E_Ipc_Double;
typedef struct _E_Ipc_2Int E_Ipc_2Int;
typedef struct _E_Ipc_List E_Ipc_List;
typedef struct _E_Ipc_Str E_Ipc_Str;
typedef struct _E_Ipc_Str_Int E_Ipc_Str_Int;
typedef struct _E_Ipc_Str_Int_List E_Ipc_Str_Int_List;
typedef struct _E_Ipc_2Str_Int E_Ipc_2Str_Int;
typedef struct _E_Ipc_2Str_Int_List E_Ipc_2Str_Int_List;
#else
#ifndef E_IPC_CODEC_H
@ -28,16 +32,29 @@ struct _E_Ipc_2Int
int val1, val2;
};
struct _E_Ipc_List
{
Evas_List *list;
};
struct _E_Ipc_Str
{
char *str;
};
struct _E_Ipc_Str_List
struct _E_Ipc_Str_Int
{
Evas_List *list;
char *str;
int val;
};
struct _E_Ipc_2Str_Int
{
char *str1, *str2;
int val;
};
EAPI int e_ipc_codec_init(void);
EAPI void e_ipc_codec_shutdown(void);
@ -51,6 +68,14 @@ EAPI int e_ipc_codec_str_dec(char *data, int bytes, char **dest);
EAPI void *e_ipc_codec_str_enc(char *str, int *size_ret);
EAPI int e_ipc_codec_str_list_dec(char *data, int bytes, Evas_List **dest);
EAPI void *e_ipc_codec_str_list_enc(Evas_List *list, int *size_ret);
EAPI int e_ipc_codec_str_int_dec(char *data, int bytes, E_Ipc_Str_Int **dest);
EAPI void *e_ipc_codec_str_int_enc(char *str, int val, int *size_ret);
EAPI int e_ipc_codec_str_int_list_dec(char *data, int bytes, Evas_List **dest);
EAPI void *e_ipc_codec_str_int_list_enc(Evas_List *list, int *size_ret);
EAPI int e_ipc_codec_2str_int_dec(char *data, int bytes, E_Ipc_2Str_Int **dest);
EAPI void *e_ipc_codec_2str_int_enc(char *str1, char *str2, int val, int *size_ret);
EAPI int e_ipc_codec_2str_int_list_dec(char *data, int bytes, Evas_List **dest);
EAPI void *e_ipc_codec_2str_int_list_enc(Evas_List *list, int *size_ret);
#endif
#endif

225
src/bin/e_ipc_handlers.h Normal file
View File

@ -0,0 +1,225 @@
/* NOTE:
*
* This is a very SPECIAL file. This servers as a kind of "auto code generator"
* to handle the encoder, decoder etc. aspects of ipc requests. the aim here
* is to make writing support for a new opcode simple and compact. It intends
* to centralize the handling into 1 spot, instead of having ti spread around
* the code in N different places, as well as providing common construct macros
* to help make the code more compact and easier to create.
*/
/* This is a bunch of convenience stuff for this to work */
#ifndef E_IPC_HANDLERS_H
# define E_IPC_HANDLERS_H
# define STRING(__str, HANDLER) \
case HANDLER: \
if (e->data) { \
char *__str = NULL; \
if (e_ipc_codec_str_dec(e->data, e->size, &__str)) {
# define END_STRING(__str) \
free(__str); \
} \
} \
break;
# define SAVE e_config_save_queue()
# define REQ_STRING(__str, HANDLER) \
case HANDLER: { void *data; int bytes; \
data = e_ipc_codec_str_enc(__str, &bytes); \
if (data) { \
ecore_ipc_server_send(e->server, E_IPC_DOMAIN_REQUEST, HANDLER, 0, 0, 0, data, bytes); \
free(data); \
} \
} \
break;
# define REQ_NULL(HANDLER) \
case HANDLER: \
ecore_ipc_server_send(e->server, E_IPC_DOMAIN_REQUEST, HANDLER, 0, 0, 0, NULL, 0); \
break;
# define FREE_LIST(__list) \
while (__list) { \
free(__list->data); \
__list = evas_list_remove_list(__list, __list); \
}
# define SEND_DATA(__opcode) \
ecore_ipc_client_send(e->client, E_IPC_DOMAIN_REPLY, __opcode, 0, 0, 0, data, bytes)
# define STRING_INT_LIST(__v, __dec, __typ, HANDLER) \
case HANDLER: { \
Evas_List *dat = NULL, *l; \
if (__dec(e->data, e->size, &dat)) { \
for (l = dat; l; l = l->next) { \
__typ *__v; \
__v = l->data;
#define END_STRING_INT_LIST(__v) \
free(__v->str); \
free(__v); \
} \
evas_list_free(dat); \
} \
reply_count++; \
} \
break;
#define SEND_STRING_INT_LIST(__list, __typ1, __v1, __typ2, __v2, HANDLER) \
case HANDLER: { \
Evas_List *dat = NULL, *l; \
void *data; int bytes; \
for (l = e_module_list(); l; l = l->next) { \
__typ1 *__v1; \
__typ2 *__v2; \
__v1 = l->data; \
__v2 = calloc(1, sizeof(__typ2));
#define END_SEND_STRING_INT_LIST(__v1, __op) \
dat = evas_list_append(dat, __v1); \
} \
data = e_ipc_codec_str_int_list_enc(dat, &bytes); \
SEND_DATA(__op); \
free(data); \
FREE_LIST(dat); \
} \
break;
#endif
/*
* ****************
* IPC handlers
* ****************
*/
/* what a handler looks like
*
* E_REMOTE_OPTIONS
* (opt, num_params, description, num_expected_replies, HANDLER),
* E_REMOTE_OUT
* ...
* E_WM_IN
* ...
* E_REMOTE_IN
* ...
*/
#if 0
{
#endif
/****************************************************************************/
#define HANDLER E_IPC_OP_MODULE_LOAD
#if (TYPE == E_REMOTE_OPTIONS)
{"-module-load", 1, "Loads the module named 'OPT1' into memory", 0, HANDLER},
#elif (TYPE == E_REMOTE_OUT)
REQ_STRING(params[0], HANDLER);
#elif (TYPE == E_WM_IN)
STRING(s, HANDLER);
if (!e_module_find(s)) {
e_module_new(s);
SAVE;
}
END_STRING(s);
#elif (TYPE == E_REMOTE_IN)
#endif
#undef HANDLER
/****************************************************************************/
#define HANDLER E_IPC_OP_MODULE_UNLOAD
#if (TYPE == E_REMOTE_OPTIONS)
{"-module-unload", 1, "Unloads the module named 'OPT1' from memory", 0, HANDLER},
#elif (TYPE == E_REMOTE_OUT)
REQ_STRING(params[0], HANDLER);
#elif (TYPE == E_WM_IN)
STRING(s, HANDLER);
E_Module *m;
if ((m = e_module_find(s))) {
e_module_disable(m);
e_object_del(E_OBJECT(m));
SAVE;
}
END_STRING(s);
#elif (TYPE == E_REMOTE_IN)
#endif
#undef HANDLER
/****************************************************************************/
#define HANDLER E_IPC_OP_MODULE_ENABLE
#if (TYPE == E_REMOTE_OPTIONS)
{"-module-enable", 1, "Enable the module named 'OPT1'", 0, HANDLER},
#elif (TYPE == E_REMOTE_OUT)
REQ_STRING(params[0], HANDLER);
#elif (TYPE == E_WM_IN)
STRING(s, HANDLER);
E_Module *m;
if ((m = e_module_find(s))) {
e_module_enable(m);
SAVE;
}
END_STRING(s);
#elif (TYPE == E_REMOTE_IN)
#endif
#undef HANDLER
/****************************************************************************/
#define HANDLER E_IPC_OP_MODULE_DISABLE
#if (TYPE == E_REMOTE_OPTIONS)
{"-module-disable", 1, "Disable the module named 'OPT1'", 0, HANDLER},
#elif (TYPE == E_REMOTE_OUT)
REQ_STRING(params[0], HANDLER);
#elif (TYPE == E_WM_IN)
STRING(s, HANDLER);
E_Module *m;
if ((m = e_module_find(s))) {
e_module_disable(m);
SAVE;
}
END_STRING(s);
#elif (TYPE == E_REMOTE_IN)
#endif
#undef HANDLER
/****************************************************************************/
#define HANDLER E_IPC_OP_MODULE_LIST
#if (TYPE == E_REMOTE_OPTIONS)
{"-module-list", 0, "List all loaded modules", 1, HANDLER},
#elif (TYPE == E_REMOTE_OUT)
REQ_NULL(HANDLER);
#elif (TYPE == E_WM_IN)
SEND_STRING_INT_LIST(e_module_list(), E_Module, mod, E_Ipc_Str_Int, v, HANDLER);
v->str = mod->name;
v->val = mod->enabled;
END_SEND_STRING_INT_LIST(v, E_IPC_OP_MODULE_LIST_REPLY);
#elif (TYPE == E_REMOTE_IN)
#endif
#undef HANDLER
/****************************************************************************/
#define HANDLER E_IPC_OP_MODULE_LIST_REPLY
#if (TYPE == E_REMOTE_OPTIONS)
#elif (TYPE == E_REMOTE_OUT)
#elif (TYPE == E_WM_IN)
#elif (TYPE == E_REMOTE_IN)
STRING_INT_LIST(v, e_ipc_codec_str_int_list_dec, E_Ipc_Str_Int, HANDLER);
printf("REPLY: \"%s\" ENABLED %i\n", v->str, v->val);
END_STRING_INT_LIST(v);
#endif
#undef HANDLER
#if 0
}
#endif

View File

@ -0,0 +1,118 @@
#define E_IPC_OP_MODULE_LOAD 1
#define E_IPC_OP_MODULE_UNLOAD 2
#define E_IPC_OP_MODULE_ENABLE 3
#define E_IPC_OP_MODULE_DISABLE 4
#define E_IPC_OP_MODULE_LIST 5
#define E_IPC_OP_MODULE_LIST_REPLY 6
#define E_IPC_OP_BG_SET 7
#define E_IPC_OP_BG_GET 8
#define E_IPC_OP_BG_GET_REPLY 9
#define E_IPC_OP_FONT_AVAILABLE_LIST 10
#define E_IPC_OP_FONT_AVAILABLE_LIST_REPLY 11
#define E_IPC_OP_FONT_APPLY 12
#define E_IPC_OP_FONT_FALLBACK_CLEAR 13
#define E_IPC_OP_FONT_FALLBACK_APPEND 14
#define E_IPC_OP_FONT_FALLBACK_PREPEND 15
#define E_IPC_OP_FONT_FALLBACK_LIST 16
#define E_IPC_OP_FONT_FALLBACK_LIST_REPLY 17
#define E_IPC_OP_FONT_FALLBACK_REMOVE 18
#define E_IPC_OP_FONT_DEFAULT_SET 19
#define E_IPC_OP_FONT_DEFAULT_GET 20
#define E_IPC_OP_FONT_DEFAULT_GET_REPLY 21
#define E_IPC_OP_FONT_DEFAULT_REMOVE 22
#define E_IPC_OP_FONT_DEFAULT_LIST 23
#define E_IPC_OP_FONT_DEFAULT_LIST_REPLY 24
#define E_IPC_OP_RESTART 25
#define E_IPC_OP_SHUTDOWN 26
#define E_IPC_OP_LANG_LIST 27
#define E_IPC_OP_LANG_LIST_REPLY 28
#define E_IPC_OP_LANG_SET 29
#define E_IPC_OP_LANG_GET 30
#define E_IPC_OP_LANG_GET_REPLY 31
#define E_IPC_OP_BINDING_MOUSE_LIST 32
#define E_IPC_OP_BINDING_MOUSE_LIST_REPLY 33
#define E_IPC_OP_BINDING_MOUSE_ADD 34
#define E_IPC_OP_BINDING_MOUSE_DEL 35
#define E_IPC_OP_BINDING_KEY_LIST 36
#define E_IPC_OP_BINDING_KEY_LIST_REPLY 37
#define E_IPC_OP_BINDING_KEY_ADD 38
#define E_IPC_OP_BINDING_KEY_DEL 39
#define E_IPC_OP_MENUS_SCROLL_SPEED_SET 40
#define E_IPC_OP_MENUS_SCROLL_SPEED_GET 41
#define E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY 42
#define E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET 43
#define E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET 44
#define E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET_REPLY 45
#define E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_SET 46
#define E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET 47
#define E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET_REPLY 48
#define E_IPC_OP_BORDER_SHADE_ANIMATE_SET 49
#define E_IPC_OP_BORDER_SHADE_ANIMATE_GET 50
#define E_IPC_OP_BORDER_SHADE_ANIMATE_GET_REPLY 51
#define E_IPC_OP_BORDER_SHADE_TRANSITION_SET 52
#define E_IPC_OP_BORDER_SHADE_TRANSITION_GET 53
#define E_IPC_OP_BORDER_SHADE_TRANSITION_GET_REPLY 54
#define E_IPC_OP_BORDER_SHADE_SPEED_SET 55