move some to codecs. this needs cleaning tho... (ipc)


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 18 years ago
parent e61b2b515a
commit 078e74e14c
  1. 4
      TODO
  2. 5
      src/bin/Makefile.am
  3. 6
      src/bin/e.h
  4. 1
      src/bin/e_includes.h
  5. 75
      src/bin/e_ipc.c
  6. 35
      src/bin/e_ipc.h
  7. 76
      src/bin/e_ipc_codec.c
  8. 32
      src/bin/e_ipc_codec.h

@ -56,8 +56,8 @@ Also look at all the .c files - they have their own localized TODO lists
These are in no particular order:
* break out desks x/y size config so you can have a different desktop size
per zone
* simplify adding config options to ipc
per zone - right now there is a signle global (use this later as the default
for new/unconfigured zones)
* language packs: need to have a tool to load/setup a language pack (which
means .mo compiled files from a .po, an optional font and a config file that
specifies the locale and font) and then install the font(s) either as a user

@ -51,7 +51,8 @@ e_dnd.h \
e_bindings.h \
e_moveresize.h \
e_actions.h \
e_popup.h
e_popup.h \
e_ipc_codec.h
enlightenment_SOURCES = \
e_main.c \
@ -96,12 +97,14 @@ e_bindings.c \
e_moveresize.c \
e_actions.c \
e_popup.c \
e_ipc_codec.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_LDFLAGS = -export-dynamic @e_libs@ @dlopen_libs@
enlightenment_remote_SOURCES = \
e.h \
e_ipc_codec.c \
e_remote_main.c
enlightenment_remote_LDFLAGS = @e_libs@ @dlopen_libs@

@ -4,6 +4,8 @@
#ifndef E_H
#define E_H
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -28,10 +30,6 @@
#include <Eet.h>
#include <Edje.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#if HAVE___ATTRIBUTE__
#define __UNUSED__ __attribute__((unused))
#else

@ -41,4 +41,5 @@
#include "e_moveresize.h"
#include "e_actions.h"
#include "e_popup.h"
#include "e_ipc_codec.h"
#include "e_test.h"

@ -9,6 +9,9 @@ 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);
@ -40,12 +43,15 @@ e_ipc_init(void)
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, _e_ipc_cb_client_add, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, _e_ipc_cb_client_del, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, _e_ipc_cb_client_data, NULL);
e_ipc_codec_init();
return 1;
}
void
e_ipc_shutdown(void)
{
e_ipc_codec_shutdown();
if (_e_ipc_server)
{
ecore_ipc_server_del(_e_ipc_server);
@ -582,6 +588,71 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
}
}
break;
case E_IPC_OP_MENUS_SCROLL_SPEED_SET:
if (e_ipc_codec_double_dec(e->data, e->size,
&(e_config->menus_scroll_speed)))
{
E_CONFIG_LIMIT(e_config->menus_scroll_speed, 1.0, 20000.0);
e_config_save_queue();
}
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);
}
}
break;
case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET:
break;
case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET:
break;
case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_SET:
break;
case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET:
break;
case E_IPC_OP_BORDER_SHADE_ANIMATE_SET:
break;
case E_IPC_OP_BORDER_SHADE_ANIMATE_GET:
break;
case E_IPC_OP_BORDER_SHADE_TRANSITION_SET:
break;
case E_IPC_OP_BORDER_SHADE_TRANSITION_GET:
break;
case E_IPC_OP_BORDER_SHADE_SPEED_SET:
break;
case E_IPC_OP_BORDER_SHADE_SPEED_GET:
break;
case E_IPC_OP_FRAMERATE_SET:
break;
case E_IPC_OP_FRAMERATE_GET:
break;
case E_IPC_OP_IMAGE_CACHE_SET:
break;
case E_IPC_OP_IMAGE_CACHE_GET:
break;
case E_IPC_OP_FONT_CAHCE_SET:
break;
case E_IPC_OP_FONT_CACHE_GET:
break;
case E_IPC_OP_USE_EDGE_FLIP_SET:
break;
case E_IPC_OP_USE_EDGE_FLIP_GET:
break;
case E_IPC_OP_EDGE_FLIP_TIMEOUT_SET:
break;
case E_IPC_OP_EDGE_FLIP_TIMEOUT_GET:
break;
default:
break;
}
@ -668,7 +739,6 @@ _e_ipc_simple_str_dec(char *data, int bytes)
str = malloc(bytes + 1);
str[bytes] = 0;
memcpy(str, data, bytes);
return str;
}
@ -700,7 +770,8 @@ _e_ipc_multi_str_dec(char *data, int bytes, int str_count)
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)

@ -59,6 +59,41 @@ typedef enum _E_Ipc_Op
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_CAHCE_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,
E_IPC_OP_LAST
} E_Ipc_Op;

@ -0,0 +1,76 @@
#include "e.h"
/* local subsystem functions */
/* encode functions, Should these be global? */
/* local subsystem globals */
static Eet_Data_Descriptor *_e_ipc_int_edd = NULL;
static Eet_Data_Descriptor *_e_ipc_double_edd = NULL;
/* externally accessible functions */
int
e_ipc_codec_init(void)
{
_e_ipc_int_edd = E_CONFIG_DD_NEW("int", E_Ipc_Int);
E_CONFIG_VAL(_e_ipc_int_edd, E_Ipc_Int, val, INT);
_e_ipc_double_edd = E_CONFIG_DD_NEW("double", E_Ipc_Double);
E_CONFIG_VAL(_e_ipc_double_edd, E_Ipc_Double, val, DOUBLE);
return 1;
}
void
e_ipc_codec_shutdown(void)
{
E_CONFIG_DD_FREE(_e_ipc_int_edd);
E_CONFIG_DD_FREE(_e_ipc_double_edd);
}
int
e_ipc_codec_int_dec(char *data, int bytes, int *dest)
{
E_Ipc_Int *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_int_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->val;
free(dat);
return 1;
}
void *
e_ipc_codec_int_enc(int val, int *size_ret)
{
E_Ipc_Int dat;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_int_edd, &dat, size_ret);
}
int
e_ipc_codec_double_dec(char *data, int bytes, double *dest)
{
E_Ipc_Double *dat;
if (!data) return 0;
dat = eet_data_descriptor_decode(_e_ipc_double_edd, data, bytes);
if (!dat) return 0;
if (dest) *dest = dat->val;
free(dat);
return 1;
}
void *
e_ipc_codec_double_enc(double val, int *size_ret)
{
E_Ipc_Double dat;
dat.val = val;
return eet_data_descriptor_encode(_e_ipc_double_edd, &dat, size_ret);
}
/* local subsystem globals */

@ -0,0 +1,32 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
typedef struct _E_Ipc_Int E_Ipc_Int;
typedef struct _E_Ipc_Double E_Ipc_Double;
#else
#ifndef E_IPC_CODEC_H
#define E_IPC_CODEC_H
struct _E_Ipc_Int
{
int val;
};
struct _E_Ipc_Double
{
double val;
};
EAPI int e_ipc_codec_init(void);
EAPI void e_ipc_codec_shutdown(void);
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);
#endif
#endif
Loading…
Cancel
Save