breaking out some ipc action!


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 18 years ago
parent 9036a4c57a
commit 3f92e26079
  1. 7
      src/bin/e_config.c
  2. 203
      src/bin/e_ipc.c
  3. 3
      src/bin/e_ipc.h
  4. 29
      src/bin/e_ipc_codec.c
  5. 9
      src/bin/e_ipc_codec.h
  6. 4
      src/bin/e_remote_main.c

@ -111,8 +111,8 @@ e_config_init(void)
E_CONFIG_VAL(D, T, framerate, DOUBLE);
E_CONFIG_VAL(D, T, image_cache, INT);
E_CONFIG_VAL(D, T, font_cache, INT);
E_CONFIG_VAL(D, T, zone_desks_x_count, INT); /**/
E_CONFIG_VAL(D, T, zone_desks_y_count, INT); /**/
E_CONFIG_VAL(D, T, zone_desks_x_count, INT);
E_CONFIG_VAL(D, T, zone_desks_y_count, INT);
E_CONFIG_VAL(D, T, use_virtual_roots, INT); /* should not make this a config option (for now) */
E_CONFIG_VAL(D, T, use_edge_flip, INT);
E_CONFIG_VAL(D, T, edge_flip_timeout, DOUBLE);
@ -650,6 +650,9 @@ e_config_init(void)
E_CONFIG_LIMIT(e_config->framerate, 1.0, 200.0);
E_CONFIG_LIMIT(e_config->image_cache, 0, 256 * 1024);
E_CONFIG_LIMIT(e_config->font_cache, 0, 32 * 1024);
E_CONFIG_LIMIT(e_config->zone_desks_x_count, 1, 64);
E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64);
E_CONFIG_LIMIT(e_config->use_edge_flip, 0, 1);
E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0);
/* apply lang config - exception because config is loaded after intl setup */

@ -4,6 +4,9 @@
static int _e_ipc_cb_client_add(void *data, int type, void *event);
static int _e_ipc_cb_client_del(void *data, int type, void *event);
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_path_str_get(char **paths, int *bytes);
static char *_e_ipc_str_list_get(Evas_List *strs, int *bytes);
static char *_e_ipc_simple_str_dec(char *data, int bytes);
@ -597,61 +600,180 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
}
break;
case E_IPC_OP_MENUS_SCROLL_SPEED_GET:
{
void *data;
int bytes;
if ((data = e_ipc_codec_double_enc(e_config->menus_scroll_speed,
&bytes)))
{
ecore_ipc_client_send(e->client,
E_IPC_DOMAIN_REPLY,
E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
}
_e_ipc_reply_double_send(e->client,
e_config->menus_scroll_speed,
E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY);
break;
case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET:
if (e_ipc_codec_double_dec(e->data, e->size,
&(e_config->menus_fast_mouse_move_threshhold)))
{
E_CONFIG_LIMIT(e_config->menus_fast_mouse_move_threshhold, 1.0, 2000.0);
e_config_save_queue();
}
break;
case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET:
_e_ipc_reply_double_send(e->client,
e_config->menus_fast_mouse_move_threshhold,
E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET_REPLY);
break;
case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_SET:
if (e_ipc_codec_double_dec(e->data, e->size,
&(e_config->menus_click_drag_timeout)))
{
E_CONFIG_LIMIT(e_config->menus_click_drag_timeout, 0.0, 10.0);
e_config_save_queue();
}
break;
case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET:
_e_ipc_reply_double_send(e->client,
e_config->menus_click_drag_timeout,
E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET_REPLY);
break;
case E_IPC_OP_BORDER_SHADE_ANIMATE_SET:
if (e_ipc_codec_int_dec(e->data, e->size,
&(e_config->border_shade_animate)))
{
E_CONFIG_LIMIT(e_config->border_shade_animate, 0, 1);
e_config_save_queue();
}
break;
case E_IPC_OP_BORDER_SHADE_ANIMATE_GET:
_e_ipc_reply_int_send(e->client,
e_config->border_shade_animate,
E_IPC_OP_BORDER_SHADE_ANIMATE_GET_REPLY);
break;
case E_IPC_OP_BORDER_SHADE_TRANSITION_SET:
if (e_ipc_codec_int_dec(e->data, e->size,
&(e_config->border_shade_transition)))
{
E_CONFIG_LIMIT(e_config->border_shade_speed, 0, 3);
e_config_save_queue();
}
break;
case E_IPC_OP_BORDER_SHADE_TRANSITION_GET:
_e_ipc_reply_int_send(e->client,
e_config->border_shade_transition,
E_IPC_OP_BORDER_SHADE_TRANSITION_GET_REPLY);
break;
case E_IPC_OP_BORDER_SHADE_SPEED_SET:
if (e_ipc_codec_double_dec(e->data, e->size,
&(e_config->framerate)))
{
E_CONFIG_LIMIT(e_config->framerate, 1.0, 20000.0);
e_config_save_queue();
}
break;
case E_IPC_OP_BORDER_SHADE_SPEED_GET:
_e_ipc_reply_double_send(e->client,
e_config->border_shade_speed,
E_IPC_OP_BORDER_SHADE_SPEED_GET_REPLY);
break;
case E_IPC_OP_FRAMERATE_SET:
if (e_ipc_codec_double_dec(e->data, e->size,
&(e_config->framerate)))
{
E_CONFIG_LIMIT(e_config->image_cache, 1.0, 200.0);
e_config_save_queue();
}
break;
case E_IPC_OP_FRAMERATE_GET:
_e_ipc_reply_double_send(e->client,
e_config->framerate,
E_IPC_OP_FRAMERATE_GET_REPLY);
break;
case E_IPC_OP_IMAGE_CACHE_SET:
if (e_ipc_codec_int_dec(e->data, e->size,
&(e_config->image_cache)))
{
E_CONFIG_LIMIT(e_config->image_cache, 0, 256 * 1024);
e_config_save_queue();
}
break;
case E_IPC_OP_IMAGE_CACHE_GET:
_e_ipc_reply_int_send(e->client,
e_config->image_cache,
E_IPC_OP_IMAGE_CACHE_GET_REPLY);
break;
case E_IPC_OP_FONT_CAHCE_SET:
if (e_ipc_codec_int_dec(e->data, e->size,
&(e_config->font_cache)))
{
E_CONFIG_LIMIT(e_config->font_cache, 0, 32 * 1024);
e_config_save_queue();
}
break;
case E_IPC_OP_FONT_CACHE_GET:
_e_ipc_reply_int_send(e->client,
e_config->font_cache,
E_IPC_OP_FONT_CACHE_GET_REPLY);
break;
case E_IPC_OP_USE_EDGE_FLIP_SET:
if (e_ipc_codec_int_dec(e->data, e->size,
&(e_config->use_edge_flip)))
{
E_CONFIG_LIMIT(e_config->use_edge_flip, 0, 1);
e_config_save_queue();
}
break;
case E_IPC_OP_USE_EDGE_FLIP_GET:
_e_ipc_reply_int_send(e->client,
e_config->use_edge_flip,
E_IPC_OP_USE_EDGE_FLIP_GET_REPLY);
break;
case E_IPC_OP_EDGE_FLIP_TIMEOUT_SET:
if (e_ipc_codec_double_dec(e->data, e->size,
&(e_config->edge_flip_timeout)))
{
E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0);
e_config_save_queue();
}
break;
case E_IPC_OP_EDGE_FLIP_TIMEOUT_GET:
_e_ipc_reply_double_send(e->client,
e_config->edge_flip_timeout,
E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY);
break;
case E_IPC_OP_DESKS_SET:
if (e_ipc_codec_2int_dec(e->data, e->size,
&(e_config->zone_desks_x_count),
&(e_config->zone_desks_y_count)))
{
Evas_List *l;
E_CONFIG_LIMIT(e_config->zone_desks_x_count, 1, 64);
E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64);
for (l = e_manager_list(); l; l = l->next)
{
E_Manager *man;
Evas_List *l2;
man = l->data;
for (l2 = man->containers; l2; l2 = l2->next)
{
E_Container *con;
Evas_List *l3;
con = l2->data;
for (l3 = con->zones; l3; l3 = l3->next)
{
E_Zone *zone;
zone = l3->data;
e_zone_desk_count_set(zone,
e_config->zone_desks_x_count,
e_config->zone_desks_y_count);
}
}
}
e_config_save_queue();
}
break;
case E_IPC_OP_DESKS_GET:
_e_ipc_reply_2int_send(e->client,
e_config->zone_desks_x_count,
e_config->zone_desks_y_count,
E_IPC_OP_DESKS_GET_REPLY);
break;
default:
break;
@ -665,6 +787,57 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
return 1;
}
static void
_e_ipc_reply_double_send(Ecore_Ipc_Client *client, double val, int opcode)
{
void *data;
int bytes;
if ((data = e_ipc_codec_double_enc(val, &bytes)))
{
ecore_ipc_client_send(client,
E_IPC_DOMAIN_REPLY,
opcode,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
}
static void
_e_ipc_reply_int_send(Ecore_Ipc_Client *client, int val, int opcode)
{
void *data;
int bytes;
if ((data = e_ipc_codec_int_enc(val, &bytes)))
{
ecore_ipc_client_send(client,
E_IPC_DOMAIN_REPLY,
opcode,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
}
static void
_e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode)
{
void *data;
int bytes;
if ((data = e_ipc_codec_2int_enc(val1, val2, &bytes)))
{
ecore_ipc_client_send(client,
E_IPC_DOMAIN_REPLY,
opcode,
0/*ref*/, 0/*ref_to*/, 0/*response*/,
data, bytes);
free(data);
}
}
/*
* FIXME: This dosen't handle the case where one of the paths is of the
* form: ~moo/bar/baz need to figure out the correct path to the

@ -93,6 +93,9 @@ typedef enum _E_Ipc_Op
E_IPC_OP_EDGE_FLIP_TIMEOUT_SET,
E_IPC_OP_EDGE_FLIP_TIMEOUT_GET,
E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY,
E_IPC_OP_DESKS_SET,
E_IPC_OP_DESKS_GET,
E_IPC_OP_DESKS_GET_REPLY,
E_IPC_OP_LAST
} E_Ipc_Op;

@ -7,6 +7,7 @@
/* local subsystem globals */
static Eet_Data_Descriptor *_e_ipc_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_double_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_2int_edd = NULL;
/* externally accessible functions */
int
@ -18,6 +19,9 @@ e_ipc_codec_init(void)
_e_ipc_double_edd = E_CONFIG_DD_NEW("double", E_Ipc_Double);
E_CONFIG_VAL(_e_ipc_double_edd, E_Ipc_Double, val, DOUBLE);
_e_ipc_2int_edd = E_CONFIG_DD_NEW("2int", E_Ipc_2Int);
E_CONFIG_VAL(_e_ipc_2int_edd, E_Ipc_2Int, val1, INT);
E_CONFIG_VAL(_e_ipc_2int_edd, E_Ipc_2Int, val2, INT);
return 1;
}
@ -26,6 +30,7 @@ e_ipc_codec_shutdown(void)
{
E_CONFIG_DD_FREE(_e_ipc_int_edd);
E_CONFIG_DD_FREE(_e_ipc_double_edd);
E_CONFIG_DD_FREE(_e_ipc_2int_edd);
}
int
@ -72,5 +77,29 @@ e_ipc_codec_double_enc(double val, int *size_ret)
return eet_data_descriptor_encode(_e_ipc_double_edd, &dat, size_ret);
}
int
e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2)
{
E_Ipc_2Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_2int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->val1;
if (dest2) *dest2 = dat->val2;
free(dat);
return 1;
}
void *
e_ipc_codec_2int_enc(int val1, int val2, int *size_ret)
{
E_Ipc_2Int dat;
dat.val1 = val1;
dat.val2 = val2;
return eet_data_descriptor_encode(_e_ipc_2int_edd, &dat, size_ret);
}
/* local subsystem globals */

@ -5,6 +5,7 @@
typedef struct _E_Ipc_Int E_Ipc_Int;
typedef struct _E_Ipc_Double E_Ipc_Double;
typedef struct _E_Ipc_2Int E_Ipc_2Int;
#else
#ifndef E_IPC_CODEC_H
@ -20,6 +21,12 @@ struct _E_Ipc_Double
double val;
};
struct _E_Ipc_2Int
{
int val1, val2;
};
EAPI int e_ipc_codec_init(void);
EAPI void e_ipc_codec_shutdown(void);
@ -27,6 +34,8 @@ EAPI int e_ipc_codec_int_dec(char *data, int bytes, int *dest);
EAPI void *e_ipc_codec_int_enc(int val, int *size_ret);
EAPI int e_ipc_codec_double_dec(char *data, int bytes, double *dest);
EAPI void *e_ipc_codec_double_enc(double val, int *size_ret);
EAPI int e_ipc_codec_2int_dec(char *data, int bytes, int *dest, int *dest2x);
EAPI void *e_ipc_codec_2int_enc(int val1, int val2, int *size_ret);
#endif
#endif

@ -361,10 +361,12 @@ main(int argc, char **argv)
"Maybe try the '-display :0.0' option?\n");
exit(-1);
}
e_ipc_codec_init();
/* start our main loop */
ecore_main_loop_begin();
e_ipc_codec_shutdown();
_e_ipc_shutdown();
ecore_ipc_shutdown();
ecore_shutdown();

Loading…
Cancel
Save