Enlightenment CVS committal
Author : handyande
Project : e17
Module : apps/e
Dir : e17/apps/e/src/lib
Modified Files:
Makefile.am e_main.c e_private.h
Log Message:
Add some more IPC stuff, think I am getting the hang of this now
Make libe use the ipc_handlers backend (womeone might need to correct my
autofoo)
what should we do for the (pretty custom) libe RESPONSEs? should they go into
the handlers too?
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 1 Jun 2005 14:27:18 -0000 1.4
+++ Makefile.am 2 Jun 2005 14:15:18 -0000 1.5
@@ -1,7 +1,8 @@
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(includedir) \
-I$(top_srcdir)/src/bin
- @ecore_cflags@
+ @ecore_cflags@ \
+ @evas_cflags@
lib_LTLIBRARIES = libe.la
@@ -11,7 +12,8 @@
e_main.c \
e.h \
../bin/e_ipc_codec.c \
+../bin/e_ipc_codec.h \
e_private.h
-libe_la_LIBADD = @ecore_libs@
+libe_la_LIBADD = @ecore_libs@ @evas_libs@
libe_la_DEPENDENCIES = $(top_builddir)/config.h
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/e_main.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- e_main.c 1 Jun 2005 14:31:17 -0000 1.13
+++ e_main.c 2 Jun 2005 14:15:18 -0000 1.14
@@ -16,13 +16,33 @@
* add ability to e to set theme, so we can have a theme_set call :)
*/
+#include <Evas.h>
#include "E.h"
#include "e_private.h"
#include <Ecore.h>
#include <Ecore_Ipc.h>
+typedef struct _Opt Opt;
+
+struct _Opt
+{
+ char *opt;
+ int num_param;
+ char *desc;
+ int num_reply;
+ E_Ipc_Op opcode;
+};
+
+Opt opts[] = {
+#define TYPE E_REMOTE_OPTIONS
+#include "e_ipc_handlers.h"
+#undef TYPE
+};
+
static int _e_ipc_init(const char *display);
static void _e_ipc_shutdown(void);
+static Opt *_e_ipc_call_find(char *name);
+static void _e_ipc_call(Opt *opt, char **params);
static int _e_cb_server_data(void *data, int type, void *event);
static void _e_cb_module_list_free(void *data, void *ev);
@@ -98,13 +118,6 @@
return 0;
}
- /* setup e ipc codecs */
- if (!e_ipc_codec_init())
- {
- fprintf(stderr, "ERROR: Could not start enlightenment IPC codecs.\n");
- return 0;
- }
-
/* setup e ipc service */
if (!_e_ipc_init(disp))
{
@@ -112,6 +125,7 @@
"Did you specify the right display?\n");
return 0;
}
+ e_ipc_codec_init();
if (!E_RESPONSE_MODULE_LIST)
{
@@ -145,17 +159,13 @@
void
e_restart(void)
{
- ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST,
- E_IPC_OP_RESTART, 0/*ref*/, 0/*ref_to*/,
- 0/*response*/, NULL, 0);
+ _e_ipc_call(_e_ipc_call_find("-restart"), NULL);
}
void
e_quit(void)
{
- ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST,
- E_IPC_OP_SHUTDOWN, 0/*ref*/, 0/*ref_to*/,
- 0/*response*/, NULL, 0);
+ _e_ipc_call(_e_ipc_call_find("-shutdown"), NULL);
}
void
@@ -167,13 +177,9 @@
return;
if (enable)
- type = E_IPC_OP_MODULE_ENABLE;
+ _e_ipc_call(_e_ipc_call_find("-module-enable"), &module);
else
- type = E_IPC_OP_MODULE_DISABLE;
-
- ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST, type, 0/*ref*/,
- 0/*ref_to*/, 0/*response*/, (void *)module,
- strlen(module));
+ _e_ipc_call(_e_ipc_call_find("-module-disable"), &module);
}
void
@@ -185,21 +191,15 @@
return;
if (load)
- type = E_IPC_OP_MODULE_LOAD;
+ _e_ipc_call(_e_ipc_call_find("-module-load"), &module);
else
- type = E_IPC_OP_MODULE_UNLOAD;
-
- ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST, type, 0/*ref*/,
- 0/*ref_to*/, 0/*response*/, (void *)module,
- strlen(module));
+ _e_ipc_call(_e_ipc_call_find("-module-unload"), &module);
}
void
e_module_list(void)
{
- ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST,
- E_IPC_OP_MODULE_LIST, 0/*ref*/, 0/*ref_to*/,
- 0/*response*/, NULL, 0);
+ _e_ipc_call(_e_ipc_call_find("-module-list"), NULL);
}
void
@@ -216,17 +216,13 @@
if (!bgfile)
return;
- ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST, E_IPC_OP_BG_SET,
- 0/*ref*/, 0/*ref_to*/, 0/*response*/, (void *)bgfile,
- strlen(bgfile));
+ _e_ipc_call(_e_ipc_call_find("-default-bg-set"), &bgfile);
}
void
e_background_get(void)
{
- ecore_ipc_server_send(_e_ipc_server, E_IPC_DOMAIN_REQUEST,
- E_IPC_OP_BG_GET, 0/*ref*/, 0/*ref_to*/,
- 0/*response*/, NULL, 0);
+ _e_ipc_call(_e_ipc_call_find("-default-bg-get"), NULL);
}
void
@@ -245,6 +241,8 @@
// 0/*ref_to*/, 0/*response*/, NULL, 0);
}
+//static int reply_count = 0;
+
static int
_e_ipc_init(const char *display)
{
@@ -259,10 +257,8 @@
/* similar... */
if (!_e_ipc_server) return 0;
-/* ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, _e_cb_server_add,
NULL);*/
-/* ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, _e_cb_server_del,
NULL);*/
ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, _e_cb_server_data,
NULL);
-
+
return 1;
}
@@ -276,10 +272,80 @@
}
}
+static Opt *
+_e_ipc_call_find(char *name)
+{
+ int i, j;
+
+ for (j = 0; j < (int)(sizeof(opts) / sizeof(Opt)); j++)
+ {
+ Opt *opt;
+
+ opt = &(opts[j]);
+ if (!strcmp(opt->opt, name))
+ return opt;
+ }
+ return NULL;
+}
+
+static void
+_e_ipc_call(Opt *opt, char **params)
+{
+ Ecore_Ipc_Event_Server_Data *e =
malloc(sizeof(Ecore_Ipc_Event_Server_Data));
+ e->server = _e_ipc_server;
+
+ switch(opt->opcode)
+ {
+
+#define TYPE E_REMOTE_OUT
+#include "e_ipc_handlers.h"
+#undef TYPE
+
+ default:
+ break;
+ }
+ free(e);
+}
+
static int
_e_cb_server_data(void *data __UNUSED__, int type, void *event)
{
Ecore_Ipc_Event_Server_Data *e;
+
+ e = event;
+
+ switch (e->minor)
+ {
+
+ case E_IPC_OP_BG_GET_REPLY:
+ {
+ E_Response_Background_Get *res;
+ char *str = NULL;
+
+ res = calloc(1, sizeof(E_Response_Background_Get));
+ if (e->data)
+ {
+ e_ipc_codec_str_dec(e->data, e->size, &str);
+ res->file = str;
+ }
+ ecore_event_add(E_RESPONSE_BACKGROUND_GET, res, NULL, NULL);
+ }
+ break;
+
+// FIXME: if we were to use the e_handlers.h then it will need library
+// stuff, i.e. E_LIB_IN which creates the replies and sends the event...
+//
+//#define TYPE E_REMOTE_IN
+//#include "e_ipc_handlers.h"
+//#undef TYPE
+
+ default:
+ break;
+ }
+
+
+ /*
+ Ecore_Ipc_Event_Server_Data *e;
e = event;
@@ -328,7 +394,7 @@
_e_cb_module_list_free, NULL);
}
break;
-/*
+*
case E_IPC_OP_MODULE_DIRS_LIST_REPLY:
if (e->data)
{
@@ -360,7 +426,7 @@
_e_cb_module_dir_list_free, NULL);
}
break;
- */
+ *
case E_IPC_OP_BG_GET_REPLY:
{
E_Response_Background_Get *res;
@@ -369,13 +435,13 @@
res = calloc(1, sizeof(E_Response_Background_Get));
if (e->data)
{
- e_ipc_codec_str_dec(e->data, e->size, &str);
+ e_codec_str_dec(e->data, e->size, &str);
res->file = str;
}
ecore_event_add(E_RESPONSE_BACKGROUND_GET, res, NULL, NULL);
}
break;
-/* case E_IPC_OP_BG_DIRS_LIST_REPLY:
+* case E_IPC_OP_BG_DIRS_LIST_REPLY:
if (e->data)
{
E_Response_Background_Dirs_List *res;
@@ -406,8 +472,8 @@
_e_cb_bg_dir_list_free, NULL);
}
break;
- */
-/* case E_IPC_OP_THEME_DIRS_LIST_REPLY:
+ *
+* case E_IPC_OP_THEME_DIRS_LIST_REPLY:
if (e->data)
{
E_Response_Theme_Dirs_List *res;
@@ -438,11 +504,11 @@
_e_cb_theme_dir_list_free, NULL);
}
break;
- */
+ *
default:
break;
}
- return 1;
+ return 1;*/
}
static void _e_cb_module_list_free(void *data __UNUSED__, void *ev)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/e_private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_private.h 31 May 2005 03:01:53 -0000 1.4
+++ e_private.h 2 Jun 2005 14:15:18 -0000 1.5
@@ -23,3 +23,9 @@
#include "e_ipc.h"
#endif
+
+#define E_TYPEDEFS 1
+#include "e_ipc_codec.h"
+#undef E_TYPEDEFS
+#include "e_ipc_codec.h"
+
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs