remove test/example stuff

SVN revision: 26835
This commit is contained in:
Carsten Haitzler 2006-10-28 09:55:50 +00:00
parent 935c00fdb1
commit a0d2a33d04
68 changed files with 2 additions and 10809 deletions

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = data src examples
SUBDIRS = src
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
config.h.in config.sub configure install-sh \
@ -24,7 +24,6 @@ EXTRA_DIST = AUTHORS COPYING COPYING-PLAIN ecore.c.in gendoc ecore.supp ecore.m4
debian/control \
debian/copyright \
debian/ecore0-bin.install \
debian/ecore0-debug.install \
debian/libecore0-con.install \
debian/libecore0-config.install \
debian/libecore0-dbus.install \

View File

@ -1253,10 +1253,6 @@ AC_SUBST(requirements)
AC_OUTPUT([
Makefile
ecore.pc
data/Makefile
data/fonts/Makefile
data/images/Makefile
data/pointers/Makefile
src/Makefile
src/bin/Makefile
src/lib/Makefile
@ -1273,7 +1269,6 @@ src/lib/ecore_file/Makefile
src/lib/ecore_dbus/Makefile
src/lib/ecore_desktop/Makefile
src/lib/ecore_directfb/Makefile
examples/Makefile
ecore-config
README
ecore.spec

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@ -1,2 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = fonts images pointers

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@ -1,10 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
FILES = Vera.ttf VeraBI.ttf VeraBd.ttf VeraIt.ttf VeraMoBI.ttf \
VeraMoBd.ttf VeraMoIt.ttf VeraMono.ttf VeraSe.ttf VeraSeBd.ttf \
fonts.alias fonts.dir
fontsdir = $(pkgdatadir)/fonts
fonts_DATA = $(FILES)
EXTRA_DIST = $(FILES)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,11 +0,0 @@
Vera-Bold-Italic -Bitstream-Bitstream Vera Sans-bold-i-normal--0-0-0-0-p-0-ascii-0
Vera-Normal -Bitstream-Bitstream Vera Sans-medium-r-normal--0-0-0-0-p-0-ascii-0
Vera-Bold -Bitstream-Bitstream Vera Sans-bold-r-normal--0-0-0-0-p-0-ascii-0
Vera-Italic -Bitstream-Bitstream Vera Sans-medium-i-normal--0-0-0-0-p-0-ascii-
Vera-Mono-Bold-Italic -Bitstream-Bitstream Vera Sans Mono-bold-i-normal--0-0-0-0-m-0-ascii-0
Vera-Mono-Bold -Bitstream-Bitstream Vera Sans Mono-bold-r-normal--0-0-0-0-m-0-ascii-0
Vera-Mono-Italic -Bitstream-Bitstream Vera Sans Mono-medium-i-normal--0-0-0-0-m-0-ascii-0
Vera-Mono -Bitstream-Bitstream Vera Sans Mono-medium-r-normal--0-0-0-0-m-0-ascii-0
Vera-Serif -Bitstream-Bitstream Vera Serif-medium-r-normal--0-0-0-0-p-0-ascii-0
Vera-Serif-Bold -Bitstream-Bitstream Vera Serif-bold-r-normal--0-0-0-0-p-0-ascii-0
Vera -Bitstream-Bitstream Vera Sans-medium-r-normal--0-0-0-0-p-0-ascii-0

View File

@ -1,51 +0,0 @@
50
VeraBI.ttf -Bitstream-Bitstream Vera Sans-bold-i-normal--0-0-0-0-p-0-ascii-0
VeraBI.ttf -Bitstream-Bitstream Vera Sans-bold-i-normal--0-0-0-0-p-0-fcd8859-15
VeraBI.ttf -Bitstream-Bitstream Vera Sans-bold-i-normal--0-0-0-0-p-0-iso8859-1
VeraBI.ttf -Bitstream-Bitstream Vera Sans-bold-i-normal--0-0-0-0-p-0-iso8859-15
VeraBI.ttf -Bitstream-Bitstream Vera Sans-bold-i-normal--0-0-0-0-p-0-iso8859-9
Vera.ttf -Bitstream-Bitstream Vera Sans-medium-r-normal--0-0-0-0-p-0-ascii-0
Vera.ttf -Bitstream-Bitstream Vera Sans-medium-r-normal--0-0-0-0-p-0-fcd8859-15
Vera.ttf -Bitstream-Bitstream Vera Sans-medium-r-normal--0-0-0-0-p-0-iso8859-1
Vera.ttf -Bitstream-Bitstream Vera Sans-medium-r-normal--0-0-0-0-p-0-iso8859-15
Vera.ttf -Bitstream-Bitstream Vera Sans-medium-r-normal--0-0-0-0-p-0-iso8859-9
VeraBd.ttf -Bitstream-Bitstream Vera Sans-bold-r-normal--0-0-0-0-p-0-ascii-0
VeraBd.ttf -Bitstream-Bitstream Vera Sans-bold-r-normal--0-0-0-0-p-0-fcd8859-15
VeraBd.ttf -Bitstream-Bitstream Vera Sans-bold-r-normal--0-0-0-0-p-0-iso8859-1
VeraBd.ttf -Bitstream-Bitstream Vera Sans-bold-r-normal--0-0-0-0-p-0-iso8859-15
VeraBd.ttf -Bitstream-Bitstream Vera Sans-bold-r-normal--0-0-0-0-p-0-iso8859-9
VeraIt.ttf -Bitstream-Bitstream Vera Sans-medium-i-normal--0-0-0-0-p-0-ascii-0
VeraIt.ttf -Bitstream-Bitstream Vera Sans-medium-i-normal--0-0-0-0-p-0-fcd8859-15
VeraIt.ttf -Bitstream-Bitstream Vera Sans-medium-i-normal--0-0-0-0-p-0-iso8859-1
VeraIt.ttf -Bitstream-Bitstream Vera Sans-medium-i-normal--0-0-0-0-p-0-iso8859-15
VeraIt.ttf -Bitstream-Bitstream Vera Sans-medium-i-normal--0-0-0-0-p-0-iso8859-9
VeraMoBI.ttf -Bitstream-Bitstream Vera Sans Mono-bold-i-normal--0-0-0-0-m-0-ascii-0
VeraMoBI.ttf -Bitstream-Bitstream Vera Sans Mono-bold-i-normal--0-0-0-0-m-0-fcd8859-15
VeraMoBI.ttf -Bitstream-Bitstream Vera Sans Mono-bold-i-normal--0-0-0-0-m-0-iso8859-1
VeraMoBI.ttf -Bitstream-Bitstream Vera Sans Mono-bold-i-normal--0-0-0-0-m-0-iso8859-15
VeraMoBI.ttf -Bitstream-Bitstream Vera Sans Mono-bold-i-normal--0-0-0-0-m-0-iso8859-9
VeraMoBd.ttf -Bitstream-Bitstream Vera Sans Mono-bold-r-normal--0-0-0-0-m-0-ascii-0
VeraMoBd.ttf -Bitstream-Bitstream Vera Sans Mono-bold-r-normal--0-0-0-0-m-0-fcd8859-15
VeraMoBd.ttf -Bitstream-Bitstream Vera Sans Mono-bold-r-normal--0-0-0-0-m-0-iso8859-1
VeraMoBd.ttf -Bitstream-Bitstream Vera Sans Mono-bold-r-normal--0-0-0-0-m-0-iso8859-15
VeraMoBd.ttf -Bitstream-Bitstream Vera Sans Mono-bold-r-normal--0-0-0-0-m-0-iso8859-9
VeraMoIt.ttf -Bitstream-Bitstream Vera Sans Mono-medium-i-normal--0-0-0-0-m-0-ascii-0
VeraMoIt.ttf -Bitstream-Bitstream Vera Sans Mono-medium-i-normal--0-0-0-0-m-0-fcd8859-15
VeraMoIt.ttf -Bitstream-Bitstream Vera Sans Mono-medium-i-normal--0-0-0-0-m-0-iso8859-1
VeraMoIt.ttf -Bitstream-Bitstream Vera Sans Mono-medium-i-normal--0-0-0-0-m-0-iso8859-15
VeraMoIt.ttf -Bitstream-Bitstream Vera Sans Mono-medium-i-normal--0-0-0-0-m-0-iso8859-9
VeraMono.ttf -Bitstream-Bitstream Vera Sans Mono-medium-r-normal--0-0-0-0-m-0-ascii-0
VeraMono.ttf -Bitstream-Bitstream Vera Sans Mono-medium-r-normal--0-0-0-0-m-0-fcd8859-15
VeraMono.ttf -Bitstream-Bitstream Vera Sans Mono-medium-r-normal--0-0-0-0-m-0-iso8859-1
VeraMono.ttf -Bitstream-Bitstream Vera Sans Mono-medium-r-normal--0-0-0-0-m-0-iso8859-15
VeraMono.ttf -Bitstream-Bitstream Vera Sans Mono-medium-r-normal--0-0-0-0-m-0-iso8859-9
VeraSe.ttf -Bitstream-Bitstream Vera Serif-medium-r-normal--0-0-0-0-p-0-ascii-0
VeraSe.ttf -Bitstream-Bitstream Vera Serif-medium-r-normal--0-0-0-0-p-0-fcd8859-15
VeraSe.ttf -Bitstream-Bitstream Vera Serif-medium-r-normal--0-0-0-0-p-0-iso8859-1
VeraSe.ttf -Bitstream-Bitstream Vera Serif-medium-r-normal--0-0-0-0-p-0-iso8859-15
VeraSe.ttf -Bitstream-Bitstream Vera Serif-medium-r-normal--0-0-0-0-p-0-iso8859-9
VeraSeBd.ttf -Bitstream-Bitstream Vera Serif-bold-r-normal--0-0-0-0-p-0-ascii-0
VeraSeBd.ttf -Bitstream-Bitstream Vera Serif-bold-r-normal--0-0-0-0-p-0-fcd8859-15
VeraSeBd.ttf -Bitstream-Bitstream Vera Serif-bold-r-normal--0-0-0-0-p-0-iso8859-1
VeraSeBd.ttf -Bitstream-Bitstream Vera Serif-bold-r-normal--0-0-0-0-p-0-iso8859-15
VeraSeBd.ttf -Bitstream-Bitstream Vera Serif-bold-r-normal--0-0-0-0-p-0-iso8859-9

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@ -1,10 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
IMAGES = ball.png bar.png bar_shad_above.png bar_shad_below.png \
bg.png crosshair.png e_logo.png evas_logo.png shadow.png
imgdir = $(pkgdatadir)/images
img_DATA = $(IMAGES)
EXTRA_DIST = $(IMAGES)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@ -1,8 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
POINTERS = mouse_pointer.png
pntrdir = $(pkgdatadir)/pointers
pntr_DATA = $(POINTERS)
EXTRA_DIST = $(POINTERS)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,16 +0,0 @@
.deps
.libs
Makefile
Makefile.in
args_example
con_client_example
con_server_example
config_basic_example
config_listener_example
event_handler_example
exe_example
list_destroy_example
list_example
output_tester
timer_example
x_window_example

View File

@ -1,79 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
EXAMPLES = \
timer_example \
event_handler_example \
args_example \
list_example \
list_destroy_example \
output_tester \
exe_example
if BUILD_ECORE_CON
CON_EXAMPLES = con_server_example con_client_example
endif
if BUILD_ECORE_CONFIG
CONFIG_EXAMPLES = \
config_basic_example \
config_listener_example
endif
if BUILD_ECORE_X
X_EXAMPLES = x_window_example
endif
noinst_PROGRAMS = $(EXAMPLES) $(CON_EXAMPLES) $(CONFIG_EXAMPLES) $(X_EXAMPLES)
INCLUDES = \
-I$(top_srcdir)/src/lib/ecore \
-I$(top_srcdir)/src/lib/ecore_config \
-I$(top_srcdir)/src/lib/ecore_x \
-I$(top_srcdir)/src/lib/ecore_con \
@EVAS_CFLAGS@
LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
-lm @iconv_libs@
DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la
timer_example_SOURCES = timer_example.c
list_example_SOURCES = list_example.c
list_destroy_example_SOURCES = list_destroy_example.c
event_handler_example_SOURCES = event_handler_example.c
args_example_SOURCES = args_example.c
exe_example_SOURCES = exe_example.c
output_tester_SOURCES = output_tester.c
if BUILD_ECORE_CON
con_server_example_SOURCES = con_server_example.c
con_server_example_LDADD = $(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la
con_client_example_SOURCES = con_client_example.c
con_client_example_LDADD = $(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la
endif
if BUILD_ECORE_CONFIG
config_basic_example_SOURCES = config_basic_example.c
config_basic_example_LDADD = $(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_config/libecore_config.la \
$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la
config_listener_example_SOURCES = config_listener_example.c
config_listener_example_LDADD = $(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_config/libecore_config.la \
$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \
$(top_builddir)/src/lib/ecore_con/libecore_con.la
endif
if BUILD_ECORE_X
x_window_example_SOURCES = x_window_example.c
x_window_example_LDADD = $(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la \
$(top_builddir)/src/lib/ecore_job/libecore_job.la \
$(top_builddir)/src/lib/ecore_x/libecore_x.la
endif

View File

@ -1,28 +0,0 @@
/* Example of how to set and retrieve program arguments.
*/
#include <Ecore.h>
#include <stdlib.h>
#include <stdio.h>
int timer_once(void *data)
{
int argc;
char **argv;
int i;
ecore_app_args_get(&argc, &argv);
for (i = 0; i < argc; i++) printf("ARG %i: %s\n", i, argv[i]);
ecore_main_loop_quit();
return 1;
}
int main(int argc, char **argv)
{
ecore_init();
ecore_app_args_set(argc, (const char **) argv);
ecore_timer_add(0.1, timer_once, NULL);
ecore_main_loop_begin();
ecore_shutdown();
return 0;
}

View File

@ -1,53 +0,0 @@
/* Ecore_Con Usage Example
*/
#include <Ecore.h>
#include <Ecore_Con.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
Ecore_Con_Server *svr;
#define SOCKET_NAME "con_example"
#define SOCKET_PORT 0
char *msg = "get http://www.enlightenment.org\n";
typedef int (*Handler_Func) (void *data, int type, void *event);
int
server_data (void *data,
int ev_type,
Ecore_Con_Event_Server_Data *ev) {
printf("Data received from the server! Data was:\n");
printf(" %*s\n", ev->size, (char *)ev->data);
ecore_main_loop_quit();
return 0;
}
int
main (int argc,
char *argv[]) {
ecore_con_init();
// Try to conect to server.
svr = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM, "www.enlightenment.org",
80, NULL);
if (NULL == svr) {
printf("*** ERROR: Unable to connect to server.\n");
printf("*** Start con_server_example before running this program.\n");
return 0;
}
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
(Handler_Func)server_data, NULL);
ecore_con_server_send(svr, msg, strlen(msg));
ecore_main_loop_begin();
ecore_con_server_del(svr);
ecore_con_shutdown();
return 0;
}

View File

@ -1,59 +0,0 @@
/* Ecore_Con Usage Example
*/
#include <Ecore.h>
#include <Ecore_Con.h>
//#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
Ecore_Con_Server *svr;
char *msg = "Hello client! Received your message";
typedef int (*Handler_Func) (void *data, int type, void *event);
int
client_connect (Ecore_Con_Client *client,
int ev_type,
Ecore_Con_Event_Client_Add *ev) {
printf("Client connected.\n");
return 0;
}
int
client_disconnect (Ecore_Con_Client *client,
int ev_type,
Ecore_Con_Event_Client_Del *ev){
printf("Client disconnected.\n");
return 0;
}
int
client_data (void *data,
int ev_type,
Ecore_Con_Event_Client_Data *ev) {
printf("Client sent data! Replying...");
ecore_con_client_send(ev->client, msg, strlen(msg));
printf("done! Data was:\n");
printf(" %*s\n", ev->size, (char *)ev->data);
return 0;
}
int main (int argc, char *argv[]) {
ecore_con_init();
printf("Server is running: waiting for connections\n");
svr = ecore_con_server_add(ECORE_CON_LOCAL_USER, "con_example", 0, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD,
(Handler_Func)client_connect, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL,
(Handler_Func)client_disconnect, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA,
(Handler_Func)client_data, NULL);
ecore_main_loop_begin();
ecore_con_shutdown();
return 0;
}

View File

@ -1,98 +0,0 @@
/* Shows how to handle the Enlightened Properties Library.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Ecore_Config.h>
#define INT_VAL_KEY "/example/integer"
#define FLT_VAL_KEY "/example/float"
#define STR_VAL_KEY "/example/string"
#define RGB_VAL_KEY "/example/colour"
#define THM_VAL_KEY "/example/theme"
long int_val;
float flt_val;
int a_val;
int r_val;
int g_val;
int b_val;
char *str_val;
char *thm_val;
void set_defaults (void) {
ecore_config_int_default(INT_VAL_KEY, 0);
ecore_config_float_default(FLT_VAL_KEY, 0.0);
ecore_config_string_default(STR_VAL_KEY, "test1");
ecore_config_argb_default(RGB_VAL_KEY, 255, 0, 0, 0);
ecore_config_theme_default(THM_VAL_KEY, "default");
}
void get_settings (void) {
/* Note the order here. Defaults are to be set before load, so that the
* types are definitely right.
*/
set_defaults();
ecore_config_load();
int_val = ecore_config_int_get(INT_VAL_KEY);
flt_val = ecore_config_float_get(FLT_VAL_KEY);
str_val = ecore_config_string_get(STR_VAL_KEY);
ecore_config_argb_get(RGB_VAL_KEY, &a_val, &r_val, &g_val, &b_val);
thm_val = ecore_config_theme_get(THM_VAL_KEY);
}
void change_settings(void) {
int_val += 1;
flt_val += 0.1;
if('9' == str_val[4]) {
str_val[4] = '0';
} else {
str_val[4] += 1;
}
a_val = (a_val + 1) % 256;
r_val = (r_val + 1) % 256;
g_val = (g_val + 1) % 256;
b_val = (b_val + 1) % 256;
if(!strcmp(thm_val, "default")) {
if(thm_val) free(thm_val);
thm_val = strdup("winter");
} else {
if(thm_val) free(thm_val);
thm_val = strdup("default");
}
}
void save_settings (void) {
ecore_config_int_set(INT_VAL_KEY, int_val);
ecore_config_float_set(FLT_VAL_KEY, flt_val);
ecore_config_string_set(STR_VAL_KEY, str_val);
ecore_config_argb_set(RGB_VAL_KEY, a_val, r_val, g_val, b_val);
ecore_config_theme_set(THM_VAL_KEY, thm_val);
ecore_config_save();
}
void dump_settings (void) {
printf(" Int Value: %li\n", int_val);
printf(" Float Value: %f\n", flt_val);
printf(" String Value: %s\n", str_val);
printf(" ARGB Value: %i %i %i %i\n", a_val, r_val, g_val, b_val);
printf(" Theme Value: %s\n", thm_val);
}
int main (int argc, char **argv) {
ecore_config_init("config_basic_example");
get_settings();
printf("--- Original Values ---\n");
dump_settings();
change_settings();
printf("--- Values to be Saved ---\n");
dump_settings();
save_settings();
if(str_val) free(str_val);
if(thm_val) free(thm_val);
ecore_config_shutdown();
return 0;
}

View File

@ -1,26 +0,0 @@
/* Demonstrates how to use listeners.
*/
#include <stdio.h>
#include <Ecore.h>
#include <Ecore_Config.h>
#define INT_PROPERTY_KEY "/example/integer"
#define CALLBACK_NAME "change listener"
int change_listener (const char *key, const Ecore_Config_Type type,
const int tag, void *data) {
printf("Callback called when property '%s' is %li\n", key, ecore_config_int_get(key));
return 0;
}
int main (int argc, char *argv[]) {
/* We'll use the same config as config_basic_example.c */
ecore_config_init("config_basic_example");
ecore_config_int_default (INT_PROPERTY_KEY, -1);
ecore_config_listen(CALLBACK_NAME, INT_PROPERTY_KEY, change_listener, 1, NULL);
ecore_config_load();
ecore_config_int_set(INT_PROPERTY_KEY, ecore_config_int_get(INT_PROPERTY_KEY) + 1);
ecore_config_shutdown();
return 0;
}

View File

@ -1,45 +0,0 @@
/* Ecore Event Handler Example. */
#include <Ecore.h>
#include <stdlib.h>
#include <stdio.h>
Ecore_Event_Handler *handler1 = NULL, *handler2 = NULL;
int event_hup(void *data, int ev_type, void *ev)
{
printf("Hup signal! Remove the exit handler.\n");
if (handler1)
{
ecore_event_handler_del(handler1);
handler1 = NULL;
}
return 0;
}
int event_exit(void *data, int ev_type, void *ev)
{
Ecore_Event_Signal_Exit *e;
e = (Ecore_Event_Signal_Exit *)ev;
printf("This callback handles event type: %i\n", ECORE_EVENT_SIGNAL_EXIT);
printf("Event type recieved: %i\n", ev_type);
if (e->interrupt) printf("Exit: interrupt\n");
if (e->quit) printf("Exit: quit\n");
if (e->terminate) printf("Exit: terminate\n");
ecore_main_loop_quit();
return 1;
}
int main(int argc, char **argv)
{
ecore_init();
ecore_app_args_set(argc, (const char **) argv);
handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,
event_exit, NULL);
handler2 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP,
event_hup, NULL);
ecore_main_loop_begin();
ecore_shutdown();
return 0;
}

View File

@ -1,205 +0,0 @@
/* Timer example.
*/
#include <Ecore.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int size = 0;
int exe_count = 0;
int data_count = 0;
int line_count = 0;
double then = 0.0, now = 0.0;
Ecore_Exe *exe0 = NULL;
Ecore_Exe *exe1 = NULL;
Ecore_Exe *exe2 = NULL;
Ecore_Exe *exe3 = NULL;
Ecore_Exe *exe4 = NULL;
static int
exe_data(void *data, int type, void *event)
{
Ecore_Exe_Event_Data *ev;
int i;
ev = event;
printf(" [*] DATA RET EXE %p - %p [%i bytes]\n", ev->exe, ev->data,
ev->size);
if (ev->lines)
{
int i;
for (i = 0; ev->lines[i].line != NULL; i++)
{
printf("%d %s\n", ev->lines[i].size, ev->lines[i].line);
}
}
else
{
for (i = 0; i < ev->size; i++)
putchar(((unsigned char *)ev->data)[i]);
}
printf("\n");
return 1;
}
static int
exe_data_count(void *data, int type, void *event)
{
Ecore_Exe_Event_Data *ev;
int i;
ev = event;
if (ev->lines)
{
for (i = 0; ev->lines[i].line != NULL; i++)
line_count++;
/* printf("%d ", i); This is for testing the number of lines per event. */
}
data_count += ev->size;
if (data_count >= size)
{
now = ecore_time_get();
printf
("\n\nApproximate data rate - %f bytes/second (%d lines and %d bytes (x2) in %f seconds).\n",
((double)data_count * 2.0) / (now - then), line_count, data_count,
now - then);
if (data_count != size)
printf("Size discrepency of %d bytes.\n", size - data_count);
printf("\n");
/* Since there does not seem to be anyway to convince /bin/cat to finish... */
ecore_exe_terminate(exe0);
}
return 1;
}
static int
exe_exit(void *data, int type, void *event)
{
Ecore_Exe_Event_Del *ev;
ev = event;
printf(" [*] EXE EXIT: %p\n", ev->exe);
exe_count--;
if (exe_count <= 0)
ecore_main_loop_quit();
return 1;
}
int
timer_once(void *data)
{
int argc;
char **argv;
int i = 1;
ecore_app_args_get(&argc, &argv);
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, exe_data_count, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, exe_data_count, NULL);
printf("FILE : %s\n", argv[i]);
exe0 =
ecore_exe_pipe_run("/bin/cat",
ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL);
if (exe0)
{
struct stat s;
exe_count++;
if (stat(argv[i], &s) == 0)
{
int fd;
size = s.st_size;
if ((fd = open(argv[i], O_RDONLY)) != -1)
{
char buf[1024];
int length;
then = ecore_time_get();
while ((length = read(fd, buf, 1024)) > 0)
ecore_exe_send(exe0, buf, length);
close(fd);
}
}
/* FIXME: Fuckit, neither of these will actually cause /bin/cat to shut down. What the fuck does it take? */
ecore_exe_send(exe0, "\004", 1); /* Send an EOF. */
ecore_exe_close_stdin(exe0); /* /bin/cat should stop when it's stdin closes. */
}
return 0;
}
int
main(int argc, char **argv)
{
ecore_app_args_set(argc, (const char **)argv);
ecore_init();
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, exe_exit, NULL);
if (argc == 1)
{
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, exe_data, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, exe_data, NULL);
exe0 = ecore_exe_run("/bin/uname -a", NULL);
if (exe0)
exe_count++;
exe1 = ecore_exe_pipe_run("/bin/sh",
ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_WRITE,
NULL);
if (exe1)
{
exe_count++;
ecore_exe_send(exe1, "ls\n", 3);
ecore_exe_send(exe1, "exit\n", 5);
}
exe2 = ecore_exe_pipe_run("/usr/bin/find . -print",
ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL);
if (exe2)
exe_count++;
exe3 = ecore_exe_pipe_run("/bin/cat", ECORE_EXE_PIPE_WRITE, NULL);
if (exe3)
{
exe_count++;
ecore_exe_send(exe3, "ls\n", 3);
}
exe4 = ecore_exe_pipe_run(".libs/output_tester",
ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_READ_LINE_BUFFERED |
ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, NULL);
if (exe4)
exe_count++;
printf(" [*] exe0 = %p (/bin/uname -a)\n", exe0);
printf(" [*] exe1 = %p (echo \"ls\" | /bin/sh)\n", exe1);
printf(" [*] exe2 = %p (/usr/bin/find / -print)\n", exe2);
printf(" [*] exe3 = %p (echo \"ls\" | /bin/cat)\n", exe3);
printf(" [*] exe4 = %p (.libs/output_tester)\n", exe4);
}
else
ecore_timer_add(0.5, timer_once, NULL);
if ((exe_count > 0) || (argc > 1))
ecore_main_loop_begin();
ecore_shutdown();
return 0;
}

View File

@ -1,26 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Ecore_Data.h>
void alloc_data (Ecore_List *list) {
ecore_list_append(list, strdup("first"));
ecore_list_append(list, strdup("second"));
ecore_list_append(list, strdup("third"));
}
void destroy_cb (void *data) {
printf("Destroying \"%s\".\n", (char *)data);
free(data);
}
int main (int argc, char *argv[]) {
Ecore_List *list;
list = ecore_list_new();
alloc_data(list);
ecore_list_set_free_cb(list, destroy_cb);
ecore_list_destroy(list);
return 0;
}

View File

@ -1,31 +0,0 @@
#include <stdio.h>
#include <Ecore_Data.h>
void print_list (Ecore_List *list) {
char *list_item;
printf("--- Current List ---\n");
ecore_list_goto_first(list);
while((list_item = (char*)ecore_list_next(list)) != NULL) {
printf("\t%s\n", list_item);
}
}
int main (int argc, char *argv[]) {
Ecore_List *list;
char *first = "first";
char *second = "second";
char *last = "last";
list = ecore_list_new();
ecore_list_append(list, last); // Insert
ecore_list_prepend(list, first); // Add to front
ecore_list_goto_index(list, 1); // counted from 0
ecore_list_insert(list, second); // Insert before item at index 2
print_list(list);
ecore_list_destroy(list);
return 0;
}

View File

@ -1,130 +0,0 @@
/* output and error tester.
*/
#include <Ecore.h>
#include <stdlib.h>
#include <stdio.h>
Ecore_Timer *timer1 = NULL;
char *data1 = "data1";
int
timer1_tick(void *data)
{
printf("Once only timer called at %3.2f seconds, data %p\n",
ecore_time_get(), data);
fprintf(stderr, "This is an error message from the timer callback.\n");
fprintf(stdout, "This is an output message from the timer callback.\n");
fprintf(stderr,
"Some text for testing the various problems that may occur. It should all be to stderr.\n");
fprintf(stderr, "!@#$%%^&*(){}|[]\\/\\\\=?+',.\"<>`~-_;:\n");
fprintf(stderr, "1234567890\n");
fprintf(stderr, "abcdefghijklmnopqrstuvwxyz\n");
fprintf(stderr, "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n");
fprintf(stderr,
"This is a really long line that is used to test the systems response to really long lines. Having said that, if I hadn't added this extra sentence it would not have been as long as the introduction line that is five lines above this one. If you got this far, then you may actually have no life, as this is just a really long test line that says nothing important, and the only parts that have any actual relevance are the beginning and the end.\n");
fprintf(stderr,
"This line is almost identical to the one above, only \\n's ae added to test multiline.\nThis is a really long line that is used to test the systems response to really long lines.\nHaving said that, if I hadn't added this extra sentence it would not have been as long as the introduction line that is five lines above this one.\nIf you got this far, then you may actually have no life, as this is just a really long test line that says nothing important, and the only parts that have any actual relevance are the beginning and the\nend.\n");
fprintf(stderr, "&gt;&amp;&lt; == <&>\n");
fprintf(stderr, "This - <br> - is a HTML line break.\n");
fprintf(stderr, "&gt;br&lt; == <br>\n");
fprintf(stderr,
"The rest is just some lines cut and paste from http://matrix-rad.net/ coz I need a big lump of text, and it was handy. Used with the permission of the author, coz I (David 'onefang' Seikel) am the author, apply the standard E17 license to this part when it is part of E17 cvs.\n");
fprintf(stderr, "\n");
fprintf(stderr,
"NAWS stands for Not A Widget Set, it will not be a widget set, it will be a\n");
fprintf(stderr,
"single, generalised widget and a single generalized widget container.\n");
fprintf(stderr, " </P>\n");
fprintf(stderr, " <P>\n");
fprintf(stderr, "The idea is roughly this -<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"NAWS should allow pixel perfect layout on any OS/JVM combination. This is very\n");
fprintf(stderr,
"important, it gives the GUI designers the freedom from differences that has been\n");
fprintf(stderr, "sorely lacking on the web.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"All widgets should be shaped, so that you can have two roundish widgets\n");
fprintf(stderr,
"snuggling up to each other. All widgets should be font sensitive, this could\n");
fprintf(stderr,
"break pixel perfection though. The shape should be definable by a mask graphic,\n");
fprintf(stderr, "or a combination of graphics primitives.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"Labels should be able to display multiline flowed text or a graphic, with the\n");
fprintf(stderr,
"graphic being a .png, .jpg, .gif (in that order of preference), and with\n");
fprintf(stderr,
"animation support. Labels should be able to be attached to all other widgets as\n");
fprintf(stderr,
"prompts. Labels should have automatic disabled graphics (ghosting) created and\n");
fprintf(stderr,
"the option of supplying one. So that a widgets prompt gets ghosted when the\n");
fprintf(stderr,
"widget gets ghosted, and to provide ghosting support for the other widget types.\n");
fprintf(stderr,
"Labels can have a different text / graphic for the mouse hover state. Label\n");
fprintf(stderr, "graphics should naturally be paintable.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"Borders are shaped outlines that can be put around anything. Not really a\n");
fprintf(stderr,
"widget, just a decoration. When using graphics, the border could be part of the\n");
fprintf(stderr,
"graphic, so no actual border is needed. Might be able to make Labels as\n");
fprintf(stderr, "containers do the job of Borders.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"Buttons are Labels that can be clicked. Alternate text / graphics for the\n");
fprintf(stderr,
"clicked state should be catered for. Radio buttons can be handled by widget\n");
fprintf(stderr,
"notification. Checkboxes are buttons that are sticky. The difference between\n");
fprintf(stderr,
"Checkboxes and toggled Buttons is purely cosmetic.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr, "Icons are movable Buttons.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"Text editing fields are Labels that allow the text to be edited. Masks and\n");
fprintf(stderr, "validation should be built in.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"Progress indicators are Labels with two graphics where the first graphic is\n");
fprintf(stderr,
"slowly revealed by chipping away at the second overlayed graphic. Default\n");
fprintf(stderr, "graphics should be supplied.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"Containers should be automatically scrollable if needed. Actually, Containers\n");
fprintf(stderr,
"could be just Labels that allow sub widgets, but I don't think I will go that\n");
fprintf(stderr, "far B-). On second thoughts, I might.<BR><BR>\n");
fprintf(stderr, "\n");
fprintf(stderr,
"All else is really just a Container with several of the basic widgets in them. A\n");
fprintf(stderr,
"List is just a collection of Buttons. A Menu is not very different from a List\n");
fprintf(stderr,
"with sub Lists. Choices are Lists where the selected item is usually all that is\n");
fprintf(stderr, "\n");
ecore_main_loop_quit();
return 0;
}
int
main(int argc, char **argv)
{
ecore_init();
timer1 = ecore_timer_add(5.0, timer1_tick, data1);
fprintf(stdout, "This is an output message from the main function.\n");
fprintf(stderr, "This is an error message from the main function.\n");
ecore_main_loop_begin();
ecore_shutdown();
return 123;
}

View File

@ -1,43 +0,0 @@
/* Timer example.
*/
#include <Ecore.h>
#include <stdlib.h>
#include <stdio.h>
Ecore_Timer *timer1 = NULL;
Ecore_Timer *timer2 = NULL;
Ecore_Timer *timer3 = NULL;
char *data1 = "data1";
char *data2 = "data2";
char *data3 = "data3";
int timer3_tick(void *data) {
printf("Tick timer %3.2f\n", ecore_time_get());
return 1;
}
int timer2_tick(void *data) {
printf("Repeat timer called at %3.2f seconds, data %p\n",
ecore_time_get(), data);
return 1;
}
int timer1_tick(void *data) {
printf("Once only timer called at %3.2f seconds, data %p\n",
ecore_time_get(), data);
ecore_timer_del(timer2);
return 0;
}
int main(int argc, char **argv) {
ecore_init();
timer1 = ecore_timer_add(5.0, timer1_tick, data1);
timer2 = ecore_timer_add(0.5, timer2_tick, data2);
timer3 = ecore_timer_add(1.0, timer3_tick, data3);
ecore_main_loop_begin();
ecore_shutdown();
return 0;
}

View File

@ -1,20 +0,0 @@
/* X Windows Example
*/
#include <unistd.h>
#include <Ecore.h>
#include <Ecore_X.h>
int main (int argc, char *argv[]) {
Ecore_X_Window win;
ecore_x_init(NULL);
win = ecore_x_window_new(0, 20, 20, 200, 200);
ecore_x_window_show(win);
ecore_x_flush(); // Ensure requests are sent to the server.
usleep(3000000); // Sleep for 3 seconds.
ecore_x_shutdown();
return 0;
}

View File

@ -1,916 +0,0 @@
#ifndef E_CORE_H
#define E_CORE_H 1
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <signal.h>
#define XK_MISCELLANY 1
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xresource.h>
#include <X11/keysymdef.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/shape.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif
#define XEV_NONE NoEventMask
#define XEV_KEY KeyPressMask | KeyReleaseMask
#define XEV_BUTTON ButtonPressMask | ButtonReleaseMask
#define XEV_KEY_PRESS KeyPressMask
#define XEV_KEY_RELEASE KeyReleaseMask
#define XEV_BUTTON_PRESS ButtonPressMask
#define XEV_BUTTON_RELEASE ButtonReleaseMask
#define XEV_IN_OUT EnterWindowMask | LeaveWindowMask
#define XEV_MOUSE_MOVE PointerMotionMask | ButtonMotionMask
#define XEV_EXPOSE ExposureMask
#define XEV_VISIBILITY VisibilityChangeMask
#define XEV_CONFIGURE StructureNotifyMask
#define XEV_CHILD_CHANGE SubstructureNotifyMask
#define XEV_CHILD_REDIRECT SubstructureRedirectMask | ResizeRedirectMask
#define XEV_FOCUS FocusChangeMask
#define XEV_PROPERTY PropertyChangeMask
#define XEV_COLORMAP ColormapChangeMask
#define ECORE_ATOM(atom, name) \
if (!atom) (atom) = ecore_atom_get(name);
#define MEMCPY(src, dst, type, num) \
memcpy(dst, src, sizeof(type) * (num))
#define NEW(type, num) \
malloc(sizeof(type) * (num))
#define ZERO(ptr, type, num) \
memset((ptr), 0, sizeof(type) * (num))
#define NEW_PTR(num) \
malloc(sizeof(void *) * (num))
#define FREE(ptr) \
{ \
free(ptr); \
(ptr) = NULL; \
}
#define IF_FREE(ptr) \
{if (ptr) FREE(ptr);}
#define REALLOC(ptr, type, num) \
{ \
if ((ptr) && (num == 0)) {free(ptr); ptr = NULL;} \
else if (ptr) ptr = realloc((ptr), sizeof(type) * (num)); \
else ptr = malloc(sizeof(type) * (num)); \
}
#define REALLOC_PTR(ptr, num) \
{ \
if ((ptr) && (num == 0)) {free(ptr); ptr = NULL;} \
else if (ptr) ptr = realloc(ptr, sizeof(void *) * (num)); \
else ptr = malloc(sizeof(void *) * (num)); \
}
#define START_LIST_DEL(type, base, cmp) \
type *_p, *_pp; _pp = NULL; \
_p = (base); \
while(_p) \
{ \
if (cmp) \
{ \
if (_pp) _pp->next = _p->next; \
else (base) = _p->next;
#define END_LIST_DEL \
return; \
} \
_pp = _p; \
_p = _p->next; \
}
#define DND_TYPE_URI_LIST 0
#define DND_TYPE_PLAIN_TEXT 1
#define DND_TYPE_MOZ_URL 2
#define DND_TYPE_NETSCAPE_URL 3
#ifdef __cplusplus
extern "C"
{
#endif
extern XContext xid_context;
typedef void (*Ecore_Error_Function) (Display * d, XErrorEvent * ev);
typedef struct _ecore_keygrab Ecore_KeyGrab;
typedef enum _ecore_ev_modifiers
{
ECORE_EVENT_KEY_MODIFIER_NONE = 0,
ECORE_EVENT_KEY_MODIFIER_SHIFT = (1 << 0),
ECORE_EVENT_KEY_MODIFIER_CTRL = (1 << 1),
ECORE_EVENT_KEY_MODIFIER_ALT = (1 << 2),
ECORE_EVENT_KEY_MODIFIER_WIN = (1 << 3)
} Ecore_Event_Key_Modifiers;
typedef enum _ecore_event_stack_detail
{
ECORE_EVENT_STACK_ABOVE = Above,
ECORE_EVENT_STACK_BELOW = Below,
ECORE_EVENT_STACK_TOP_IF = TopIf,
ECORE_EVENT_STACK_BOTTOM_IF = BottomIf,
ECORE_EVENT_STACK_OPPOSITE = Opposite
} Ecore_Event_Stack_Detail;
typedef enum _ecore_event_value_mask
{
ECORE_EVENT_VALUE_X = CWX,
ECORE_EVENT_VALUE_Y = CWY,
ECORE_EVENT_VALUE_W = CWWidth,
ECORE_EVENT_VALUE_H = CWHeight,
ECORE_EVENT_VALUE_BORDER = CWBorderWidth,
ECORE_EVENT_VALUE_SIBLING = CWSibling,
ECORE_EVENT_VALUE_STACKING = CWStackMode
} Ecore_Event_Value_Mask;
typedef enum _ecore_event_type
{
ECORE_EVENT_MOUSE_MOVE,
ECORE_EVENT_MOUSE_DOWN,
ECORE_EVENT_MOUSE_UP,
ECORE_EVENT_MOUSE_IN,
ECORE_EVENT_MOUSE_OUT,
ECORE_EVENT_MOUSE_WHEEL,
ECORE_EVENT_KEY_DOWN,
ECORE_EVENT_KEY_UP,
ECORE_EVENT_WINDOW_MAP,
ECORE_EVENT_WINDOW_UNMAP,
ECORE_EVENT_WINDOW_CREATE,
ECORE_EVENT_WINDOW_DESTROY,
ECORE_EVENT_WINDOW_CONFIGURE,
ECORE_EVENT_WINDOW_CONFIGURE_REQUEST,
ECORE_EVENT_WINDOW_MAP_REQUEST,
ECORE_EVENT_WINDOW_PROPERTY,
ECORE_EVENT_WINDOW_CIRCULATE,
ECORE_EVENT_WINDOW_CIRCULATE_REQUEST,
ECORE_EVENT_WINDOW_REPARENT,
ECORE_EVENT_WINDOW_EXPOSE,
ECORE_EVENT_WINDOW_VISIBILITY,
ECORE_EVENT_WINDOW_SHAPE,
ECORE_EVENT_WINDOW_FOCUS_IN,
ECORE_EVENT_WINDOW_FOCUS_OUT,
ECORE_EVENT_MESSAGE,
ECORE_EVENT_WINDOW_DELETE,
ECORE_EVENT_COLORMAP,
ECORE_EVENT_DND_DROP_REQUEST,
ECORE_EVENT_DND_DROP_END,
ECORE_EVENT_DND_DROP_POSITION,
ECORE_EVENT_DND_DROP,
ECORE_EVENT_DND_DROP_STATUS,
ECORE_EVENT_DND_DATA_REQUEST,
ECORE_EVENT_PASTE_REQUEST,
ECORE_EVENT_CLEAR_SELECTION,
ECORE_EVENT_CHILD,
ECORE_EVENT_USER,
ECORE_EVENT_MAX
} Ecore_Event_Type;
typedef struct _ecore_event
{
Ecore_Event_Type type;
char ignore;
void *event;
void (*ev_free) (void *evnt);
struct _ecore_event *next;
} Ecore_Event;
typedef struct _ecore_event_fd_handler
{
int fd;
void (*func) (int fd);
struct _ecore_event_fd_handler *next;
} Ecore_Event_Fd_Handler;
typedef struct _ecore_event_pid_handler
{
pid_t pid;
void (*func) (pid_t pid);
struct _ecore_event_pid_handler *next;
} Ecore_Event_Pid_Handler;
typedef struct _ecore_event_ipc_handler
{
int ipc;
void (*func) (int ipc);
struct _ecore_event_ipc_handler *next;
} Ecore_Event_Ipc_Handler;
typedef struct _ecore_event_timer
{
char *name;
void (*func) (int val, void *data);
int val;
void *data;
double in;
char just_added;
struct _ecore_event_timer *next;
} Ecore_Event_Timer;
typedef struct _ecore_event_key_down
{
Window win, root;
Ecore_Event_Key_Modifiers mods;
char *key;
char *compose;
Time time;
} Ecore_Event_Key_Down;
typedef struct _ecore_event_key_up
{
Window win, root;
Ecore_Event_Key_Modifiers mods;
char *key;
char *compose;
Time time;
} Ecore_Event_Key_Up;
typedef struct _ecore_event_mouse_down
{
Window win, root;
Ecore_Event_Key_Modifiers mods;
int button;
int x, y;
int rx, ry;
int double_click, triple_click;
Time time;
} Ecore_Event_Mouse_Down;
typedef struct _ecore_event_mouse_up
{
Window win, root;
Ecore_Event_Key_Modifiers mods;
int button;
int x, y;
int rx, ry;
Time time;
} Ecore_Event_Mouse_Up;
typedef struct _ecore_event_wheel
{
Window win, root;
Ecore_Event_Key_Modifiers mods;
int x, y, z;
int rx, ry;
Time time;
} Ecore_Event_Wheel;
typedef struct _ecore_event_mouse_move
{
Window win, root;
Ecore_Event_Key_Modifiers mods;
int x, y;
int rx, ry;
Time time;
} Ecore_Event_Mouse_Move;
typedef struct _ecore_event_window_enter
{
Window win, root;
int x, y;
int rx, ry;
Ecore_Event_Key_Modifiers mods;
Time time;
} Ecore_Event_Window_Enter;
typedef struct _ecore_event_window_leave
{
Window win, root;
int x, y;
int rx, ry;
Ecore_Event_Key_Modifiers mods;
Time time;
} Ecore_Event_Window_Leave;
typedef struct _ecore_event_window_focus_in
{
Window win, root;
int key_grab;
Time time;
} Ecore_Event_Window_Focus_In;
typedef struct _ecore_event_window_focus_out
{
Window win, root;
int key_grab;
Time time;
} Ecore_Event_Window_Focus_Out;
typedef struct _ecore_event_window_expose
{
Window win, root;
int x, y, w, h;
} Ecore_Event_Window_Expose;
typedef struct _ecore_event_window_visibility
{
Window win, root;
int fully_obscured;
} Ecore_Event_Window_Visibility;
typedef struct _ecore_event_window_create
{
Window win, root;
int override;
} Ecore_Event_Window_Create;
typedef struct _ecore_event_window_destroy
{
Window win, root;
} Ecore_Event_Window_Destroy;
typedef struct _ecore_event_window_map
{
Window win, root;
} Ecore_Event_Window_Map;
typedef struct _ecore_event_window_unmap
{
Window win, root;
} Ecore_Event_Window_Unmap;
typedef struct _ecore_event_window_map_request
{
Window win, root;
} Ecore_Event_Window_Map_Request;
typedef struct _ecore_event_window_reparent
{
Window win, root;
Window parent_from, parent;
} Ecore_Event_Window_Reparent;
typedef struct _ecore_event_window_configure
{
Window win, root;
int x, y, w, h;
int wm_generated;
} Ecore_Event_Window_Configure;
typedef struct _ecore_event_window_configure_request
{
Window win, root;
int x, y, w, h;
int border;
Window stack_win;
Ecore_Event_Stack_Detail detail;
Ecore_Event_Value_Mask mask;
} Ecore_Event_Window_Configure_Request;
typedef struct _ecore_event_window_circulate
{
Window win, root;
int lower;
} Ecore_Event_Window_Circulate;
typedef struct _ecore_event_window_circulate_request
{
Window win, root;
int lower;
} Ecore_Event_Window_Circulate_Request;
typedef struct _ecore_event_window_property
{
Window win, root;
Atom atom;
Time time;
} Ecore_Event_Window_Property;
typedef struct _ecore_event_window_shape
{
Window win, root;
Time time;
} Ecore_Event_Window_Shape;
typedef struct _ecore_event_message
{
Window win;
int format;
Atom atom;
union
{
char b[20];
short s[10];
long l[5];
}
data;
} Ecore_Event_Message;
typedef struct _ecore_event_colormap
{
Window win, root;
Colormap cmap;
int installed;
} Ecore_Event_Colormap;
typedef struct _ecore_event_window_delete
{
Window win, root;
} Ecore_Event_Window_Delete;
typedef struct _ecore_event_paste_request
{
Window win, root, source_win;
char *string;
} Ecore_Event_Paste_Request;
typedef struct _ecore_event_clear_selection
{
Window win, root;
Atom selection;
} Ecore_Event_Clear_Selection;
typedef struct _ecore_event_dnd_drop_request
{
Window win, root, source_win;
int num_files;
char **files;
int copy, link, move;
} Ecore_Event_Dnd_Drop_Request;
typedef struct _ecore_event_dnd_drop_end
{
Window win, root, source_win;
} Ecore_Event_Dnd_Drop_End;
typedef struct _ecore_event_dnd_drop_position
{
Window win, root, source_win;
int x, y;
} Ecore_Event_Dnd_Drop_Position;
typedef struct _ecore_event_dnd_drop
{
Window win, root, source_win;
} Ecore_Event_Dnd_Drop;
typedef struct _ecore_event_dnd_drop_status
{
Window win, root, source_win;
int x, y, w, h;
int copy, link, move, e_private;
int all_position_msgs;
int ok;
} Ecore_Event_Dnd_Drop_Status;
typedef struct _ecore_event_dnd_data_request
{
Window win, root, source_win;
Atom destination_atom;
int plain_text;
int uri_list;
int moz_url;
int netscape_url;
} Ecore_Event_Dnd_Data_Request;
typedef struct _ecore_event_child
{
pid_t pid;
int exit_code;
} Ecore_Event_Child;
typedef struct _ecore_event_user
{
int num;
int hup;
} Ecore_Event_User;
typedef struct _ecore_event_ipc_service
{
int service;
void (*func) (int fd);
struct _ecore_event_ipc_service *next;
} Ecore_Event_Ipc_Service;
typedef struct _ecore_xid
{
Window win;
Window parent;
Window root;
int children_num;
Window *children;
int x, y, w, h;
int mapped;
int mouse_in;
int depth;
int gravity;
int coords_invalid;
int bw;
int (*grab_button_auto_replay) (Ecore_Event_Mouse_Down *ev);
} Ecore_XID;
/* ---------------- API CALLS BELOW --------------------*/
/* ---------------- X WRAPPER CALLS */
int ecore_x_get_fd(void);
void ecore_set_error_handler(Ecore_Error_Function func);
void ecore_reset_error_handler(void);
/**
* ecore_display_init - Establishes a connection to the X server
* @display: The name of the display to connect to
*
* This function creates a connection to the X server. If
* @display is NULL, the name is taken from the $DISPLAY
* environment variable.
*/
int ecore_display_init(char *display);
int ecore_events_pending(void);
void ecore_get_next_event(XEvent * event);
int ecore_event_shape_get_id(void);
void ecore_sync(void);
void ecore_flush(void);
/* ---------------- WINDOW CHILD HANDLING */
void ecore_del_child(Window win, Window child);
void ecore_add_child(Window win, Window child);
void ecore_raise_child(Window win, Window child);
void ecore_lower_child(Window win, Window child);
Ecore_XID *ecore_add_xid(Window win, int x, int y, int w, int h,
int depth, Window parent);
Ecore_XID *ecore_validate_xid(Window win);
void ecore_unvalidate_xid(Window win);
/* ---------------- WINDOWS-RELATED CALLS */
Window ecore_window_new(Window parent, int x, int y, int w,
int h);
Window ecore_window_override_new(Window parent, int x, int y,
int w, int h);
Window ecore_window_input_new(Window parent, int x, int y, int w,
int h);
void ecore_window_set_events_propagate(Window win,
int propagate);
void ecore_window_show(Window win);
void ecore_window_hide(Window win);
void ecore_window_set_background_pixmap(Window win,
Pixmap pmap);
void ecore_window_set_shape_mask(Window win, Pixmap mask);
void ecore_window_add_shape_mask(Window win, Pixmap mask);
void ecore_window_set_shape_window(Window win, Window src,
int x, int y);
void ecore_window_add_shape_window(Window win, Window src,
int x, int y);
void ecore_window_set_shape_rectangle(Window win, int x, int y,
int w, int h);
void ecore_window_add_shape_rectangle(Window win, int x, int y,
int w, int h);
void ecore_window_set_shape_rectangles(Window win,
XRectangle * rect,
int num);
void ecore_window_add_shape_rectangles(Window win,
XRectangle * rect,
int num);
void ecore_window_clip_shape_by_rectangle(Window win, int x,
int y, int w, int h);
XRectangle *ecore_window_get_shape_rectangles(Window win, int *num);
void ecore_window_select_shape_events(Window win);
void ecore_window_unselect_shape_events(Window win);
void ecore_window_clear(Window win);
void ecore_window_clear_area(Window win, int x, int y, int w,
int h);
void ecore_window_set_events(Window win, long mask);
void ecore_window_remove_events(Window win, long mask);
void ecore_window_add_events(Window win, long mask);
void ecore_window_move(Window win, int x, int y);
void ecore_window_resize(Window win, int w, int h);
void ecore_window_move_resize(Window win, int x, int y, int w,
int h);
void ecore_window_destroy(Window win);
void ecore_window_reparent(Window win, Window parent, int x,
int y);
void ecore_window_raise(Window win);
void ecore_window_lower(Window win);
void ecore_window_get_geometry(Window win, int *x, int *y,
int *w, int *h);
int ecore_window_get_depth(Window win);
int ecore_window_exists(Window win);
Window ecore_window_get_parent(Window win);
Window *ecore_window_get_children(Window win, int *num);
int ecore_window_mouse_in(Window win);
void ecore_window_mouse_set_in(Window win, int in);
Window ecore_window_get_root(Window win);
void ecore_window_set_delete_inform(Window win);
void ecore_window_property_set(Window win, Atom type,
Atom format, int size,
void *data, int number);
void *ecore_window_property_get(Window win, Atom type,
Atom format, int *size);
void ecore_window_dnd_advertise(Window win);
void ecore_window_ignore(Window win);
void ecore_window_no_ignore(Window win);
int ecore_window_is_ignored(Window win);
Window ecore_window_get_at_xy(int x, int y);
int ecore_window_dnd_capable(Window win);
void ecore_window_dnd_handle_motion(Window source_win, int x,
int y, int dragging);
void ecore_window_dnd_ok(int ok);
void ecore_window_dnd_finished(void);
void ecore_window_dnd_send_status_ok(Window source_win,
Window win, int x, int y,
int w, int h);
void ecore_window_dnd_send_finished(Window source_win,
Window win);
void ecore_window_set_title(Window win, char *title);
void ecore_window_set_name_class(Window win, char *name,
char *);
void ecore_window_get_name_class(Window win, char **name,
char **name_class);
char *ecore_window_get_machine(Window win);
char *ecore_window_get_command(Window win);
char *ecore_window_get_icon_name(Window win);
void ecore_window_get_hints(Window win, int *accepts_focus,
int *initial_state,
Pixmap * icon_pixmap,
Pixmap * icon_mask,
Window * icon_window,
Window * window_group);
void ecore_window_set_min_size(Window win, int w, int h);
void ecore_window_set_max_size(Window win, int w, int h);
void ecore_window_set_xy_hints(Window win, int x, int y);
void ecore_window_get_frame_size(Window win, int *l, int *r,
int *t, int *b);
int ecore_window_save_under(Window win);
void ecore_window_hint_set_layer(Window win, int layer);
void ecore_window_hint_set_sticky(Window win, int sticky);
void ecore_window_hint_set_borderless(Window win);
int ecore_window_get_gravity(Window win);
void ecore_window_gravity_reset(Window win);
void ecore_window_gravity_set(Window win, int gravity);
void ecore_window_bit_gravity_set(Window win, int gravity);
void ecore_window_get_root_relative_location(Window win,
int *x, int *y);
void ecore_window_send_event_move_resize(Window win, int x,
int y, int w, int h);
void ecore_window_send_client_message(Window win, Atom type,
int format, void *data);
void ecore_window_add_to_save_set(Window win);
void ecore_window_del_from_save_set(Window win);
void ecore_window_kill_client(Window win);
void ecore_window_set_border_width(Window win, int bw);
int ecore_window_get_border_width(Window win);
int ecore_window_get_wm_size_hints(Window win,
XSizeHints * hints,
int *mask);
int ecore_window_is_visible(Window win);
int ecore_window_is_normal(Window win);
/**
* ecore_window_is_manageable - Returns 1 if a window can be managed by the wm.
* @win: the window for which to query.
*
* This function returns 0 if the window is unmapped, should be ignored
* by the window manager or is of the InputOnly class, 1 otherwise.
*/
int ecore_window_is_manageable(Window win);
void ecore_windows_restack(Window * wins, int num);
void ecore_window_stack_above(Window win, Window above);
void ecore_window_stack_below(Window win, Window below);
char *ecore_window_get_title(Window win);
void ecore_window_button_grab_auto_replay_set(Window win,
int (*func) (Ecore_Event_Mouse_Down *ev));
void *ecore_window_button_grab_auto_replay_get(Window win);
Window ecore_window_root(void);
void ecore_window_get_virtual_area(Window win, int *area_x,
int *area_y);
/* ---------------- PIXMAP CALLS */
Pixmap ecore_pixmap_new(Window win, int w, int h, int dep);
void ecore_pixmap_free(Pixmap pmap);
/* ---------------- POINTER CALLS */
void ecore_pointer_xy(Window win, int *x, int *y);
void ecore_pointer_xy_set(int x, int y);
void ecore_pointer_xy_get(int *x, int *y);
void ecore_pointer_warp_by(int dx, int dy);
void ecore_pointer_warp_to(int x, int y);
void ecore_pointer_replay(Time t);
void ecore_pointer_grab(Window win, Time t);
void ecore_pointer_ungrab(Time t);
/* ---------------- KEYBOARD-RELATED CALLS */
KeySym ecore_key_get_keysym_from_keycode(KeyCode keycode);
char *ecore_key_get_string_from_keycode(KeyCode keycode);
void ecore_key_grab(char *key, Ecore_Event_Key_Modifiers mods,
int anymod, int sync);
void ecore_key_ungrab(char *key,
Ecore_Event_Key_Modifiers mods,
int anymod);
KeyCode ecore_key_get_keycode(char *key);
char *ecore_keypress_translate_into_typeable(Ecore_Event_Key_Down * e);
void ecore_event_allow(int mode, Time t);
/* ---------------- LOCKS AND MODIFIER CALLS */
int ecore_lock_mask_scroll_get(void);
int ecore_lock_mask_num_get(void);
int ecore_lock_mask_caps_get(void);
void ecore_lock_scroll_set(int onoff);
int ecore_lock_scroll_get(void);
void ecore_lock_num_set(int onoff);
int ecore_lock_num_get(void);
void ecore_lock_caps_set(int onoff);
int ecore_lock_caps_get(void);
int ecore_mod_mask_shift_get(void);
int ecore_mod_mask_ctrl_get(void);
int ecore_mod_mask_alt_get(void);
int ecore_mod_mask_win_get(void);
void ecore_mod_shift_set(int onoff);
int ecore_mod_shift_get(void);
void ecore_mod_ctrl_set(int onoff);
int ecore_mod_ctrl_get(void);
void ecore_mod_alt_set(int onoff);
int ecore_mod_alt_get(void);
void ecore_mod_win_set(int onoff);
int ecore_mod_win_get(void);
int ecore_lock_mask_get(void);
int ecore_modifier_mask_get(void);
Window ecore_get_key_grab_win(void);
Display *ecore_display_get(void);
void ecore_focus_window_set(Window win);
Window ecore_focus_window_get(void);
void ecore_focus_to_window(Window win);
void ecore_focus_mode_reset(void);
Atom ecore_atom_get(char *name);
/* ---------------- GRABBING/UNGRABBING CALLS */
/**
* ecore_grab - Grabs the X server connection
*
* This function wraps XGrabServer, which prevents all other
* clients from receiving events. Calls are reference-counted.
*/
void ecore_grab(void);
/**
* ecore_ungrab - Ungrabs the X server connection
*
* This function releases the server, provided that ecore_grab()
* has been called the same number of times as ecore_ungrab().
*/
void ecore_ungrab(void);
void ecore_grab_mouse(Window win, int confine, Cursor cursor);
void ecore_ungrab_mouse(void);
Window ecore_grab_window_get(void);
void ecore_button_grab(Window win, int button, int events,
Ecore_Event_Key_Modifiers mod,
int any_mod);
void ecore_button_ungrab(Window win, int button,
Ecore_Event_Key_Modifiers mod,
int any_mod);
void ecore_keyboard_grab(Window win);
void ecore_keyboard_ungrab(void);
Window ecore_keyboard_grab_window_get(void);
/* ----------------- GRAPHICS CONTEXT AND DRAWING CALLS */
GC ecore_gc_new(Drawable d);
void ecore_gc_free(GC gc);
void ecore_gc_set_fg(GC gc, int val);
void ecore_gc_set_include_inferiors(GC gc);
void ecore_fill_rectangle(Drawable d, GC gc, int x, int y,
int w, int h);
void ecore_draw_rectangle(Drawable d, GC gc, int x, int y,
int w, int h);
void ecore_draw_line(Drawable d, GC gc, int x1, int y1, int x2,
int y2);
void ecore_draw_point(Drawable d, GC gc, int x, int y);
void ecore_area_copy(Drawable src, Drawable dest, GC gc,
int sx, int sy, int sw, int sh, int dx,
int dy);
/* ---------------- DRAG AND DROP CALLS */
int ecore_dnd_selection_convert(Window win, Window req,
Atom type);
void *ecore_dnd_selection_get(Window win, Window req, Atom type,
int *size);
void ecore_dnd_set_data(Window win);
void ecore_dnd_set_action(Window win);
void ecore_dnd_send_data(Window win, Window source_win,
void *data, int size, Atom dest_atom,
int type);
void ecore_dnd_set_mode_copy(void);
void ecore_dnd_set_mode_link(void);
void ecore_dnd_set_mode_move(void);
void ecore_dnd_set_mode_ask(void);
void ecore_dnd_own_selection(Window win);
void ecore_dnd_send_drop(Window win, Window source_win);
void ecore_get_virtual_area(int *area_x, int *area_y);
void ecore_clear_target_status(void);
/* ---------------- IPC CALLS */
void ecore_event_ipc_init(char *path);
void ecore_event_ipc_cleanup(void);
void ecore_add_ipc_service(int service, void (*func) (int fd));
void ecore_del_ipc_service(int service);
/* ---------------- SELECTION CALLS */
char *ecore_selection_get_data(Window win, Atom prop);
Window ecore_selection_request(void);
Window ecore_selection_set(char *string);
/* ---------------- CURSOR LOOK CALLS */
void ecore_set_blank_pointer(Window w);
Cursor ecore_cursor_new(Pixmap pmap, Pixmap mask, int x, int y,
int fr, int fg, int fb, int br, int bg,
int bb);
void ecore_cursor_free(Cursor c);
void ecore_cursor_set(Window win, Cursor c);
/* ---------------- EVENT-HANDLING CALLS */
void ecore_add_event(Ecore_Event_Type type, void *event,
void (*ev_free) (void *event));
void ecore_del_event(void *event);
void ecore_del_all_events(void);
Ecore_Event *ecore_get_last_event(void);
void ecore_add_event_fd(int fd, void (*func) (int fd));
void ecore_del_event_fd(int fd);
void ecore_add_event_pid(pid_t pid, void (*func) (pid_t pid));
void ecore_del_event_pid(pid_t pid);
void ecore_add_event_ipc(int ipc, void (*func) (int ipc));
void ecore_del_event_ipc(int ipc);
void ecore_event_loop(void);
void ecore_event_loop_quit(void);
void ecore_add_event_timer(char *name, double in,
void (*func) (int val, void *data),
int val, void *data);
void *ecore_del_event_timer(char *name);
void ecore_event_filter(Ecore_Event * ev);
void ecore_event_filter_events_handle(Ecore_Event * ev);
void ecore_event_filter_idle_handle(void);
/**
* ecore_event_filter_init - Setup event handlers
*
* This function initializes all ECORE_EVENT_MAX
* event handler to be empty.
*/
void ecore_event_filter_init(void);
void ecore_event_filter_handler_add(Ecore_Event_Type type,
void (*func) (Ecore_Event *ev));
void ecore_event_filter_idle_handler_add(void (*func) (void *data), void *data);
/**
* ecore_event_signal_init - Setup for default signal handlers
*
* This function initializes signal handlers for various
* signals via sigaction().
*/
void ecore_event_signal_init(void);
int ecore_event_signal_events_pending(void);
/**
* ecore_event_x_init - Ecore X initialization
*
* This function initializes Ecore's X event handling
* callbacks.
*/
void ecore_event_x_init(void);
/* ---------------- MISCELLANEOUS CALLS */
double ecore_get_time(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,12 +1,3 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = lib bin
EXTRA_DIST = \
e_ev_filter.c \
e_ev_signal.c \
e_ev_x.c \
e_events.c \
e_ipc.c \
e_util.c \
e_x.c
SUBDIRS = lib

View File

@ -1,10 +0,0 @@
.deps
.libs
Makefile
Makefile.in
ecore_config
ecore_evas_test
ecore_test
ecore_dbus_test
ecore_dbus_hal_test
ecore_dbus_receiver_test

View File

@ -1,219 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
if BUILD_ECORE_EVAS
ECORE_EVAS_LIB = $(top_builddir)/src/lib/ecore_evas/libecore_evas.la
else
ECORE_EVAS_LIB =
endif
if BUILD_ECORE_DIRECTFB
ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la
else
ECORE_DIRECTFB_LIB =
endif
if BUILD_ECORE_X
ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la
else
ECORE_X_LIB =
endif
if BUILD_ECORE_FB
ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la
else
ECORE_FB_LIB =
endif
if BUILD_ECORE_JOB
ECORE_JOB_LIB = $(top_builddir)/src/lib/ecore_job/libecore_job.la
else
ECORE_JOB_LIB =
endif
if BUILD_ECORE_CON
ECORE_CON_LIB = $(top_builddir)/src/lib/ecore_con/libecore_con.la
else
ECORE_CON_LIB =
endif
if BUILD_ECORE_IPC
ECORE_IPC_LIB = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la
else
ECORE_IPC_LIB =
endif
if BUILD_ECORE_TXT
ECORE_TXT_LIB = $(top_builddir)/src/lib/ecore_txt/libecore_txt.la
else
ECORE_TXT_LIB =
endif
if BUILD_ECORE_CONFIG
ECORE_CONFIG_LIB = $(top_builddir)/src/lib/ecore_config/libecore_config.la
else
ECORE_CONFIG_LIB =
endif
if BUILD_ECORE_DBUS
ECORE_DBUS_LIB = $(top_builddir)/src/lib/ecore_dbus/libecore_dbus.la
else
ECORE_DBUS_LIB =
endif
INCLUDES = \
-I$(top_srcdir)/src/lib/ecore \
-I$(top_srcdir)/src/lib/ecore_evas \
-I$(top_srcdir)/src/lib/ecore_directfb \
-I$(top_srcdir)/src/lib/ecore_x \
-I$(top_srcdir)/src/lib/ecore_fb \
-I$(top_srcdir)/src/lib/ecore_job \
-I$(top_srcdir)/src/lib/ecore_con \
-I$(top_srcdir)/src/lib/ecore_ipc \
-I$(top_srcdir)/src/lib/ecore_txt @iconv_cflags@ \
-I$(top_srcdir)/src/lib/ecore_config \
-I$(top_srcdir)/src/lib/ecore_dbus \
-I$(top_builddir)/src/lib/ecore \
-I$(top_builddir)/src/lib/ecore_evas \
-I$(top_builddir)/src/lib/ecore_directfb \
-I$(top_builddir)/src/lib/ecore_x \
-I$(top_builddir)/src/lib/ecore_fb \
-I$(top_builddir)/src/lib/ecore_job \
-I$(top_builddir)/src/lib/ecore_con \
-I$(top_builddir)/src/lib/ecore_ipc \
-I$(top_builddir)/src/lib/ecore_txt @iconv_cflags@ \
-I$(top_builddir)/src/lib/ecore_config \
-I$(top_builddir)/src/lib/ecore_dbus \
@EVAS_CFLAGS@ \
@x_cflags@ \
@EET_CFLAGS@ \
-DPACKAGE_BIN_DIR=\"@PACKAGE_BIN_DIR@\" \
-DPACKAGE_LIB_DIR=\"@PACKAGE_LIB_DIR@\" \
-DPACKAGE_DATA_DIR=\"@PACKAGE_DATA_DIR@\"
bin_PROGRAMS = \
ecore_test \
ecore_evas_test \
ecore_config \
ecore_dbus_test \
ecore_dbus_hal_test \
ecore_dbus_receiver_test
ecore_test_SOURCES = \
ecore_test.c
ecore_test_LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_X_LIB) \
$(ECORE_TXT_LIB) \
$(ECORE_JOB_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_EVAS_LIB) \
$(ECORE_CON_LIB) \
$(ECORE_IPC_LIB) \
-lm @iconv_libs@
ecore_test_CFLAGS = \
$(CFLAGS) \
$(INCLUDES)
ecore_test_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_X_LIB) \
$(ECORE_TXT_LIB) \
$(ECORE_JOB_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_EVAS_LIB) \
$(ECORE_CON_LIB) \
$(ECORE_IPC_LIB)
ecore_evas_test_SOURCES = \
ecore_evas_test.c \
ecore_evas_test_app.c \
ecore_evas_test_bg.c \
ecore_evas_test_calibrate.c \
ecore_evas_test.h
ecore_evas_test_LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_X_LIB) \
$(ECORE_TXT_LIB) \
$(ECORE_JOB_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_EVAS_LIB) \
$(ECORE_CON_LIB) \
$(ECORE_IPC_LIB) \
-lm @iconv_libs@
ecore_evas_test_CFLAGS = \
$(CFLAGS) \
$(INCLUDES)
ecore_evas_test_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_JOB_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_X_LIB) \
$(ECORE_EVAS_LIB) \
$(ECORE_CON_LIB) \
$(ECORE_IPC_LIB) \
$(ECORE_TXT_LIB)
ecore_config_SOURCES = \
ecore_config.c
ecore_config_LDADD = \
$(ECORE_CONFIG_LIB)
ecore_config_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_CONFIG_LIB)
ecore_dbus_test_SOURCES = \
ecore_dbus_test.c \
ecore_dbus_test.h
ecore_dbus_test_LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_DBUS_LIB)
ecore_dbus_test_CFLAGS = \
$(CFLAGS) \
$(INCLUDES)
ecore_dbus_test_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_DBUS_LIB)
ecore_dbus_hal_test_SOURCES = \
ecore_dbus_hal_test.c \
ecore_dbus_test.h
ecore_dbus_hal_test_LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_DBUS_LIB)
ecore_dbus_hal_test_CFLAGS = \
$(CFLAGS) \
$(INCLUDES)
ecore_dbus_hal_test_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_DBUS_LIB)
ecore_dbus_receiver_test_SOURCES = \
ecore_dbus_receiver_test.c \
ecore_dbus_test.h
ecore_dbus_receiver_test_LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_DBUS_LIB)
ecore_dbus_receiver_test_CFLAGS = \
$(CFLAGS) \
$(INCLUDES)
ecore_dbus_receiver_test_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_DBUS_LIB)

View File

@ -1,336 +0,0 @@
#include "config.h"
#include "Ecore.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef BUILD_ECORE_CONFIG
#include <unistd.h>
#include <getopt.h>
#include <Eet.h>
#include "Ecore_Config.h"
#include "Ecore_Data.h"
#include "ecore_config_private.h"
// strcmp for paths - for sorting folders before files
int
pathcmp(const char *s1, const char *s2)
{
char *s1d, *s2d;
// strip common part of paths
while(*s1 && *s2 && *s1 == *s2)
{
s1++;
s2++;
}
// handle /foo/bar/baz <> /foo/bar_baz properly
if (*s1 == '/' && *s2 != '/') return -1;
if (*s1 != '/' && *s2 == '/') return 1;
// skip leading /
if (*s1 == '/') s1++;
if (*s2 == '/') s2++;
// order folders before files
s1d = strchr(s1, '/');
s2d = strchr(s2, '/');
if (s1d != NULL && s2d == NULL) return -1;
if (s1d == NULL && s2d != NULL) return 1;
return strcmp(s1, s2);
}
int
del(const char *key)
{
Ecore_Config_Prop *e;
e = ecore_config_get(key);
if(e == NULL) return -1;
ecore_config_dst(e);
return 0;
}
int
get(const char *key)
{
Ecore_Config_Prop *e;
char *temp = NULL;
if (!(e = ecore_config_get(key)))
{
fprintf(stderr, "No such property\n");
return -1;
}
printf("%-10s", ecore_config_type_get(e));
switch (e->type)
{
case ECORE_CONFIG_NIL:
printf("\n");
break;
case ECORE_CONFIG_INT:
printf("%ld\n", ecore_config_int_get(key));
break;
case ECORE_CONFIG_BLN:
printf("%d\n", ecore_config_boolean_get(key));
break;
case ECORE_CONFIG_FLT:
printf("%lf\n", ecore_config_float_get(key));
break;
case ECORE_CONFIG_STR:
temp = ecore_config_string_get(key);
break;
case ECORE_CONFIG_RGB:
temp = ecore_config_argbstr_get(key);
break;
case ECORE_CONFIG_THM:
temp = ecore_config_theme_get(key);
break;
default:
fprintf(stderr, "Property has unrecognized type");
return -1;
}
if(temp)
{
printf("\"%s\"\n", temp);
free(temp);
}
return 0;
}
int
list(const char *file)
{
char *key;
Eet_File *ef;
Ecore_Config_Prop *e;
Ecore_Sheap *keys;
// Get number of keys and create heap for sort
ef = eet_open(file, EET_FILE_MODE_READ);
if (!ef) return -1;
keys = ecore_sheap_new(ECORE_COMPARE_CB(pathcmp), eet_num_entries(ef));
eet_close(ef);
e = __ecore_config_bundle_local->data;
do
{
// don't show system settings
if( !(e->flags & ECORE_CONFIG_FLAG_SYSTEM) )
ecore_sheap_insert(keys, e->key);
}
while((e = e->next));
while((key = ecore_sheap_extract(keys)))
{
printf("%-28s\t", key);
get(key);
}
ecore_sheap_destroy(keys);
return 0;
}
void
usage_and_exit(const char *prog, int ret, const char *msg)
{
if (msg) fprintf(stderr, "%s\n\n", msg);
fprintf(stderr, "Usage: %s <options> <command>\n", prog);
fprintf(stderr, "Modify ecore_config files\n\n");
fprintf(stderr, "Options:\n");
fprintf(stderr, " -c, --file=FILE config file\n");
fprintf(stderr, " -k, --key=KEY must be given for all commands except -a\n\n");
fprintf(stderr, "Commands:\n");
fprintf(stderr, " -a, --list get all keys\n");
fprintf(stderr, " -g, --get get key\n");
fprintf(stderr, " -d, --del delete key\n");
fprintf(stderr, " -b, --bool=VALUE set boolean\n");
fprintf(stderr, " -f, --float=VALUE set float\n");
fprintf(stderr, " -i, --int=VALUE set integer\n");
fprintf(stderr, " -r, --rgb=VALUE set RGBA\n");
fprintf(stderr, " -s, --string=VALUE set string\n");
fprintf(stderr, " -t, --theme=VALUE set theme\n\n");
exit(ret);
}
int
main(int argc, char * const argv[])
{
char *prog, *file, *key;
void *value = (void *)NULL;
char cmd = 's';
int type = -1;
int ret = 0;
long i;
float f;
file = key = prog = NULL;
prog = strdup(argv[0]);
if(argc < 4)
usage_and_exit(prog, 2, NULL);
while(1)
{
static struct option long_options[] = {
{"file", 1, 0, 'c'},
{"list", 0, 0, 'a'},
{"get", 0, 0, 'g'},
{"del", 0, 0, 'd'},
{"bool", 1, 0, 'b'},
{"float", 1, 0, 'f'},
{"int", 1, 0, 'i'},
{"rgb", 1, 0, 'r'},
{"string", 1, 0, 's'},
{"theme", 1, 0, 't'},
{"key", 1, 0, 'k'},
{0, 0, 0, 0}
};
ret = getopt_long(argc, argv, "c:agdb:f:i:r:s:t:k:", long_options, NULL);
if(ret == -1)
break;
switch(ret)
{
case 'k':
key = strdup(optarg);
break;
case 'n':
if(value)
usage_and_exit(prog, 2, "too many commands");
type = ECORE_CONFIG_NIL;
value = NULL;
break;
case 'b':
if(value)
usage_and_exit(prog, 2, "too many commands");
type = ECORE_CONFIG_BLN;
i = atoi(optarg);
value = &i;
break;
case 'i':
if(value)
usage_and_exit(prog, 2, "too many commands");
type = ECORE_CONFIG_INT;
i = atoi(optarg);
value = &i;
break;
case 'f':
if(value)
usage_and_exit(prog, 2, "too many commands");
type = ECORE_CONFIG_FLT;
f = atof(optarg);
value = &f;
break;
case 'r':
if(value)
usage_and_exit(prog, 2, "too many commands");
type = ECORE_CONFIG_RGB;
i = (long) strtoul( (*optarg == '#') ? (optarg + 1) : optarg, NULL, 16 );
value = &i;
break;
case 's':
if(value)
usage_and_exit(prog, 2, "too many commands");
type = ECORE_CONFIG_STR;
value = strdup(optarg);
break;
case 't':
if(value)
usage_and_exit(prog, 2, "too many commands");
type = ECORE_CONFIG_THM;
value = strdup(optarg);
break;
case 'c':
if(file)
free(file);
file = strdup(optarg);
break;
case '?':
case ':':
return 1;
default:
cmd = ret;
break;
}
}
if(cmd == 's' && type == -1)
usage_and_exit(prog, 2, "You need to specify a command!");
if(cmd != 'a' && key == NULL)
usage_and_exit(prog, 2, "You need to specify key!");
if(ecore_config_init("econfig") != ECORE_CONFIG_ERR_SUCC)
{
fprintf(stderr, "Couldn't init ecore_config!");
return 1;
}
// Load configuration from file
ecore_config_file_load(file);
ret = 0;
// Execute command
switch (cmd)
{
case 's':
if (ecore_config_typed_set(key, value, type) != ECORE_CONFIG_ERR_SUCC)
{
fprintf(stderr, "Set failed for %s", key);
ret = 1;
} else {
ecore_config_file_save(file);
}
get(key); // display value after setting it
break;
case 'd':
if(del(key))
{
fprintf(stderr, "Delete failed for %s", key);
ret = 1;
} else {
ecore_config_file_save(file);
}
break;
case 'g':
if (get(key)) ret = 1;
break;
case 'a':
if (list(file)) ret = 1;
break;
default:
printf("Unhandled command '%c'\n", cmd);
}
ecore_config_shutdown();
if(type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM)
free(value);
if(file)
free(file);
return ret;
}
#else
int
main(int argc, const char **argv)
{
printf("Ecore_config module not compiled. This program is empty.\n");
return -1;
}
#endif

View File

@ -1,170 +0,0 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_dbus_test.h"
#ifdef BUILD_ECORE_DBUS
static int ecore_dbus_event_server_add(void *udata, int ev_type, void *ev);
static int ecore_dbus_event_server_del(void *udata, int ev_type, void *ev);
static void ecore_dbus_method_name_has_owner_cb(void *data, Ecore_DBus_Method_Return *reply);
static void ecore_dbus_method_add_match_cb(void *data, Ecore_DBus_Method_Return *reply);
static void ecore_dbus_method_error_cb(void *data, const char *error);
static int ecore_dbus_event_server_signal(void *udata, int ev_type, void *ev);
static const char *event_type_get(Ecore_DBus_Message_Type type);
static Ecore_DBus_Server *svr = NULL;
int
main(int argc, char **argv)
{
ecore_dbus_init();
svr = ecore_dbus_server_system_connect(NULL);
if (!svr)
{
printf("Couldn't connect to dbus system server!\n");
}
else
{
int i = 0;
Ecore_Event_Handler *handler[3];
printf("Connected!\n");
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_ADD,
ecore_dbus_event_server_add, NULL);
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_DEL,
ecore_dbus_event_server_del, NULL);
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SIGNAL,
ecore_dbus_event_server_signal, NULL);
ecore_main_loop_begin();
for (i = 0; i < 3; i++)
ecore_event_handler_del(handler[i]);
if (svr) ecore_dbus_server_del(svr);
}
ecore_dbus_shutdown();
return 0;
}
static int
ecore_dbus_event_server_add(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Server_Add *event;
event = ev;
printf("ecore_dbus_event_server_add\n");
ecore_dbus_method_name_has_owner(event->server, "org.freedesktop.Hal",
ecore_dbus_method_name_has_owner_cb,
ecore_dbus_method_error_cb, NULL);
return 0;
}
static int
ecore_dbus_event_server_del(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Server_Del *event;
event = ev;
printf("ecore_dbus_event_server_del\n");
svr = NULL;
ecore_main_loop_quit();
return 0;
}
static void
ecore_dbus_method_name_has_owner_cb(void *data, Ecore_DBus_Method_Return *reply)
{
unsigned int *exists;
printf("ecore_dbus_event_server_method_return %s %s.%s\n", event_type_get(reply->type),
reply->header.interface,
reply->header.member);
exists = reply->args[0].value;
if ((!exists) || (!*exists))
{
printf("No hal\n");
ecore_main_loop_quit();
}
else
{
printf("Add listener for devices\n");
ecore_dbus_method_add_match(reply->server,
"type='signal',"
"interface='org.freedesktop.Hal.Manager',"
"sender='org.freedesktop.Hal',"
"path='/org/freedesktop/Hal/Manager'",
ecore_dbus_method_add_match_cb,
ecore_dbus_method_error_cb, NULL);
}
}
static void
ecore_dbus_method_add_match_cb(void *data, Ecore_DBus_Method_Return *reply)
{
printf("ecore_dbus_event_server_method_return %s %s.%s\n", event_type_get(reply->type),
reply->header.interface,
reply->header.member);
printf("Should be listening for device changes!\n");
}
static void
ecore_dbus_method_error_cb(void *data, const char *error)
{
printf("Error: %s\n", error);
ecore_main_loop_quit();
}
static int
ecore_dbus_event_server_signal(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Signal *event;
event = ev;
printf("ecore_dbus_event_server_signal %s %s.%s\n", event_type_get(event->type),
event->header.interface,
event->header.member);
if (!strcmp(event->header.member, "DeviceAdded"))
{
printf("Device added: %s\n", (char *)event->args[0].value);
}
else if (!strcmp(event->header.member, "DeviceRemoved"))
{
printf("Device removed: %s\n", (char *)event->args[0].value);
}
return 0;
}
static const char *
event_type_get(Ecore_DBus_Message_Type type)
{
switch (type)
{
case ECORE_DBUS_MESSAGE_TYPE_INVALID:
return "ECORE_DBUS_MESSAGE_TYPE_INVALID";
case ECORE_DBUS_MESSAGE_TYPE_METHOD_CALL:
return "ECORE_DBUS_MESSAGE_TYPE_CALL";
case ECORE_DBUS_MESSAGE_TYPE_METHOD_RETURN:
return "ECORE_DBUS_MESSAGE_TYPE_RETURN";
case ECORE_DBUS_MESSAGE_TYPE_ERROR:
return "ECORE_DBUS_MESSAGE_TYPE_ERROR";
case ECORE_DBUS_MESSAGE_TYPE_SIGNAL:
return "ECORE_DBUS_MESSAGE_TYPE_SIGNAL";
}
return "UNKNOWN";
}
#else
int
main(int argc, const char **argv)
{
printf("Ecore_DBus module not compiled. This program is empty.\n");
return -1;
}
#endif

View File

@ -1,152 +0,0 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_dbus_test.h"
#ifdef BUILD_ECORE_DBUS
static int ecore_dbus_event_server_add(void *udata, int ev_type, void *ev);
static int ecore_dbus_event_server_del(void *udata, int ev_type, void *ev);
static int ecore_dbus_event_method_call(void *udata, int ev_type, void *ev);
static void ecore_dbus_method_error_cb(void *data, const char *error);
static void _test_object_init(Ecore_DBus_Server *svr);
static Ecore_DBus_Server *svr = NULL;
int
main(int argc, char **argv)
{
ecore_dbus_init();
svr = ecore_dbus_server_session_connect(NULL);
if (!svr)
{
printf("Couldn't connect to dbus system server!\n");
}
else
{
int i = 0;
Ecore_Event_Handler *handler[3];
printf("Connected!\n");
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_ADD,
ecore_dbus_event_server_add, NULL);
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_DEL,
ecore_dbus_event_server_del, NULL);
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_METHOD_CALL,
ecore_dbus_event_method_call, NULL);
ecore_main_loop_begin();
for (i = 0; i < 2; i++)
ecore_event_handler_del(handler[i]);
if (svr) ecore_dbus_server_del(svr);
}
ecore_dbus_shutdown();
return 0;
}
static int
ecore_dbus_event_server_add(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Server_Add *event;
event = ev;
printf("ecore_dbus_event_server_add\n");
ecore_dbus_method_request_name(event->server, "org.enlightenment.Test", 0, NULL, ecore_dbus_method_error_cb, NULL);
_test_object_init(event->server);
return 0;
}
static int
ecore_dbus_event_method_call(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Method_Call *event;
event = ev;
printf("ecore_dbus_event_method_call\n");
return 1;
}
static int
ecore_dbus_event_server_del(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Server_Del *event;
event = ev;
printf("ecore_dbus_event_server_del\n");
svr = NULL;
ecore_main_loop_quit();
return 0;
}
static void
ecore_dbus_method_error_cb(void *data, const char *error)
{
printf("Error: %s\n", error);
ecore_main_loop_quit();
}
static void
_test_object_test(void *data, Ecore_DBus_Event_Method_Call *event)
{
Ecore_DBus_Message *msg;
unsigned int *i;
char *s1, *s2;
Ecore_List *l;
int first;
printf("received call to test!\n");
msg = event->message;
i = (unsigned int *)ecore_dbus_message_body_field_get(msg, 0);
s1 = (char *)ecore_dbus_message_body_field_get(msg, 1);
l = (Ecore_List *)ecore_dbus_message_body_field_get(msg, 2);
s2 = (char *)ecore_dbus_message_body_field_get(msg, 3);
if (!i || !s1 || !l || !s2)
{
/* XXX reply with error */
return;
}
printf(" params: i = %d, s1 = \"%s\", l = (", i ? *i : 0, s1);
ecore_list_goto_first(l);
first = 1;
while((i = ecore_list_next(l)))
{
if (!first) printf(", ");
else first = 0;
printf("%d", i ? *i : 0);
}
printf("), s2: %s\n", s2);
}
static void
_test_object_init(Ecore_DBus_Server *svr)
{
Ecore_DBus_Object *obj;
printf("init object!\n");
if (!svr) return;
obj = ecore_dbus_object_add(svr, "/org/enlightenment/test");
ecore_dbus_object_method_add(obj, "org.enlightenment.Test", "Test", _test_object_test, NULL);
}
#else
int
main(int argc, const char **argv)
{
printf("Ecore_DBus module not compiled. This program is empty.\n");
return -1;
}
#endif

View File

@ -1,192 +0,0 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_dbus_test.h"
#ifdef BUILD_ECORE_DBUS
static int ecore_dbus_event_server_add(void *udata, int ev_type, void *ev);
static int ecore_dbus_event_server_del(void *udata, int ev_type, void *ev);
static void ecore_dbus_method_list_names_cb(void *data, Ecore_DBus_Method_Return *reply);
static void ecore_dbus_method_test_cb(void *data, Ecore_DBus_Method_Return *reply);
static void ecore_dbus_method_error_cb(void *data, const char *error);
static const char *event_type_get(Ecore_DBus_Message_Type type);
static void _test_type_length();
static Ecore_DBus_Server *svr = NULL;
int
main(int argc, char **argv)
{
ecore_dbus_init();
_test_type_length();
svr = ecore_dbus_server_session_connect(NULL);
if (!svr)
{
printf("Couldn't connect to dbus session server!\n");
}
else
{
int i = 0;
Ecore_Event_Handler *handler[3];
printf("Connected!\n");
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_ADD,
ecore_dbus_event_server_add, NULL);
handler[i++] = ecore_event_handler_add(ECORE_DBUS_EVENT_SERVER_DEL,
ecore_dbus_event_server_del, NULL);
ecore_main_loop_begin();
for (i = 0; i < 2; i++)
ecore_event_handler_del(handler[i]);
if (svr) ecore_dbus_server_del(svr);
}
ecore_dbus_shutdown();
return 0;
}
static int
ecore_dbus_event_server_add(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Server_Add *event;
Ecore_List *ids;
int i;
event = ev;
printf("ecore_dbus_event_server_add\n");
ecore_dbus_method_list_names(event->server,
ecore_dbus_method_list_names_cb,
ecore_dbus_method_error_cb, NULL);
ids = ecore_list_new();
ecore_list_set_free_cb(ids, free);
for(i = 0; i < 5; i++)
{
unsigned int *id;
id = malloc(sizeof(int));
*id = i * 2;
ecore_list_append(ids, id);
}
ecore_dbus_message_new_method_call(event->server,
"/org/enlightenment/test" /*path*/,
"org.enlightenment.Test" /*interface*/,
"Test" /*method*/,
"org.enlightenment.Test" /*destination*/,
ecore_dbus_method_test_cb,
ecore_dbus_method_error_cb, NULL,
"usaus" /*fmt*/,
5, "hello", ids, "goodbye");
ecore_list_destroy(ids);
return 0;
}
static int
ecore_dbus_event_server_del(void *udata, int ev_type, void *ev)
{
Ecore_DBus_Event_Server_Del *event;
event = ev;
printf("ecore_dbus_event_server_del\n");
svr = NULL;
ecore_main_loop_quit();
return 0;
}
static void
ecore_dbus_method_test_cb(void *data,
Ecore_DBus_Method_Return *reply)
{
printf("test reply cb\n");
}
static void
ecore_dbus_method_list_names_cb(void *data,
Ecore_DBus_Method_Return *reply)
{
Ecore_List *names;
printf("ecore_dbus_event_server_data %s %s.%s\n", event_type_get(reply->type),
reply->header.interface,
reply->header.member);
names = reply->args[0].value;
printf("Got names %c\n", reply->args[0].type);
if (names)
{
char *name;
ecore_list_goto_first(names);
while ((name = ecore_list_next(names)))
{
printf("Name: %s\n", name);
}
ecore_list_destroy(names);
}
ecore_main_loop_quit();
}
static void
ecore_dbus_method_error_cb(void *data, const char *error)
{
printf("Error: %s\n", error);
ecore_main_loop_quit();
}
static const char *
event_type_get(Ecore_DBus_Message_Type type)
{
switch (type)
{
case ECORE_DBUS_MESSAGE_TYPE_INVALID:
return "ECORE_DBUS_MESSAGE_TYPE_INVALID";
case ECORE_DBUS_MESSAGE_TYPE_METHOD_CALL:
return "ECORE_DBUS_MESSAGE_TYPE_CALL";
case ECORE_DBUS_MESSAGE_TYPE_METHOD_RETURN:
return "ECORE_DBUS_MESSAGE_TYPE_RETURN";
case ECORE_DBUS_MESSAGE_TYPE_ERROR:
return "ECORE_DBUS_MESSAGE_TYPE_ERROR";
case ECORE_DBUS_MESSAGE_TYPE_SIGNAL:
return "ECORE_DBUS_MESSAGE_TYPE_SIGNAL";
}
return "UNKNOWN";
}
//int _ecore_dbus_complete_type_length(const char *);
static void
_test_type_length()
{
#define _NUM_TYPES 4
struct { char *type; int len; } types[_NUM_TYPES] = {
{ "us", 1 },
{ "ads", 2 },
{ "a(a(ai))su", 8 },
{ "a{ss}u", 5 }
};
int i;
printf("Test type length\n---------------\n");
for (i = 0; i < _NUM_TYPES; i++)
{
int len = _ecore_dbus_complete_type_length_get(types[i].type);
printf("\"%s\" => %d (expected %d) %s\n", types[i].type, len, types[i].len, len == types[i].len ? "PASS" : "FAIL");
}
printf("---------------\n");
}
#else
int
main(int argc, const char **argv)
{
printf("Ecore_DBus module not compiled. This program is empty.\n");
return -1;
}
#endif

View File

@ -1,18 +0,0 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifndef _ECORE_DBUS_TEST_H
#define _ECORE_DBUS_TEST_H
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef BUILD_ECORE_DBUS
#include "Ecore.h"
#include "Ecore_Data.h"
#include "Ecore_DBus.h"
#endif
#endif

View File

@ -1,27 +0,0 @@
#include "ecore_evas_test.h"
#ifdef BUILD_ECORE_EVAS
int
main(int argc, const char **argv)
{
if (app_start(argc, argv) < 1) return -1;
bg_start();
calibrate_start();
ecore_main_loop_begin();
app_finish();
return 0;
}
#else
int
main(int argc, const char **argv)
{
printf("Ecore_evas module not compiled. This program is empty.\n");
return -1;
}
#endif

View File

@ -1,39 +0,0 @@
#ifndef _ECORE_EVAS_TEST_H
#define _ECORE_EVAS_TEST_H
#include "config.h"
#include "Ecore.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef BUILD_ECORE_EVAS
#include "Ecore_Evas.h"
#include "Ecore_Fb.h"
#define IM PACKAGE_DATA_DIR"/images/"
#define PT PACKAGE_DATA_DIR"/pointers/"
#define FN PACKAGE_DATA_DIR"/fonts/"
extern double start_time;
extern Ecore_Evas *ee;
extern Evas *evas;
void calibrate_pos_set(int pos);
int calibrate_pos_get(void);
void calibrate_finish(void);
void calibrate_start(void);
void bg_resize(double w, double h);
void bg_start(void);
void bg_go(void);
int app_start(int argc, const char **argv);
void app_finish(void);
#endif
#endif

View File

@ -1,184 +0,0 @@
#include "ecore_evas_test.h"
#ifdef BUILD_ECORE_EVAS
double start_time = 0.0;
Ecore_Evas *ee = NULL;
Evas *evas = NULL;
Ecore_Idle_Enterer *getpix_handler = NULL;
static void app_resize(Ecore_Evas *ee);
static int app_signal_exit(void *data, int ev_type, void *ev);
static void app_delete_request(Ecore_Evas *ee);
static int
getpix_cb(void *data)
{
const int *pix;
int p;
int w, h;
FILE *f;
int x, y;
static int count = 0;
char buf[256];
unsigned char *line;
pix = ecore_evas_buffer_pixels_get(ee);
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
snprintf(buf, sizeof(buf), "out%04i.ppm", count);
count++;
f = fopen(buf, "wb");
if (f)
{
line = malloc(w * 4);
fprintf(f, "P6\n%i %i\n255\n", w, h);
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
p = pix[(y * w) + x];
line[(x * 3) + 0] = ((p >> 16) & 0xff);
line[(x * 3) + 1] = ((p >> 8 ) & 0xff);
line[(x * 3) + 2] = ((p ) & 0xff);
/* line[(x * 3) + 3] = ((p >> 24) & 0xff);*/
}
fwrite(line, w * 3, 1, f);
}
free(line);
fclose(f);
}
return 1;
}
int
app_start(int argc, const char **argv)
{
/* init the app */
start_time = ecore_time_get();
ecore_init();
ecore_app_args_set(argc, argv);
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, app_signal_exit, NULL);
/* create an evas */
if (!ecore_evas_init()) return -1;
if ((argc > 1) && (!strcmp(argv[1], "-fb")))
{
ee = ecore_evas_fb_new(NULL, 0, 240, 320);
evas = ecore_evas_get(ee);
}
else if ((argc > 1) && (!strcmp(argv[1], "-x")))
{
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 240, 320);
evas = ecore_evas_get(ee);
}
else if ((argc > 1) && (!strcmp(argv[1], "-xr")))
{
ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 240, 320);
evas = ecore_evas_get(ee);
}
else if ((argc > 1) && (!strcmp(argv[1], "-gl")))
{
ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 240, 320);
evas = ecore_evas_get(ee);
}
else if ((argc > 1) && (!strcmp(argv[1], "-dfb")))
{
ee = ecore_evas_directfb_new(NULL, 0, 0, 0, 240, 320);
evas = ecore_evas_get(ee);
}
else if ((argc > 1) && (!strcmp(argv[1], "-buf")))
{
ee = ecore_evas_buffer_new(240, 320);
evas = ecore_evas_get(ee);
getpix_handler = ecore_idle_enterer_add(getpix_cb, NULL);
}
else if ((argc > 1) && (!strcmp(argv[1], "-buf2")))
{
Evas_Object *o;
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 240, 320);
o = evas_object_rectangle_add(ecore_evas_get(ee));
evas_object_move(o, 0, 0);
evas_object_resize(o, 240, 320);
evas_object_color_set(o, 150, 200, 250, 255);
evas_object_show(o);
o = ecore_evas_object_image_new(ee);
evas = ecore_evas_get(evas_object_data_get(o, "Ecore_Evas"));
evas_object_move(o, 50, 50);
evas_object_resize(o, 120, 160);
evas_object_image_fill_set(o, 0, 0, 120, 160);
evas_object_image_size_set(o, 240, 320);
ecore_evas_resize(evas_object_data_get(o, "Ecore_Evas"), 240, 320);
evas_object_color_set(o, 255, 255, 255, 200);
evas_object_show(o);
}
else if ((argc > 1) && (!strcmp(argv[1], "-h")))
{
printf("%s -x Test ecore_evas in X (default)\n"
"%s -xr Test ecore_evas in XRender\n"
"%s -gl Test ecore_evas in X GL\n"
"%s -dfb Test ecore_evas in DirectFB\n"
"%s -fb Test ecore_evas in the Framebuffer\n"
"%s -buf Test ecore_evas in the Buffer\n"
"%s -buf2 Test ecore_evas in the Image Buffer\n"
"%s -h Display this help\n",
argv[0], argv[0], argv[0], argv[0], argv[0], argv[0], argv[0], argv[0]);
ecore_evas_shutdown();
ecore_shutdown();
return 0;
}
else {
#ifdef BUILD_ECORE_X
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 240, 320);
#else
#ifdef BUILD_ECORE_FB
ee = ecore_evas_fb_new(NULL, 270, 240, 320);
#endif
#endif
evas = ecore_evas_get(ee);
}
if (!ee) return -1;
ecore_evas_callback_delete_request_set(ee, app_delete_request);
ecore_evas_callback_resize_set(ee, app_resize);
ecore_evas_title_set(ee, "Ecore Evas Test");
ecore_evas_name_class_set(ee, "ecore_test", "test_evas");
ecore_evas_show(ee);
evas_image_cache_set(evas, 8192 * 1024);
evas_font_cache_set(evas, 512 * 1024);
evas_font_path_append(evas, FN);
return 1;
}
void
app_finish(void)
{
ecore_evas_shutdown();
ecore_shutdown();
}
static void
app_resize(Ecore_Evas *ee)
{
Evas_Coord w, h;
evas_output_viewport_get(evas, NULL, NULL, &w, &h);
bg_resize(w, h);
}
static int
app_signal_exit(void *data, int ev_type, void *ev)
{
ecore_main_loop_quit();
return 1;
}
static void
app_delete_request(Ecore_Evas *ee)
{
ecore_main_loop_quit();
}
#endif

View File

@ -1,453 +0,0 @@
#include "ecore_evas_test.h"
#ifdef BUILD_ECORE_EVAS
Evas_Object *o_bg_rect = NULL;
Evas_Object *o_logo = NULL;
Ecore_Timer *anim_timer = NULL;
#define NUM 32
#define SIZE 32
#define SLIDE 80
Evas_Object *o_ball[NUM];
Evas_Object *o_shad[NUM];
Evas_Object *o_clip = NULL;
Evas_Object *o_bar[2];
Evas_Object *o_bar_shad_1[3];
Evas_Object *o_bar_shad_2[2];
Evas_Object *o_bg = NULL;
static int bg_animate_obj_timer(void *data);
static void bg_cb_key_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void bg_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
void
bg_resize(double w, double h)
{
evas_object_resize(o_bg_rect, w, h);
evas_object_move(o_logo, (w - 240) / 2, (h - 280) / 2);
bg_animate_obj_timer(NULL);
}
void
bg_start(void)
{
Evas_Object *o;
/* set up a big white rectangle on the bg */
o = evas_object_rectangle_add(evas);
evas_object_color_set(o, 255, 255, 255, 255);
evas_object_move(o, 0, 0);
evas_object_resize(o, 240, 320);
evas_object_layer_set(o, -1000000);
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, bg_cb_key_down, ee);
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_UP, bg_cb_key_up, ee);
evas_object_focus_set(o, 1);
evas_object_show(o);
o_bg_rect = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"e_logo.png", NULL);
evas_object_resize(o, 240, 280);
evas_object_image_fill_set(o, 0, 0, 240, 280);
evas_object_move(o, (240 - 240) / 2, (320 - 280) / 2);
evas_object_layer_set(o, -999);
evas_object_pass_events_set(o, 1);
evas_object_show(o);
o_logo = o;
o = evas_object_rectangle_add(evas);
evas_object_color_set(o, 255, 255, 255, 255);
evas_object_resize(o, 240, 0);
evas_object_pass_events_set(o, 1);
evas_object_show(o);
o_clip = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bg.png", NULL);
evas_object_resize(o, 240, 320);
evas_object_image_fill_set(o, 0, 0, 240, 320);
evas_object_layer_set(o, -9999);
evas_object_move(o, 0, 0);
evas_object_clip_set(o, o_clip);
evas_object_pass_events_set(o, 1);
evas_object_show(o);
o_bg = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bar.png", NULL);
evas_object_image_border_set(o, 5, 5, 5, 5);
evas_object_resize(o, 240, 32);
evas_object_image_fill_set(o, 0, 0, 240, 32);
evas_object_layer_set(o, 100);
evas_object_pass_events_set(o, 1);
o_bar[0] = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bar.png", NULL);
evas_object_image_border_set(o, 5, 5, 5, 5);
evas_object_resize(o, 240, 32);
evas_object_image_fill_set(o, 0, 0, 240, 32);
evas_object_layer_set(o, 100);
evas_object_pass_events_set(o, 1);
o_bar[1] = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bar_shad_above.png", NULL);
evas_object_resize(o, 240, 8);
evas_object_image_fill_set(o, 0, 0, 240, 8);
evas_object_image_smooth_scale_set(o, 0);
evas_object_layer_set(o, 100);
evas_object_pass_events_set(o, 1);
o_bar_shad_1[0] = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bar_shad_below.png", NULL);
evas_object_resize(o, 240, 32);
evas_object_image_fill_set(o, 0, 0, 240, 32);
evas_object_image_smooth_scale_set(o, 0);
evas_object_layer_set(o, -100);
evas_object_pass_events_set(o, 1);
evas_object_clip_set(o, o_clip);
o_bar_shad_1[1] = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bar_shad_below.png", NULL);
evas_object_resize(o, 240, 16);
evas_object_image_fill_set(o, 0, 0, 240, 16);
evas_object_image_smooth_scale_set(o, 0);
evas_object_layer_set(o, 100);
evas_object_pass_events_set(o, 1);
evas_object_clip_set(o, o_clip);
o_bar_shad_1[2] = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bar_shad_above.png", NULL);
evas_object_resize(o, 240, 8);
evas_object_image_fill_set(o, 0, 0, 240, 8);
evas_object_image_smooth_scale_set(o, 0);
evas_object_layer_set(o, 100);
evas_object_pass_events_set(o, 1);
evas_object_clip_set(o, o_clip);
o_bar_shad_2[0] = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"bar_shad_below.png", NULL);
evas_object_resize(o, 240, 8);
evas_object_image_fill_set(o, 0, 0, 240, 8);
evas_object_image_smooth_scale_set(o, 0);
evas_object_layer_set(o, 100);
evas_object_pass_events_set(o, 1);
o_bar_shad_2[1] = o;
{
int i;
for (i = 0; i < NUM; i++)
{
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"ball.png", NULL);
evas_object_resize(o, SIZE, SIZE);
evas_object_image_fill_set(o, 0, 0, SIZE, SIZE);
evas_object_move(o, 0, 0);
evas_object_pass_events_set(o, 1);
evas_object_clip_set(o, o_clip);
o_ball[i] = o;
o = evas_object_image_add(evas);
evas_object_image_file_set(o, IM"shadow.png", NULL);
evas_object_resize(o, SIZE, SIZE);
evas_object_image_fill_set(o, 0, 0, SIZE, SIZE);
evas_object_move(o, 0, 0);
evas_object_pass_events_set(o, 1);
evas_object_clip_set(o, o_clip);
evas_object_lower(o);
o_shad[i] = o;
}
}
}
void
bg_go(void)
{
/* add a timer to animate them */
anim_timer = ecore_timer_add(0.01, bg_animate_obj_timer, NULL);
}
static int
bg_animate_obj_timer(void *data)
{
Evas_Object *o;
Evas_Coord x, y, sx, sy;
Evas_Coord w, h;
double v;
int ow, oh;
double t;
int l, m, n;
int i;
static double t_first = 0;
static int done = 0;
t = ecore_time_get() - start_time;
if (t_first == 0) t_first = t;
if (t - t_first > 2.0) done = 1;
evas_output_viewport_get(evas_object_evas_get(o_clip), NULL, NULL, &w, &h);
if (!done)
{
v = ((cos(((t - t_first) / 2) * 3.14159) - 1.0) / -2);
l = (SLIDE) * v;
}
else
{
l = SLIDE;
}
evas_object_move(o_bar[0], 0, (h / 2) - 32 - l);
evas_object_move(o_bar[1], 0, (h / 2) + l);
evas_object_move(o_bar_shad_1[0], 0, (h / 2) - 32 - l - 8);
evas_object_move(o_bar_shad_1[1], 0, (h / 2) - l);
evas_object_move(o_bar_shad_1[2], 0, (h / 2) - l);
evas_object_move(o_bar_shad_2[0], 0, (h / 2) + l - 8);
evas_object_move(o_bar_shad_2[1], 0, (h / 2) + 32 + l);
evas_object_resize(o_bar[0], w, 32);
evas_object_image_fill_set(o_bar[0], 0, 0, w, 32);
evas_object_resize(o_bar[1], w, 32);
evas_object_image_fill_set(o_bar[1], 0, 0, w, 32);
evas_object_resize(o_bar_shad_1[0], w, 8);
evas_object_image_fill_set(o_bar_shad_1[0], 0, 0, w, 8);
evas_object_resize(o_bar_shad_1[1], w, 32);
evas_object_image_fill_set(o_bar_shad_1[1], 0, 0, w, 32);
evas_object_resize(o_bar_shad_1[2], w, 16);
evas_object_image_fill_set(o_bar_shad_1[2], 0, 0, w, 16);
evas_object_resize(o_bar_shad_2[0], w, 8);
evas_object_image_fill_set(o_bar_shad_2[0], 0, 0, w, 8);
evas_object_resize(o_bar_shad_2[1], w, 8);
evas_object_image_fill_set(o_bar_shad_2[1], 0, 0, w, 8);
evas_object_move(o_clip, 0, (h / 2) - l);
evas_object_resize(o_clip, w, l * 2);
evas_object_resize(o_bg, w, h);
evas_object_image_fill_set(o_bg, 0, 0, w, h);
evas_object_show(o_bar[0]);
evas_object_show(o_bar[1]);
evas_object_show(o_bar_shad_1[0]);
evas_object_show(o_bar_shad_1[1]);
evas_object_show(o_bar_shad_1[2]);
evas_object_show(o_bar_shad_2[0]);
evas_object_show(o_bar_shad_2[1]);
for (i = 0; i < NUM; i++)
{
o = o_ball[i];
evas_output_viewport_get(evas_object_evas_get(o), NULL, NULL, &w, &h);
l = ((int)o / 179) & 0x0f;
v = (sin(t * (double)l / 12) + 1.0) / 2;
v = 0.25 + (0.75 * v);
m = 1 + (((int)o / 36) & 0x0f);
n = 1 + (((int)o / 763) & 0x0f);
ow = SIZE * v;
oh = SIZE * v;
evas_object_resize(o, ow, oh);
evas_object_image_fill_set(o, 0, 0, ow, oh);
x = sin(t * (double)m / 12) * ((w - ow) / 2);
y = sin(t * (double)n / 12) * ((h - oh) / 2);
evas_object_move(o, (w / 2) - (ow / 2) + x, (h / 2) - (oh / 2) + y);
evas_object_show(o);
o = o_shad[i];
evas_object_resize(o, ow, oh);
evas_object_image_fill_set(o, 0, 0, ow, oh);
sx = v * (((w - ow) / 2) + x) / 8;
sy = v * (((h - oh) / 2) + y) / 8;
evas_object_move(o,
(w / 2) - (ow / 2) + x + sx,
(h / 2) - (oh / 2) + y + sy);
evas_object_show(o);
}
return 1;
}
/* NB: on ipaq
*
* "F1" "F2" "F3" "F4"
* "Up"
* "Left" "Return" "Right"
* "Down"
*
*/
static void
bg_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev;
ev = event_info;
printf("DOWN %s\n", ev->keyname);
if (!strcmp(ev->keyname, "Escape")) ecore_main_loop_quit();
if (!strcmp(ev->keyname, "q")) ecore_main_loop_quit();
if (!strcmp(ev->keyname, "Q")) ecore_main_loop_quit();
if ((!strcmp(ev->keyname, "f")) ||
(!strcmp(ev->keyname, "F1")))
{
if (!ecore_evas_fullscreen_get(ee))
ecore_evas_fullscreen_set(ee, 1);
else
ecore_evas_fullscreen_set(ee, 0);
}
if (!strcmp(ev->keyname, "o"))
{
if (!ecore_evas_override_get(ee))
ecore_evas_override_set(ee, 1);
else
ecore_evas_override_set(ee, 0);
}
if ((!strcmp(ev->keyname, "r")) ||
(!strcmp(ev->keyname, "F4")))
{
int r;
r = ecore_evas_rotation_get(ee);
if (r == 0) r = 90;
else if (r == 90) r = 270;
else if (r == 270) r = 0;
ecore_evas_rotation_set(ee, r);
}
if (!strcmp(ev->keyname, "b"))
{
if (!ecore_evas_borderless_get(ee))
ecore_evas_borderless_set(ee, 1);
else
ecore_evas_borderless_set(ee, 0);
}
if (!strcmp(ev->keyname, "d"))
{
if (!ecore_evas_avoid_damage_get(ee))
ecore_evas_avoid_damage_set(ee, 1);
else
ecore_evas_avoid_damage_set(ee, 0);
}
if (!strcmp(ev->keyname, "s"))
{
if (!ecore_evas_shaped_get(ee))
{
evas_object_hide(o_bg_rect);
evas_object_hide(o_bg);
ecore_evas_shaped_set(ee, 1);
}
else
{
evas_object_show(o_bg_rect);
evas_object_show(o_bg);
ecore_evas_shaped_set(ee, 0);
}
}
if (!strcmp(ev->keyname, "a"))
{
if (!ecore_evas_alpha_get(ee))
{
evas_object_hide(o_bg_rect);
evas_object_hide(o_bg);
ecore_evas_alpha_set(ee, 1);
}
else
{
evas_object_show(o_bg_rect);
evas_object_show(o_bg);
ecore_evas_alpha_set(ee, 0);
}
}
if (!strcmp(ev->keyname, "Up"))
{
#ifdef BUILD_ECORE_FB
#if 0
double br;
br = ecore_fb_backlight_brightness_get();
ecore_fb_backlight_brightness_set(br + 0.1);
#endif
#endif
}
if (!strcmp(ev->keyname, "Down"))
{
#ifdef BUILD_ECORE_FB
#if 0
double br;
br = ecore_fb_backlight_brightness_get();
ecore_fb_backlight_brightness_set(br - 0.1);
#endif
#endif
}
if (!strcmp(ev->keyname, "F2"))
{
#ifdef BUILD_ECORE_FB
#if 0
if (ecore_fb_backlight_get())
ecore_fb_backlight_set(0);
else
ecore_fb_backlight_set(1);
#endif
#endif
}
if (!strcmp(ev->keyname, "F3"))
{
#ifdef BUILD_ECORE_FB
#if 0
static int v = 0;
if (v) ecore_fb_led_set(0);
else ecore_fb_led_set(1);
if (!v) v = 1;
else v = 0;
#endif
#endif
}
if (!strcmp(ev->keyname, "Left"))
{
#ifdef BUILD_ECORE_FB
#if 0
ecore_fb_led_blink_set(0.1);
#endif
#endif
}
if (!strcmp(ev->keyname, "Right"))
{
#ifdef BUILD_ECORE_FB
#if 0
ecore_fb_led_blink_set(0.5);
#endif
#endif
}
if ((!strcmp(ev->keyname, "p")) ||
(!strcmp(ev->keyname, "Return")))
{
char *fl;
ecore_evas_cursor_get(ee, &fl, NULL, NULL, NULL);
if (!fl)
ecore_evas_cursor_set(ee, PT"mouse_pointer.png", 1000000, 2, 2);
else
ecore_evas_cursor_set(ee, NULL, 0, 0, 0);
#ifdef BUILD_ECORE_FB
#if 0
printf("%3.3f\n", ecore_fb_light_sensor_get());
#endif
#endif
}
}
static void
bg_cb_key_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Up *ev;
ev = event_info;
printf("UP %s\n", ev->keyname);
}
#endif

View File

@ -1,291 +0,0 @@
#include "ecore_evas_test.h"
#ifdef BUILD_ECORE_EVAS
static Evas_Object *o_events = NULL;
static Evas_Object *o_crosshair = NULL;
static Evas_Object *o_text = NULL;
static int cal_pos = 0;
static int down = 0;
static int cal_coords[] = {15, 15, -15, 15, 15, -15, -15, -15};
static char *cal_lines[] =
{
"Please click on the crosshair",
"Again please",
"And again",
"Last one, then calibration is complete"
};
static int cal_input[8];
static int tmp_input_count = 0;
static int tmp_input[16];
static void calibrate_cb_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void calibrate_cb_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void calibrate_cb_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
void
calibrate_pos_set(int pos)
{
Evas_Coord w, h, ow, oh;
int x, y;
cal_pos = pos;
evas_object_geometry_get(o_crosshair, NULL, NULL, &w, &h);
x = cal_coords[(cal_pos * 2) + 0];
y = cal_coords[(cal_pos * 2) + 1];
evas_output_viewport_get(evas, NULL, NULL, &ow, &oh);
if (x < 0) x = ow + x - 1;
if (y < 0) y = oh + y - 1;
cal_coords[(cal_pos * 2) + 0] = x;
cal_coords[(cal_pos * 2) + 1] = y;
evas_object_move(o_crosshair, x - (((int)w - 1) / 2), y - (((int)h - 1) / 2));
evas_object_text_text_set(o_text, cal_lines[cal_pos]);
evas_object_geometry_get(o_text, NULL, NULL, &w, &h);
evas_object_move(o_text, (ow - w) / 2, (oh - h) / 2);
}
int
calibrate_pos_get(void)
{
return cal_pos;
}
void
calibrate_finish(void)
{
int m0, m1;
int y0, y1;
int x[4], y[4], xi[4], yi[4];
int i, rot;
int xscale, xtrans, yscale, ytrans, xyswap;
rot = ecore_evas_rotation_get(ee);
for (i = 0; i < 4; i++)
{
x[i] = cal_coords[(i * 2) + 0];
y[i] = cal_coords[(i * 2) + 1];
xi[i] = cal_input[(i * 2) + 0];
yi[i] = cal_input[(i * 2) + 1];
}
xyswap = 0;
m0 = ((x[1] - x[0]) * 256) / (xi[1] - xi[0]);
y0 = ((x[1] - ((xi[1] * m0) / 256)) + (x[0] - ((xi[0] * m0) >> 8)) ) / 2;
m1 = ((x[3] - x[2]) * 256) / (xi[3] - xi[2]);
y1 = ((x[3] - ((xi[3] * m1) / 256)) + (x[2] - ((xi[2] * m1) >> 8)) ) / 2;
xscale = (m0 + m1) / 2;
xtrans = (y0 + y1) / 2;
m0 = ((y[2] - y[0]) * 256) / (yi[2] - yi[0]);
y0 = ((y[2] - ((yi[2] * m0) / 256)) + (y[0] - ((yi[0] * m0) >> 8)) ) / 2;
m1 = ((y[3] - y[1]) * 256) / (yi[3] - yi[1]);
y1 = ((y[3] - ((yi[3] * m1) / 256)) + (y[1] - ((yi[1] * m1) >> 8)) ) / 2;
yscale = (m0 + m1) / 2;
ytrans = (y0 + y1) / 2;
if (rot == 0)
{
#ifdef BUILD_ECORE_FB
#if 0
ecore_fb_touch_screen_calibrate_set(xscale, xtrans, yscale, ytrans, xyswap);
#endif
#endif
}
else if (rot == 270)
{
int ow, oh;
evas_output_size_get(evas, &ow, &oh);
ytrans = oh - (ytrans + ((oh * yscale) / 256));
#ifdef BUILD_ECORE_FB
#if 0
ecore_fb_touch_screen_calibrate_set(yscale, ytrans, xscale, xtrans, xyswap);
#endif
#endif
}
evas_object_del(o_crosshair);
evas_object_del(o_events);
evas_object_del(o_text);
o_crosshair = NULL;
o_events = NULL;
o_text = NULL;
cal_pos = 0;
bg_go();
}
void
calibrate_start(void)
{
Evas_Object *o;
#ifdef BUILD_ECORE_FB
#if 0
ecore_fb_touch_screen_calibrate_set(256, 0, 256, 0, 0);
#endif
#endif
o = evas_object_rectangle_add(evas);
evas_object_layer_set(o, 1000000);
evas_object_color_set(o, 255, 255, 255, 120);
evas_object_move(o, -12000, -16000);
evas_object_resize(o, 24000, 32000);
evas_object_show(o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, calibrate_cb_down, ee);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, calibrate_cb_up, ee);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, calibrate_cb_move, ee);
o_events = o;
o = evas_object_image_add(evas);
evas_object_layer_set(o, 1000001);
evas_object_image_file_set(o, IM"crosshair.png", NULL);
evas_object_resize(o, 31, 31);
evas_object_image_fill_set(o, 0, 0, 31, 31);
evas_object_pass_events_set(o, 1);
evas_object_show(o);
o_crosshair = o;
o = evas_object_text_add(evas);
evas_object_layer_set(o, 1000002);
evas_object_color_set(o, 0, 0, 0, 255);
evas_object_text_font_set(o, "Vera", 10);
evas_object_pass_events_set(o, 1);
evas_object_show(o);
o_text = o;
calibrate_pos_set(0);
}
static void
calibrate_cb_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev;
ev = event_info;
evas_object_move(o_crosshair, ev->output.x - 15, ev->output.y - 15);
tmp_input_count = 0;
tmp_input[((tmp_input_count & 0x7) * 2) + 0] = ev->output.x;
tmp_input[((tmp_input_count & 0x7) * 2) + 1] = ev->output.y;
tmp_input_count++;
down = 1;
}
static void
calibrate_cb_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Up *ev;
int n, i, avx, avy, c, mx, my;
int dists[8];
int indexes[8];
int sorted;
ev = event_info;
down = 0;
tmp_input[((tmp_input_count & 0x7) * 2) + 0] = ev->output.x;
tmp_input[((tmp_input_count & 0x7) * 2) + 1] = ev->output.y;
tmp_input_count++;
n = 8;
if (tmp_input_count < 8) n = tmp_input_count;
avx = 0; avy = 0; c = 0;
for (i = 0; i < n; i++)
{
dists[i] = tmp_input[(i * 2) + 0];
indexes[i] = i;
}
sorted = 0;
while (!sorted)
{
sorted = 1;
for (i = 0; i < n - 1; i++)
{
if (dists[i + 1] < dists[i])
{
int tmp;
sorted = 0;
tmp = dists[i];
dists[i] = dists[i + 1];
dists[i + 1] = tmp;
tmp = indexes[i];
indexes[i] = indexes[i + 1];
indexes[i + 1] = tmp;
}
}
}
mx = dists[(n + 1) / 2];
for (i = 0; i < n; i++)
{
dists[i] = tmp_input[(i * 2) + 1];
indexes[i] = i;
}
sorted = 0;
while (!sorted)
{
sorted = 1;
for (i = 0; i < n - 1; i++)
{
if (dists[i + 1] < dists[i])
{
int tmp;
sorted = 0;
tmp = dists[i];
dists[i] = dists[i + 1];
dists[i + 1] = tmp;
tmp = indexes[i];
indexes[i] = indexes[i + 1];
indexes[i + 1] = tmp;
}
}
}
my = dists[(n + 1) / 2];
for (i = 0; i < n; i++)
{
int x, y, dx, dy;
x = tmp_input[(i * 2) + 0];
y = tmp_input[(i * 2) + 1];
dx = x - mx;
dy = y - my;
if (dx < 0) dx = -dx;
if (dy < 0) dy = -dy;
if ((dx <= 8) && (dy <= 8))
{
avx += tmp_input[(i * 2) + 0];
avy += tmp_input[(i * 2) + 1];
c++;
}
}
cal_input[(cal_pos * 2) + 0] = avx / c;
cal_input[(cal_pos * 2) + 1] = avy / c;
n = calibrate_pos_get();
if (n < 3)
{
calibrate_pos_set(n + 1);
return;
}
calibrate_finish();
}
static void
calibrate_cb_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Move *ev;
ev = event_info;
if (!down) return;
tmp_input[((tmp_input_count & 0x7) * 2) + 0] = ev->cur.output.x;
tmp_input[((tmp_input_count & 0x7) * 2) + 1] = ev->cur.output.y;
tmp_input_count++;
}
#endif

View File

@ -1,903 +0,0 @@
#include "config.h"
#include "Ecore.h"
#ifdef BUILD_ECORE_JOB
#include "Ecore_Job.h"
#endif
#ifdef BUILD_ECORE_X
#include "Ecore_X.h"
#endif
#ifdef BUILD_ECORE_FB
#include "Ecore_Fb.h"
#endif
#ifdef BUILD_ECORE_EVAS
#include "Ecore_Evas.h"
#endif
#ifdef BUILD_ECORE_CON
#include "Ecore_Con.h"
#endif
#ifdef BUILD_ECORE_IPC
#include "Ecore_Ipc.h"
#endif
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
/* APP GLOBALS */
double start_time = 0;
int
handler_signal_exit(void *data, int ev_type, void *ev)
{
Ecore_Event_Signal_Exit *e;
e = ev;
if (e->interrupt) printf("exit: interrupt\n");
if (e->quit) printf("exit: quit\n");
if (e->terminate) printf("exit: terminate\n");
ecore_main_loop_quit();
return 1;
}
int
handler_ipc_client_add(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_IPC
Ecore_Ipc_Event_Client_Add *e;
e = event;
printf("!!! client %p connected to server!\n", e->client);
return 1;
#endif
}
int
handler_ipc_client_del(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_IPC
Ecore_Ipc_Event_Client_Del *e;
e = event;
printf("!!! client %p disconnected from server!\n", e->client);
return 1;
#endif
}
int
handler_ipc_client_data(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_IPC
Ecore_Ipc_Event_Client_Data *e;
e = event;
printf("!!! client sent: [%i] [%i] (%i) \"%s\"\n", e->major, e->minor, e->size, (char*)e->data);
ecore_ipc_client_send(e->client, 1, 2, 0, 0, 0, "ABC", 4);
/* we can disconnect a client like this: */
/* ecore_ipc_client_del(e->client); */
/* or we can end a server by: */
/* ecore_ipc_server_del(ecore_ipc_client_server_get(e->client)); */
return 1;
#endif
}
int
handler_ipc_server_add(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_IPC
Ecore_Ipc_Event_Server_Add *e;
e = event;
printf("!!! client made successful connect to server %p!\n", e->server);
return 1;
#endif
}
int
handler_ipc_server_del(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_IPC
Ecore_Ipc_Event_Server_Del *e;
e = event;
printf("!!! server went away!\n");
/* clean up our server connection since it went away */
ecore_ipc_server_del(e->server);
return 1;
#endif
}
int
handler_ipc_server_data(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_IPC
Ecore_Ipc_Event_Server_Data *e;
static int count = 0;
e = event;
printf("!!! server sent: [%i] [%i] (%i) \"%s\"\n", e->major, e->minor, e->size, (char*)e->data);
ecore_ipc_server_send(e->server, 3, 4, 0, 0, 0, "EFG", 4);
count++;
if (count > 4)
{
printf("!!! go & disconnect from server!\n");
ecore_ipc_server_del(e->server);
}
return 1;
#endif
}
/**** ECORE_CON TEST CODE */
int
handler_client_add(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_CON
Ecore_Con_Event_Client_Add *e;
e = event;
printf("!!! client %p connected to server!\n", e->client);
return 1;
#endif
}
int
handler_client_del(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_CON
Ecore_Con_Event_Client_Del *e;
e = event;
printf("!!! client %p disconnected from server!\n", e->client);
return 1;
#endif
}
int
handler_client_data(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_CON
Ecore_Con_Event_Client_Data *e;
e = event;
printf("!!! client sent: \"%s\"\n", (char*)e->data);
ecore_con_client_send(e->client, "ABC", 4);
/* we can disconnect a client like this: */
/* ecore_con_client_del(e->client); */
/* or we can end a server by: */
/* ecore_con_server_del(ecore_con_client_server_get(e->client)); */
return 1;
#endif
}
int
handler_server_add(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_CON
Ecore_Con_Event_Server_Add *e;
e = event;
printf("!!! client made successful connect to server %p!\n", e->server);
return 1;
#endif
}
int
handler_server_del(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_CON
Ecore_Con_Event_Server_Del *e;
e = event;
printf("!!! server went away!\n");
/* clean up our server connection since it went away */
ecore_con_server_del(e->server);
return 1;
#endif
}
int
handler_server_data(void *data, int type, void *event)
{
#ifdef BUILD_ECORE_CON
Ecore_Con_Event_Server_Data *e;
static int count = 0;
e = event;
printf("!!! server sent: \"%s\"\n", (char*)e->data);
ecore_con_server_send(e->server, "EFG", 4);
count++;
if (count > 4)
{
printf("!!! go & disconnect from server!\n");
ecore_con_server_del(e->server);
}
return 1;
#endif
}
/* NB: also tests ECORE_JOB */
#ifdef BUILD_ECORE_JOB
void
job_call(void *data)
{
printf("!! Job done \"%s\"!\n", (char *)data);
}
#endif
int
idle_enterer(void *data)
{
printf("-------> Entering idle %3.3f\n", ecore_time_get() - start_time);
return 1;
}
int
idler(void *data)
{
printf("oo Idler %3.3f\n", ecore_time_get() - start_time);
return 1;
}
int
timer(void *data)
{
printf("Q- Timer tick %3.8f\n", ecore_time_get() - start_time);
/* test ecore_job */
#ifdef BUILD_ECORE_JOB
ecore_job_add(job_call, "1");
ecore_job_add(job_call, "2");
ecore_job_add(job_call, "3");
#endif
return 1;
}
void
setup_ecore_test(void)
{
ecore_idle_enterer_add(idle_enterer, NULL);
/* ecore_idler_add(idler, NULL); */
ecore_timer_add(2.0, timer, NULL);
}
#ifdef BUILD_ECORE_X
/**** ECORE_X TEST CODE */
Ecore_X_Window win = 0;
int
handler_x_key_down(void *data, int type, void *event)
{
Ecore_X_Event_Key_Down *e;
e = event;
printf("Key down %s\n", e->keyname);
return 1;
}
int
handler_x_key_up(void *data, int type, void *event)
{
Ecore_X_Event_Key_Up *e;
e = event;
printf("Key up %s\n", e->keyname);
return 1;
}
int
handler_x_mouse_button_down(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Button_Down *e;
e = event;
printf("Mouse down %i [%i][%i]\n", e->button, e->double_click, e->triple_click);
return 1;
}
int
handler_x_mouse_button_up(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Button_Up *e;
e = event;
printf("Mouse up %i\n", e->button);
return 1;
}
int
handler_x_mouse_move(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Move *e;
e = event;
printf("Mouse move to %i %i\n", e->x, e->y);
return 1;
}
int
handler_x_mouse_in(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_In *e;
e = event;
printf("Mouse in\n");
return 1;
}
int
handler_x_mouse_out(void *data, int type, void *event)
{
Ecore_X_Event_Mouse_Out *e;
e = event;
printf("Mouse out\n");
return 1;
}
int
handler_x_window_focus_in(void *data, int type, void *event)
{
Ecore_X_Event_Window_Focus_In *e;
e = event;
printf("Focus in\n");
return 1;
}
int
handler_x_window_focus_out(void *data, int type, void *event)
{
Ecore_X_Event_Window_Focus_Out *e;
e = event;
printf("Focus out\n");
return 1;
}
int
handler_x_window_damage(void *data, int type, void *event)
{
Ecore_X_Event_Window_Damage *e;
e = event;
printf("Damage %i %i, %ix%i\n", e->x, e->y, e->w, e->h);
return 1;
}
int
handler_x_window_destroy(void *data, int type, void *event)
{
Ecore_X_Event_Window_Destroy *e;
e = event;
printf("Destroy\n");
ecore_main_loop_quit();
return 1;
}
int
handler_x_window_configure(void *data, int type, void *event)
{
Ecore_X_Event_Window_Configure *e;
const int desktop = 0;
e = event;
printf("Configure %i %i, %ix%i\n", e->x, e->y, e->w, e->h);
printf("Switching desktops to %d\n", desktop);
ecore_x_netwm_desktop_request_send(e->win, 0, desktop);
return 1;
}
int
handler_x_window_delete_request(void *data, int type, void *event)
{
Ecore_X_Event_Window_Delete_Request *e;
e = event;
printf("Delete Request\n");
ecore_main_loop_quit();
return 1;
}
int
handler_x_window_prop_title_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Title_Change *e;
e = event;
if (e->title)
printf("Title change to \"%s\"\n", e->title);
else
printf("Title deleted\n");
return 1;
}
int
handler_x_window_prop_visible_title_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
e = event;
if (e->title)
printf("Visible title change to \"%s\"\n", e->title);
else
printf("Visible title deleted\n");
return 1;
}
int
handler_x_window_prop_icon_name_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
e = event;
if (e->name)
printf("Icon name change to \"%s\"\n", e->name);
else
printf("Icon name deleted\n");
return 1;
}
int
handler_x_window_prop_visible_icon_name_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
e = event;
if (e->name)
printf("Visible icon name change to \"%s\"\n", e->name);
else
printf("Visible icon name deleted\n");
return 1;
}
int
handler_x_window_prop_client_machine_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
e = event;
if (e->name)
printf("Client machine change to \"%s\"\n", e->name);
else
printf("Client machine deleted\n");
return 1;
}
int
handler_x_window_prop_pid_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Pid_Change *e;
e = event;
if (e->pid)
{
printf("Pid change to \"%d\" ", e->pid);
if (e->pid == getpid())
printf("correct.\n");
else
printf("INCORRECT!\n");
}
else
printf("Pid deleted\n");
return 1;
}
int
handler_x_window_prop_name_class_change(void *data, int type, void *event)
{
Ecore_X_Event_Window_Prop_Name_Class_Change *e;
e = event;
if ((e->name) && (e->clas))
printf("Name & Class change to \"%s\".\"%s\"\n", e->name, e->clas);
else
printf("Name & Class deleted\n");
return 1;
}
void
setup_ecore_x_test(void)
{
char *tmp;
int pid;
unsigned int desktop;
win = ecore_x_window_new(0, 0, 0, 120, 60);
ecore_x_netwm_name_set(win, "Ecore Test Program");
ecore_x_icccm_title_set(win, "Ecore Test Program");
//printf("Title currently: %s\n", tmp);
#if 0
/* Visibile title should be set by the wm */
tmp = ecore_x_netwm_visible_name_get(win);
if (!tmp)
{
printf("No visible title, setting it to Ecore ... Program\n");
ecore_x_window_prop_visible_title_set(win, "Ecore ... Program");
tmp = ecore_x_window_prop_visible_title_get(win);
}
printf("Visible title: %s\n", tmp);
free(tmp);
#endif
ecore_x_netwm_icon_name_get(win, &tmp);
if (!tmp)
{
printf("No icon name, setting it to Ecore_Test\n");
ecore_x_netwm_icon_name_set(win, "Ecore_Test");
ecore_x_netwm_icon_name_get(win, &tmp);
}
printf("Icon Name: %s\n", tmp);
free(tmp);
#if 0
/* Visibile icon should be set by the wm */
tmp = ecore_x_window_prop_visible_icon_name_get(win);
if (!tmp)
{
printf("No visible icon name, setting it to Ecore\n");
ecore_x_window_prop_visible_icon_name_set(win, "Ecore");
tmp = ecore_x_window_prop_visible_icon_name_get(win);
}
printf("Visible icon Name: %s\n", tmp);
free(tmp);
#endif
tmp = ecore_x_icccm_client_machine_get(win);
if (tmp)
{
printf("Client machine: %s\n", tmp);
free(tmp);
}
ecore_x_netwm_pid_get(win, &pid);
printf("Pid: %d\n", pid);
ecore_x_icccm_name_class_set(win, "ecore_test", "main");
ecore_x_netwm_desktop_set(win, 1);
ecore_x_netwm_desktop_get(win, &desktop);
printf("Window on desktop %u\n", desktop);
ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_DIALOG);
ecore_x_icccm_protocol_set(win, ECORE_X_WM_PROTOCOL_DELETE_REQUEST, 1);
ecore_x_window_show(win);
ecore_x_flush();
ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN, handler_x_key_down, NULL);
ecore_event_handler_add(ECORE_X_EVENT_KEY_UP, handler_x_key_up, NULL);
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, handler_x_mouse_button_down, NULL);
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, handler_x_mouse_button_up, NULL);
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, handler_x_mouse_move, NULL);
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, handler_x_mouse_in, NULL);
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, handler_x_mouse_out, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, handler_x_window_focus_in, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, handler_x_window_focus_out, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, handler_x_window_damage, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, handler_x_window_destroy, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, handler_x_window_configure, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, handler_x_window_delete_request, NULL);
/*
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, handler_x_window_prop_title_change, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, handler_x_window_prop_visible_title_change, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, handler_x_window_prop_icon_name_change, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, handler_x_window_prop_visible_icon_name_change, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, handler_x_window_prop_name_class_change, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, handler_x_window_prop_client_machine_change, NULL);
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, handler_x_window_prop_pid_change, NULL);
*/
}
#endif
#ifdef BUILD_ECORE_EVAS
/* choose: TEST_X, TEST_FB */
#define TEST_X
/**** ECORE_EVAS TEST CODE */
Ecore_Timer *anim_timer = NULL;
Ecore_Evas *ee = NULL;
Evas *evas = NULL;
Evas_Object *objects[64];
int
obj_timer(void *data)
{
Evas_Object *o;
Evas_Coord x, y;
Evas_Coord w, h;
Evas_Coord ow, oh;
double t;
int m, n;
int i;
t = ecore_time_get() - start_time;
for (i = 0; i < (sizeof(objects) / sizeof(Evas_Object *)); i++)
{
o = objects[i];
evas_output_viewport_get(evas_object_evas_get(o), NULL, NULL, &w, &h);
evas_object_geometry_get(o, NULL, NULL, &ow, &oh);
m = ((int)o / 36) & 0x3f;
n = ((int)o / 763) & 0x3f;
x = sin(t * (double)m / 12) * ((w - ow) / 2);
y = sin(t * (double)n / 12) * ((h - oh) / 2);
evas_object_move(o, (w / 2) - (ow / 2) + x, (h / 2) - (oh / 2) + y);
}
return 1;
}
void
del_req(Ecore_Evas *ee)
{
int i;
printf("request to go away... nice exit\n");
for (i = 0; i < (sizeof(objects) / sizeof(Evas_Object *)); i++)
objects[i] = NULL;
ecore_timer_del(anim_timer);
anim_timer = NULL;
ecore_main_loop_quit();
}
static void
cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev;
ev = event_info;
if (!strcmp(ev->keyname, "Escape")) ecore_main_loop_quit();
if (!strcmp(ev->keyname, "q")) ecore_main_loop_quit();
if (!strcmp(ev->keyname, "Q")) ecore_main_loop_quit();
if (!strcmp(ev->keyname, "f"))
{
if (!ecore_evas_fullscreen_get(ee))
ecore_evas_fullscreen_set(ee, 1);
else
ecore_evas_fullscreen_set(ee, 0);
}
if (!strcmp(ev->keyname, "o"))
{
if (!ecore_evas_override_get(ee))
ecore_evas_override_set(ee, 1);
else
ecore_evas_override_set(ee, 0);
}
if (!strcmp(ev->keyname, "r"))
{
int r;
r = ecore_evas_rotation_get(ee);
if (r == 0) r = 90;
else if (r == 90) r = 270;
else if (r == 270) r = 0;
ecore_evas_rotation_set(ee, r);
}
if (!strcmp(ev->keyname, "b"))
{
if (!ecore_evas_borderless_get(ee))
ecore_evas_borderless_set(ee, 1);
else
ecore_evas_borderless_set(ee, 0);
}
if (!strcmp(ev->keyname, "d"))
{
if (!ecore_evas_avoid_damage_get(ee))
ecore_evas_avoid_damage_set(ee, 1);
else
ecore_evas_avoid_damage_set(ee, 0);
}
if (!strcmp(ev->keyname, "s"))
{
if (!ecore_evas_shaped_get(ee))
ecore_evas_shaped_set(ee, 1);
else
ecore_evas_shaped_set(ee, 0);
}
#if 1 /* no data files shipped yet to test this */
if (!strcmp(ev->keyname, "p"))
{
char *fl;
ecore_evas_cursor_get(ee, &fl, NULL, NULL, NULL);
if (!fl)
ecore_evas_cursor_set(ee, "data/pointers/mouse_pointer.png", 1000000, 2, 2);
else
ecore_evas_cursor_set(ee, NULL, 0, 0, 0);
}
#endif
}
int
setup_ecore_evas_test(void)
{
Evas_Object *o;
int i;
/* create a new ecore wrapped evas canvas in X */
#ifdef TEST_X
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 240, 320);
#endif
#ifdef TEST_FB
ee = ecore_evas_fb_new(NULL, 270, 240, 320);
#endif
if (!ee) return 0;
ecore_evas_title_set(ee, "Ecore Evas Test");
ecore_evas_name_class_set(ee, "ecore_test", "test_evas");
/* callback if clsoe button is pressed and win is asked to be deleted */
ecore_evas_callback_delete_request_set(ee, del_req);
/* get the actual evas ecore created for us */
evas = ecore_evas_get(ee);
/* image cache set (in bytes) */
evas_image_cache_set(evas, 0 * 1024);
/* font cache set (in bytes) */
evas_font_cache_set(evas, 0 * 1024);
/* add a directory to look in for fonts */
evas_font_path_append(evas, "./");
/* set up a big white rectangle on the bg */
o = evas_object_rectangle_add(evas);
evas_object_color_set(o, 255, 255, 255, 255);
evas_object_move(o, 0, 0);
evas_object_resize(o, 100000, 100000);
evas_object_layer_set(o, -1000000);
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, cb_key_down, ee);
evas_object_focus_set(o, 1);
evas_object_show(o);
/* make a bunch of rectangles */
for (i = 0; i < (sizeof(objects) / sizeof(Evas_Object *)); i++)
{
o = evas_object_rectangle_add(evas);
evas_object_move(o, 10, 10);
evas_object_pass_events_set(o, 1);
evas_object_color_set(o,
((int)o) & 0xff,
((int)o / 30) & 0xff,
((int)o / 65) & 0xff,
((int)o / 156) & 0xff);
evas_object_resize(o, 4 + (((int)o) % 100), 4 + (((int)o / 50) % 100));
evas_object_show(o);
objects[i] = o;
}
/* add a timer to animate them */
anim_timer = ecore_timer_add(0.01, obj_timer, NULL);
ecore_evas_show(ee);
return 1;
}
#endif
/**** MAIN */
int
main(int argc, const char **argv)
{
/* get the time the program started at */
start_time = ecore_time_get();
/* init ecore */
ecore_init();
/* tell ecore what our arguments are */
ecore_app_args_set(argc, argv);
#if 1
/* setup to test ecore module basics */
setup_ecore_test();
#endif
#ifdef BUILD_ECORE_CON
#if 0
/* init ecore_con */
ecore_con_init();
{
Ecore_Con_Server *server;
/* server = ecore_con_server_add(ECORE_CON_LOCAL_USER, "ecore_test", 0, NULL);*/
server = ecore_con_server_add(ECORE_CON_LOCAL_SYSTEM, "ecore_test", 0, NULL);
/* server = ecore_con_server_add(ECORE_CON_REMOTE_SYSTEM, "localhost", 7654, NULL); */
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, handler_client_add, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, handler_client_del, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, handler_client_data, NULL);
printf("create server %p\n", server);
}
{
Ecore_Con_Server *server;
/* server = ecore_con_server_connect(ECORE_CON_LOCAL_USER, "ecore_test", 0, NULL);*/
server = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM, "ecore_test", 0, NULL);
/* server = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM, "localhost", 7654, NULL); */
/* server = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM, "www.rasterman.com", 80, NULL); */
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, handler_server_add, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, handler_server_del, NULL);
ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, handler_server_data, NULL);
printf("connect to server: %p\n", server);
if (server)
{
char data[160 * 1024];
strcpy(data, "BLAHPANTS!");
ecore_con_server_send(server, data, 160 * 1024);
}
}
#endif
#endif
#ifdef BUILD_ECORE_IPC
#if 1
/* init ecore_ipc */
ecore_ipc_init();
{
Ecore_Ipc_Server *server;
server = ecore_ipc_server_add(ECORE_IPC_LOCAL_SYSTEM, "ecore_ipc_test", 0, NULL);
/* server = ecore_ipc_server_add(ECORE_IPC_REMOTE_SYSTEM, "localhost", 4567, NULL); */
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, handler_ipc_client_add, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, handler_ipc_client_del, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, handler_ipc_client_data, NULL);
printf("create ipc server %p\n", server);
}
{
Ecore_Ipc_Server *server;
server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_SYSTEM, "ecore_ipc_test", 0, NULL);
/* server = ecore_ipc_server_connect(ECORE_IPC_REMOTE_SYSTEM, "localhost", 4567, NULL); */
ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, handler_ipc_server_add, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, handler_ipc_server_del, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, handler_ipc_server_data, NULL);
printf("connect to ipc server: %p\n", server);
if (server)
{
char data[160 * 1024];
strcpy(data, "BLAHPANTS!");
ecore_ipc_server_send(server, 5, 6, 0, 0, 0, data, 160 * 1024);
}
}
#endif
#endif
#ifdef BUILD_ECORE_EVAS
/* init ecore_evas */
/* if (!ecore_evas_init()) return -1; */
#endif
/* setup a callback to handle a systsme signal to quit */
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, handler_signal_exit, NULL);
#ifdef BUILD_ECORE_X
/* setup to test ecore_x module things */
if (!ecore_x_init(NULL)) return -1;
setup_ecore_x_test();
#endif
#ifdef BUILD_ECORE_EVAS
/* setup to test ecore_evas module */
/* if (!setup_ecore_evas_test()) return -1; */
#endif
/* run the main loop */
ecore_main_loop_begin();
#ifdef BUILD_ECORE_EVAS
/* shut down ecore_evas */
ecore_evas_shutdown();
#endif
#ifdef BUILD_ECORE_IPC
/* shut down ecore_ipc */
ecore_ipc_shutdown();
#endif
#ifdef BUILD_ECORE_CON
/* shut down ecore_con */
ecore_con_shutdown();
#endif
/* shut down ecore */
ecore_shutdown();
return 0;
}

View File

@ -1,132 +0,0 @@
#include "Ecore.h"
typedef struct _ecore_event_handler Ecore_Event_Handler;
typedef struct _ecore_event_idle_handler Ecore_Event_Idle_Handler;
struct _ecore_event_handler
{
void (*func) (Ecore_Event * ev);
Ecore_Event_Handler *next;
};
struct _ecore_event_idle_handler
{
void (*func) (void *data);
void *data;
Ecore_Event_Idle_Handler *next;
};
static Ecore_Event_Handler *handler[ECORE_EVENT_MAX];
static Ecore_Event_Idle_Handler *idle_handlers = NULL;
void
ecore_event_filter(Ecore_Event * ev)
{
Ecore_Event *evp;
int motion_events = 0;
int dnd_pos_events = 0;
int dnd_status_events = 0;
/* count events to only use last events of some types */
for (evp = ev; evp; evp = evp->next)
{
if (evp->type == ECORE_EVENT_MOUSE_MOVE)
motion_events++;
if (evp->type == ECORE_EVENT_DND_DROP_POSITION)
dnd_pos_events++;
if (evp->type == ECORE_EVENT_DND_DROP_STATUS)
dnd_status_events++;
}
for (evp = ev; evp; evp = evp->next)
{
if (evp->type == ECORE_EVENT_MOUSE_MOVE)
{
if (motion_events > 1)
{
evp->ignore = 1;
motion_events--;
}
}
else if (evp->type == ECORE_EVENT_DND_DROP_POSITION)
{
if (dnd_pos_events > 1)
{
evp->ignore = 1;
dnd_pos_events--;
}
}
else if (evp->type == ECORE_EVENT_DND_DROP_STATUS)
{
if (dnd_status_events > 1)
{
evp->ignore = 1;
dnd_status_events--;
}
}
}
}
void
ecore_event_filter_events_handle(Ecore_Event * ev)
{
Ecore_Event *evp;
for (evp = ev; evp; evp = evp->next)
{
Ecore_Event_Handler *h;
if (!evp->ignore)
{
for (h = handler[evp->type]; h; h = h->next)
{
if (h->func)
h->func(evp);
}
}
}
}
void
ecore_event_filter_idle_handle(void)
{
Ecore_Event_Idle_Handler *h;
for (h = idle_handlers; h; h = h->next)
h->func(h->data);
}
extern int __quit_ev_loop;
void
ecore_event_filter_init(void)
{
int i;
__quit_ev_loop = 0;
for (i = 0; i < ECORE_EVENT_MAX; i++)
handler[i] = NULL;
}
void
ecore_event_filter_handler_add(Ecore_Event_Type type,
void (*func) (Ecore_Event * ev))
{
Ecore_Event_Handler *h;
h = NEW(Ecore_Event_Handler, 1);
h->func = func;
h->next = handler[type];
handler[type] = h;
}
void
ecore_event_filter_idle_handler_add(void (*func) (void *data), void *data)
{
Ecore_Event_Idle_Handler *h;
h = NEW(Ecore_Event_Idle_Handler, 1);
h->func = func;
h->data = data;
h->next = idle_handlers;
idle_handlers = h;
}

View File

@ -1,320 +0,0 @@
#include "Ecore.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
static void ecore_event_signal_free(void *event);
static void ecore_event_signal_handle_sigchld(int num);
static void ecore_event_signal_handle_sigusr1(int num);
static void ecore_event_signal_handle_sigusr2(int num);
static void ecore_event_signal_handle_sighup(int num);
static void ecore_event_signal_handle_sigpipe(int num);
static void ecore_event_signal_handle_sigsegv(int num);
static void ecore_event_signal_handle_sigfpe(int num);
static void ecore_event_signal_handle_sigill(int num);
static void ecore_event_signal_handle_sigbus(int num);
#ifdef HAVE_SIGSTKFLT
static void ecore_event_signal_handle_sigstkflt(int num);
#endif
#ifdef HAVE_SIGPWR
static void ecore_event_signal_handle_sigpwr(int num);
#endif
static void ecore_event_signal_handle_sigchld(int num);
static void ecore_event_signal_handle_all(pid_t pid);
static int signal_chld_count = 0;
static int signal_usr1_count = 0;
static int signal_usr2_count = 0;
static int signal_hup_count = 0;
/* freeing stuff */
static void
ecore_event_signal_free(void *event)
{
FREE(event);
}
/* signal handlers we can return from and add to signal recieved counts */
static void
ecore_event_signal_handle_sigchld(int num)
{
signal_chld_count++;
return;
num = 0;
}
static void
ecore_event_signal_handle_sigusr1(int num)
{
signal_usr1_count++;
return;
num = 0;
}
static void
ecore_event_signal_handle_sigusr2(int num)
{
signal_usr2_count++;
return;
num = 0;
}
static void
ecore_event_signal_handle_sighup(int num)
{
signal_hup_count++;
return;
num = 0;
}
/* signals to ignore */
static void
ecore_event_signal_handle_sigpipe(int num)
{
return;
num = 0;
}
/* signal handlers we cant return from - so handle here */
static void
ecore_event_signal_handle_sigsegv(int num)
{
for (;;)
{
fprintf(stderr, "EEEEEEEEK SEGV - waiting 10 seconds\n");
sleep(10);
}
/* EEK - can't return - bad */
abort();
num = 0;
}
static void
ecore_event_signal_handle_sigfpe(int num)
{
/* EEK - can't return - bad */
abort();
num = 0;
}
static void
ecore_event_signal_handle_sigill(int num)
{
/* EEK - can't return - bad */
abort();
num = 0;
}
static void
ecore_event_signal_handle_sigbus(int num)
{
/* EEK - can't return - bad */
abort();
num = 0;
}
#ifdef HAVE_SIGSTKFLT
static void
ecore_event_signal_handle_sigstkflt(int num)
{
/* EEK - can't return - bad */
abort();
return;
num = 0;
}
#endif
static void
ecore_event_signal_handle_sigint(int num)
{
exit(0);
return;
num = 0;
}
static void
ecore_event_signal_handle_sigquit(int num)
{
exit(0);
return;
num = 0;
}
static void
ecore_event_signal_handle_sigabrt(int num)
{
abort();
return;
num = 0;
}
static void
ecore_event_signal_handle_sigalrm(int num)
{
return;
num = 0;
}
static void
ecore_event_signal_handle_sigterm(int num)
{
exit(0);
return;
num = 0;
}
#ifdef HAVE_SIGPWR
static void
ecore_event_signal_handle_sigpwr(int num)
{
exit(0);
return;
num = 0;
}
#endif
static void
ecore_event_signal_handle_all(pid_t pid_pass)
{
int status;
pid_t pid;
if (signal_chld_count > 0)
{
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
{
if (WIFEXITED(status))
{
Ecore_Event_Child *e;
int code;
code = WEXITSTATUS(status);
e = NEW(Ecore_Event_Child, 1);
e->pid = pid;
e->exit_code = code;
ecore_add_event(ECORE_EVENT_CHILD, e, ecore_event_signal_free);
}
}
signal_chld_count = 0;
}
while (signal_usr1_count > 0)
{
Ecore_Event_User *e;
e = NEW(Ecore_Event_User, 1);
e->num = 0;
e->hup = 0;
ecore_add_event(ECORE_EVENT_USER, e, ecore_event_signal_free);
signal_usr1_count--;
}
while (signal_hup_count > 0)
{
Ecore_Event_User *e;
e = NEW(Ecore_Event_User, 1);
e->num = 0;
e->hup = 1;
ecore_add_event(ECORE_EVENT_USER, e, ecore_event_signal_free);
signal_hup_count--;
}
return;
pid_pass = 0;
}
int
ecore_event_signal_events_pending(void)
{
return (signal_chld_count + signal_usr1_count + signal_hup_count);
}
void
ecore_event_signal_init(void)
{
struct sigaction sa;
ecore_add_event_pid(0, ecore_event_signal_handle_all);
sa.sa_handler = ecore_event_signal_handle_sigchld;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGCHLD, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigusr1;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGUSR1, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigusr2;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGUSR2, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sighup;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGHUP, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigpipe;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGPIPE, &sa, (struct sigaction *)0);
/*
sa.sa_handler = ecore_event_signal_handle_sigsegv;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, (struct sigaction *)0);
*/
sa.sa_handler = ecore_event_signal_handle_sigfpe;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGFPE, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigill;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGILL, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigbus;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGBUS, &sa, (struct sigaction *)0);
#ifdef HAVE_SIGSTKFLT
sa.sa_handler = ecore_event_signal_handle_sigstkflt;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGSTKFLT, &sa, (struct sigaction *)0);
#endif
sa.sa_handler = ecore_event_signal_handle_sigint;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigquit;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGQUIT, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigabrt;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGABRT, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigalrm;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGALRM, &sa, (struct sigaction *)0);
sa.sa_handler = ecore_event_signal_handle_sigterm;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGTERM, &sa, (struct sigaction *)0);
#ifdef HAVE_SIGPWR
sa.sa_handler = ecore_event_signal_handle_sigpwr;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGPWR, &sa, (struct sigaction *)0);
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -1,430 +0,0 @@
#include "Ecore.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* glocal (yes global/local) variabels for events */
Ecore_Event_Fd_Handler *fd_handlers = NULL;
Ecore_Event_Ipc_Handler *ipc_handlers = NULL;
Ecore_Event_Pid_Handler *pid_handlers = NULL;
Ecore_Event_Timer *timers = NULL;
Ecore_Event *events = NULL;
Ecore_Event *last_event = NULL;
int __quit_ev_loop = 0;
/* local functions for event handling */
static void ecore_handle_event_timer(void);
static void ecore_handle_zero_event_timer(void);
/* public functions */
/* add an event to the end of the event queue */
void
ecore_add_event(Ecore_Event_Type type, void *event,
void (*ev_free) (void *event))
{
Ecore_Event *ev;
ev = NEW(Ecore_Event, 1);
ev->type = type;
ev->ignore = 0;
ev->event = event;
ev->next = NULL;
ev->ev_free = ev_free;
if (!events)
events = ev;
else
last_event->next = ev;
last_event = ev;
}
/* delete an event from the event queue */
void
ecore_del_event(void *event)
{
Ecore_Event *ev, *pev;
pev = NULL;
ev = events;
while (ev)
{
if (ev->event == event)
{
if (pev)
pev->next = ev->next;
else
events = ev->next;
if (!ev->next)
last_event = pev;
if ((ev->event) && (ev->ev_free))
(*ev->ev_free) (ev->event);
FREE(ev);
return;
}
pev = ev;
ev = ev->next;
}
}
void
ecore_del_all_events(void)
{
Ecore_Event *ev, *pev;
ev = events;
while (ev)
{
pev = ev;
ev = ev->next;
if ((pev->event) && (pev->ev_free))
pev->ev_free(pev->event);
FREE(pev);
}
events = NULL;
last_event = NULL;
}
Ecore_Event *
ecore_get_last_event(void)
{
return last_event;
}
/* add a callback handler if fd is active for reading */
void
ecore_add_event_fd(int fd, void (*func) (int fd))
{
Ecore_Event_Fd_Handler *fd_h;
/* new handler struct */
fd_h = NEW(Ecore_Event_Fd_Handler, 1);
fd_h->next = fd_handlers;
fd_h->fd = fd;
fd_h->func = func;
fd_handlers = fd_h;
}
/* delete handler for fd */
void
ecore_del_event_fd(int fd)
{
START_LIST_DEL(Ecore_Event_Fd_Handler, fd_handlers, (_p->fd == fd));
FREE(_p);
END_LIST_DEL;
}
void
ecore_add_event_pid(pid_t pid, void (*func) (pid_t pid))
{
Ecore_Event_Pid_Handler *pid_h;
/* delete the old handler */
ecore_del_event_pid(pid);
/* new handler struct */
pid_h = NEW(Ecore_Event_Pid_Handler, 1);
pid_h->next = pid_handlers;
pid_h->pid = pid;
pid_h->func = func;
pid_handlers = pid_h;
}
void
ecore_del_event_pid(pid_t pid)
{
START_LIST_DEL(Ecore_Event_Pid_Handler, pid_handlers, (_p->pid == pid));
FREE(_p);
END_LIST_DEL;
}
void
ecore_add_event_ipc(int ipc, void (*func) (int ipc))
{
Ecore_Event_Ipc_Handler *ipc_h;
/* delete the old handler */
ecore_del_event_ipc(ipc);
/* new handler struct */
ipc_h = NEW(Ecore_Event_Ipc_Handler, 1);
ipc_h->next = ipc_handlers;
ipc_h->ipc = ipc;
ipc_h->func = func;
ipc_handlers = ipc_h;
}
void
ecore_del_event_ipc(int ipc)
{
START_LIST_DEL(Ecore_Event_Ipc_Handler, ipc_handlers, (_p->ipc == ipc));
FREE(_p);
END_LIST_DEL;
}
/* sit in this loop forever and process events */
void
ecore_event_loop(void)
{
int fdcount, fdsize, ipccount, ipcsize;
int timed_out, were_events;
double time1, time2, prev_time = 0.0;
struct timeval tval;
fd_set fdset, ipcset;
Ecore_Event_Fd_Handler *fd_h;
Ecore_Event_Pid_Handler *pid_h;
Ecore_Event_Ipc_Handler *ipc_h;
/* init some of the time variables */
time1 = ecore_get_time();
time2 = time1 - prev_time;
prev_time = time1;
while (__quit_ev_loop == 0)
{
/* state setup */
timed_out = 0;
were_events = 0;
/* setup fd array from list of listening fd's */
fdsize = 0;
FD_ZERO(&fdset);
/* for ever fd handler add the fd to the array and incriment fdsize */
for (fd_h = fd_handlers; fd_h; fd_h = fd_h->next)
{
FD_SET(fd_h->fd, &fdset);
if (fd_h->fd > fdsize)
fdsize = fd_h->fd;
}
fdcount = 1;
ipcsize = 0;
FD_ZERO(&ipcset);
/* for ever fd handler add the fd to the array and incriment fdsize */
for (ipc_h = ipc_handlers; ipc_h; ipc_h = ipc_h->next)
{
FD_SET(ipc_h->ipc, &ipcset);
if (ipc_h->ipc > ipcsize)
ipcsize = ipc_h->ipc;
}
ipccount = 1;
/* if there are timers setup adjust timeout value and select */
if (timers)
{
if (timers->just_added)
{
timers->just_added = 0;
time1 = timers->in;
}
else
{
time1 = timers->in - time2;
if (time1 < 0.0)
time1 = 0.0;
timers->in = time1;
}
tval.tv_sec = (long)time1;
tval.tv_usec = (long)((time1 - ((double)tval.tv_sec)) * 1000000);
if (tval.tv_sec < 0)
tval.tv_sec = 0;
if (tval.tv_usec <= 1000)
tval.tv_usec = 1000;
ecore_handle_zero_event_timer();
if ((!ecore_events_pending()) && (!ecore_event_signal_events_pending()))
fdcount = select(fdsize + 1, &fdset, NULL, NULL, &tval);
}
/* no timers - just sit and block */
else
{
if ((!ecore_events_pending()) && (!ecore_event_signal_events_pending()))
fdcount = select(fdsize + 1, &fdset, NULL, NULL, NULL);
}
for (pid_h = pid_handlers; pid_h; pid_h = pid_h->next)
pid_h->func(pid_h->pid);
/* see if we have any new ipc connections */
tval.tv_sec = 0;
tval.tv_usec = 0;
ipccount += select(ipcsize + 1, &ipcset, NULL, NULL, &tval);
/* return < 0 - error or signal interrupt */
if (fdcount < 0)
{
/* error */
if ((errno == ENOMEM) || (errno == EINVAL) || (errno == EBADF))
{
fprintf(stderr, "Lost connection to X display.\n");
exit(1);
}
}
/* timers are available and its a timeout */
if ((timers) && (fdcount == 0))
{
ecore_handle_event_timer();
timed_out = 1;
}
if (fdcount < 0)
fdcount = 0;
if (ecore_events_pending())
{
fdcount++;
FD_SET(ecore_x_get_fd(), &fdset);
}
/* fd's are active */
if (fdcount > 0)
{
/* for every fd handler - if its fd is set - call the func */
for (fd_h = fd_handlers; fd_h;)
{
Ecore_Event_Fd_Handler *fdh;
fdh = fd_h;
fd_h = fd_h->next;
if (FD_ISSET(fdh->fd, &fdset))
fdh->func(fdh->fd);
}
}
/* ipc clients are active */
if (ipccount > 0)
{
for (ipc_h = ipc_handlers; ipc_h;)
{
Ecore_Event_Ipc_Handler *ipch;
ipch = ipc_h;
ipc_h = ipc_h->next;
if (FD_ISSET(ipch->ipc, &ipcset))
ipch->func(ipch->ipc);
}
}
if (events)
ecore_event_filter(events);
if (events)
{
ecore_event_filter_events_handle(events);
were_events = 1;
}
ecore_del_all_events();
if ((timed_out) || (were_events))
ecore_event_filter_idle_handle();
ecore_flush();
time1 = ecore_get_time();
time2 = time1 - prev_time;
prev_time = time1;
}
__quit_ev_loop = 0;
}
/* set a flag to 0 so that we can quit the event loop and shutdown
* properly */
void
ecore_event_loop_quit(void)
{
__quit_ev_loop = 1;
}
/* add a timeout funcitont o be called in "in" seconds with name name */
void
ecore_add_event_timer(char *name, double in, void (*func) (int val, void *data),
int val, void *data)
{
Ecore_Event_Timer *timer, *ptr, *pptr;
double tally;
if (name)
ecore_del_event_timer(name);
timer = NEW(Ecore_Event_Timer, 1);
timer->next = NULL;
timer->func = func;
timer->data = data;
timer->val = val;
timer->just_added = 1;
timer->in = in;
timer->name = strdup(name);
if (!timers)
timers = timer;
else
{
pptr = NULL;
ptr = timers;
tally = 0.0;
while (ptr)
{
tally += ptr->in;
if (tally > in)
{
tally -= ptr->in;
timer->next = ptr;
if (pptr)
pptr->next = timer;
else
timers = timer;
timer->in -= tally;
if (timer->next)
timer->next->in -= timer->in;
return;
}
pptr = ptr;
ptr = ptr->next;
}
if (pptr)
pptr->next = timer;
else
timers = timer;
timer->in -= tally;
}
}
/* delete a timer timeout entry named "name" */
void *
ecore_del_event_timer(char *name)
{
Ecore_Event_Timer *timer, *ptr, *pptr;
pptr = NULL;
ptr = timers;
while (ptr)
{
timer = ptr;
if (!strcmp(timer->name, name))
{
void *data;
if (pptr)
pptr->next = timer->next;
else
timers = timer->next;
if (timer->next)
timer->next->in += timer->in;
IF_FREE(timer->name);
data = timer->data;
FREE(timer);
return data;
}
pptr = ptr;
ptr = ptr->next;
}
return NULL;
}
/* private functions */
static void
ecore_handle_event_timer(void)
{
Ecore_Event_Timer *timer;
if (!timers)
return;
timer = timers;
timers = timer->next;
(*(timer->func)) (timer->val, timer->data);
IF_FREE(timer->name);
FREE(timer);
}
static void
ecore_handle_zero_event_timer(void)
{
while ((timers) && (timers->in == 0.0))
ecore_handle_event_timer();
}

View File

@ -1,187 +0,0 @@
#include "Ecore.h"
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
void ecore_ipc_init(char *path);
void ecore_ipc_cleanup(void);
static void ecore_ipc_connect_handler(int fd);
static void ecore_ipc_client_handler(int fd);
void ecore_ipc_get_data(int fd, void *buf);
void ecore_ipc_send_data(int fd, void *buf, int size);
void ecore_add_ipc_service(int service, void (*func) (int fd));
void ecore_del_ipc_service(int service);
Ecore_Event_Ipc_Service *ipc_services = NULL;
void
ecore_ev_ipc_init(char *path)
{
int fd, len;
struct sockaddr_un saun;
if (path == NULL)
return;
/* a UNIX domain, stream socket */
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
{
printf("Cannot create ipc socket... disabling ipc.\n");
return;
}
/* create the address we will be binding to */
saun.sun_family = AF_UNIX;
strcpy(saun.sun_path, path);
/* unlink the address so the bind won't fail */
unlink(path);
len = sizeof(saun.sun_family) + strlen(saun.sun_path);
if (bind(fd, (struct sockaddr *)&saun, len) < 0)
{
printf("Cannot bind ipc socket... disabling ipc.\n");
return;
}
/* listen on the socket */
if (listen(fd, 5) < 0)
{
printf("Cannot listen on ipc socket... disabling ipc.\n");
return;
}
/* add ipc listener */
ecore_add_event_ipc(fd, ecore_ipc_connect_handler);
}
void
ecore_ev_ipc_cleanup(void)
{
Ecore_Event_Ipc_Service *ipc_s;
/* cleanup services list */
for (ipc_s = ipc_services; ipc_s; ipc_s = ipc_s->next)
{
ecore_del_ipc_service(ipc_s->service);
}
}
static void
ecore_ipc_connect_handler(int fd)
{
struct sockaddr_un fsaun;
int fromlen, nfd;
/* accept ipc connection */
fromlen = sizeof(fsaun);
if ((nfd = accept(fd, (struct sockaddr *)&fsaun, &fromlen)) < 0)
{
printf("Cannot accept ipc connection... ignoring connection attempt.\n");
return;
}
/* add ipc client */
ecore_add_event_ipc(nfd, ecore_ipc_client_handler);
}
static void
ecore_ipc_client_handler(int fd)
{
int nread, service;
Ecore_Event_Ipc_Service *ipc_s;
if ((nread = read(fd, &service, sizeof(service))) == 0)
{
close(fd);
ecore_del_event_ipc(fd);
}
else if (nread > 0)
{
/* call the service function */
for (ipc_s = ipc_services; ipc_s; ipc_s = ipc_s->next)
{
if (ipc_s->service == service)
{
ipc_s->func(fd);
break;
}
}
}
else
{
printf("ipc error in read service.\n");
fflush(stdout);
}
}
void
ecore_ipc_get_data(int fd, void *buf)
{
int readn, nread;
/* read number of bytes being sent */
if ((nread = read(fd, &readn, sizeof(readn))) == -1)
{
printf("ipc error in get data.\n");
fflush(stdout);
return;
}
/* get data structure */
if ((nread = read(fd, buf, readn)) == -1)
{
printf("ipc error in get data.\n");
fflush(stdout);
return;
}
}
void
ecore_ipc_send_data(int fd, void *buf, int size)
{
int n;
/* send length of data being sent */
if ((n = write(fd, &size, sizeof(size))) == -1)
{
printf("ipc error in send data length.\n");
fflush(stdout);
return;
}
/* send data */
if ((n = write(fd, buf, size)) == -1)
{
printf("ipc error in send data.\n");
fflush(stdout);
return;
}
}
void
ecore_add_ipc_service(int service, void (*func) (int fd))
{
Ecore_Event_Ipc_Service *ipc_s;
/* delete the old service */
ecore_del_ipc_service(service);
/* new service struct */
ipc_s = NEW(Ecore_Event_Ipc_Service, 1);
ipc_s->next = ipc_services;
ipc_s->service = service;
ipc_s->func = func;
ipc_services = ipc_s;
}
void
ecore_del_ipc_service(int service)
{
START_LIST_DEL(Ecore_Event_Ipc_Service, ipc_services,
(_p->service == service));
FREE(_p);
END_LIST_DEL;
}

View File

@ -1,10 +0,0 @@
#include "Ecore.h"
double
ecore_get_time(void)
{
struct timeval timev;
gettimeofday(&timev, NULL);
return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
}

File diff suppressed because it is too large Load Diff