diff --git a/legacy/ecore/Makefile.am b/legacy/ecore/Makefile.am index 4e31f17484..398fa41e78 100644 --- a/legacy/ecore/Makefile.am +++ b/legacy/ecore/Makefile.am @@ -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 \ diff --git a/legacy/ecore/configure.in b/legacy/ecore/configure.in index 552ce6cf98..fcab0df267 100644 --- a/legacy/ecore/configure.in +++ b/legacy/ecore/configure.in @@ -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 diff --git a/legacy/ecore/data/.cvsignore b/legacy/ecore/data/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/legacy/ecore/data/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/legacy/ecore/data/Makefile.am b/legacy/ecore/data/Makefile.am deleted file mode 100644 index 0eb6a4e411..0000000000 --- a/legacy/ecore/data/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = fonts images pointers diff --git a/legacy/ecore/data/fonts/.cvsignore b/legacy/ecore/data/fonts/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/legacy/ecore/data/fonts/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/legacy/ecore/data/fonts/Makefile.am b/legacy/ecore/data/fonts/Makefile.am deleted file mode 100644 index c4d04b7f67..0000000000 --- a/legacy/ecore/data/fonts/Makefile.am +++ /dev/null @@ -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) - diff --git a/legacy/ecore/data/fonts/Vera.ttf b/legacy/ecore/data/fonts/Vera.ttf deleted file mode 100644 index 58cd6b5e61..0000000000 Binary files a/legacy/ecore/data/fonts/Vera.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraBI.ttf b/legacy/ecore/data/fonts/VeraBI.ttf deleted file mode 100644 index b55eee397e..0000000000 Binary files a/legacy/ecore/data/fonts/VeraBI.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraBd.ttf b/legacy/ecore/data/fonts/VeraBd.ttf deleted file mode 100644 index 51d6111d72..0000000000 Binary files a/legacy/ecore/data/fonts/VeraBd.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraIt.ttf b/legacy/ecore/data/fonts/VeraIt.ttf deleted file mode 100644 index cc23c9efd2..0000000000 Binary files a/legacy/ecore/data/fonts/VeraIt.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraMoBI.ttf b/legacy/ecore/data/fonts/VeraMoBI.ttf deleted file mode 100644 index 8624542ed2..0000000000 Binary files a/legacy/ecore/data/fonts/VeraMoBI.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraMoBd.ttf b/legacy/ecore/data/fonts/VeraMoBd.ttf deleted file mode 100644 index 9be6547ed6..0000000000 Binary files a/legacy/ecore/data/fonts/VeraMoBd.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraMoIt.ttf b/legacy/ecore/data/fonts/VeraMoIt.ttf deleted file mode 100644 index 2404924856..0000000000 Binary files a/legacy/ecore/data/fonts/VeraMoIt.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraMono.ttf b/legacy/ecore/data/fonts/VeraMono.ttf deleted file mode 100644 index 139f0b4311..0000000000 Binary files a/legacy/ecore/data/fonts/VeraMono.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraSe.ttf b/legacy/ecore/data/fonts/VeraSe.ttf deleted file mode 100644 index 4b4ecc6667..0000000000 Binary files a/legacy/ecore/data/fonts/VeraSe.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/VeraSeBd.ttf b/legacy/ecore/data/fonts/VeraSeBd.ttf deleted file mode 100644 index 672bf761fe..0000000000 Binary files a/legacy/ecore/data/fonts/VeraSeBd.ttf and /dev/null differ diff --git a/legacy/ecore/data/fonts/fonts.alias b/legacy/ecore/data/fonts/fonts.alias deleted file mode 100644 index bbb99b3fe3..0000000000 --- a/legacy/ecore/data/fonts/fonts.alias +++ /dev/null @@ -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 diff --git a/legacy/ecore/data/fonts/fonts.dir b/legacy/ecore/data/fonts/fonts.dir deleted file mode 100644 index 2dab016e1d..0000000000 --- a/legacy/ecore/data/fonts/fonts.dir +++ /dev/null @@ -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 diff --git a/legacy/ecore/data/images/.cvsignore b/legacy/ecore/data/images/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/legacy/ecore/data/images/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/legacy/ecore/data/images/Makefile.am b/legacy/ecore/data/images/Makefile.am deleted file mode 100644 index 6a7d4a9061..0000000000 --- a/legacy/ecore/data/images/Makefile.am +++ /dev/null @@ -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) - diff --git a/legacy/ecore/data/images/ball.png b/legacy/ecore/data/images/ball.png deleted file mode 100644 index 6549ac3c68..0000000000 Binary files a/legacy/ecore/data/images/ball.png and /dev/null differ diff --git a/legacy/ecore/data/images/bar.png b/legacy/ecore/data/images/bar.png deleted file mode 100644 index ed619c39de..0000000000 Binary files a/legacy/ecore/data/images/bar.png and /dev/null differ diff --git a/legacy/ecore/data/images/bar_shad_above.png b/legacy/ecore/data/images/bar_shad_above.png deleted file mode 100644 index fda2e8ab9c..0000000000 Binary files a/legacy/ecore/data/images/bar_shad_above.png and /dev/null differ diff --git a/legacy/ecore/data/images/bar_shad_below.png b/legacy/ecore/data/images/bar_shad_below.png deleted file mode 100644 index 7f242f839b..0000000000 Binary files a/legacy/ecore/data/images/bar_shad_below.png and /dev/null differ diff --git a/legacy/ecore/data/images/bg.png b/legacy/ecore/data/images/bg.png deleted file mode 100644 index d3b680c864..0000000000 Binary files a/legacy/ecore/data/images/bg.png and /dev/null differ diff --git a/legacy/ecore/data/images/crosshair.png b/legacy/ecore/data/images/crosshair.png deleted file mode 100644 index 612d117997..0000000000 Binary files a/legacy/ecore/data/images/crosshair.png and /dev/null differ diff --git a/legacy/ecore/data/images/e_logo.png b/legacy/ecore/data/images/e_logo.png deleted file mode 100644 index 54100d5b65..0000000000 Binary files a/legacy/ecore/data/images/e_logo.png and /dev/null differ diff --git a/legacy/ecore/data/images/evas_logo.png b/legacy/ecore/data/images/evas_logo.png deleted file mode 100644 index 932555eb0e..0000000000 Binary files a/legacy/ecore/data/images/evas_logo.png and /dev/null differ diff --git a/legacy/ecore/data/images/shadow.png b/legacy/ecore/data/images/shadow.png deleted file mode 100644 index 327567f3c3..0000000000 Binary files a/legacy/ecore/data/images/shadow.png and /dev/null differ diff --git a/legacy/ecore/data/pointers/.cvsignore b/legacy/ecore/data/pointers/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/legacy/ecore/data/pointers/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/legacy/ecore/data/pointers/Makefile.am b/legacy/ecore/data/pointers/Makefile.am deleted file mode 100644 index 56d7c8cf11..0000000000 --- a/legacy/ecore/data/pointers/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -POINTERS = mouse_pointer.png - -pntrdir = $(pkgdatadir)/pointers -pntr_DATA = $(POINTERS) - -EXTRA_DIST = $(POINTERS) diff --git a/legacy/ecore/data/pointers/mouse_pointer.png b/legacy/ecore/data/pointers/mouse_pointer.png deleted file mode 100644 index b4e2e123ed..0000000000 Binary files a/legacy/ecore/data/pointers/mouse_pointer.png and /dev/null differ diff --git a/legacy/ecore/examples/.cvsignore b/legacy/ecore/examples/.cvsignore deleted file mode 100644 index 3888c2d083..0000000000 --- a/legacy/ecore/examples/.cvsignore +++ /dev/null @@ -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 diff --git a/legacy/ecore/examples/Makefile.am b/legacy/ecore/examples/Makefile.am deleted file mode 100644 index 4fe3989f5a..0000000000 --- a/legacy/ecore/examples/Makefile.am +++ /dev/null @@ -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 diff --git a/legacy/ecore/examples/args_example.c b/legacy/ecore/examples/args_example.c deleted file mode 100644 index d8a8a5e84b..0000000000 --- a/legacy/ecore/examples/args_example.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Example of how to set and retrieve program arguments. - */ -#include - -#include -#include - -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; -} diff --git a/legacy/ecore/examples/con_client_example.c b/legacy/ecore/examples/con_client_example.c deleted file mode 100644 index a4e42ad67d..0000000000 --- a/legacy/ecore/examples/con_client_example.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Ecore_Con Usage Example - */ - -#include -#include - -#include -#include -#include - -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; -} diff --git a/legacy/ecore/examples/con_server_example.c b/legacy/ecore/examples/con_server_example.c deleted file mode 100644 index 6b710ad051..0000000000 --- a/legacy/ecore/examples/con_server_example.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Ecore_Con Usage Example - */ - -#include -#include - -//#include -#include -#include -#include - -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; -} diff --git a/legacy/ecore/examples/config_basic_example.c b/legacy/ecore/examples/config_basic_example.c deleted file mode 100644 index 824cc6958e..0000000000 --- a/legacy/ecore/examples/config_basic_example.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Shows how to handle the Enlightened Properties Library. - */ - -#include -#include -#include -#include - -#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; -} diff --git a/legacy/ecore/examples/config_listener_example.c b/legacy/ecore/examples/config_listener_example.c deleted file mode 100644 index 1ca4ecb10a..0000000000 --- a/legacy/ecore/examples/config_listener_example.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Demonstrates how to use listeners. - */ - -#include -#include -#include - -#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; -} diff --git a/legacy/ecore/examples/event_handler_example.c b/legacy/ecore/examples/event_handler_example.c deleted file mode 100644 index 09bc3e7697..0000000000 --- a/legacy/ecore/examples/event_handler_example.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Ecore Event Handler Example. */ -#include - -#include -#include - -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; -} diff --git a/legacy/ecore/examples/exe_example.c b/legacy/ecore/examples/exe_example.c deleted file mode 100644 index e5eccf5b0d..0000000000 --- a/legacy/ecore/examples/exe_example.c +++ /dev/null @@ -1,205 +0,0 @@ -/* Timer example. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -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; -} diff --git a/legacy/ecore/examples/list_destroy_example.c b/legacy/ecore/examples/list_destroy_example.c deleted file mode 100644 index ccf00ffd34..0000000000 --- a/legacy/ecore/examples/list_destroy_example.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include -#include - -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; -} diff --git a/legacy/ecore/examples/list_example.c b/legacy/ecore/examples/list_example.c deleted file mode 100644 index 2aa606aff8..0000000000 --- a/legacy/ecore/examples/list_example.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -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; -} diff --git a/legacy/ecore/examples/output_tester.c b/legacy/ecore/examples/output_tester.c deleted file mode 100644 index a8a97cefbf..0000000000 --- a/legacy/ecore/examples/output_tester.c +++ /dev/null @@ -1,130 +0,0 @@ -/* output and error tester. - */ - -#include - -#include -#include - -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, ">&< == <&>\n"); - fprintf(stderr, "This -
- is a HTML line break.\n"); - fprintf(stderr, ">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, "

\n"); - fprintf(stderr, "

\n"); - fprintf(stderr, "The idea is roughly this -

\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.

\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.

\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.

\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.

\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.

\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Icons are movable Buttons.

\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.

\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.

\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.

\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; -} diff --git a/legacy/ecore/examples/timer_example.c b/legacy/ecore/examples/timer_example.c deleted file mode 100644 index d50d13095c..0000000000 --- a/legacy/ecore/examples/timer_example.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Timer example. - */ - -#include - -#include -#include - -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; -} diff --git a/legacy/ecore/examples/x_window_example.c b/legacy/ecore/examples/x_window_example.c deleted file mode 100644 index 33ef63ab22..0000000000 --- a/legacy/ecore/examples/x_window_example.c +++ /dev/null @@ -1,20 +0,0 @@ -/* X Windows Example - */ - -#include -#include -#include - -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; -} diff --git a/legacy/ecore/src/Ecore.h b/legacy/ecore/src/Ecore.h deleted file mode 100644 index 9bdd679614..0000000000 --- a/legacy/ecore/src/Ecore.h +++ /dev/null @@ -1,916 +0,0 @@ -#ifndef E_CORE_H -#define E_CORE_H 1 - -#include -#include -#include -#include -#include - -#define XK_MISCELLANY 1 - -#include -#include -#include -#include -#include -#include -#include -#ifdef WITH_DMALLOC -#include -#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 diff --git a/legacy/ecore/src/Makefile.am b/legacy/ecore/src/Makefile.am index f8d2f8c4a9..2433e6cc47 100644 --- a/legacy/ecore/src/Makefile.am +++ b/legacy/ecore/src/Makefile.am @@ -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 diff --git a/legacy/ecore/src/bin/.cvsignore b/legacy/ecore/src/bin/.cvsignore deleted file mode 100644 index 79fccaccf9..0000000000 --- a/legacy/ecore/src/bin/.cvsignore +++ /dev/null @@ -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 diff --git a/legacy/ecore/src/bin/Makefile.am b/legacy/ecore/src/bin/Makefile.am deleted file mode 100644 index 556212ab7c..0000000000 --- a/legacy/ecore/src/bin/Makefile.am +++ /dev/null @@ -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) diff --git a/legacy/ecore/src/bin/ecore_config.c b/legacy/ecore/src/bin/ecore_config.c deleted file mode 100644 index 494087cb84..0000000000 --- a/legacy/ecore/src/bin/ecore_config.c +++ /dev/null @@ -1,336 +0,0 @@ -#include "config.h" -#include "Ecore.h" - -#include -#include -#include - -#ifdef BUILD_ECORE_CONFIG -#include -#include -#include -#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 \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 diff --git a/legacy/ecore/src/bin/ecore_dbus_hal_test.c b/legacy/ecore/src/bin/ecore_dbus_hal_test.c deleted file mode 100644 index 45c41043e2..0000000000 --- a/legacy/ecore/src/bin/ecore_dbus_hal_test.c +++ /dev/null @@ -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 diff --git a/legacy/ecore/src/bin/ecore_dbus_receiver_test.c b/legacy/ecore/src/bin/ecore_dbus_receiver_test.c deleted file mode 100644 index 1606927c94..0000000000 --- a/legacy/ecore/src/bin/ecore_dbus_receiver_test.c +++ /dev/null @@ -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 diff --git a/legacy/ecore/src/bin/ecore_dbus_test.c b/legacy/ecore/src/bin/ecore_dbus_test.c deleted file mode 100644 index a7b54c5463..0000000000 --- a/legacy/ecore/src/bin/ecore_dbus_test.c +++ /dev/null @@ -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 - - diff --git a/legacy/ecore/src/bin/ecore_dbus_test.h b/legacy/ecore/src/bin/ecore_dbus_test.h deleted file mode 100644 index 3eab10a41a..0000000000 --- a/legacy/ecore/src/bin/ecore_dbus_test.h +++ /dev/null @@ -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 -#include -#include - -#ifdef BUILD_ECORE_DBUS -#include "Ecore.h" -#include "Ecore_Data.h" -#include "Ecore_DBus.h" -#endif - -#endif diff --git a/legacy/ecore/src/bin/ecore_evas_test.c b/legacy/ecore/src/bin/ecore_evas_test.c deleted file mode 100644 index 91536e5f2f..0000000000 --- a/legacy/ecore/src/bin/ecore_evas_test.c +++ /dev/null @@ -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 diff --git a/legacy/ecore/src/bin/ecore_evas_test.h b/legacy/ecore/src/bin/ecore_evas_test.h deleted file mode 100644 index 1b8c845160..0000000000 --- a/legacy/ecore/src/bin/ecore_evas_test.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _ECORE_EVAS_TEST_H -#define _ECORE_EVAS_TEST_H - -#include "config.h" -#include "Ecore.h" -#include -#include -#include -#include - -#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 diff --git a/legacy/ecore/src/bin/ecore_evas_test_app.c b/legacy/ecore/src/bin/ecore_evas_test_app.c deleted file mode 100644 index 2ec78c4116..0000000000 --- a/legacy/ecore/src/bin/ecore_evas_test_app.c +++ /dev/null @@ -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 diff --git a/legacy/ecore/src/bin/ecore_evas_test_bg.c b/legacy/ecore/src/bin/ecore_evas_test_bg.c deleted file mode 100644 index 71116ba5db..0000000000 --- a/legacy/ecore/src/bin/ecore_evas_test_bg.c +++ /dev/null @@ -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 diff --git a/legacy/ecore/src/bin/ecore_evas_test_calibrate.c b/legacy/ecore/src/bin/ecore_evas_test_calibrate.c deleted file mode 100644 index 449f7ba37f..0000000000 --- a/legacy/ecore/src/bin/ecore_evas_test_calibrate.c +++ /dev/null @@ -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 diff --git a/legacy/ecore/src/bin/ecore_test.c b/legacy/ecore/src/bin/ecore_test.c deleted file mode 100644 index bd0bba7fb7..0000000000 --- a/legacy/ecore/src/bin/ecore_test.c +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -/* 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; -} diff --git a/legacy/ecore/src/e_ev_filter.c b/legacy/ecore/src/e_ev_filter.c deleted file mode 100644 index 58c7e0f1f4..0000000000 --- a/legacy/ecore/src/e_ev_filter.c +++ /dev/null @@ -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; -} diff --git a/legacy/ecore/src/e_ev_signal.c b/legacy/ecore/src/e_ev_signal.c deleted file mode 100644 index b0e34cb021..0000000000 --- a/legacy/ecore/src/e_ev_signal.c +++ /dev/null @@ -1,320 +0,0 @@ -#include "Ecore.h" -#include -#include -#include -#include -#include - -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 -} diff --git a/legacy/ecore/src/e_ev_x.c b/legacy/ecore/src/e_ev_x.c deleted file mode 100644 index a3ea7bd336..0000000000 --- a/legacy/ecore/src/e_ev_x.c +++ /dev/null @@ -1,1234 +0,0 @@ -#include "Ecore.h" -#include -#include -#include - -/* private funtion prototypes */ -static void ecore_event_x_handle_events(int fd); -static void ecore_event_x_translate_events(XEvent * events, - int num_events); - -static void ecore_event_key_down_free(void *event); -static void ecore_event_key_up_free(void *event); -static void ecore_event_generic_free(void *event); -static void ecore_event_dnd_drop_request_free(void *event); -static void ecore_event_paste_request_free(void *event); - -static void ecore_event_x_handle_keypress(XEvent * xevent); -static void ecore_event_x_handle_keyrelease(XEvent * xevent); -static void ecore_event_x_handle_button_press(XEvent * xevent); -static void ecore_event_x_handle_button_release(XEvent * xevent); -static void ecore_event_x_handle_motion_notify(XEvent * xevent); -static void ecore_event_x_handle_enter_notify(XEvent * xevent); -static void ecore_event_x_handle_leave_notify(XEvent * xevent); -static void ecore_event_x_handle_focus_in(XEvent * xevent); -static void ecore_event_x_handle_focus_out(XEvent * xevent); -static void ecore_event_x_handle_expose(XEvent * xevent); -static void ecore_event_x_handle_visibility_notify(XEvent * xevent); -static void ecore_event_x_handle_create_notify(XEvent * xevent); -static void ecore_event_x_handle_destroy_notify(XEvent * xevent); -static void ecore_event_x_handle_unmap_notify(XEvent * xevent); -static void ecore_event_x_handle_map_notify(XEvent * xevent); -static void ecore_event_x_handle_map_request(XEvent * xevent); -static void ecore_event_x_handle_reparent_notify(XEvent * xevent); -static void ecore_event_x_handle_configure_notify(XEvent * xevent); -static void ecore_event_x_handle_configure_request(XEvent * xevent); -static void ecore_event_x_handle_circulate_notify(XEvent * xevent); -static void ecore_event_x_handle_circulate_request(XEvent * xevent); -static void ecore_event_x_handle_property_notify(XEvent * xevent); -static void ecore_event_x_handle_colormap_notify(XEvent * xevent); -static void ecore_event_x_handle_selection_notify(XEvent * xevent); -static void ecore_event_x_handle_selection_clear(XEvent * xevent); -static void ecore_event_x_handle_selection_request(XEvent * xevent); -static void ecore_event_x_handle_client_message(XEvent * xevent); -static void ecore_event_x_handle_shape_change(XEvent * xevent); - -static int max_event_id = 0; -static void (**event_translator) (XEvent * event) = NULL; - -static int lock_mask_scroll = 0, lock_mask_num = 0, lock_mask_caps = 0; -static int mod_mask_shift = 0, mod_mask_ctrl = 0, mod_mask_alt = - 0, mod_mask_win = 0; - -/* convenience macros */ -#define GETSET_MODS(state, mods) \ -(mods) = ECORE_EVENT_KEY_MODIFIER_NONE;\ -if ((state) & mod_mask_shift) { ecore_mod_shift_set(1); (mods) |= ECORE_EVENT_KEY_MODIFIER_SHIFT; }\ -else ecore_mod_shift_set(0);\ -if ((state) & mod_mask_ctrl) { ecore_mod_ctrl_set(1); (mods) |= ECORE_EVENT_KEY_MODIFIER_CTRL; }\ -else ecore_mod_ctrl_set(0);\ -if ((state) & mod_mask_alt) { ecore_mod_alt_set(1); (mods) |= ECORE_EVENT_KEY_MODIFIER_ALT; }\ -else ecore_mod_alt_set(0);\ -if ((state) & mod_mask_win) { ecore_mod_win_set(1); (mods) |= ECORE_EVENT_KEY_MODIFIER_WIN; }\ -else ecore_mod_win_set(0); - -/* public functions */ - -/* initialise event handling for the fd X is on */ -void -ecore_event_x_init(void) -{ - int i, shape_event_id, current_lock; - - shape_event_id = max_event_id = ecore_event_shape_get_id(); - if (shape_event_id < LASTEvent) - { - max_event_id = LASTEvent; - fprintf(stderr, "ERROR: No shape extension! This is BAD!\n"); - } - event_translator = NEW_PTR(max_event_id + 1); - for (i = 0; i < max_event_id + 1; i++) - event_translator[i] = NULL; - event_translator[KeyPress] = ecore_event_x_handle_keypress; - event_translator[KeyRelease] = ecore_event_x_handle_keyrelease; - event_translator[ButtonPress] = ecore_event_x_handle_button_press; - event_translator[ButtonRelease] = ecore_event_x_handle_button_release; - event_translator[MotionNotify] = ecore_event_x_handle_motion_notify; - event_translator[EnterNotify] = ecore_event_x_handle_enter_notify; - event_translator[LeaveNotify] = ecore_event_x_handle_leave_notify; - event_translator[FocusIn] = ecore_event_x_handle_focus_in; - event_translator[FocusOut] = ecore_event_x_handle_focus_out; - event_translator[Expose] = ecore_event_x_handle_expose; - event_translator[VisibilityNotify] = ecore_event_x_handle_visibility_notify; - event_translator[CreateNotify] = ecore_event_x_handle_create_notify; - event_translator[DestroyNotify] = ecore_event_x_handle_destroy_notify; - event_translator[UnmapNotify] = ecore_event_x_handle_unmap_notify; - event_translator[MapNotify] = ecore_event_x_handle_map_notify; - event_translator[MapRequest] = ecore_event_x_handle_map_request; - event_translator[ReparentNotify] = ecore_event_x_handle_reparent_notify; - event_translator[ConfigureNotify] = ecore_event_x_handle_configure_notify; - event_translator[ConfigureRequest] = ecore_event_x_handle_configure_request; - event_translator[CirculateNotify] = ecore_event_x_handle_circulate_notify; - event_translator[CirculateRequest] = ecore_event_x_handle_circulate_request; - event_translator[PropertyNotify] = ecore_event_x_handle_property_notify; - event_translator[ColormapNotify] = ecore_event_x_handle_colormap_notify; - event_translator[ClientMessage] = ecore_event_x_handle_client_message; - event_translator[SelectionNotify] = ecore_event_x_handle_selection_notify; - event_translator[SelectionClear] = ecore_event_x_handle_selection_clear; - event_translator[SelectionRequest] = ecore_event_x_handle_selection_request; - if (shape_event_id > SelectionRequest) - event_translator[shape_event_id] = ecore_event_x_handle_shape_change; - - lock_mask_scroll = ecore_lock_mask_scroll_get(); - lock_mask_num = ecore_lock_mask_num_get(); - lock_mask_caps = ecore_lock_mask_caps_get(); - - mod_mask_shift = ecore_mod_mask_shift_get(); - mod_mask_ctrl = ecore_mod_mask_ctrl_get(); - mod_mask_alt = ecore_mod_mask_alt_get(); - mod_mask_win = ecore_mod_mask_win_get(); - -/* HRRRMMM lets not do this - ecorecore_keygrab("Num_Lock", ECORE_EVENT_KEY_MODIFIER_NONE, 1, 1); - ecorecore_keygrab("Scroll_Lock", ECORE_EVENT_KEY_MODIFIER_NONE, 1, 1); - ecorecore_keygrab("Caps_Lock", ECORE_EVENT_KEY_MODIFIER_NONE, 1, 1); - */ - current_lock = ecore_modifier_mask_get(); - if (current_lock & lock_mask_scroll) - ecore_lock_scroll_set(1); - if (current_lock & lock_mask_num) - ecore_lock_num_set(1); - if (current_lock & lock_mask_caps) - ecore_lock_caps_set(1); - if (current_lock & mod_mask_shift) - ecore_mod_shift_set(1); - if (current_lock & mod_mask_ctrl) - ecore_mod_ctrl_set(1); - if (current_lock & mod_mask_alt) - ecore_mod_alt_set(1); - if (current_lock & mod_mask_win) - ecore_mod_win_set(1); - ecore_add_event_fd(ecore_x_get_fd(), ecore_event_x_handle_events); -} - -/* private functions */ -/* get all events onthe event queue and translate them */ -static void -ecore_event_x_handle_events(int fd) -{ - int num_events = 0, size_events = 0; - XEvent *events = NULL; - - /* while there are events in the queue */ - while (ecore_events_pending()) - { - /* incriment our event count */ - num_events++; - /* if the numebr fo events is > than our buffer size then */ - if (num_events > size_events) - { - /* increase the buffer size by 64 events */ - size_events += 64; - if (events) - { - REALLOC(events, XEvent, size_events)} - else - events = NEW(XEvent, size_events); - } - /* get the next event into the event buffer */ - ecore_get_next_event(&(events[num_events - 1])); - } - /* call the XEvent -> Eevent translator */ - if (events) - { - ecore_event_x_translate_events(events, num_events); - /* if theres an event buffer - free it */ - FREE(events); - } - return; - fd = 0; -} - -/* take an array of events and translate them into E events */ -static void -ecore_event_x_translate_events(XEvent * events, int num_events) -{ - int i; - - for (i = 0; i < num_events; i++) - { - if ((events[i].type <= max_event_id) && - (event_translator[events[i].type])) - (*(event_translator[events[i].type])) (&(events[i])); - } -} - -static void -ecore_event_key_down_free(void *event) -{ - Ecore_Event_Key_Down *e; - - e = (Ecore_Event_Key_Down *) event; - IF_FREE(e->key); - IF_FREE(e->compose); - FREE(e); -} - -static void -ecore_event_key_up_free(void *event) -{ - Ecore_Event_Key_Up *e; - - e = (Ecore_Event_Key_Up *) event; - IF_FREE(e->key); - IF_FREE(e->compose); - FREE(e); -} - -static void -ecore_event_generic_free(void *event) -{ - FREE(event); -} - -static void -ecore_event_dnd_drop_request_free(void *event) -{ - Ecore_Event_Dnd_Drop_Request *e; - - e = (Ecore_Event_Dnd_Drop_Request *) event; - if (e->files) - { - int i; - - for (i = 0; i < e->num_files; i++) - FREE(e->files[i]); - } - FREE(event); -} - -static void -ecore_event_paste_request_free(void *event) -{ - Ecore_Event_Paste_Request *e; - - e = (Ecore_Event_Paste_Request *) event; - IF_FREE(e->string); - FREE(event); -} - -static void -ecore_event_x_handle_keypress(XEvent * xevent) -{ - Ecore_Event_Key_Down *e; - static KeyCode previous_code = 0; - static Time previous_time = 0; - - /* avoid doubling events up from passive grabs */ - if ((xevent->xkey.keycode == previous_code) && - xevent->xkey.time == previous_time) - return; - previous_code = xevent->xkey.keycode; - previous_time = xevent->xkey.time; -/* - if (ecore_keyget_keysym_from_keycode(xevent->xkey.keycode) == XK_Scroll_Lock) - { - if (ecore_lock_scroll_get()) - ecore_lock_scroll_set(0); - else - ecore_lock_scroll_set(1); - e_event_allow(ReplayKeyboard, xevent->xkey.time); - ecore_flush(); - } - else if (ecore_keyget_keysym_from_keycode(xevent->xkey.keycode) == XK_Num_Lock) - { - if (ecore_lock_num_get()) - ecore_lock_num_set(0); - else - ecore_lock_num_set(1); - e_event_allow(ReplayKeyboard, xevent->xkey.time); - ecore_flush(); - } - else if (ecore_keyget_keysym_from_keycode(xevent->xkey.keycode) == XK_Caps_Lock) - { - if (ecore_lock_caps_get()) - ecore_lock_caps_set(0); - else - ecore_lock_caps_set(1); - e_event_allow(ReplayKeyboard, xevent->xkey.time); - ecore_flush(); - } - */ - e = NEW(Ecore_Event_Key_Down, 1); - e->win = xevent->xkey.window; - e->root = xevent->xkey.root; - GETSET_MODS(xevent->xkey.state, e->mods); - e->time = xevent->xkey.time; - e->key = ecore_key_get_string_from_keycode(xevent->xkey.keycode); - { - int val; - char buf[256]; - KeySym sym; - XComposeStatus stat; - - val = XLookupString((XKeyEvent *) xevent, buf, sizeof(buf), &sym, &stat); - if (val > 0) - { - buf[val] = 0; - e->compose = strdup(buf); - } - else - e->compose = NULL; - } - ecore_add_event(ECORE_EVENT_KEY_DOWN, e, ecore_event_key_down_free); -} - -static void -ecore_event_x_handle_keyrelease(XEvent * xevent) -{ - Ecore_Event_Key_Up *e; - static KeyCode previous_code = 0; - static Time previous_time = 0; - - /* avoid doubling events up from passive grabs */ - if ((xevent->xkey.keycode == previous_code) && - xevent->xkey.time == previous_time) - return; - previous_code = xevent->xkey.keycode; - previous_time = xevent->xkey.time; - - e = NEW(Ecore_Event_Key_Up, 1); - e->win = xevent->xkey.window; - e->root = xevent->xkey.root; - GETSET_MODS(xevent->xkey.state, e->mods); - e->time = xevent->xkey.time; - e->key = ecore_key_get_string_from_keycode(xevent->xkey.keycode); - { - int val; - char buf[256]; - KeySym sym; - XComposeStatus stat; - - val = XLookupString((XKeyEvent *) xevent, buf, sizeof(buf), &sym, &stat); - if (val > 0) - { - buf[val] = 0; - e->compose = strdup(buf); - } - else - e->compose = NULL; - } - ecore_add_event(ECORE_EVENT_KEY_UP, e, ecore_event_key_up_free); -} - -static void -ecore_event_x_handle_button_press(XEvent * xevent) -{ - static Time last_time = 0, last_last_time = 0; - static int last_button = 0, last_last_button = 0; - static Window last_window = 0, last_last_window = 0; - - ecore_pointer_xy_set(xevent->xbutton.x_root, xevent->xbutton.y_root); - if ((xevent->xbutton.button == 4) || (xevent->xbutton.button == 5)) - { - Ecore_Event_Wheel *e; - - e = NEW(Ecore_Event_Wheel, 1); - e->win = xevent->xbutton.window; - e->root = xevent->xbutton.root; - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->rx = xevent->xbutton.x_root; - e->ry = xevent->xbutton.y_root; - e->time = xevent->xbutton.time; - if (xevent->xbutton.button == 5) - e->z = 1; - else - e->z = -1; - if (xevent->xbutton.time - last_time < 15) - e->z *= 16; - else if (xevent->xbutton.time - last_time < 30) - e->z *= 4; - GETSET_MODS(xevent->xbutton.state, e->mods); - ecore_add_event(ECORE_EVENT_MOUSE_WHEEL, e, ecore_event_generic_free); - } - else - { - Ecore_Event_Mouse_Down *e; - - e = NEW(Ecore_Event_Mouse_Down, 1); - e->win = xevent->xbutton.window; - e->root = xevent->xbutton.root; - e->button = xevent->xbutton.button; - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->rx = xevent->xbutton.x_root; - e->ry = xevent->xbutton.y_root; - e->time = xevent->xbutton.time; - e->double_click = 0; - e->triple_click = 0; - GETSET_MODS(xevent->xbutton.state, e->mods); - if (xevent->xbutton.time - last_last_time < 500) - { - if ((xevent->xbutton.window == (unsigned int)last_window) && - (last_window == last_last_window) && - (xevent->xbutton.button == (unsigned int)last_button) && - (last_button == last_button)) - e->triple_click = 1; - } - else if (xevent->xbutton.time - last_time < 250) - { - if ((xevent->xbutton.window == (unsigned int)last_window) && - (xevent->xbutton.button == (unsigned int)last_button)) - e->double_click = 1; - } - ecore_add_event(ECORE_EVENT_MOUSE_DOWN, e, ecore_event_generic_free); - { - Ecore_XID *xid = NULL; - - if (XFindContext(xevent->xbutton.display, e->win, - xid_context, (XPointer *) & xid) != XCNOENT) - { - if ((xid->grab_button_auto_replay) && - (xid->grab_button_auto_replay(e))) - { - ecore_pointer_replay(e->time); - } - } - } - } - last_last_window = last_window; - last_window = xevent->xbutton.window; - last_last_button = last_button; - last_button = xevent->xbutton.button; - last_last_time = last_time; - last_time = xevent->xbutton.time; -} - -static void -ecore_event_x_handle_button_release(XEvent * xevent) -{ - Ecore_Event_Mouse_Up *e; - - if (xevent->xbutton.button > 3) - return; - - e = NEW(Ecore_Event_Mouse_Up, 1); - e->win = xevent->xbutton.window; - e->root = xevent->xbutton.root; - e->button = xevent->xbutton.button; - e->x = xevent->xbutton.x; - e->y = xevent->xbutton.y; - e->rx = xevent->xbutton.x_root; - e->ry = xevent->xbutton.y_root; - e->time = xevent->xbutton.time; - GETSET_MODS(xevent->xbutton.state, e->mods); - ecore_add_event(ECORE_EVENT_MOUSE_UP, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_motion_notify(XEvent * xevent) -{ - Ecore_Event_Mouse_Move *e; - - ecore_pointer_xy_set(xevent->xmotion.x_root, xevent->xmotion.y_root); - e = NEW(Ecore_Event_Mouse_Move, 1); - e->win = xevent->xmotion.window; - e->root = xevent->xmotion.root; - e->x = xevent->xmotion.x; - e->y = xevent->xmotion.y; - e->rx = xevent->xmotion.x_root; - e->ry = xevent->xmotion.y_root; - e->time = xevent->xmotion.time; - GETSET_MODS(xevent->xmotion.state, e->mods); - ecore_add_event(ECORE_EVENT_MOUSE_MOVE, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_enter_notify(XEvent * xevent) -{ - Ecore_Event_Window_Enter *e; - -/* if ((xevent->xcrossing.mode == NotifyGrab) || (xevent->xcrossing.mode == NotifyUngrab)) return;*/ - ecore_pointer_xy_set(xevent->xcrossing.x_root, xevent->xcrossing.y_root); - e = NEW(Ecore_Event_Window_Enter, 1); - e->win = xevent->xcrossing.window; - e->root = xevent->xcrossing.root; - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->rx = xevent->xcrossing.x_root; - e->ry = xevent->xcrossing.y_root; - e->time = xevent->xcrossing.time; - GETSET_MODS(xevent->xcrossing.state, e->mods); - ecore_add_event(ECORE_EVENT_MOUSE_IN, e, ecore_event_generic_free); - ecore_window_mouse_set_in(e->win, 1); - { - Ecore_Event_Mouse_Move *e; - - e = NEW(Ecore_Event_Mouse_Move, 1); - e->win = xevent->xcrossing.window; - e->root = xevent->xcrossing.root; - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->rx = xevent->xcrossing.x_root; - e->ry = xevent->xcrossing.y_root; - e->time = xevent->xcrossing.time; - GETSET_MODS(xevent->xcrossing.state, e->mods); - ecore_add_event(ECORE_EVENT_MOUSE_MOVE, e, ecore_event_generic_free); - } -} - -static void -ecore_event_x_handle_leave_notify(XEvent * xevent) -{ - Ecore_Event_Window_Leave *e; - -/* if ((xevent->xcrossing.mode == NotifyGrab) || (xevent->xcrossing.mode == NotifyUngrab)) return;*/ - ecore_pointer_xy_set(xevent->xcrossing.x_root, xevent->xcrossing.y_root); - { - Ecore_Event_Mouse_Move *e; - - e = NEW(Ecore_Event_Mouse_Move, 1); - e->win = xevent->xcrossing.window; - e->root = xevent->xcrossing.root; - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->rx = xevent->xcrossing.x_root; - e->ry = xevent->xcrossing.y_root; - e->time = xevent->xcrossing.time; - GETSET_MODS(xevent->xcrossing.state, e->mods); - ecore_add_event(ECORE_EVENT_MOUSE_MOVE, e, ecore_event_generic_free); - } - e = NEW(Ecore_Event_Window_Leave, 1); - e->win = xevent->xcrossing.window; - e->root = xevent->xcrossing.root; - e->x = xevent->xcrossing.x; - e->y = xevent->xcrossing.y; - e->rx = xevent->xcrossing.x_root; - e->ry = xevent->xcrossing.y_root; - e->time = xevent->xcrossing.time; - GETSET_MODS(xevent->xcrossing.state, e->mods); - ecore_add_event(ECORE_EVENT_MOUSE_OUT, e, ecore_event_generic_free); - ecore_window_mouse_set_in(e->win, 0); -} - -static void -ecore_event_x_handle_focus_in(XEvent * xevent) -{ - Ecore_Event_Window_Focus_In *e; - - e = NEW(Ecore_Event_Window_Focus_In, 1); - e->win = xevent->xfocus.window; - e->root = ecore_window_get_root(e->win); - if (xevent->xfocus.mode != NotifyNormal) - e->key_grab = 1; - else - e->key_grab = 0; - ecore_add_event(ECORE_EVENT_WINDOW_FOCUS_IN, e, ecore_event_generic_free); - ecore_focus_window_set(e->win); -} - -static void -ecore_event_x_handle_focus_out(XEvent * xevent) -{ - Ecore_Event_Window_Focus_Out *e; - - e = NEW(Ecore_Event_Window_Focus_Out, 1); - e->win = xevent->xfocus.window; - e->root = ecore_window_get_root(e->win); - if (xevent->xfocus.mode != NotifyNormal) - e->key_grab = 1; - else - e->key_grab = 0; - ecore_add_event(ECORE_EVENT_WINDOW_FOCUS_OUT, e, ecore_event_generic_free); - ecore_focus_window_set(0); -} - -static void -ecore_event_x_handle_expose(XEvent * xevent) -{ - Ecore_Event_Window_Expose *e; - - e = NEW(Ecore_Event_Window_Expose, 1); - e->win = xevent->xexpose.window; - e->root = ecore_window_get_root(e->win); - e->x = xevent->xexpose.x; - e->y = xevent->xexpose.y; - e->w = xevent->xexpose.width; - e->h = xevent->xexpose.height; - ecore_add_event(ECORE_EVENT_WINDOW_EXPOSE, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_visibility_notify(XEvent * xevent) -{ - if (xevent->xvisibility.state != VisibilityPartiallyObscured) - { - Ecore_Event_Window_Visibility *e; - - e = NEW(Ecore_Event_Window_Visibility, 1); - e->win = xevent->xvisibility.window; - e->root = ecore_window_get_root(e->win); - if (xevent->xvisibility.state == VisibilityFullyObscured) - e->fully_obscured = 1; - else - e->fully_obscured = 0; - ecore_add_event(ECORE_EVENT_WINDOW_VISIBILITY, e, - ecore_event_generic_free); - } -} - -static void -ecore_event_x_handle_create_notify(XEvent * xevent) -{ - Ecore_Event_Window_Create *e; - - e = NEW(Ecore_Event_Window_Create, 1); - e->win = xevent->xcreatewindow.window; - ecore_validate_xid(e->win); - e->root = ecore_window_get_root(e->win); - if (xevent->xcreatewindow.override_redirect) - e->override = 1; - else - e->override = 0; - ecore_add_event(ECORE_EVENT_WINDOW_CREATE, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_destroy_notify(XEvent * xevent) -{ - Ecore_Event_Window_Destroy *e; - - e = NEW(Ecore_Event_Window_Destroy, 1); - e->win = xevent->xdestroywindow.window; - e->root = ecore_window_get_root(e->win); - ecore_add_event(ECORE_EVENT_WINDOW_DESTROY, e, ecore_event_generic_free); - ecore_unvalidate_xid(e->win); -} - -static void -ecore_event_x_handle_unmap_notify(XEvent * xevent) -{ - Ecore_Event_Window_Unmap *e; - Ecore_XID *xid = NULL; - - e = NEW(Ecore_Event_Window_Unmap, 1); - e->win = xevent->xunmap.window; - e->root = ecore_window_get_root(e->win); - ecore_add_event(ECORE_EVENT_WINDOW_UNMAP, e, ecore_event_generic_free); - xid = ecore_validate_xid(e->win); - if (xid) - xid->mapped = 0; -} - -static void -ecore_event_x_handle_map_notify(XEvent * xevent) -{ - Ecore_Event_Window_Map *e; - Ecore_XID *xid = NULL; - - e = NEW(Ecore_Event_Window_Map, 1); - e->win = xevent->xmap.window; - e->root = ecore_window_get_root(e->win); - ecore_add_event(ECORE_EVENT_WINDOW_MAP, e, ecore_event_generic_free); - xid = ecore_validate_xid(e->win); - if (xid) - xid->mapped = 1; -} - -static void -ecore_event_x_handle_map_request(XEvent * xevent) -{ - Ecore_Event_Window_Map_Request *e; - - e = NEW(Ecore_Event_Window_Map_Request, 1); - e->win = xevent->xmaprequest.window; - e->root = ecore_window_get_root(e->win); - ecore_add_event(ECORE_EVENT_WINDOW_MAP_REQUEST, e, ecore_event_generic_free); - ecore_validate_xid(e->win); -} - -static void -ecore_event_x_handle_reparent_notify(XEvent * xevent) -{ - Ecore_Event_Window_Reparent *e; - Window parent; - Ecore_XID *xid = NULL; - - e = NEW(Ecore_Event_Window_Reparent, 1); - e->win = xevent->xreparent.window; - xid = ecore_validate_xid(e->win); - e->root = ecore_window_get_root(e->win); - parent = ecore_window_get_parent(e->win); - e->parent_from = parent; - e->parent = xevent->xreparent.parent; - ecore_validate_xid(e->parent); - ecore_del_child(parent, e->win); - ecore_add_child(xevent->xreparent.parent, xevent->xreparent.window); - if (xid) - xid->parent = e->parent; - ecore_add_event(ECORE_EVENT_WINDOW_REPARENT, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_configure_notify(XEvent * xevent) -{ - Ecore_Event_Window_Configure *e; - Ecore_XID *xid; - - e = NEW(Ecore_Event_Window_Configure, 1); - e->win = xevent->xconfigure.window; - e->root = ecore_window_get_root(e->win); - e->x = xevent->xconfigure.x; - e->y = xevent->xconfigure.y; - e->w = xevent->xconfigure.width; - e->h = xevent->xconfigure.height; - if (!xevent->xconfigure.send_event) - { - xid = ecore_validate_xid(e->win); - if (xid) - { - xid->x = e->x; - xid->y = e->y; - xid->w = e->w; - xid->h = e->h; - } - e->wm_generated = 0; - /* FIXME: don't handle redoing stack for xevent->xconfigure.above */ - /* member (the window is stacked immediately in stack above this) */ - } - else - e->wm_generated = 1; - ecore_add_event(ECORE_EVENT_WINDOW_CONFIGURE, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_configure_request(XEvent * xevent) -{ - Ecore_Event_Window_Configure_Request *e; - - e = NEW(Ecore_Event_Window_Configure_Request, 1); - e->win = xevent->xconfigurerequest.window; - e->root = ecore_window_get_root(e->win); - e->x = xevent->xconfigurerequest.x; - e->y = xevent->xconfigurerequest.y; - e->w = xevent->xconfigurerequest.width; - e->h = xevent->xconfigurerequest.height; - e->stack_win = xevent->xconfigurerequest.above; - e->detail = xevent->xconfigurerequest.detail; - e->mask = xevent->xconfigurerequest.value_mask; - ecore_add_event(ECORE_EVENT_WINDOW_CONFIGURE_REQUEST, e, - ecore_event_generic_free); -} - -static void -ecore_event_x_handle_circulate_notify(XEvent * xevent) -{ - Ecore_Event_Window_Circulate *e; - - e = NEW(Ecore_Event_Window_Circulate, 1); - e->win = xevent->xcirculate.window; - e->root = ecore_window_get_root(e->win); - if (xevent->xcirculate.place == PlaceOnBottom) - e->lower = 1; - else - e->lower = 0; - ecore_add_event(ECORE_EVENT_WINDOW_CIRCULATE, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_circulate_request(XEvent * xevent) -{ - Ecore_Event_Window_Circulate_Request *e; - - e = NEW(Ecore_Event_Window_Circulate_Request, 1); - e->win = xevent->xcirculaterequest.window; - e->root = ecore_window_get_root(e->win); - if (xevent->xcirculaterequest.place == PlaceOnBottom) - e->lower = 1; - else - e->lower = 0; - ecore_add_event(ECORE_EVENT_WINDOW_CIRCULATE_REQUEST, e, - ecore_event_generic_free); -} - -static void -ecore_event_x_handle_property_notify(XEvent * xevent) -{ - Ecore_Event_Window_Property *e; - - e = NEW(Ecore_Event_Window_Property, 1); - e->win = xevent->xproperty.window; - e->root = ecore_window_get_root(e->win); - e->atom = xevent->xproperty.atom; - e->time = xevent->xproperty.time; - ecore_add_event(ECORE_EVENT_WINDOW_PROPERTY, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_colormap_notify(XEvent * xevent) -{ - Ecore_Event_Colormap *e; - - e = NEW(Ecore_Event_Colormap, 1); - e->win = xevent->xcolormap.window; - e->root = ecore_window_get_root(e->win); - e->cmap = xevent->xcolormap.colormap; - if (xevent->xcolormap.state == ColormapInstalled) - e->installed = 1; - else - e->installed = 0; - ecore_add_event(ECORE_EVENT_COLORMAP, e, ecore_event_generic_free); -} - -Ecore_Event_Dnd_Drop_Request *ev_drop_request_pending = NULL; - -static void -ecore_event_x_handle_selection_notify(XEvent * xevent) -{ - Ecore_Event_Dnd_Drop_Request *e; - char *data; - int size; - static Atom atom_xdndactioncopy = 0; - static Atom atom_xdndactionmove = 0; - static Atom atom_xdndactionlink = 0; - static Atom atom_xdndactionask = 0; - static Atom atom_xdndactionlist = 0; - - e = ev_drop_request_pending; - if (!e) - { - Ecore_Event_Paste_Request *e2; - - e2 = NEW(Ecore_Event_Paste_Request, 1); - e2->string = ecore_selection_get_data(xevent->xselection.requestor, - xevent->xselection.property); - if (e2->string) - { - e2->win = xevent->xselection.requestor; - e2->root = ecore_window_get_root(e2->win); - e2->source_win = xevent->xselection.requestor; - ecore_add_event(ECORE_EVENT_PASTE_REQUEST, e2, - ecore_event_paste_request_free); - } - else - { - FREE(e2); - } - return; - } - - ECORE_ATOM(atom_xdndactioncopy, "XdndActionCopy"); - ECORE_ATOM(atom_xdndactionmove, "XdndActionMove"); - ECORE_ATOM(atom_xdndactionlink, "XdndActionLink"); - ECORE_ATOM(atom_xdndactionask, "XdndActionAsk"); - ECORE_ATOM(atom_xdndactionlist, "XdndActionList"); - data = ecore_dnd_selection_get(xevent->xany.window, e->source_win, - xevent->xselection.property, &size); - if (data) - { - char *s, *buf; - int i, is; - Atom *method = NULL; - - method = ecore_window_property_get(e->source_win, - atom_xdndactionlist, XA_ATOM, &is); - if (method) - { - e->copy = 0; - e->link = 0; - e->move = 0; - if (*method == atom_xdndactioncopy) - e->copy = 1; - else if (*method == atom_xdndactionmove) - e->move = 1; - else if (*method == atom_xdndactionlink) - e->link = 1; - FREE(method); - } - else - { - e->copy = 0; - e->link = 0; - e->move = 0; - } - s = data; - buf = NEW(char, size); - - i = 0; - is = 0; - e->files = NULL; - while ((s[is]) && (is < size)) - { - if ((i == 0) && (s[is] == '#')) - { - for (; ((s[is] != 0) && (s[is] != '\n')); is++); - } - else - { - if (s[is] != '\r') - { - buf[i++] = s[is]; - } - else - { - buf[i] = 0; - e->num_files++; - REALLOC_PTR(e->files, e->num_files); - e->files[e->num_files - 1] = strdup(buf); - buf[0] = 0; - i = 0; - is++; - } - is++; - } - } - if (i > 0) - { - buf[i] = 0; - e->num_files++; - REALLOC_PTR(e->files, e->num_files); - e->files[e->num_files - 1] = strdup(buf); - } - FREE(buf); - FREE(data); - } - ecore_add_event(ECORE_EVENT_DND_DROP_REQUEST, e, - ecore_event_dnd_drop_request_free); - ev_drop_request_pending = NULL; -} - -static void -ecore_event_x_handle_selection_clear(XEvent * xevent) -{ - Ecore_Event_Clear_Selection *e; - - e = NEW(Ecore_Event_Clear_Selection, 1); - e->win = xevent->xselectionclear.window; - e->root = ecore_window_get_root(e->win); - e->selection = xevent->xselectionclear.selection; - ecore_add_event(ECORE_EVENT_CLEAR_SELECTION, e, ecore_event_generic_free); -} - -static void -ecore_event_x_handle_selection_request(XEvent * xevent) -{ - static Atom atom_xdndselection = 0; - static Atom atom_text_plain = 0; - static Atom atom_text_uri_list = 0; - static Atom atom_text_moz_url = 0; - static Atom atom_netscape_url = 0; - static Atom atom_text_selection = 0; - Ecore_Event_Dnd_Data_Request *e; - - ECORE_ATOM(atom_xdndselection, "XdndSelection"); - ECORE_ATOM(atom_text_plain, "text/plain"); - ECORE_ATOM(atom_text_uri_list, "text/uri-list"); - ECORE_ATOM(atom_text_moz_url, "text/x-moz-url"); - ECORE_ATOM(atom_netscape_url, "_NETSCAPE_URL"); - ECORE_ATOM(atom_text_selection, "TEXT_SELECTION"); - if (xevent->xselectionrequest.selection == atom_xdndselection) - { - e = NEW(Ecore_Event_Dnd_Data_Request, 1); - e->win = xevent->xselectionrequest.owner; - e->root = ecore_window_get_root(e->win); - e->source_win = xevent->xselectionrequest.requestor; - e->plain_text =0; - e->uri_list = 0; - e->moz_url = 0; - e->netscape_url = 0; - - if (xevent->xselectionrequest.target == atom_text_plain) e->plain_text = 1; - if (xevent->xselectionrequest.target == atom_text_uri_list) e->uri_list = 1; - if (xevent->xselectionrequest.target == atom_text_moz_url) e->moz_url = 1; - if (xevent->xselectionrequest.target == atom_netscape_url) e->netscape_url = 1; - e->destination_atom = xevent->xselectionrequest.property; - ecore_add_event(ECORE_EVENT_DND_DATA_REQUEST, e, - ecore_event_generic_free); - } - else - { - XEvent ev; - Atom target_list[2]; - static Atom xa_targets = None; - - if (xa_targets == None) - xa_targets = XInternAtom(xevent->xselectionrequest.display, - "TARGETS", False); - ev.xselection.type = SelectionNotify; - ev.xselection.property = None; - ev.xselection.display = xevent->xselectionrequest.display; - ev.xselection.requestor = xevent->xselectionrequest.requestor; - ev.xselection.selection = xevent->xselectionrequest.selection; - ev.xselection.target = xevent->xselectionrequest.target; - ev.xselection.time = xevent->xselectionrequest.time; - if (xevent->xselectionrequest.target == xa_targets) - { - target_list[0] = (Atom) xa_targets; - target_list[1] = (Atom) XA_STRING; - XChangeProperty(xevent->xselectionrequest.display, - xevent->xselectionrequest.requestor, - xevent->xselectionrequest.property, - xevent->xselectionrequest.target, - (8 * sizeof(target_list[0])), - PropModeReplace, - (unsigned char *)target_list, - (sizeof(target_list) / sizeof(target_list[0]))); - ev.xselection.property = xevent->xselectionrequest.property; - } - else if (xevent->xselectionrequest.target == XA_STRING) - { - void *data; - int size; - - data = ecore_window_property_get(xevent->xselectionrequest.owner, - atom_text_selection, XA_STRING, - &size); - if (data) - { - XChangeProperty(xevent->xselectionrequest.display, - xevent->xselectionrequest.requestor, - xevent->xselectionrequest.property, - xevent->xselectionrequest.target, - 8, PropModeReplace, data, size); - FREE(data); - } - ev.xselection.property = xevent->xselectionrequest.property; - } - XSendEvent(xevent->xselectionrequest.display, - xevent->xselectionrequest.requestor, False, 0, &ev); - } -} - -static void -ecore_event_x_handle_client_message(XEvent * xevent) -{ - static Atom atom_wm_delete_window = 0; - static Atom atom_wm_protocols = 0; - static Atom atom_xdndstatus = 0; - static Atom atom_xdndenter = 0; - static Atom atom_xdndleave = 0; - static Atom atom_xdndfinished = 0; - static Atom atom_xdndposition = 0; - static Atom atom_xdnddrop = 0; - static Atom atom_text_uri_list = 0; - static Atom atom_xdndactioncopy = 0; - static Atom atom_xdndactionlink = 0; - static Atom atom_xdndactionmove = 0; - static Atom atom_xdndactionprivate = 0; - - /* setup some known atoms to translate this message into a sensible event */ - ECORE_ATOM(atom_wm_delete_window, "WM_DELETE_WINDOW"); - ECORE_ATOM(atom_wm_protocols, "WM_PROTOCOLS"); - ECORE_ATOM(atom_xdndstatus, "XdndStatus"); - ECORE_ATOM(atom_xdndfinished, "XdndFinished"); - ECORE_ATOM(atom_xdndenter, "XdndEnter"); - ECORE_ATOM(atom_xdndleave, "XdndLeave"); - ECORE_ATOM(atom_xdnddrop, "XdndDrop"); - ECORE_ATOM(atom_xdndposition, "XdndPosition"); - ECORE_ATOM(atom_xdndactioncopy, "XdndActionCopy"); - ECORE_ATOM(atom_xdndactionlink, "XdndActionLink"); - ECORE_ATOM(atom_xdndactionmove, "XdndActionMove"); - ECORE_ATOM(atom_xdndactionprivate, "XdndActionPrivate"); - ECORE_ATOM(atom_text_uri_list, "text/uri-list"); - - /* first type = delete event sent to client */ - if ((xevent->xclient.message_type == atom_wm_protocols) && - (xevent->xclient.format == 32) && - (xevent->xclient.data.l[0] == (long)atom_wm_delete_window)) - { - Ecore_Event_Window_Delete *e; - - e = NEW(Ecore_Event_Window_Delete, 1); - e->win = xevent->xclient.window; - e->root = ecore_window_get_root(e->win); - ecore_add_event(ECORE_EVENT_WINDOW_DELETE, e, ecore_event_generic_free); - } - else if ((xevent->xclient.message_type == atom_xdndenter) && - (xevent->xclient.format == 32)) - { -/* if ((xevent->xclient.data.l[2] == (long)atom_text_uri_list) || - * (xevent->xclient.data.l[3] == (long)atom_text_uri_list) || - * (xevent->xclient.data.l[4] == (long)atom_text_uri_list)) - */ { - Ecore_Event_Dnd_Drop_Request *e; - - - if (ev_drop_request_pending) - { - ecore_event_dnd_drop_request_free(ev_drop_request_pending); - ev_drop_request_pending = NULL; - } - e = NEW(Ecore_Event_Dnd_Drop_Request, 1); - e->win = xevent->xclient.window; - e->root = ecore_window_get_root(e->win); - e->source_win = (Window) xevent->xclient.data.l[0]; - if (!ecore_dnd_selection_convert - (e->source_win, e->win, atom_text_uri_list)) - { - FREE(e); - return; - } - e->files = NULL; - e->num_files = 0; - ev_drop_request_pending = e; - } - } - else if ((xevent->xclient.message_type == atom_xdndleave) && - (xevent->xclient.format == 32)) - { - Ecore_Event_Dnd_Drop_End *e; - - e = NEW(Ecore_Event_Dnd_Drop_End, 1); - e->win = xevent->xclient.window; - e->root = ecore_window_get_root(e->win); - e->source_win = (Window) xevent->xclient.data.l[0]; - ecore_add_event(ECORE_EVENT_DND_DROP_END, e, ecore_event_generic_free); - } - else if ((xevent->xclient.message_type == atom_xdndposition) && - (xevent->xclient.format == 32)) - { - Ecore_Event_Dnd_Drop_Position *e; - - e = NEW(Ecore_Event_Dnd_Drop_Position, 1); - e->win = xevent->xclient.window; - e->root = ecore_window_get_root(e->win); - e->source_win = (Window) xevent->xclient.data.l[0]; - e->x = (xevent->xclient.data.l[2] >> 16) & 0xffff; - e->y = xevent->xclient.data.l[2] & 0xffff; - ecore_add_event(ECORE_EVENT_DND_DROP_POSITION, e, - ecore_event_generic_free); - } - else if ((xevent->xclient.message_type == atom_xdndstatus) && - (xevent->xclient.format == 32)) - { - Ecore_Event_Dnd_Drop_Status *e; - - ecore_clear_target_status(); - e = NEW(Ecore_Event_Dnd_Drop_Status, 1); - e->win = xevent->xclient.window; - e->root = ecore_window_get_root(e->win); - e->source_win = (Window) xevent->xclient.data.l[0]; - e->x = (xevent->xclient.data.l[2] >> 16) & 0xffff; - e->y = xevent->xclient.data.l[2] & 0xffff; - e->w = (xevent->xclient.data.l[3] >> 16) & 0xffff; - e->h = xevent->xclient.data.l[3] & 0xffff; - - e->copy = e->link = e->move = e->e_private = 0; - if( xevent->xclient.data.l[4] == atom_xdndactioncopy ) - e->copy = 1; - else if( xevent->xclient.data.l[4] == atom_xdndactionlink ) - e->link = 1; - else if( xevent->xclient.data.l[4] == atom_xdndactionmove ) - e->move = 1; - else if( xevent->xclient.data.l[4] == atom_xdndactionprivate ) - e->e_private = 1; - - if (xevent->xclient.data.l[1] & 0x1) - e->ok = 1; - else - e->ok = 0; - if (xevent->xclient.data.l[1] & 0x2) - e->all_position_msgs = 1; - else - e->all_position_msgs = 0; - ecore_add_event(ECORE_EVENT_DND_DROP_STATUS, e, ecore_event_generic_free); - } - else if ((xevent->xclient.message_type == atom_xdndfinished) && - (xevent->xclient.format == 32)) - { - Ecore_Event_Dnd_Drop_End *e; - - e = NEW(Ecore_Event_Dnd_Drop_End, 1); - e->win = xevent->xclient.window; - e->root = ecore_window_get_root(e->win); - e->source_win = (Window) xevent->xclient.data.l[0]; - ecore_add_event(ECORE_EVENT_DND_DROP_END, e, ecore_event_generic_free); - } - else if ((xevent->xclient.message_type == atom_xdnddrop) && - (xevent->xclient.format == 32)) - { - Ecore_Event_Dnd_Drop *e; - - e = NEW(Ecore_Event_Dnd_Drop, 1); - e->win = xevent->xclient.window; - e->root = ecore_window_get_root(e->win); - e->source_win = (Window) xevent->xclient.data.l[0]; - ecore_add_event(ECORE_EVENT_DND_DROP, e, ecore_event_generic_free); - } - else - { - Ecore_Event_Message *e; - - e = NEW(Ecore_Event_Message, 1); - e->win = xevent->xclient.window; - e->format = xevent->xclient.format; - e->atom = xevent->xclient.message_type; - MEMCPY(xevent->xclient.data.b, e->data.b, char, 20); - - ecore_add_event(ECORE_EVENT_MESSAGE, e, ecore_event_generic_free); - } -} - -static void -ecore_event_x_handle_shape_change(XEvent * xevent) -{ - Ecore_Event_Window_Shape *e; - XShapeEvent *shape_event; - - shape_event = (XShapeEvent *) xevent; - e = NEW(Ecore_Event_Window_Shape, 1); - e->win = shape_event->window; - e->root = ecore_window_get_root(e->win); - e->time = shape_event->time; - ecore_add_event(ECORE_EVENT_WINDOW_SHAPE, e, ecore_event_generic_free); -} - -char * -ecore_keypress_translate_into_typeable(Ecore_Event_Key_Down * e) -{ - /* exceptions */ - if ((!strcmp(e->key, "Delete")) || - (!strcmp(e->key, "BackSpace")) || - (!strcmp(e->key, "Tab")) || - (!strcmp(e->key, "Escape")) || - (!strcmp(e->key, "Return")) || - (!strcmp(e->key, "KP_Enter")) || - (!strcmp(e->key, "Enter")) || - (!strcmp(e->key, "KP_Divide")) || - (!strcmp(e->key, "KP_Multiply")) || - (!strcmp(e->key, "KP_Subtract")) || - (!strcmp(e->key, "KP_Add")) || (!strcmp(e->key, "Enter"))) - return NULL; - return e->compose; -} diff --git a/legacy/ecore/src/e_events.c b/legacy/ecore/src/e_events.c deleted file mode 100644 index 0a8f442e5e..0000000000 --- a/legacy/ecore/src/e_events.c +++ /dev/null @@ -1,430 +0,0 @@ -#include "Ecore.h" -#include -#include -#include -#include -#include - -/* 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(); -} diff --git a/legacy/ecore/src/e_ipc.c b/legacy/ecore/src/e_ipc.c deleted file mode 100644 index 2a6de2b4ab..0000000000 --- a/legacy/ecore/src/e_ipc.c +++ /dev/null @@ -1,187 +0,0 @@ -#include "Ecore.h" -#include -#include -#include -#include -#include - -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; -} diff --git a/legacy/ecore/src/e_util.c b/legacy/ecore/src/e_util.c deleted file mode 100644 index fc4a2ae0cb..0000000000 --- a/legacy/ecore/src/e_util.c +++ /dev/null @@ -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); -} diff --git a/legacy/ecore/src/e_x.c b/legacy/ecore/src/e_x.c deleted file mode 100644 index b3d8069c2c..0000000000 --- a/legacy/ecore/src/e_x.c +++ /dev/null @@ -1,3610 +0,0 @@ -#include "Ecore.h" -#include -#include -#include -#include - -#ifdef XA_CLIPBOARD -#define X_CLIPBOARD_SELECTION XA_CLIPBOARD(disp) -#define X_CLIPBOARD_PROP XA_CLIPBOARD(disp) -#else -#define X_CLIPBOARD_SELECTION XA_PRIMARY -#define X_CLIPBOARD_PROP XA_CUT_BUFFER0 -#endif - -typedef struct _window_list Window_List; - -struct _window_list -{ - Window win; - Window_List *next; -}; - -XContext xid_context = 0; - -static Display *disp; -static Visual *default_vis; -static Colormap default_cm; -static int default_depth; -static Window default_win; -static Window default_root; - -static int lock_scroll = 0; -static int lock_num = 0; -static int lock_caps = 0; - -static Window focused_win = 0; - -static int mod_shift = 0; -static int mod_ctrl = 0; -static int mod_alt = 0; -static int mod_win = 0; - -static Window grabkey_win = 0; - -static int mouse_x = 0, mouse_y = 0; - -static Window current_dnd_win = 0; -static int current_dnd_target_ok = 0; -static int dnd_await_target_status = 0; - -static int x_grabs = 0; - -static Window_List *ignore_wins = NULL; - -static Window grab_pointer_win = 0; - -static Window keyboard_grab_win = 0; - -static int dnd_copy = 0; -static int dnd_link = 0; -static int dnd_move = 1; - -static void ecore_handle_x_error(Display * d, XErrorEvent * ev); -static void ecore_handle_x_io_error(Display * d); -static Window ecore_window_at_xy_0(Window base, int bx, int by, int x, - int y); - -static void -ecore_handle_x_error(Display * d, XErrorEvent * ev) -{ -/* - char err[16384]; - - XGetErrorText(d, ev->error_code, err, 16000); - printf("X Error:\n" - "Error: %s\nrequest: %i\nminor: %i\n", err, ev->request_code, ev->minor_code); - */ - /* ignore all X errors */ - return; - d = NULL; - ev = NULL; -} - -static void -ecore_handle_x_io_error(Display * d) -{ - /* FIXME: call clean exit handler */ - exit(1); - d = NULL; -} - -void -ecore_del_child(Window win, Window child) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return; - if (XFindContext(disp, win, xid_context, (XPointer *) & xid) == XCNOENT) - return; - if (xid) - { - int i; - - for (i = 0; i < xid->children_num; i++) - { - if (xid->children[i] == child) - { - int j; - - for (j = i; j < xid->children_num - 1; j++) - xid->children[j] = xid->children[j + 1]; - xid->children_num--; - REALLOC(xid->children, Window, xid->children_num); - return; - } - } - } -} - -void -ecore_add_child(Window win, Window child) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return; - if (XFindContext(disp, win, xid_context, (XPointer *) & xid) == XCNOENT) - return; - if (xid) - { - int i; - - for (i = 0; i < xid->children_num; i++) - { - if (xid->children[i] == child) - return; - } - xid->children_num++; - REALLOC(xid->children, Window, xid->children_num); - xid->children[xid->children_num - 1] = child; - } - xid = ecore_validate_xid(child); -} - -void -ecore_raise_child(Window win, Window child) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return; - if (XFindContext(disp, win, xid_context, (XPointer *) & xid) == XCNOENT) - return; - if (xid) - { - int i; - - for (i = 0; i < xid->children_num; i++) - { - if (xid->children[i] == child) - { - int j; - - for (j = i; j < xid->children_num - 1; j++) - xid->children[j] = xid->children[j + 1]; - xid->children[xid->children_num - 1] = child; - return; - } - } - } -} - -void -ecore_lower_child(Window win, Window child) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return; - if (XFindContext(disp, win, xid_context, (XPointer *) & xid) == XCNOENT) - return; - if (xid) - { - int i; - - for (i = 0; i < xid->children_num; i++) - { - if (xid->children[i] == child) - { - int j; - - for (j = i; j > 0; j--) - xid->children[j] = xid->children[j - 1]; - xid->children[0] = child; - return; - } - } - } -} - -Ecore_XID * -ecore_add_xid(Window win, int x, int y, int w, int h, int depth, Window parent) -{ - Ecore_XID *xid = NULL; - - ecore_window_add_events(win, XEV_IN_OUT | XEV_CONFIGURE | XEV_VISIBILITY); - xid = NEW(Ecore_XID, 1); - xid->win = win; - xid->x = x; - xid->y = y; - xid->w = w; - xid->h = h; - xid->mapped = 0; - xid->depth = depth; - xid->mouse_in = 0; - xid->parent = parent; - xid->root = ecore_window_get_root(parent); - xid->children_num = 0; - xid->children = NULL; - xid->gravity = ecore_window_get_gravity(win); - xid->coords_invalid = 0; - xid->bw = 0; - xid->grab_button_auto_replay = NULL; - XSaveContext(disp, xid->win, xid_context, (XPointer) xid); - ecore_add_child(parent, win); - return xid; -} - -Ecore_XID * -ecore_validate_xid(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return NULL; - if (XFindContext(disp, win, xid_context, (XPointer *) & xid) == XCNOENT) - { - XWindowAttributes att; - Window root_ret = 0, parent_ret = 0, *children_ret = NULL; - unsigned int children_ret_num = 0; - - ecore_window_add_events(win, XEV_IN_OUT | XEV_CONFIGURE | - XEV_VISIBILITY | XEV_CHILD_CHANGE); - xid = NEW(Ecore_XID, 1); - xid->win = win; - if (!XGetWindowAttributes(disp, win, &att)) - { - FREE(xid); - return NULL; - } - if (!XQueryTree(disp, win, &root_ret, &parent_ret, &children_ret, - &children_ret_num)) - { - FREE(xid); - return NULL; - } - xid->parent = parent_ret; - if (xid->parent) - ecore_validate_xid(xid->parent); - if (children_ret) - { - xid->children_num = children_ret_num; - xid->children = NEW(Window, children_ret_num); - MEMCPY(children_ret, xid->children, Window, children_ret_num); - XFree(children_ret); - } - else - { - xid->children_num = 0; - xid->children = NULL; - } - xid->root = root_ret; - xid->x = att.x; - xid->y = att.y; - xid->w = att.width; - xid->h = att.height; - if (att.map_state == IsUnmapped) - xid->mapped = 0; - else - xid->mapped = 1; - xid->depth = att.depth; - xid->mouse_in = 0; - xid->gravity = att.win_gravity; - xid->bw = att.border_width; - xid->coords_invalid = 0; - xid->grab_button_auto_replay = NULL; - XSaveContext(disp, xid->win, xid_context, (XPointer) xid); - ecore_add_child(xid->parent, win); - } - return xid; -} - -void -ecore_unvalidate_xid(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return; - if (XFindContext(disp, win, xid_context, (XPointer *) & xid) == XCNOENT) - return; - if (xid) - { - int i; - - for (i = 0; i < xid->children_num; i++) - ecore_unvalidate_xid(xid->children[i]); - ecore_del_child(xid->parent, win); - IF_FREE(xid->children); - FREE(xid); - XDeleteContext(disp, win, xid_context); - } -} - -void -ecore_sync(void) -{ - if (!disp) - return; - - XSync(disp, False); -} - -void -ecore_flush(void) -{ - if (!disp) - return; - XFlush(disp); -} - -Window -ecore_window_new(Window parent, int x, int y, int w, int h) -{ - Window win; - XSetWindowAttributes attr; - - if (!disp) - return 0; - if (!parent) - parent = default_root; - attr.backing_store = NotUseful; - attr.override_redirect = False; - attr.colormap = default_cm; - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.save_under = False; - attr.do_not_propagate_mask = True; - win = XCreateWindow(disp, parent, - x, y, w, h, 0, - default_depth, InputOutput, default_vis, - CWOverrideRedirect | CWSaveUnder | CWBackingStore | - CWColormap | CWBackPixmap | CWBorderPixel | - CWDontPropagate, &attr); - ecore_add_xid(win, x, y, w, h, default_depth, parent); - ecore_add_child(parent, win); - ecore_validate_xid(parent); - return win; -} - -Window -ecore_window_override_new(Window parent, int x, int y, int w, int h) -{ - Window win; - XSetWindowAttributes attr; - - if (!disp) - return 0; - if (!parent) - parent = default_root; - attr.backing_store = NotUseful; - attr.override_redirect = True; - attr.colormap = default_cm; - attr.border_pixel = 0; - attr.background_pixmap = None; - attr.save_under = False; - attr.do_not_propagate_mask = True; - win = XCreateWindow(disp, parent, - x, y, w, h, 0, - default_depth, InputOutput, default_vis, - CWOverrideRedirect | CWSaveUnder | CWBackingStore | - CWColormap | CWBackPixmap | CWBorderPixel | - CWDontPropagate, &attr); - ecore_add_xid(win, x, y, w, h, default_depth, parent); - ecore_add_child(parent, win); - ecore_validate_xid(parent); - return win; -} - -Window -ecore_window_input_new(Window parent, int x, int y, int w, int h) -{ - Window win; - XSetWindowAttributes attr; - - if (!disp) - return 0; - if (!parent) - parent = default_root; - attr.override_redirect = True; - attr.do_not_propagate_mask = True; - win = XCreateWindow(disp, parent, - x, y, w, h, 0, - 0, InputOnly, default_vis, - CWOverrideRedirect | CWDontPropagate, &attr); - ecore_add_xid(win, x, y, w, h, 0, parent); - ecore_add_child(parent, win); - ecore_validate_xid(parent); - return win; -} - -void -ecore_window_set_events_propagate(Window win, int propagate) -{ - XSetWindowAttributes attr; - - if (!disp) - return; - if (!win) - win = default_root; - if (!propagate) - attr.do_not_propagate_mask = True; - else - attr.do_not_propagate_mask = False; - XChangeWindowAttributes(disp, win, CWDontPropagate, &attr); -} - -void -ecore_window_show(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return; - xid = ecore_validate_xid(win); - if (xid) - { - if (xid->mapped) - return; - xid->mapped = 1; - XMapWindow(disp, win); - } -} - -void -ecore_window_hide(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) - return; - xid = ecore_validate_xid(win); - if (xid) - { - if (!xid->mapped) - return; - xid->mapped = 0; - XUnmapWindow(disp, win); - } -} - -Pixmap -ecore_pixmap_new(Window win, int w, int h, int dep) -{ - if (!disp) - return 0; - if (!win) - win = default_win; - if (dep == 0) - dep = default_depth; - return XCreatePixmap(disp, win, w, h, dep); -} - -void -ecore_pixmap_free(Pixmap pmap) -{ - if (!disp) - return; - if (!pmap) - return; - XFreePixmap(disp, pmap); -} - -void -ecore_window_set_background_pixmap(Window win, Pixmap pmap) -{ - if (!disp) - return; - if (win == 0) - win = default_root; - XSetWindowBackgroundPixmap(disp, win, pmap); -} - -void -ecore_window_set_shape_mask(Window win, Pixmap mask) -{ - if (!disp) - return; - XShapeCombineMask(disp, win, ShapeBounding, 0, 0, mask, ShapeSet); -} - -void -ecore_window_add_shape_mask(Window win, Pixmap mask) -{ - if (!disp) - return; - XShapeCombineMask(disp, win, ShapeBounding, 0, 0, mask, ShapeUnion); -} - -void -ecore_window_set_shape_window(Window win, Window src, int x, int y) -{ - if (!disp) - return; - XShapeCombineShape(disp, win, ShapeBounding, x, y, src, ShapeBounding, - ShapeSet); -} - -void -ecore_window_add_shape_window(Window win, Window src, int x, int y) -{ - if (!disp) - return; - XShapeCombineShape(disp, win, ShapeBounding, x, y, src, ShapeBounding, - ShapeUnion); -} - -void -ecore_window_set_shape_rectangle(Window win, int x, int y, int w, int h) -{ - XRectangle rect; - - if (!disp) - return; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, - Unsorted); -} - -void -ecore_window_add_shape_rectangle(Window win, int x, int y, int w, int h) -{ - XRectangle rect; - - if (!disp) - return; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, &rect, 1, ShapeUnion, - Unsorted); -} - -void -ecore_window_set_shape_rectangles(Window win, XRectangle * rect, int num) -{ - if (!disp) - return; - XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, rect, num, ShapeSet, - Unsorted); -} - -void -ecore_window_add_shape_rectangles(Window win, XRectangle * rect, int num) -{ - if (!disp) - return; - XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, rect, num, ShapeUnion, - Unsorted); -} - -void -ecore_window_clip_shape_by_rectangle(Window win, int x, int y, int w, int h) -{ - XRectangle rect; - - if (!disp) - return; - rect.x = x; - rect.y = y; - rect.width = w; - rect.height = h; - XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, &rect, 1, - ShapeIntersect, Unsorted); -} - -XRectangle * -ecore_window_get_shape_rectangles(Window win, int *num) -{ - int ord; - - if (!disp) - return NULL; - return XShapeGetRectangles(disp, win, ShapeBounding, num, &ord); -} - -void -ecore_window_select_shape_events(Window win) -{ - if (!disp) - return; - - XShapeSelectInput(disp, win, ShapeNotifyMask); -} - -void -ecore_window_unselect_shape_events(Window win) -{ - if (!disp) - return; - - XShapeSelectInput(disp, win, 0); -} - -void -ecore_window_clear(Window win) -{ - if (!disp) - return; - if (win == 0) - win = default_root; - XClearWindow(disp, win); -} - -void -ecore_window_clear_area(Window win, int x, int y, int w, int h) -{ - if (!disp) - return; - if (win == 0) - win = default_root; - XClearArea(disp, win, x, y, w, h, False); -} - -void -ecore_pointer_xy(Window win, int *x, int *y) -{ - Window dw; - unsigned int dm; - int wx, wy; - - if (!disp) - return; - - if (win == 0) - win = default_root; - - XQueryPointer(disp, win, &dw, &dw, &mouse_x, &mouse_y, &wx, &wy, &dm); - - if (x) - *x = wx; - if (y) - *y = wy; -} - -void -ecore_pointer_xy_set(int x, int y) -{ - if (!disp) return; - mouse_x = x; - mouse_y = y; -} - -void -ecore_pointer_xy_get(int *x, int *y) -{ - if (!disp) return; - if (x) - *x = mouse_x; - if (y) - *y = mouse_y; -} - -void -ecore_window_set_events(Window win, long mask) -{ - if (!disp) return; - if (win == 0) - win = default_root; - XSelectInput(disp, win, mask); -} - -void -ecore_window_remove_events(Window win, long mask) -{ - XWindowAttributes att; - - if (!disp) return; - if (win == 0) - win = default_root; - if (XGetWindowAttributes(disp, win, &att) == True) - { - mask = att.your_event_mask & (~mask); - ecore_window_set_events(win, mask); - } -} - -void -ecore_window_add_events(Window win, long mask) -{ - XWindowAttributes att; - - if (!disp) return; - if (win == 0) - win = default_root; - if (XGetWindowAttributes(disp, win, &att) == True) - { - mask = att.your_event_mask | mask; - ecore_window_set_events(win, mask); - } -} - -void -ecore_window_move(Window win, int x, int y) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - if (!xid->coords_invalid) - { - if ((xid->x == x) && (xid->y == y)) - return; - } - xid->x = x; - xid->y = y; - xid->coords_invalid = 0; - XMoveWindow(disp, win, x, y); - } -} - -#define REGRAVITATE \ -if (xid->children) \ -{ \ - int j; \ -\ - for (j = 0; j < xid->children_num; j++) \ - { \ - Ecore_XID *xid2; \ -\ - xid2 = ecore_validate_xid(xid->children[j]); \ - if (xid2) \ - { \ - xid2->coords_invalid = 1; \ - } \ - } \ -} - -#if 0 -switch (xid2->gravity) - { - case UnmapGravity: - xid2->mapped = 0; - break; - case NorthWestGravity: - break; - case NorthGravity: - xid2->x += (w - xid->w) / 2; - break; - case NorthEastGravity: - xid2->x += (w - xid->w); - break; - case WestGravity: - xid2->h += (h - xid->h) / 2; - break; - case CenterGravity: - xid2->x += (w - xid->w) / 2; - xid2->h += (h - xid->h) / 2; - break; - case EastGravity: - xid2->x += (w - xid->w); - break; - case SouthWestGravity: - xid2->y += (h - xid->h); - break; - case SouthGravity: - xid2->x += (w - xid->w) / 2; - xid2->y += (h - xid->h); - break; - case SouthEastGravity: - xid2->x += (w - xid->w); - xid2->y += (h - xid->h); - break; - case StaticGravity: - xid2->coords_invalid = 1; - break; - default: - break; - } -} -} -} -#endif - -void -ecore_window_resize(Window win, int w, int h) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - if (!xid->coords_invalid) - { - if ((xid->w == w) && (xid->h == h)) - return; - } - REGRAVITATE; - xid->w = w; - xid->h = h; - xid->coords_invalid = 0; - XResizeWindow(disp, win, w, h); - } -} - -void -ecore_window_move_resize(Window win, int x, int y, int w, int h) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - if (!xid->coords_invalid) - { - if ((xid->x == x) && (xid->y == y) && (xid->w == w) && (xid->h == h)) - return; - } - REGRAVITATE; - xid->x = x; - xid->y = y; - xid->w = w; - xid->h = h; - xid->coords_invalid = 0; - XMoveResizeWindow(disp, win, x, y, w, h); - } -} - -int -ecore_x_get_fd(void) -{ - if (!disp) return 0; - return ConnectionNumber(disp); -} - -void -ecore_set_error_handler(Ecore_Error_Function func) -{ - if (!disp) return; - XSetErrorHandler((XErrorHandler) func); -} - -void -ecore_reset_error_handler(void) -{ - if (!disp) return; - XSetErrorHandler((XErrorHandler) ecore_handle_x_error); -} - -int -ecore_display_init(char *display) -{ - int revert; - - xid_context = XUniqueContext(); - disp = XOpenDisplay(display); - if (!disp) - { - char *d; - - d = getenv("DISPLAY"); -/* no need for this anymore - if (d) - fprintf(stderr, - "Fatal Error:\n" - "Cannot connect to the display nominated by your DISPLAY variable:\n" - "%s\n" - "Try changing your DISPLAY variable like:\n" - "DISPLAY=host:0 application_name\n", d); - else - fprintf(stderr, - "Fatal Error:\n" - "No DISPLAY variable set so cannot determine display to connect to.\n" - "Try setting your DISPLAY variable like:\n" - "DISPLAY=host:0 appication_name\n"); -*/ - return 0; - } - XSetErrorHandler((XErrorHandler) ecore_handle_x_error); - XSetIOErrorHandler((XIOErrorHandler) ecore_handle_x_io_error); - default_vis = DefaultVisual(disp, DefaultScreen(disp)); - default_depth = DefaultDepth(disp, DefaultScreen(disp)); - default_cm = DefaultColormap(disp, DefaultScreen(disp)); - default_win = DefaultRootWindow(disp); - default_root = DefaultRootWindow(disp); - mod_shift = ecore_mod_mask_shift_get(); - mod_ctrl = ecore_mod_mask_ctrl_get(); - mod_alt = ecore_mod_mask_alt_get(); - mod_win = ecore_mod_mask_win_get(); - XGetInputFocus(disp, &focused_win, &revert); - ecore_window_set_events(default_root, XEV_KEY | XEV_IN_OUT | XEV_MOUSE_MOVE | - XEV_CONFIGURE | XEV_CHILD_CHANGE | XEV_PROPERTY | - XEV_COLORMAP | XEV_VISIBILITY); - ecore_pointer_xy(0, NULL, NULL); - return 1; -} - -int -ecore_events_pending(void) -{ - if (!disp) return 0; - return XPending(disp); -} - -void -ecore_get_next_event(XEvent * event) -{ - if (!disp) return; - XNextEvent(disp, event); -} - -int -ecore_event_shape_get_id(void) -{ - int base = -1, err_base; - - if (!disp) return 0; - XShapeQueryExtension(disp, &base, &err_base); - base += ShapeNotify; - return base; -} - -KeySym -ecore_key_get_keysym_from_keycode(KeyCode keycode) -{ - if (!disp) return 0; - return XKeycodeToKeysym(disp, keycode, 0); -} - -char * -ecore_key_get_string_from_keycode(KeyCode keycode) -{ - char *str; - - if (!disp) return strdup(""); - str = XKeysymToString(ecore_key_get_keysym_from_keycode(keycode)); - if (!str) - return strdup(""); - return strdup(str); -} - -void -ecore_event_allow(int mode, Time t) -{ - if (!disp) return; - XAllowEvents(disp, mode, t); -} - -int -ecore_lock_mask_scroll_get(void) -{ - static int have_mask = 0; - static int mask = 0; - XModifierKeymap *mod; - KeyCode nl; - int i; - int masks[8] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, - Mod4Mask, Mod5Mask - }; - - if (!disp) return 0; - if (have_mask) - return mask; - mod = XGetModifierMapping(disp); - nl = XKeysymToKeycode(disp, XK_Scroll_Lock); - if ((mod) && (mod->max_keypermod > 0)) - { - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - if ((nl) && (mod->modifiermap[i] == nl)) - { - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - have_mask = 1; - return mask; - } - } - } - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - } - return 0; -} - -int -ecore_lock_mask_num_get(void) -{ - static int have_mask = 0; - static int mask = 0; - XModifierKeymap *mod; - KeyCode nl; - int i; - int masks[8] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, - Mod4Mask, Mod5Mask - }; - - if (!disp) return 0; - if (have_mask) - return mask; - mod = XGetModifierMapping(disp); - nl = XKeysymToKeycode(disp, XK_Num_Lock); - if ((mod) && (mod->max_keypermod > 0)) - { - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - if ((nl) && (mod->modifiermap[i] == nl)) - { - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - have_mask = 1; - return mask; - } - } - } - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - } - return 0; -} - -int -ecore_lock_mask_caps_get(void) -{ - static int have_mask = 0; - static int mask = 0; - XModifierKeymap *mod; - KeyCode nl; - int i; - int masks[8] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, - Mod4Mask, Mod5Mask - }; - - if (!disp) return 0; - if (have_mask) - return mask; - mod = XGetModifierMapping(disp); - nl = XKeysymToKeycode(disp, XK_Caps_Lock); - if ((mod) && (mod->max_keypermod > 0)) - { - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - if ((nl) && (mod->modifiermap[i] == nl)) - { - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - have_mask = 1; - return mask; - } - } - } - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - } - return 0; -} - -int -ecore_mod_mask_shift_get(void) -{ - static int have_mask = 0; - static int mask = 0; - XModifierKeymap *mod; - KeyCode nl; - int i; - int masks[8] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, - Mod4Mask, Mod5Mask - }; - - if (!disp) return 0; - if (have_mask) - return mask; - mod = XGetModifierMapping(disp); - nl = XKeysymToKeycode(disp, XK_Shift_L); - if ((mod) && (mod->max_keypermod > 0)) - { - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - if ((nl) && (mod->modifiermap[i] == nl)) - { - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - have_mask = 1; - return mask; - } - } - } - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - } - return 0; -} - -int -ecore_mod_mask_ctrl_get(void) -{ - static int have_mask = 0; - static int mask = 0; - XModifierKeymap *mod; - KeyCode nl; - int i; - int masks[8] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, - Mod4Mask, Mod5Mask - }; - - if (!disp) return 0; - if (have_mask) - return mask; - mod = XGetModifierMapping(disp); - nl = XKeysymToKeycode(disp, XK_Control_L); - if ((mod) && (mod->max_keypermod > 0)) - { - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - if ((nl) && (mod->modifiermap[i] == nl)) - { - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - have_mask = 1; - return mask; - } - } - } - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - } - return 0; -} - -int -ecore_mod_mask_alt_get(void) -{ - static int have_mask = 0; - static int mask = 0; - XModifierKeymap *mod; - KeyCode nl; - int i; - int masks[8] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, - Mod4Mask, Mod5Mask - }; - - if (!disp) return 0; - if (have_mask) - return mask; - mod = XGetModifierMapping(disp); - nl = XKeysymToKeycode(disp, XK_Alt_L); - if ((mod) && (mod->max_keypermod > 0)) - { - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - if ((nl) && (mod->modifiermap[i] == nl)) - { - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - have_mask = 1; - return mask; - } - } - } - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - } - return 0; -} - -int -ecore_mod_mask_win_get(void) -{ - static int have_mask = 0; - static int mask = 0; - XModifierKeymap *mod; - KeyCode nl; - int i; - int masks[8] = { - ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, - Mod4Mask, Mod5Mask - }; - - if (!disp) return 0; - if (have_mask) - return mask; - mod = XGetModifierMapping(disp); - nl = XKeysymToKeycode(disp, XK_Meta_L); - if ((mod) && (mod->max_keypermod > 0)) - { - for (i = 0; i < (8 * mod->max_keypermod); i++) - { - if ((nl) && (mod->modifiermap[i] == nl)) - { - mask = masks[i / mod->max_keypermod]; - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - if (mask == ecore_mod_mask_alt_get()) - mask = 0; - if (mask == ecore_mod_mask_ctrl_get()) - mask = 0; - have_mask = 1; - return mask; - } - } - } - if (mod) - { - if (mod->modifiermap) - XFree(mod->modifiermap); - XFree(mod); - } - return 0; -} - -int -ecore_lock_mask_get(void) -{ - static int mask = 0; - Window root_ret, child_ret; - int root_x_ret, root_y_ret, win_x_ret, win_y_ret; - unsigned int mask_ret; - - if (!disp) return 0; - if (!mask) - mask = ecore_lock_mask_scroll_get() | ecore_lock_mask_num_get() | - ecore_lock_mask_caps_get(); - XQueryPointer(disp, default_root, &root_ret, &child_ret, &root_x_ret, - &root_y_ret, &win_x_ret, &win_y_ret, &mask_ret); - return (mask_ret & mask); -} - -int -ecore_modifier_mask_get(void) -{ - Window root_ret, child_ret; - int root_x_ret, root_y_ret, win_x_ret, win_y_ret; - unsigned int mask_ret; - - if (!disp) return 0; - XQueryPointer(disp, default_root, &root_ret, &child_ret, &root_x_ret, - &root_y_ret, &win_x_ret, &win_y_ret, &mask_ret); - return (mask_ret); -} - -Window -ecore_get_key_grab_win(void) -{ - if (!disp) return 0; - return grabkey_win; -} - -void -ecore_key_grab(char *key, Ecore_Event_Key_Modifiers mods, int anymod, int sync) -{ - KeyCode keycode; - int i, mod, mask_scroll, mask_num, mask_caps, masks[8], mode; - - if (!disp) return; - keycode = ecore_key_get_keycode(key); - mod = 0; - mode = GrabModeAsync; - if (sync) - mode = GrabModeSync; - if (!grabkey_win) - grabkey_win = default_root; - if (mods & ECORE_EVENT_KEY_MODIFIER_SHIFT) - mod |= ecore_mod_mask_shift_get(); - if (mods & ECORE_EVENT_KEY_MODIFIER_CTRL) - mod |= ecore_mod_mask_ctrl_get(); - if (mods & ECORE_EVENT_KEY_MODIFIER_ALT) - mod |= ecore_mod_mask_alt_get(); - if (mods & ECORE_EVENT_KEY_MODIFIER_WIN) - mod |= ecore_mod_mask_win_get(); - mask_scroll = ecore_lock_mask_scroll_get(); - mask_num = ecore_lock_mask_num_get(); - mask_caps = ecore_lock_mask_caps_get(); - masks[0] = 0; - masks[1] = mask_scroll; - masks[2] = mask_num; - masks[3] = mask_caps; - masks[4] = mask_scroll | mask_num; - masks[5] = mask_scroll | mask_caps; - masks[6] = mask_num | mask_caps; - masks[7] = mask_scroll | mask_num | mask_caps; - if (anymod) - XGrabKey(disp, keycode, AnyModifier, grabkey_win, False, mode, mode); - else - { - for (i = 0; i < 8; i++) - XGrabKey(disp, keycode, masks[i] | mod, grabkey_win, False, mode, mode); - } -} - -void -ecore_key_ungrab(char *key, Ecore_Event_Key_Modifiers mods, int anymod) -{ - KeyCode keycode; - - if (!disp) return; - keycode = ecore_key_get_keycode(key); - if (anymod) - XUngrabKey(disp, keycode, AnyModifier, default_root); - else - { - int i, mod, mask_scroll, mask_num, mask_caps, masks[8]; - - mod = 0; - if (mods & ECORE_EVENT_KEY_MODIFIER_SHIFT) - mod |= ecore_mod_mask_shift_get(); - if (mods & ECORE_EVENT_KEY_MODIFIER_CTRL) - mod |= ecore_mod_mask_ctrl_get(); - if (mods & ECORE_EVENT_KEY_MODIFIER_ALT) - mod |= ecore_mod_mask_alt_get(); - if (mods & ECORE_EVENT_KEY_MODIFIER_WIN) - mod |= ecore_mod_mask_win_get(); - mask_scroll = ecore_lock_mask_scroll_get(); - mask_num = ecore_lock_mask_num_get(); - mask_caps = ecore_lock_mask_caps_get(); - masks[0] = 0; - masks[1] = mask_scroll; - masks[2] = mask_num; - masks[3] = mask_caps; - masks[4] = mask_scroll | mask_num; - masks[5] = mask_scroll | mask_caps; - masks[6] = mask_num | mask_caps; - masks[7] = mask_scroll | mask_num | mask_caps; - for (i = 0; i < 8; i++) - XUngrabKey(disp, keycode, masks[i] | mod, grabkey_win); - } -} - -KeyCode -ecore_key_get_keycode(char *key) -{ - if (!disp) return 0; - return XKeysymToKeycode(disp, XStringToKeysym(key)); -} - -void -ecore_window_destroy(Window win) -{ - if (!disp) return; - ecore_unvalidate_xid(win); - XDestroyWindow(disp, win); -} - -void -ecore_window_reparent(Window win, Window parent, int x, int y) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - if (parent == 0) - parent = default_root; - XReparentWindow(disp, win, parent, x, y); - ecore_del_child(xid->parent, win); - ecore_add_child(parent, win); - xid->parent = parent; - xid->x = x; - xid->y = y; - } -} - -void -ecore_window_raise(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - XRaiseWindow(disp, win); - ecore_raise_child(xid->parent, win); - } -} - -void -ecore_window_lower(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - XLowerWindow(disp, win); - ecore_lower_child(xid->parent, win); - } -} - -void -ecore_window_get_geometry(Window win, int *x, int *y, int *w, int *h) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - if (win == 0) - win = default_root; - xid = ecore_validate_xid(win); - if ((xid) && (xid->coords_invalid)) - { - Window dw; - int rx, ry; - unsigned int rw, rh, di; - - XGetGeometry(disp, win, &dw, &rx, &ry, &rw, &rh, &di, &di); - xid->x = rx; - xid->y = ry; - xid->w = (int)rw; - xid->h = (int)rh; - xid->coords_invalid = 0; - } - if (xid) - { - if (x) - *x = xid->x; - if (y) - *y = xid->y; - if (w) - *w = xid->w; - if (h) - *h = xid->h; - } - else - { - if (x) - *x = 0; - if (y) - *y = 0; - if (w) - *w = 0; - if (h) - *h = 0; - } -} - -int -ecore_window_get_depth(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return 0; - if (win == 0) - win = default_root; - xid = ecore_validate_xid(win); - if (xid) - return xid->depth; - return -1; -} - -int -ecore_window_exists(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return 0; - xid = ecore_validate_xid(win); - if (xid) - return 1; - return 0; -} - -Window -ecore_window_get_parent(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return 0; - xid = ecore_validate_xid(win); - if (xid) - return xid->parent; - return 0; -} - -Window * -ecore_window_get_children(Window win, int *num) -{ - Ecore_XID *xid = NULL; - - if (!disp) return NULL; - if (win == 0) - win = default_root; - xid = ecore_validate_xid(win); - if (xid) - { - Window *wlist = NULL; - - *num = xid->children_num; - if (xid->children) - { - wlist = NEW(Window, xid->children_num); - MEMCPY(xid->children, wlist, Window, xid->children_num); - } - return wlist; - } - *num = 0; - return NULL; -} - -int -ecore_window_mouse_in(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return 0; - if (win == 0) - win = default_root; - xid = ecore_validate_xid(win); - if (xid) - return xid->mouse_in; - return 0; -} - -void -ecore_window_mouse_set_in(Window win, int in) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - if (win == 0) - win = default_root; - xid = ecore_validate_xid(win); - if (xid) - xid->mouse_in = in; -} - -Display * -ecore_display_get(void) -{ - return disp; -} - -Window -ecore_window_get_root(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return 0; - xid = ecore_validate_xid(win); - if (xid) - return xid->root; - return 0; -} - -void -ecore_lock_scroll_set(int onoff) -{ - lock_scroll = onoff; -} - -int -ecore_lock_scroll_get(void) -{ - return lock_scroll; -} - -void -ecore_lock_num_set(int onoff) -{ - lock_num = onoff; -} - -int -ecore_lock_num_get(void) -{ - return lock_num; -} - -void -ecore_lock_caps_set(int onoff) -{ - lock_caps = onoff; -} - -int -ecore_lock_caps_get(void) -{ - return lock_caps; -} - -void -ecore_mod_shift_set(int onoff) -{ - mod_shift = onoff; -} - -int -ecore_mod_shift_get(void) -{ - return mod_shift; -} - -void -ecore_mod_ctrl_set(int onoff) -{ - mod_ctrl = onoff; -} - -int -ecore_mod_ctrl_get(void) -{ - return mod_ctrl; -} - -void -ecore_mod_alt_set(int onoff) -{ - mod_alt = onoff; -} - -int -ecore_mod_alt_get(void) -{ - return mod_alt; -} - -void -ecore_mod_win_set(int onoff) -{ - mod_win = onoff; -} - -int -ecore_mod_win_get(void) -{ - return mod_win; -} - -void -ecore_focus_window_set(Window win) -{ - focused_win = win; -} - -Window -ecore_focus_window_get(void) -{ - return focused_win; -} - -void -ecore_focus_to_window(Window win) -{ - if (!disp) return; - if (win == 0) - win = default_root; - XSetInputFocus(disp, win, RevertToNone, CurrentTime); -} - -void -ecore_focus_mode_reset(void) -{ - if (!disp) return; - XSetInputFocus(disp, default_root, RevertToPointerRoot, CurrentTime); -} - -Atom -ecore_atom_get(char *name) -{ - if (!disp) return 0; - return XInternAtom(disp, name, False); -} - -void -ecore_window_set_delete_inform(Window win) -{ - static Atom protocols[1] = { 0 }; - - if (!disp) return; - ECORE_ATOM(protocols[0], "WM_DELETE_WINDOW"); - XSetWMProtocols(disp, win, protocols, 1); -} - -void -ecore_window_property_set(Window win, Atom type, Atom format, int size, - void *data, int number) -{ - if (!disp) return; - if (win == 0) - win = default_root; - if (size != 32) - XChangeProperty(disp, win, type, format, size, PropModeReplace, - (unsigned char *)data, number); - else - { - long *dat; - int i, *ptr; - - dat = NEW(long, number); - - for (ptr = (int *)data, i = 0; i < number; i++) - dat[i] = ptr[i]; - XChangeProperty(disp, win, type, format, size, PropModeReplace, - (unsigned char *)dat, number); - FREE(dat); - } -} - -void * -ecore_window_property_get(Window win, Atom type, Atom format, int *size) -{ - unsigned char *retval; - Atom type_ret; - unsigned long bytes_after, num_ret; - int format_ret; - void *data = NULL; - - if (!disp) - return NULL; - - retval = NULL; - if (win == 0) - win = default_root; - XGetWindowProperty(disp, win, type, 0, 0x7fffffffL, False, format, - &type_ret, &format_ret, &num_ret, &bytes_after, &retval); - if (retval) - { - if (format_ret == 32) - { - int i; - - *size = num_ret * sizeof(unsigned int); - - data = NEW(unsigned int, num_ret); - - for (i = 0; i < (int)num_ret; i++) - ((unsigned int *)data)[i] = ((unsigned long *)retval)[i]; - } - else if (format_ret == 16) - { - int i; - - *size = num_ret * sizeof(unsigned short); - - data = NEW(unsigned short, *size); - - for (i = 0; i < (int)num_ret; i++) - ((unsigned short *)data)[i] = ((unsigned short *)retval)[i]; - } - else if (format_ret == 8) - { - /* format_ret == 8 */ - *size = num_ret; - data = NEW(char, num_ret); - - if (data) - memcpy(data, retval, num_ret); - } - XFree(retval); - return data; - } - *size = 0; - return NULL; -} - -void -ecore_window_dnd_advertise(Window win) -{ - static Atom atom_xdndaware = 0; - int dnd_version = 3; - - if (!disp) return; - ECORE_ATOM(atom_xdndaware, "XdndAware"); - ecore_window_property_set(win, atom_xdndaware, XA_ATOM, 32, &dnd_version, 1); -} - -void -ecore_grab(void) -{ - if (!disp) - return; - - x_grabs++; - - if (x_grabs == 1) - XGrabServer(disp); -} - -void -ecore_ungrab(void) -{ - if (!disp) - return; - - x_grabs--; - - if (x_grabs == 0) - { - XUngrabServer(disp); - ecore_sync(); - } -} - -void -ecore_window_ignore(Window win) -{ - Window_List *w; - - if (!disp) return; - if (win == 0) - win = default_root; - w = NEW(Window_List, 1); - w->win = win; - w->next = ignore_wins; - ignore_wins = w; -} - -void -ecore_window_no_ignore(Window win) -{ - Window_List *w, *pw; - - if (!disp) return; - if (win == 0) - win = default_root; - for (pw = NULL, w = ignore_wins; w; pw = w, w = w->next) - { - if (w->win == win) - { - if (pw) - pw->next = w->next; - else - ignore_wins = w->next; - FREE(w); - return; - } - } -} - -int -ecore_window_is_ignored(Window win) -{ - Window_List *w; - - if (!disp) return 0; - if (win == 0) - win = default_root; - for (w = ignore_wins; w; w = w->next) - { - if (w->win == win) - return 1; - } - return 0; -} - -static Window -ecore_window_at_xy_0(Window base, int bx, int by, int x, int y) -{ - Window *list = NULL; - XWindowAttributes att; - Window child = 0, parent_win = 0, root_win = 0; - int i; - unsigned int ww, wh, num; - int wx, wy; - - if (!disp) return 0; - if ((!XGetWindowAttributes(disp, base, &att)) || - (att.map_state != IsViewable)) - return 0; - - wx = att.x; - wy = att.y; - ww = att.width; - wh = att.height; - - wx += bx; - wy += by; - - if (!((x >= wx) && (y >= wy) && (x < (int)(wx + ww)) && (y < (int)(wy + wh)))) - return 0; - - if (!XQueryTree(disp, base, &root_win, &parent_win, &list, &num)) - return base; - if (list) - { - for (i = num - 1;; i--) - { - if (!ecore_window_is_ignored(list[i])) - { - if ((child = ecore_window_at_xy_0(list[i], wx, wy, x, y)) != 0) - { - XFree(list); - return child; - } - } - if (!i) - break; - } - XFree(list); - } - return base; -} - -Window -ecore_window_get_at_xy(int x, int y) -{ - Window child; - - if (!disp) return 0; - ecore_grab(); - child = ecore_window_at_xy_0(default_root, 0, 0, x, y); - if (child) - { - ecore_ungrab(); - return child; - } - ecore_ungrab(); - return default_root; -} - -int -ecore_window_dnd_capable(Window win) -{ - static Atom atom_xdndaware = 0; - int dnd_version = 3; - int *atom_ret; - int size = 0; - - if (!disp) return 0; - ECORE_ATOM(atom_xdndaware, "XdndAware"); - atom_ret = ecore_window_property_get(win, atom_xdndaware, XA_ATOM, &size); - if ((atom_ret) && (size >= (int)sizeof(int))) - { - if (atom_ret[0] == dnd_version) - { - FREE(atom_ret); - return 1; - } - FREE(atom_ret); - } - return 0; -} - -void -ecore_window_dnd_handle_motion(Window source_win, int x, int y, int dragging) -{ - static Atom atom_xdndenter = 0; - static Atom atom_xdndleave = 0; - static Atom atom_xdnddrop = 0; - static Atom atom_xdndposition = 0; - static Atom atom_xdndactioncopy = 0; - static Atom atom_xdndactionmove = 0; - static Atom atom_xdndactionlink = 0; - static Atom atom_xdndactionask = 0; - static Atom atom_text_uri_list = 0; - static Atom atom_text_plain = 0; - static Atom atom_text_moz_url = 0; - static Atom atom_netscape_url = 0; - Window win; - XEvent xevent; - - if (!disp) return; - win = ecore_window_get_at_xy(x, y); - while ((win) && (!ecore_window_dnd_capable(win))) - win = ecore_window_get_parent(win); - ECORE_ATOM(atom_xdndenter, "XdndEnter"); - ECORE_ATOM(atom_xdndleave, "XdndLeave"); - ECORE_ATOM(atom_xdnddrop, "XdndDrop"); - ECORE_ATOM(atom_xdndposition, "XdndPosition"); - ECORE_ATOM(atom_xdndactioncopy, "XdndActionCopy"); - ECORE_ATOM(atom_xdndactionmove, "XdndActionMove"); - ECORE_ATOM(atom_xdndactionlink, "XdndActionLink"); - ECORE_ATOM(atom_xdndactionask, "XdndActionAsk"); - ECORE_ATOM(atom_text_uri_list, "text/uri-list"); - ECORE_ATOM(atom_text_plain, "text/plain"); - ECORE_ATOM(atom_text_moz_url, "text/x-moz-url"); - ECORE_ATOM(atom_netscape_url, "_NETSCAPE_URL"); - if ((win != current_dnd_win) && (current_dnd_win)) - { - /* send leave to old dnd win */ - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.format = 32; - xevent.xclient.window = current_dnd_win; - xevent.xclient.message_type = atom_xdndleave; - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = 0; - xevent.xclient.data.l[2] = 0; - xevent.xclient.data.l[3] = 0; - xevent.xclient.data.l[4] = 0; - XSendEvent(disp, current_dnd_win, False, 0, &xevent); - } - if (win) - { - if (win != current_dnd_win) - { - /* send enter on new win */ - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.window = win; - xevent.xclient.message_type = atom_xdndenter; - xevent.xclient.format = 32; - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = (3 << 24); - xevent.xclient.data.l[2] = atom_text_uri_list; - xevent.xclient.data.l[3] = atom_text_plain; - xevent.xclient.data.l[4] = atom_text_moz_url; - XSendEvent(disp, win, False, 0, &xevent); - ecore_clear_target_status(); - } - /* kjb cep */ - if(!dnd_await_target_status) - { - /* send position information */ - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.window = win; - xevent.xclient.message_type = atom_xdndposition; - xevent.xclient.format = 32; - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = (3 << 24); - xevent.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); - xevent.xclient.data.l[3] = CurrentTime; - if (dnd_copy) - xevent.xclient.data.l[4] = atom_xdndactioncopy; - else if (dnd_link) - xevent.xclient.data.l[4] = atom_xdndactionlink; - else if (dnd_move) - xevent.xclient.data.l[4] = atom_xdndactionmove; - else - xevent.xclient.data.l[4] = atom_xdndactionask; - XSendEvent(disp, win, False, 0, &xevent); - dnd_await_target_status = 1; - } - } - if (!dragging) - { - if (win) - { - if (current_dnd_target_ok) - { - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.window = win; - xevent.xclient.message_type = atom_xdnddrop; - xevent.xclient.format = 32; - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = 0; - xevent.xclient.data.l[2] = CurrentTime; - xevent.xclient.data.l[3] = 0; - xevent.xclient.data.l[4] = 0; - XSendEvent(disp, win, False, 0, &xevent); - } - else - { - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.window = win; - xevent.xclient.message_type = atom_xdndleave; - xevent.xclient.format = 32; - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = 0; - xevent.xclient.data.l[2] = 0; - xevent.xclient.data.l[3] = 0; - xevent.xclient.data.l[4] = 0; - XSendEvent(disp, win, False, 0, &xevent); - } - } - current_dnd_target_ok = 0; - } - current_dnd_win = win; -} - - -void -ecore_clear_target_status(void) -{ - dnd_await_target_status = 0; -} - - -int -ecore_dnd_selection_convert(Window win, Window req, Atom type) -{ - static Atom atom_xdndselection = 0; - static Atom atom_jxselectionwindowproperty = 0; - - if (!disp) return 0; - ECORE_ATOM(atom_xdndselection, "XdndSelection"); - ECORE_ATOM(atom_jxselectionwindowproperty, "JXSelectionWindowProperty"); - if (win == XGetSelectionOwner(disp, atom_xdndselection)) - { - XConvertSelection(disp, atom_xdndselection, type, - atom_jxselectionwindowproperty, req, CurrentTime); - return 1; - } - return 0; -} - -void * -ecore_dnd_selection_get(Window win, Window req, Atom type, int *size) -{ - unsigned char *data = NULL; - long bytes_read; - unsigned long remaining = 1; - - if (!disp) return NULL; - *size = 0; - bytes_read = 0; - while (remaining) - { - unsigned char *s; - Atom actual; - int format; - unsigned long count; - - s = NULL; - if (XGetWindowProperty(disp, win, type, bytes_read / 4, 0x10000, 1, - AnyPropertyType, &actual, &format, &count, - &remaining, &s) != Success) - { - /* error occured */ - XFree(s); - IF_FREE(data); - *size = 0; - return NULL; - } - if (s) - { - /* got some mroe data - append it */ - bytes_read += count; - if (!data) - data = NEW(char, bytes_read); - - else - REALLOC(data, char, bytes_read); - MEMCPY(s, data + (bytes_read - count), char, count); - - XFree(s); - } - } - *size = bytes_read; - return data; - req = 0; -} - -void -ecore_dnd_set_data(Window win) -{ - static Atom atom_xdndselection = 0; - - if (!disp) return; - ECORE_ATOM(atom_xdndselection, "XdndSelection"); - ecore_dnd_set_action(win); - XSetSelectionOwner(disp, atom_xdndselection, win, CurrentTime); -} - -void -ecore_dnd_set_action(Window win) -{ - static int atom_xdndactioncopy = 0; - static int atom_xdndactionmove = 0; - static int atom_xdndactionlink = 0; - static int atom_xdndactionask = 0; - static Atom atom_xdndactionlist = 0; - - if (!disp) return; - ECORE_ATOM(atom_xdndactioncopy, "XdndActionCopy"); - ECORE_ATOM(atom_xdndactionmove, "XdndActionMove"); - ECORE_ATOM(atom_xdndactionlink, "XdndActionLink"); - ECORE_ATOM(atom_xdndactionask, "XdndActionAsk"); - ECORE_ATOM(atom_xdndactionlist, "XdndActionList"); - if (dnd_copy) - ecore_window_property_set(win, atom_xdndactionlist, XA_ATOM, 32, - &atom_xdndactioncopy, 1); - else if (dnd_link) - ecore_window_property_set(win, atom_xdndactionlist, XA_ATOM, 32, - &atom_xdndactionlink, 1); - else if (dnd_move) - ecore_window_property_set(win, atom_xdndactionlist, XA_ATOM, 32, - &atom_xdndactionmove, 1); - else - ecore_window_property_set(win, atom_xdndactionlist, XA_ATOM, 32, - &atom_xdndactionask, 1); -} - -void -ecore_dnd_send_data(Window win, Window source_win, void *data, int size, - Atom dest_atom, int type) -{ - XEvent xevent; - static Atom atom_text_plain = 0; - static Atom atom_text_uri_list = 0; - static Atom atom_text_moz_url = 0; - static Atom atom_netscape_url = 0; - static Atom atom_xdndselection = 0; - Atom target; - - if (!disp) return; - ECORE_ATOM(atom_xdndselection, "XdndSelection"); - ECORE_ATOM(atom_text_uri_list, "text/uri-list"); - ECORE_ATOM(atom_text_plain, "text/plain"); - ECORE_ATOM(atom_text_moz_url, "text/x-moz-url"); - ECORE_ATOM(atom_text_moz_url, "_NETSCAPE_URL"); - ECORE_ATOM(atom_text_plain, "text/plain"); - if (type == DND_TYPE_URI_LIST) target = atom_text_uri_list; - else if (type == DND_TYPE_PLAIN_TEXT) target = atom_text_plain; - else if (type == DND_TYPE_MOZ_URL) target = atom_text_moz_url; - else if (type == DND_TYPE_NETSCAPE_URL) target = atom_netscape_url; - else target = 0; - ecore_window_property_set(win, dest_atom, target, 8, data, size); - xevent.xselection.type = SelectionNotify; - xevent.xselection.property = dest_atom; - xevent.xselection.display = disp; - xevent.xselection.requestor = win; - xevent.xselection.selection = atom_xdndselection; - xevent.xselection.target = target; - xevent.xselection.time = CurrentTime; - XSendEvent(disp, win, False, 0, &xevent); - return; - source_win = 0; -} - -void -ecore_dnd_set_mode_copy(void) -{ - dnd_copy = 1; - dnd_link = 0; - dnd_move = 0; -} - -void -ecore_dnd_set_mode_link(void) -{ - dnd_copy = 0; - dnd_link = 1; - dnd_move = 0; -} - -void -ecore_dnd_set_mode_move(void) -{ - dnd_copy = 0; - dnd_link = 0; - dnd_move = 1; -} - -void -ecore_dnd_set_mode_ask(void) -{ - dnd_copy = 0; - dnd_link = 0; - dnd_move = 0; -} - -void -ecore_dnd_own_selection(Window win) -{ - static Atom atom_xdndselection = 0; - static Atom atom_jxselectionwindowproperty = 0; - - if (!disp) return; - ECORE_ATOM(atom_xdndselection, "XdndSelection"); - ECORE_ATOM(atom_jxselectionwindowproperty, "JXSelectionWindowProperty"); - - if (!XSetSelectionOwner(disp, atom_xdndselection, win, CurrentTime)) - return; -} - -void -ecore_dnd_send_drop(Window win, Window source_win) -{ - static Atom atom_xdnddrop = 0; - XEvent xevent; - - if (!disp) return; - ECORE_ATOM(atom_xdnddrop, "XdndDrop"); - - ecore_dnd_own_selection(source_win); - - memset(&xevent, 0, sizeof(xevent)); - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.window = win; - xevent.xclient.message_type = atom_xdnddrop; - xevent.xclient.format = 32; - - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = CurrentTime; - xevent.xclient.data.l[2] = 0; - xevent.xclient.data.l[3] = 0; - xevent.xclient.data.l[4] = 0; - XSendEvent(disp, win, False, 0, &xevent); -} - -void -ecore_window_dnd_send_status_ok(Window source_win, Window win, int x, int y, - int w, int h) -{ - static Atom atom_xdndstatus = 0; - static Atom atom_xdndactioncopy = 0; - static Atom atom_xdndactionmove = 0; - static Atom atom_xdndactionlink = 0; - static Atom atom_xdndactionask = 0; - XEvent xevent; - - if (!disp) return; - ECORE_ATOM(atom_xdndstatus, "XdndStatus"); - ECORE_ATOM(atom_xdndactioncopy, "XdndActionCopy"); - ECORE_ATOM(atom_xdndactionmove, "XdndActionMove"); - ECORE_ATOM(atom_xdndactionlink, "XdndActionLink"); - ECORE_ATOM(atom_xdndactionask, "XdndActionAsk"); - memset(&xevent, 0, sizeof(xevent)); - - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.window = win; - xevent.xclient.message_type = atom_xdndstatus; - xevent.xclient.format = 32; - - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = 3; - xevent.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); - xevent.xclient.data.l[3] = ((h << 16) & 0xffff0000) | (w & 0xffff); - if (dnd_copy) - xevent.xclient.data.l[4] = atom_xdndactioncopy; - else if (dnd_link) - xevent.xclient.data.l[4] = atom_xdndactionlink; - else if (dnd_move) - xevent.xclient.data.l[4] = atom_xdndactionmove; - else - xevent.xclient.data.l[4] = atom_xdndactionask; - XSendEvent(disp, win, False, 0, &xevent); -} - -void -ecore_window_dnd_send_finished(Window source_win, Window win) -{ - static Atom atom_xdndfinished = 0; - XEvent xevent; - - if (!disp) return; - ECORE_ATOM(atom_xdndfinished, "XdndFinished"); - memset(&xevent, 0, sizeof(xevent)); - - xevent.xany.type = ClientMessage; - xevent.xany.display = disp; - xevent.xclient.window = win; - xevent.xclient.message_type = atom_xdndfinished; - xevent.xclient.format = 32; - - xevent.xclient.data.l[0] = source_win; - xevent.xclient.data.l[1] = 0; - xevent.xclient.data.l[2] = 0; - xevent.xclient.data.l[3] = 0; - xevent.xclient.data.l[4] = 0; - XSendEvent(disp, win, False, 0, &xevent); -} - -void -ecore_window_dnd_ok(int ok) -{ - current_dnd_target_ok = ok; -} - -void -ecore_window_dnd_finished(void) -{ - current_dnd_win = 0; -} - -void -ecore_window_set_title(Window win, char *title) -{ - if (!disp) return; - XStoreName(disp, win, title); -} - -void -ecore_window_set_name_class(Window win, char *name, char *class) -{ - XClassHint hint; - - if (!disp) return; - hint.res_name = name; - hint.res_class = class; - XSetClassHint(disp, win, &hint); -} - -void -ecore_window_get_name_class(Window win, char **name, char **class) -{ - XClassHint xch; - - if (!disp) return; - if (name) - *name = NULL; - if (class) - *class = NULL; - if (XGetClassHint(disp, win, &xch)) - { - if (name) - { - if (xch.res_name) - *name = strdup(xch.res_name); - } - if (class) - { - if (xch.res_class) - *class = strdup(xch.res_class); - } - XFree(xch.res_name); - XFree(xch.res_class); - } -} - -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) -{ - XWMHints *hints; - - if (!disp) return; - hints = XGetWMHints(disp, win); - if (hints) - { - if ((hints->flags & InputHint) && (accepts_focus)) - { - if (hints->input) - *accepts_focus = 1; - else - *accepts_focus = 0; - } - if ((hints->flags & StateHint) && (initial_state)) - { - *initial_state = hints->initial_state; - } - if ((hints->flags & IconPixmapHint) && (icon_pixmap)) - { - *icon_pixmap = hints->icon_pixmap; - } - if ((hints->flags & IconMaskHint) && (icon_mask)) - { - *icon_mask = hints->icon_pixmap; - } - if ((hints->flags & IconWindowHint) && (icon_window)) - { - *icon_window = hints->icon_window; - } - if ((hints->flags & WindowGroupHint) && (window_group)) - { - *window_group = hints->window_group; - } - XFree(hints); - } -} - -char * -ecore_window_get_machine(Window win) -{ - XTextProperty xtp; - - if (!disp) return NULL; - if (XGetWMClientMachine(disp, win, &xtp)) - { - char *s; - - if (!xtp.value) - return NULL; - s = strdup(xtp.value); - XFree(xtp.value); - return s; - } - return NULL; -} - -char * -ecore_window_get_command(Window win) -{ - int cargc; - char **cargv; - - if (!disp) return NULL; - if (XGetCommand(disp, win, &cargv, &cargc)) - { - if (cargc > 0) - { - char *s; - int size, i; - - size = 0; - for (i = 0; i < cargc; i++) - size += strlen(cargv[i]); - size += cargc - 1; - s = NEW(char, size + 1); - s[0] = 0; - - strcpy(s, cargv[0]); - for (i = 1; i < cargc; i++) - { - strcat(s, " "); - strcat(s, cargv[i]); - } - XFreeStringList(cargv); - return s; - } - else - return NULL; - } - return NULL; -} - -char * -ecore_window_get_icon_name(Window win) -{ - XTextProperty xtp; - - if (!disp) return NULL; - if (XGetWMIconName(disp, win, &xtp)) - { - char *s; - - if (!xtp.value) - return NULL; - s = strdup(xtp.value); - XFree(xtp.value); - return s; - } - return NULL; -} - -void -ecore_window_set_min_size(Window win, int w, int h) -{ - XSizeHints hints; - long ret; - - if (!disp) return; - memset(&hints, 0, sizeof(XSizeHints)); - XGetWMNormalHints(disp, win, &hints, &ret); - hints.flags |= PMinSize | PSize | USSize; - hints.min_width = w; - hints.min_height = h; - XSetWMNormalHints(disp, win, &hints); -} - -void -ecore_window_set_max_size(Window win, int w, int h) -{ - XSizeHints hints; - long ret; - - if (!disp) return; - memset(&hints, 0, sizeof(XSizeHints)); - XGetWMNormalHints(disp, win, &hints, &ret); - hints.flags |= PMaxSize | PSize | USSize; - hints.max_width = w; - hints.max_height = h; - XSetWMNormalHints(disp, win, &hints); -} - -void -ecore_window_set_xy_hints(Window win, int x, int y) -{ - XSizeHints hints; - long ret; - - if (!disp) return; - memset(&hints, 0, sizeof(XSizeHints)); - XGetWMNormalHints(disp, win, &hints, &ret); - hints.flags |= PPosition | USPosition | PSize | USSize; - hints.x = x; - hints.y = y; - XSetWMNormalHints(disp, win, &hints); -} - -void -ecore_window_get_frame_size(Window win, int *l, int *r, int *t, int *b) -{ - static Atom atom_e_frame_size = 0; - int *data, size; - - if (!disp) return; - ECORE_ATOM(atom_e_frame_size, "_E_FRAME_SIZE"); - data = ecore_window_property_get(win, atom_e_frame_size, XA_CARDINAL, &size); - if (data) - { - if (size == (4 * sizeof(int))) - { - if (l) - *l = data[0]; - if (r) - *r = data[1]; - if (t) - *t = data[2]; - if (b) - *b = data[3]; - } - else - { - if (l) - *l = 0; - if (r) - *r = 0; - if (t) - *t = 0; - if (b) - *b = 0; - } - FREE(data); - } - else - { - if (l) - *l = 0; - if (r) - *r = 0; - if (t) - *t = 0; - if (b) - *b = 0; - } -} - -int -ecore_window_save_under(Window win) -{ - XSetWindowAttributes att; - XWindowAttributes gatt; - - if (!disp) return 0; - att.save_under = True; - XChangeWindowAttributes(disp, win, CWSaveUnder, &att); - XGetWindowAttributes(disp, win, &gatt); - return (gatt.save_under == True) ? 1 : 0; -} - -GC -ecore_gc_new(Drawable d) -{ - XGCValues gcv; - - if (!disp) return 0; - if (d == 0) - d = default_root; - return XCreateGC(disp, d, 0, &gcv); -} - -void -ecore_gc_free(GC gc) -{ - if (!disp) return; - XFreeGC(disp, gc); -} - -void -ecore_gc_set_fg(GC gc, int val) -{ - if (!disp) return; - XSetForeground(disp, gc, val); -} - -void -ecore_fill_rectangle(Drawable d, GC gc, int x, int y, int w, int h) -{ - if (!disp) return; - XFillRectangle(disp, d, gc, x, y, w, h); -} - -void -ecore_draw_rectangle(Drawable d, GC gc, int x, int y, int w, int h) -{ - if (!disp) return; - XDrawRectangle(disp, d, gc, x, y, w - 1, h - 1); -} - -void -ecore_draw_line(Drawable d, GC gc, int x1, int y1, int x2, int y2) -{ - if (!disp) return; - XDrawLine(disp, d, gc, x1, y1, x2, y2); -} - -void -ecore_draw_point(Drawable d, GC gc, int x, int y) -{ - if (!disp) return; - XDrawPoint(disp, d, gc, x, y); -} - -void -ecore_window_hint_set_layer(Window win, int layer) -{ - static Atom atom_win_layer = 0; - - if (!disp) return; - ECORE_ATOM(atom_win_layer, "_WIN_LAYER"); - ecore_window_property_set(win, atom_win_layer, XA_CARDINAL, 32, &layer, 1); -} - -void -ecore_window_hint_set_sticky(Window win, int sticky) -{ - static Atom atom_win_state = 0; - static Atom atom_win_hints = 0; - int data; - - if (!disp) return; - ECORE_ATOM(atom_win_state, "_WIN_STATE"); - ECORE_ATOM(atom_win_hints, "_WIN_HINTS"); - if (sticky) - { - data = ((1 << 0) | (1 << 8) | (1 << 9)); - ecore_window_property_set(win, atom_win_state, XA_CARDINAL, 32, &data, 1); - data = ((1 << 0) | (1 << 1) | (1 << 2)); - ecore_window_property_set(win, atom_win_hints, XA_CARDINAL, 32, &data, 1); - } - else - { - data = 0; - ecore_window_property_set(win, atom_win_state, XA_CARDINAL, 32, &data, 1); - ecore_window_property_set(win, atom_win_hints, XA_CARDINAL, 32, &data, 1); - } -} - -void -ecore_window_hint_set_borderless(Window win) -{ - static Atom atom_motif_wm_hints = 0; - int data[5]; - - if (!disp) return; - ECORE_ATOM(atom_motif_wm_hints, "_MOTIF_WM_HINTS"); - data[0] = 0x3; - data[1] = 0x0; - data[2] = 0x0; - data[3] = 0x2ada27b0; - data[4] = 0x2aabd6b0; - ecore_window_property_set(win, atom_motif_wm_hints, atom_motif_wm_hints, 32, - data, 5); -} - -void -ecore_grab_mouse(Window win, int confine, Cursor cursor) -{ - int ret; - - if (!disp) - return; - if (confine) - ret = XGrabPointer(disp, win, False, - XEV_BUTTON | XEV_MOUSE_MOVE | XEV_IN_OUT, - GrabModeAsync, GrabModeAsync, win, cursor, CurrentTime); - else - ret = XGrabPointer(disp, win, False, - XEV_BUTTON | XEV_MOUSE_MOVE | XEV_IN_OUT, - GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); - if (ret == GrabSuccess) - grab_pointer_win = win; -} - -void -ecore_ungrab_mouse(void) -{ - if (!disp) return; - XUngrabPointer(disp, CurrentTime); - grab_pointer_win = 0; -} - -Window -ecore_grab_window_get(void) -{ - return grab_pointer_win; -} - -int -ecore_window_get_gravity(Window win) -{ - XWindowAttributes att; - - if (!disp) - return 0; - - XGetWindowAttributes(disp, win, &att); - return att.win_gravity; -} - -void -ecore_window_gravity_reset(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - XSetWindowAttributes att; - -/* if (xid->gravity != NorthWestGravity)*/ - { - att.win_gravity = NorthWestGravity; - XChangeWindowAttributes(disp, win, CWWinGravity, &att); - xid->gravity = NorthWestGravity; - xid->coords_invalid = 1; - } - } -} - -void -ecore_window_gravity_set(Window win, int gravity) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { -/* if (xid->gravity != gravity)*/ - { - XSetWindowAttributes att; - - att.win_gravity = gravity; - XChangeWindowAttributes(disp, win, CWWinGravity, &att); - xid->gravity = gravity; - xid->coords_invalid = 1; - } - } -} - -void -ecore_window_bit_gravity_set(Window win, int gravity) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - XSetWindowAttributes att; - - att.bit_gravity = gravity; - XChangeWindowAttributes(disp, win, CWBitGravity, &att); - } -} - -void -ecore_pointer_warp_by(int dx, int dy) -{ - if (!disp) return; - XWarpPointer(disp, None, None, 0, 0, 0, 0, dx, dy); -} - -void -ecore_pointer_warp_to(int x, int y) -{ - if (!disp) return; - XWarpPointer(disp, None, default_root, 0, 0, 0, 0, x, y); -} - -void -ecore_gc_set_include_inferiors(GC gc) -{ - XGCValues gcv; - - if (!disp) return; - gcv.subwindow_mode = IncludeInferiors; - XChangeGC(disp, gc, GCSubwindowMode, &gcv); -} - -void -ecore_area_copy(Drawable src, Drawable dest, GC gc, - int sx, int sy, int sw, int sh, int dx, int dy) -{ - if (!disp) return; - if (src == 0) - src = default_root; - if (dest == 0) - dest = default_root; - XCopyArea(disp, src, dest, gc, sx, sy, sw, sh, dx, dy); -} - -Window -ecore_window_root(void) -{ - return default_root; -} - -void -ecore_window_get_virtual_area(Window win, int *area_x, int *area_y) -{ - static Atom atom_win_area = 0; - int *data, size; - - if (!disp) return; - ECORE_ATOM(atom_win_area, "_WIN_AREA"); - data = ecore_window_property_get(win, atom_win_area, XA_CARDINAL, &size); - if (data) - { - if (size == (sizeof(int) * 2)) - { - if (area_x) - *area_x = data[0]; - if (area_y) - *area_y = data[1]; - } - FREE(data); - } -} - -void -ecore_get_virtual_area(int *area_x, int *area_y) -{ - static Atom atom_win_area = 0; - int *data, size; - - if (!disp) return; - ECORE_ATOM(atom_win_area, "_WIN_AREA"); - data = ecore_window_property_get(default_root, atom_win_area, XA_CARDINAL, &size); - if (data) - { - if (size == (sizeof(int) * 2)) - { - if (area_x) - *area_x = data[0]; - if (area_y) - *area_y = data[1]; - } - FREE(data); - } -} - -void -ecore_window_get_root_relative_location(Window win, int *x, int *y) -{ - int dx, dy; - Window parent; - Ecore_XID *xid = NULL; - - if (!disp) return; - if (win == 0) - win = default_root; - if (win == default_root) - { - if (x) - *x = 0; - if (y) - *y = 0; - return; - } - xid = ecore_validate_xid(win); - if (!xid) - { - if (x) - *x = 0; - if (y) - *y = 0; - return; - } - dx = 0; - dy = 0; - do - { - parent = xid->parent; - dx += xid->x; - dy += xid->y; - if (parent != default_root) - { - xid = ecore_validate_xid(parent); - if (!xid) - { - if (x) - *x = dx; - if (y) - *y = dy; - return; - } - } - } - while (parent != default_root); - if (x) - *x = dx; - if (y) - *y = dy; -} - -void -ecore_window_button_grab_auto_replay_set(Window win, int (*func) (Ecore_Event_Mouse_Down *ev)) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (!xid) return; - xid->grab_button_auto_replay = func; -} - -void * -ecore_window_button_grab_auto_replay_get(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return NULL; - xid = ecore_validate_xid(win); - if (!xid) return NULL; - return xid->grab_button_auto_replay; -} - -void -ecore_button_grab(Window win, int button, int events, - Ecore_Event_Key_Modifiers mod, int any_mod) -{ - unsigned int b; - unsigned int m; - unsigned int locks[8]; - int i; - - if (!disp) return; - b = button; - if (b == 0) - b = AnyButton; - m = 0; - if (any_mod) - m = AnyModifier; - else - { - if (mod & ECORE_EVENT_KEY_MODIFIER_SHIFT) - m |= ecore_mod_mask_shift_get(); - if (mod & ECORE_EVENT_KEY_MODIFIER_CTRL) - m |= ecore_mod_mask_ctrl_get(); - if (mod & ECORE_EVENT_KEY_MODIFIER_ALT) - m |= ecore_mod_mask_alt_get(); - if (mod & ECORE_EVENT_KEY_MODIFIER_WIN) - m |= ecore_mod_mask_win_get(); - } - locks[0] = 0; - locks[1] = ecore_lock_mask_caps_get(); - locks[2] = ecore_lock_mask_num_get(); - locks[3] = ecore_lock_mask_scroll_get(); - locks[4] = ecore_lock_mask_caps_get() | ecore_lock_mask_num_get(); - locks[5] = ecore_lock_mask_caps_get() | ecore_lock_mask_scroll_get(); - locks[6] = ecore_lock_mask_num_get() | ecore_lock_mask_scroll_get(); - locks[7] = - ecore_lock_mask_caps_get() | ecore_lock_mask_num_get() | - ecore_lock_mask_scroll_get(); - for (i = 0; i < 8; i++) - XGrabButton(disp, b, m | locks[i], - win, False, events, GrabModeSync, GrabModeAsync, None, None); -} - -void -ecore_button_ungrab(Window win, int button, Ecore_Event_Key_Modifiers mod, - int any_mod) -{ - unsigned int b; - unsigned int m; - unsigned int locks[8]; - int i; - - if (!disp) return; - b = button; - if (b == 0) - b = AnyButton; - m = 0; - if (any_mod) - m = AnyModifier; - else - { - if (mod & ECORE_EVENT_KEY_MODIFIER_SHIFT) - m |= ecore_mod_mask_shift_get(); - if (mod & ECORE_EVENT_KEY_MODIFIER_CTRL) - m |= ecore_mod_mask_ctrl_get(); - if (mod & ECORE_EVENT_KEY_MODIFIER_ALT) - m |= ecore_mod_mask_alt_get(); - if (mod & ECORE_EVENT_KEY_MODIFIER_WIN) - m |= ecore_mod_mask_win_get(); - } - locks[0] = 0; - locks[1] = ecore_lock_mask_caps_get(); - locks[2] = ecore_lock_mask_num_get(); - locks[3] = ecore_lock_mask_scroll_get(); - locks[4] = ecore_lock_mask_caps_get() | ecore_lock_mask_num_get(); - locks[5] = ecore_lock_mask_caps_get() | ecore_lock_mask_scroll_get(); - locks[6] = ecore_lock_mask_num_get() | ecore_lock_mask_scroll_get(); - locks[7] = - ecore_lock_mask_caps_get() | ecore_lock_mask_num_get() | - ecore_lock_mask_scroll_get(); - for (i = 0; i < 8; i++) - XUngrabButton(disp, b, m | locks[i], win); -} - -void -ecore_pointer_replay(Time t) -{ - if (!disp) return; - XSync(disp, False); - XAllowEvents(disp, ReplayPointer, t); - XSync(disp, False); -} - -void -ecore_pointer_grab(Window win, Time t) -{ - if (!disp) return; - XGrabPointer(disp, win, False, XEV_BUTTON | XEV_MOUSE_MOVE | XEV_IN_OUT, - GrabModeAsync, GrabModeAsync, None, None, t); -} - -void -ecore_pointer_ungrab(Time t) -{ - if (!disp) return; - XUngrabPointer(disp, t); -} - -void -ecore_window_send_event_move_resize(Window win, int x, int y, int w, int h) -{ - XEvent ev; - - if (!disp) return; - ev.type = ConfigureNotify; - ev.xconfigure.display = disp; - ev.xconfigure.event = win; - ev.xconfigure.window = win; - ev.xconfigure.x = x; - ev.xconfigure.y = y; - ev.xconfigure.width = w; - ev.xconfigure.height = h; - ev.xconfigure.border_width = 0; - ev.xconfigure.above = win; - ev.xconfigure.override_redirect = False; - XSendEvent(disp, win, False, StructureNotifyMask, &ev); -} - -void -ecore_window_send_client_message(Window win, Atom type, int format, void *data) -{ - XClientMessageEvent ev; - int i; - - if (!disp) return; - ev.type = ClientMessage; - ev.window = win; - ev.message_type = type; - ev.format = format; - if (format == 32) - { - for (i = 0; i < 5; i++) - ev.data.l[i] = ((unsigned int *)data)[i]; - } - else if (format == 16) - { - for (i = 0; i < 10; i++) - ev.data.s[i] = ((unsigned short *)data)[i]; - } - else if (format == 8) - { - for (i = 0; i < 20; i++) - ev.data.b[i] = ((unsigned char *)data)[i]; - } - XSendEvent(disp, win, False, 0, (XEvent *) & ev); -} - -void -ecore_window_add_to_save_set(Window win) -{ - if (!disp) return; - XAddToSaveSet(disp, win); -} - -void -ecore_window_del_from_save_set(Window win) -{ - if (!disp) return; - XRemoveFromSaveSet(disp, win); -} - -void -ecore_window_kill_client(Window win) -{ - if (!disp) return; - XKillClient(disp, (XID) win); -} - -void -ecore_window_set_border_width(Window win, int bw) -{ - Ecore_XID *xid = NULL; - - if (!disp) return; - xid = ecore_validate_xid(win); - if (xid) - { - xid->bw = bw; - } - XSetWindowBorderWidth(disp, win, bw); -} - -int -ecore_window_get_border_width(Window win) -{ - Ecore_XID *xid = NULL; - - if (!disp) return 0; - - xid = ecore_validate_xid(win); - if (xid) - { - return xid->bw; - } - - return 0; -} - -int -ecore_window_get_wm_size_hints(Window win, XSizeHints * hints, int *mask) -{ - long sup_ret; - Status ok; - - if (!disp) return 0; - - ok = XGetWMNormalHints(disp, win, hints, &sup_ret); - *mask = (int)sup_ret; - return ok; -} - -int -ecore_window_is_visible(Window win) -{ - XWindowAttributes att; - - if (!disp) return 0; - if (win == 0) - win = default_root; - if (XGetWindowAttributes(disp, win, &att) == True) - { - if (att.map_state == IsUnmapped) - return 0; - return 1; - } - return 0; -} - -int -ecore_window_is_normal(Window win) -{ - XWindowAttributes att; - - if (!disp) return 0; - if (win == 0) - win = default_root; - if (XGetWindowAttributes(disp, win, &att) == True) - { - if ((att.override_redirect) || (att.class == InputOnly)) - return 0; - return 1; - } - return 0; -} - -int -ecore_window_is_manageable(Window win) -{ - XWindowAttributes att; - - if (!disp) return 0; - if (win == 0) - win = default_root; - if (XGetWindowAttributes(disp, win, &att) == True) - { - if ((att.map_state == IsUnmapped) || (att.override_redirect) - || (att.class == InputOnly)) - return 0; - return 1; - } - return 0; -} - -void -ecore_windows_restack(Window * wins, int num) -{ - if (!disp) return; - XRestackWindows(disp, wins, num); -} - -void -ecore_window_stack_above(Window win, Window above) -{ - XWindowChanges xwc; - - if (!disp) return; - if (win == 0) - win = default_root; - xwc.sibling = above; - xwc.stack_mode = Above; - XConfigureWindow(disp, win, CWSibling | CWStackMode, &xwc); -} - -void -ecore_window_stack_below(Window win, Window below) -{ - XWindowChanges xwc; - - if (!disp) return; - - if (win == 0) - win = default_root; - xwc.sibling = below; - xwc.stack_mode = Below; - XConfigureWindow(disp, win, CWSibling | CWStackMode, &xwc); -} - -char * -ecore_window_get_title(Window win) -{ - XTextProperty xtp; - - if (!disp) return 0; - - if (win == 0) - win = default_root; - if (XGetWMName(disp, win, &xtp)) - { - int items; - char **list; - Status s; - char *title = NULL; - - if (xtp.format == 8) - { - s = XmbTextPropertyToTextList(disp, &xtp, &list, &items); - if ((s == Success) && (items > 0)) - { - title = strdup(*list); - XFreeStringList(list); - } - else - title = strdup((char *)xtp.value); - } - else - title = strdup((char *)xtp.value); - XFree(xtp.value); - return title; - } - return NULL; -} - -void -ecore_keyboard_grab(Window win) -{ - int status; - - if (!disp) return; - if (keyboard_grab_win) - return; - if (win == 0) - win = default_root; - keyboard_grab_win = win; - status = - XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); - if ((status == AlreadyGrabbed) || (status == GrabNotViewable) - || (status == GrabFrozen) || (status == GrabInvalidTime)) - keyboard_grab_win = 0; -} - -void -ecore_keyboard_ungrab(void) -{ - if (!disp) return; - if (!keyboard_grab_win) - return; - keyboard_grab_win = 0; - XUngrabKeyboard(disp, CurrentTime); -} - -Window -ecore_keyboard_grab_window_get(void) -{ - if (!disp) return 0; - return keyboard_grab_win; -} - -Window -ecore_selection_set(char *string) -{ - Window target = 0; - static Atom dest = 0; - Atom selection; - - if (!disp) return 0; - selection = X_CLIPBOARD_SELECTION; - ECORE_ATOM(dest, "TEXT_SELECTION"); - target = ecore_window_new(0, 0, 0, 77, 7); - ecore_window_add_events(target, XEV_CONFIGURE | XEV_PROPERTY); - XSetSelectionOwner(disp, selection, target, CurrentTime); - if (XGetSelectionOwner(disp, XA_PRIMARY) != target) - { - ecore_window_destroy(target); - return 0; - } - XChangeProperty(disp, target, dest, - XA_STRING, 8, PropModeReplace, string, strlen(string)); - return target; -} - -Window -ecore_selection_request(void) -{ - static Atom dest = 0; - Atom selection; - Window target = 0; - - if (!disp) return 0; - selection = X_CLIPBOARD_SELECTION; - ECORE_ATOM(dest, "TEXT_SELECTION"); - target = ecore_window_new(0, 0, 0, 7, 77); - ecore_window_add_events(target, XEV_CONFIGURE | XEV_PROPERTY); - XConvertSelection(disp, XA_PRIMARY, XA_STRING, dest, target, CurrentTime); - return target; -} - -char * -ecore_selection_get_data(Window win, Atom prop) -{ - char *string = NULL; - long nread; - unsigned long bytes_after, nitems; - unsigned char *data; - Atom actual_type; - int actual_fmt; - - if (!disp) return NULL; - if (prop == None) - return NULL; - for (nread = 0, bytes_after = 1; bytes_after > 0;) - { - if ((XGetWindowProperty(disp, win, prop, nread / 4, - 0x10000, True, AnyPropertyType, - &actual_type, &actual_fmt, &nitems, - &bytes_after, &data) != Success)) - { - IF_FREE(string); - if (data) - { - XFree(data); - } - return NULL; - } - nread += nitems; - - if (actual_type == XA_STRING) - { - if (string) - string = realloc(string, strlen(string) + nitems + 1); - else - { - string = malloc(nitems + 1); - string[0] = 0; - } - string[strlen(string) + nitems] = 0; - strncat(string, data, nitems); - } - else - { - int size, i; - XTextProperty xtextp; - char **cl = NULL; - - xtextp.value = data; - xtextp.encoding = actual_type; - xtextp.format = actual_fmt; - xtextp.nitems = nitems; - XmbTextPropertyToTextList(disp, &xtextp, &cl, &size); - - if (cl) - { - for (i = 0; i < size; i++) - { - if (cl[i]) - { - if (string) - string = - realloc(string, strlen(string) + strlen(cl[i]) + 1); - else - { - string = malloc(strlen(cl[i]) + 1); - string[0] = 0; - } - string[strlen(string) + strlen(cl[i])] = 0; - strcat(string, cl[i]); - } - } - XFreeStringList(cl); - } - } - if (data) - { - XFree(data); - } - } - return string; -} - -void -ecore_set_blank_pointer(Window w) -{ - Cursor c; - XColor cl; - Pixmap p, m; - GC gc; - XGCValues gcv; - - if (!disp) return; - if (w == 0) - w = default_root; - p = XCreatePixmap(disp, w, 1, 1, 1); - m = XCreatePixmap(disp, w, 1, 1, 1); - gc = XCreateGC(disp, m, 0, &gcv); - XSetForeground(disp, gc, 0); - XDrawPoint(disp, m, gc, 0, 0); - XFreeGC(disp, gc); - c = XCreatePixmapCursor(disp, p, m, &cl, &cl, 0, 0); - XDefineCursor(disp, w, c); - XFreeCursor(disp, c); - XFreePixmap(disp, p); - XFreePixmap(disp, m); -} - -Cursor -ecore_cursor_new(Pixmap pmap, Pixmap mask, int x, int y, int fr, int fg, int fb, - int br, int bg, int bb) -{ - XColor cl1, cl2; - - if (!disp) return 0; - cl1.pixel = 0; - cl1.red = fr << 8 | fr; - cl1.green = fg << 8 | fg; - cl1.blue = fb << 8 | fb; - cl1.flags = DoRed | DoGreen | DoBlue; - cl2.pixel = 0; - cl2.red = br << 8 | br; - cl2.green = bg << 8 | bg; - cl2.blue = bb << 8 | bb; - cl2.flags = DoRed | DoGreen | DoBlue; - return XCreatePixmapCursor(disp, pmap, mask, &cl1, &cl2, x, y); -} - -void -ecore_cursor_free(Cursor c) -{ - if (!disp) return; - XFreeCursor(disp, c); -} - -void -ecore_cursor_set(Window win, Cursor c) -{ - if (!disp) return; - if (win == 0) - win = default_root; - XDefineCursor(disp, win, c); -}