forked from enlightenment/enlightenment
Added libe check E.h for its functionality, currently you can make a nice front end for loading/enabling libs or setting the background
Need to add Ecore_Event or similar for callbacks fo things like module_list or background_get etc See what you think SVN revision: 12803
This commit is contained in:
parent
06d56dc878
commit
43f38108ef
|
@ -106,6 +106,8 @@ AC_ARG_WITH(ecore-config,
|
||||||
])
|
])
|
||||||
ecore_cflags=`$ECORE_CONFIG --cflags`
|
ecore_cflags=`$ECORE_CONFIG --cflags`
|
||||||
ecore_libs=`$ECORE_CONFIG --libs`
|
ecore_libs=`$ECORE_CONFIG --libs`
|
||||||
|
AC_SUBST(ecore_cflags)
|
||||||
|
AC_SUBST(ecore_libs)
|
||||||
|
|
||||||
AC_ARG_WITH(edje-config,
|
AC_ARG_WITH(edje-config,
|
||||||
[ --with-edje-config=EDJE_CONFIG use edje-config specified ],
|
[ --with-edje-config=EDJE_CONFIG use edje-config specified ],
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
e_main.lo
|
||||||
|
libe.la
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
#ifndef _E_H
|
||||||
|
#define _E_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef EAPI
|
||||||
|
#undef EAPI
|
||||||
|
#endif
|
||||||
|
#ifdef WIN32
|
||||||
|
# ifdef BUILDING_DLL
|
||||||
|
# define EAPI __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define EAPI __declspec(dllimport)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef GCC_HASCLASSVISIBILITY
|
||||||
|
# define EAPI __attribute__ ((visibility("default")))
|
||||||
|
# else
|
||||||
|
# define EAPI
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* edje_main.c */
|
||||||
|
EAPI int e_init (const char *display);
|
||||||
|
EAPI int e_shutdown (void);
|
||||||
|
|
||||||
|
EAPI void e_module_enabled_set (const char *module,
|
||||||
|
int enable);
|
||||||
|
EAPI void e_module_loaded_set (const char *module,
|
||||||
|
int load);
|
||||||
|
EAPI void e_background_set (const char *bgfile);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,16 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
INCLUDES = -I/usr/local/include \
|
INCLUDES = -I/usr/local/include \
|
||||||
-I$(includedir)
|
-I$(includedir) \
|
||||||
|
-I../bin/
|
||||||
|
@ecore_cflags@
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libe.la
|
||||||
|
|
||||||
|
include_HEADERS = E.h
|
||||||
|
|
||||||
|
libe_la_SOURCES= \
|
||||||
|
e_main.c \
|
||||||
|
e_private.h
|
||||||
|
|
||||||
|
libe_la_LIBADD = @ecore_libs@
|
||||||
|
libe_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO:
|
||||||
|
* add ecore events for callbacks to all/some ipc calls, e.g. module_list
|
||||||
|
*
|
||||||
|
* add module_list, module_enabled_get and module_enabled_set
|
||||||
|
*
|
||||||
|
* augment IPC calls and add wrappers for them - i.e.:
|
||||||
|
* e restart/shutdown
|
||||||
|
* desktops add/remove/list etc
|
||||||
|
* windows shade[get/set]/maximise[get/set]/iconify[get/set]/list
|
||||||
|
*
|
||||||
|
* add ability to e to set theme, so we can have a theme_set call :)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "E.h"
|
||||||
|
#include "e_private.h"
|
||||||
|
|
||||||
|
#include <Ecore.h>
|
||||||
|
#include <Ecore_Ipc.h>
|
||||||
|
|
||||||
|
static int _e_ipc_init(const char *display);
|
||||||
|
static void _e_ipc_shutdown(void);
|
||||||
|
|
||||||
|
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
||||||
|
|
||||||
|
int
|
||||||
|
e_init(const char* display)
|
||||||
|
{
|
||||||
|
if (_e_ipc_server)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* basic ecore init */
|
||||||
|
if (!ecore_init())
|
||||||
|
{
|
||||||
|
printf("ERROR: Enlightenment cannot Initialize Ecore!\n"
|
||||||
|
"Perhaps you are out of memory?\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* init ipc */
|
||||||
|
if (!ecore_ipc_init())
|
||||||
|
{
|
||||||
|
printf("ERROR: Enlightenment cannot initialize the ipc system.\n"
|
||||||
|
"Perhaps you are out of memory?\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* setup e ipc service */
|
||||||
|
if (!_e_ipc_init(display))
|
||||||
|
{
|
||||||
|
printf("ERROR: Enlightenment cannot set up the IPC socket.\n"
|
||||||
|
"Did you specify the right display?\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_shutdown(void)
|
||||||
|
{
|
||||||
|
_e_ipc_shutdown();
|
||||||
|
ecore_ipc_shutdown();
|
||||||
|
ecore_shutdown();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_module_enabled_set(const char *module, int enable)
|
||||||
|
{
|
||||||
|
E_Ipc_Op type;
|
||||||
|
|
||||||
|
if (!module)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (enable)
|
||||||
|
type = E_IPC_OP_MODULE_ENABLE;
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_module_load_set(const char *module, int load)
|
||||||
|
{
|
||||||
|
E_Ipc_Op type;
|
||||||
|
|
||||||
|
if (!module)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (load)
|
||||||
|
type = E_IPC_OP_MODULE_LOAD;
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_background_set(const char *bgfile)
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_e_ipc_init(const char *display)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
char *disp;
|
||||||
|
|
||||||
|
disp = (char *)display;
|
||||||
|
if (!disp) disp = ":0";
|
||||||
|
snprintf(buf, sizeof(buf), "enlightenment-(%s)", disp);
|
||||||
|
_e_ipc_server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, buf, 0, NULL);
|
||||||
|
/* FIXME: we shoudl also try the generic ":0" if the display is ":0.0" */
|
||||||
|
/* similar... */
|
||||||
|
if (!_e_ipc_server) return 0;
|
||||||
|
|
||||||
|
// ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, _e_ipc_cb_server_add, NULL);
|
||||||
|
// ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, _e_ipc_cb_server_del, NULL);
|
||||||
|
// ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, _e_ipc_cb_server_data, NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_ipc_shutdown(void)
|
||||||
|
{
|
||||||
|
if (_e_ipc_server)
|
||||||
|
{
|
||||||
|
ecore_ipc_server_del(_e_ipc_server);
|
||||||
|
_e_ipc_server = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef _EDJE_PRIVATE_H
|
||||||
|
#define _EDJE_PRIVATE_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "e_ipc.h"
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue