From 098f578d0d0f21324fa7995bf5cd059a8171e23b Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Wed, 5 Oct 2011 15:31:04 +0900 Subject: [PATCH] Remove unused files --- examples/client_bench.c | 77 ----- examples/ecore_con_client_example.c | 90 ------ examples/ecore_con_server_example.c | 81 ----- examples/ecore_fd_handler_example.c | 195 ------------ examples/ecore_file_download_example.c | 86 ----- examples/server_bench.c | 62 ---- m4/efl_pthread.m4 | 130 -------- src/lib/ecore_evas/ecore_evas_cocoa.c | 468 ---------------------------- src/lib/ecore_evas/ecore_evas_private.h | 0 src/lib/ecore_evas/ecore_evas_x.c | 0 src/lib/ecore_x/Ecore_X.h | 0 src/lib/ecore_x/xlib/ecore_x_window_shape.c | 0 12 files changed, 1189 deletions(-) delete mode 100644 examples/client_bench.c delete mode 100644 examples/ecore_con_client_example.c delete mode 100644 examples/ecore_con_server_example.c delete mode 100644 examples/ecore_fd_handler_example.c delete mode 100644 examples/ecore_file_download_example.c delete mode 100644 examples/server_bench.c delete mode 100644 m4/efl_pthread.m4 delete mode 100644 src/lib/ecore_evas/ecore_evas_cocoa.c mode change 100755 => 100644 src/lib/ecore_evas/ecore_evas_private.h mode change 100755 => 100644 src/lib/ecore_evas/ecore_evas_x.c mode change 100755 => 100644 src/lib/ecore_x/Ecore_X.h mode change 100755 => 100644 src/lib/ecore_x/xlib/ecore_x_window_shape.c diff --git a/examples/client_bench.c b/examples/client_bench.c deleted file mode 100644 index 93a0fb1..0000000 --- a/examples/client_bench.c +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include -#include - -/* Ecore_Con client example - * 2010 Mike Blumenkrantz - */ - -#define NUM_CLIENTS 10000 - -static Eina_Counter *counter; -static int add = 0; -static int del = 0; - -Eina_Bool -_add(void *data, int type, Ecore_Con_Event_Server_Add *ev) -{ - ++add; - printf("Connection #%i!\n", add); - if (add == NUM_CLIENTS) - ecore_main_loop_quit(); - - return ECORE_CALLBACK_RENEW; -} - -Eina_Bool -_del(void *data, int type, Ecore_Con_Event_Server_Add *ev) -{ - ++del; - printf("Connection lost! #%i!\n", del); - - return ECORE_CALLBACK_RENEW; -} - -static void -_spawn(void *data) -{ - int x; - - for (x = 0; x < NUM_CLIENTS; x++) - { -// printf("Creating connection %i\n", x); - if (!ecore_con_server_connect(ECORE_CON_REMOTE_NODELAY, "127.0.0.1", 8080, NULL)) - { - printf("CRITICAL ERROR!\n" - "Could not create connection #%i!\n", x); - exit(1); - } - } - printf("***Job done***\n"); -} - -int main(void) -{ - double done; - eina_init(); - ecore_init(); - ecore_con_init(); - - eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR); - eina_log_domain_level_set("eina", EINA_LOG_LEVEL_ERR); - counter = eina_counter_new("client"); - eina_counter_start(counter); - done = ecore_time_get(); - - ecore_job_add(_spawn, NULL); - -/* set event handler for server connect */ - ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL); - ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_del, NULL); - -/* start client */ - ecore_main_loop_begin(); - eina_counter_stop(counter, 1); - printf("\nTime elapsed for %i connections: %f seconds\n%s", NUM_CLIENTS, ecore_time_get() - done, eina_counter_dump(counter)); - return 0; -} diff --git a/examples/ecore_con_client_example.c b/examples/ecore_con_client_example.c deleted file mode 100644 index 2f656c7..0000000 --- a/examples/ecore_con_client_example.c +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include -#include - -/* Ecore_Con client example - * 2010 Mike Blumenkrantz - */ - -/* comment if not using gnutls */ -static void -tls_log_func(int level, const char *str) -{ - fprintf(stderr, "|<%d>| %s", level, str); -} - -Eina_Bool -_add(void *data, int type, Ecore_Con_Event_Server_Add *ev) -{ - printf("Server with ip %s connected!\n", ecore_con_server_ip_get(ev->server)); - ecore_con_server_send(ev->server, "hello!", 6); - ecore_con_server_flush(ev->server); - - return ECORE_CALLBACK_RENEW; -} - - -Eina_Bool -_del(void *data, int type, Ecore_Con_Event_Server_Del *ev) -{ - printf("Lost server with ip %s!\n", ecore_con_server_ip_get(ev->server)); - ecore_main_loop_quit(); - return ECORE_CALLBACK_RENEW; -} - -Eina_Bool -_data(void *data, int type, Ecore_Con_Event_Server_Data *ev) -{ - char fmt[128]; - - snprintf(fmt, sizeof(fmt), - "Received %i bytes from server:\n" - ">>>>>\n" - "%%.%is\n" - ">>>>>\n", - ev->size, ev->size); - - printf(fmt, ev->data); - return ECORE_CALLBACK_RENEW; -} -int main() -{ - Ecore_Con_Server *svr; - Eina_Iterator *it; - const char *ca; - - eina_init(); - ecore_init(); - ecore_con_init(); - -/* comment if not using gnutls */ - gnutls_global_set_log_level(9); - gnutls_global_set_log_function(tls_log_func); - - if (!(it = eina_file_ls("/etc/ssl/certs"))) - exit(1); - - if (!(svr = ecore_con_server_connect(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_MIXED, "www.verisign.com", 443, NULL))) - exit(1); - - /* add all the CAs */ - EINA_ITERATOR_FOREACH(it, ca) - { - if (!ecore_con_ssl_server_cafile_add(svr, ca)) - printf("Could not load CA: %s!\n", ca); - eina_stringshare_del(ca); - } - - eina_iterator_free(it); - ecore_con_ssl_server_verify(svr); - -/* set event handler for server connect */ - ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL); -/* set event handler for server disconnect */ - ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb)_del, NULL); -/* set event handler for receiving server data */ - ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb)_data, NULL); - -/* start client */ - ecore_main_loop_begin(); -} diff --git a/examples/ecore_con_server_example.c b/examples/ecore_con_server_example.c deleted file mode 100644 index 5423eb1..0000000 --- a/examples/ecore_con_server_example.c +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include -#include - -/* Ecore_Con server example - * 2010 Mike Blumenkrantz - */ - -/* comment if not using gnutls */ -static void -tls_log_func(int level, const char *str) -{ - fprintf(stderr, "|<%d>| %s", level, str); -} - -Eina_Bool -_add(void *data, int type, Ecore_Con_Event_Client_Add *ev) -{ - printf("Client with ip %s connected!\n", ecore_con_client_ip_get(ev->client)); - ecore_con_client_send(ev->client, "hello!", 6); -// ecore_con_client_flush(ev->client); - ecore_con_client_timeout_set(ev->client, 5); - - return ECORE_CALLBACK_RENEW; -} - - -Eina_Bool -_del(void *data, int type, Ecore_Con_Event_Client_Del *ev) -{ - printf("Lost client with ip %s!\n", ecore_con_client_ip_get(ev->client)); - ecore_main_loop_quit(); - return ECORE_CALLBACK_RENEW; -} - -Eina_Bool -_data(void *data, int type, Ecore_Con_Event_Client_Data *ev) -{ - char fmt[128]; - - snprintf(fmt, sizeof(fmt), - "Received %i bytes from client:\n" - ">>>>>\n" - "%%.%is\n" - ">>>>>\n", - ev->size, ev->size); - - printf(fmt, ev->data); - return ECORE_CALLBACK_RENEW; -} -int main() -{ - Ecore_Con_Server *svr; - eina_init(); - ecore_init(); - ecore_con_init(); - -/* comment if not using gnutls */ - gnutls_global_set_log_level(9); - gnutls_global_set_log_function(tls_log_func); - - -/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */ - if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL))) - -/* to use simple tcp with ssl/tls, use this line */ -// if (!ecore_con_server_add(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_SSL3, "127.0.0.1", 8080, NULL)) - exit(1); - - ecore_con_ssl_server_cert_add(svr, "server.pem"); - ecore_con_ssl_server_privkey_add(svr, "server.pem"); -/* set event handler for client connect */ - ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL); -/* set event handler for client disconnect */ - ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL); -/* set event handler for receiving client data */ - ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb)_data, NULL); - -/* start server */ - ecore_main_loop_begin(); -} diff --git a/examples/ecore_fd_handler_example.c b/examples/ecore_fd_handler_example.c deleted file mode 100644 index b67e04e..0000000 --- a/examples/ecore_fd_handler_example.c +++ /dev/null @@ -1,195 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Ecore_Fd_Handler example - * 2010 Mike Blumenkrantz - * compile with gcc $(pkgconfig --cflags --libs gnutls ecore) - */ - - -#define print(...) fprintf(stderr, "line %i: ", __LINE__); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n") - -static int done = 0; - -static void -tls_log_func (int level, const char *str) -{ - fprintf(stderr, "|<%d>| %s", level, str); -} - -static const char* -SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_description_t status) -{ - switch (status) - { - case GNUTLS_HANDSHAKE_HELLO_REQUEST: - return "Hello request"; - case GNUTLS_HANDSHAKE_CLIENT_HELLO: - return "Client hello"; - case GNUTLS_HANDSHAKE_SERVER_HELLO: - return "Server hello"; - case GNUTLS_HANDSHAKE_CERTIFICATE_PKT: - return "Certificate packet"; - case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: - return "Server key exchange"; - case GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST: - return "Certificate request"; - case GNUTLS_HANDSHAKE_SERVER_HELLO_DONE: - return "Server hello done"; - case GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: - return "Certificate verify"; - case GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: - return "Client key exchange"; - case GNUTLS_HANDSHAKE_FINISHED: - return "Finished"; - case GNUTLS_HANDSHAKE_SUPPLEMENTAL: - return "Supplemental"; - } - return NULL; -} - -/* Connects to the peer and returns a socket - * descriptor. - */ -static int -tcp_connect (void) -{ - const char *PORT = "443"; - const char *SERVER = "69.58.181.89"; //verisign.com - int err, sd; - int flag = 1, curstate = 0; - struct sockaddr_in sa; - - /* sets some fd options such as nonblock */ - sd = socket (AF_INET, SOCK_STREAM, 0); - fcntl(sd, F_SETFL, O_NONBLOCK); - fcntl(sd, F_SETFD, FD_CLOEXEC); - setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)); - - setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)); - - memset (&sa, '\0', sizeof (sa)); - sa.sin_family = AF_INET; - sa.sin_port = htons (atoi (PORT)); - inet_pton (AF_INET, SERVER, &sa.sin_addr); - - /* connects to server - */ - err = connect (sd, (struct sockaddr *) &sa, sizeof (sa)); - if ((err < 0) && (errno != EINPROGRESS)) - { - print("Connect error\n"); - exit (1); - } - - return sd; -} - -/* closes the given socket descriptor. - */ -static void -tcp_close (int sd) -{ - shutdown (sd, SHUT_RDWR); /* no more receptions */ - close (sd); -} - -static Eina_Bool -_process_data(gnutls_session_t client, Ecore_Fd_Handler *fd_handler) -{ - static int ret, lastret; - static unsigned int count = 0; - - if (!done) - { - lastret = ret; - ret = gnutls_handshake (client); - count++; - if (gnutls_record_get_direction(client)) - ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_WRITE); - else - ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_READ); - /* avoid printing messages infinity times */ - if (lastret != ret) - { - print("gnutls returned with: %s - %s", gnutls_strerror_name(ret), gnutls_strerror(ret)); - if ((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) || (ret == GNUTLS_E_FATAL_ALERT_RECEIVED)) - print("Also received alert: %s", gnutls_alert_get_name(gnutls_alert_get(client))); - print("last out: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_out(client))); - print("last in: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_in(client))); - } - - if (gnutls_error_is_fatal(ret)) - { - print("yarrr this be an error!"); - exit(1); - } - - } - if (ret == GNUTLS_E_SUCCESS) - { - done = 1; - print("Handshake successful in %u handshake calls!", count); - ecore_main_loop_quit(); - } - - return ECORE_CALLBACK_RENEW; -} - -int -main (void) -{ - /* credentials */ - gnutls_anon_client_credentials_t c_anoncred; - gnutls_certificate_credentials_t c_certcred; - - gnutls_session_t client; - int sd; - - /* General init. */ - gnutls_global_init (); - ecore_init(); - gnutls_global_set_log_function (tls_log_func); - gnutls_global_set_log_level (6); - - /* Init client */ - gnutls_anon_allocate_client_credentials (&c_anoncred); - gnutls_certificate_allocate_credentials (&c_certcred); - gnutls_init (&client, GNUTLS_CLIENT); - /* set very specific priorities */ - gnutls_priority_set_direct(client, "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0", NULL); - gnutls_credentials_set (client, GNUTLS_CRD_ANON, c_anoncred); - gnutls_credentials_set (client, GNUTLS_CRD_CERTIFICATE, c_certcred); - gnutls_server_name_set(client, GNUTLS_NAME_DNS, "www.verisign.com", strlen("www.verisign.com")); - - - /* connect to the peer - */ - sd = tcp_connect (); - - /* associate gnutls with socket */ - gnutls_transport_set_ptr (client, (gnutls_transport_ptr_t) sd); - /* add a callback for data being available for send/receive on socket */ - if (!ecore_main_fd_handler_add(sd, ECORE_FD_READ | ECORE_FD_WRITE, (Ecore_Fd_Cb)_process_data, client, NULL, NULL)) - { - print("could not create fd handler!"); - exit(1); - } - /* begin main loop */ - ecore_main_loop_begin(); - - gnutls_bye (client, GNUTLS_SHUT_RDWR); - - gnutls_deinit (client); - - tcp_close (sd); - - return 0; -} diff --git a/examples/ecore_file_download_example.c b/examples/ecore_file_download_example.c deleted file mode 100644 index c03940b..0000000 --- a/examples/ecore_file_download_example.c +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include -#include -#include - -/* - * ecore_file_download() example - * - * compile with: - * gcc ecore_file_download_example.c `pkg-config --libs --cflags ecore-file` \ - * -o ecore_file_download_example - * - */ - -#define URL "http://www.kernel.org/pub/linux/kernel/v1.0/linux-1.0.tar.gz" -#define DST "linux-1.0.tar.gz" -#define DST_MIME "[x-gzip]linux-1.0.tar.gz" - - -void -completion_cb(void *data, const char *file, int status) -{ - printf("Done (status: %d)\n", status); - ecore_main_loop_quit(); -} - -int -progress_cb(void *data, const char *file, - long int dltotal, long int dlnow, - long int ultotal, long int ulnow) -{ - printf("Progress: %ld/%ld\n", dlnow, dltotal); - return ECORE_FILE_PROGRESS_CONTINUE; // continue the download -} - - -int main(void) -{ - double start; - Eina_Hash *headers; - - eina_init(); - ecore_init(); - ecore_file_init(); - - if (ecore_file_exists(DST)) - ecore_file_unlink(DST); - - start = ecore_time_get(); - - if (ecore_file_download(URL, DST, completion_cb, progress_cb, NULL, NULL)) - { - printf("Download started successfully:\n URL: %s\n DEST: %s\n", URL, DST); - ecore_main_loop_begin(); - printf("\nTime elapsed: %f seconds\n", ecore_time_get() - start); - printf("Downloaded %lld bytes\n", ecore_file_size(DST)); - } - else - { - printf("Error, can't start download\n"); - goto done; - } - - headers = eina_hash_string_small_new(NULL); - eina_hash_add(headers, "Content-type", "application/x-gzip"); - - if (ecore_file_download_full(URL, DST_MIME, completion_cb, progress_cb, NULL, NULL, headers)) - { - printf("Download started successfully:\n URL: %s\n DEST: %s\n", URL, DST_MIME); - ecore_main_loop_begin(); - printf("\nTime elapsed: %f seconds\n", ecore_time_get() - start); - printf("Downloaded %lld bytes\n", ecore_file_size(DST)); - } - else - { - printf("Error, can't start download\n"); - goto done; - } - -done: - if (headers) eina_hash_free(headers); - ecore_file_shutdown(); - ecore_shutdown(); - eina_shutdown(); - return 0; -} diff --git a/examples/server_bench.c b/examples/server_bench.c deleted file mode 100644 index db0020c..0000000 --- a/examples/server_bench.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include - -/* Ecore_Con server example - * 2010 Mike Blumenkrantz - */ - -static Ecore_Con_Server *svr; -static int add; -static int del; - -Eina_Bool -_add(void *data, int type, Ecore_Con_Event_Client_Add *ev) -{ - ++add; -// printf ("%s ", ecore_con_client_ip_get(ev->client)); - printf("Client #%i!\n", add); - return ECORE_CALLBACK_RENEW; -} - -Eina_Bool -_del(void *data, int type, Ecore_Con_Event_Client_Del *ev) -{ - ++del; - printf("Disconnected #%i!\n", del); - if (add == del) - ecore_main_loop_quit(); - return ECORE_CALLBACK_RENEW; -} - -int main(int argc, const char *argv[]) -{ - ecore_init(); - ecore_con_init(); - ecore_app_args_set(argc, argv); - eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR); - eina_log_domain_level_set("eina", EINA_LOG_LEVEL_ERR); - - -/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */ -// if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL))) - -/* to use simple tcp with ssl/tls, use this line */ - svr = ecore_con_server_add(ECORE_CON_REMOTE_NODELAY , "127.0.0.1", 8080, NULL); - if (!svr) - exit(1); - - ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL); - ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL); - -/* start server */ - ecore_main_loop_begin(); - if (add && del) - { - printf("Restarting server after %i connections\n", add); - add = del = 0; - ecore_con_server_del(svr); - ecore_app_restart(); - } - return 0; -} diff --git a/m4/efl_pthread.m4 b/m4/efl_pthread.m4 deleted file mode 100644 index b90a045..0000000 --- a/m4/efl_pthread.m4 +++ /dev/null @@ -1,130 +0,0 @@ -dnl Copyright (C) 2010 Vincent Torri -dnl That code is public domain and can be freely used or copied. - -dnl Macro that check if several pthread library is available or not. - -dnl Usage: EFL_CHECK_PTHREAD(want_pthread_spin[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS) -dnl Call AC_SUBST(EFL_PTHREAD_LIBS) -dnl Define EFL_HAVE_PTHREAD -dnl Define EFL_HAVE_PTHREAD_SPINLOCK - -AC_DEFUN([EFL_CHECK_PTHREAD], -[ - -dnl configure option - -AC_ARG_ENABLE([pthread], - [AC_HELP_STRING([--disable-pthread], [enable POSIX threads code @<:@default=auto@:>@])], - [ - if test "x${enableval}" = "xyes" ; then - _efl_enable_pthread="yes" - else - _efl_enable_pthread="no" - fi - ], - [_efl_enable_pthread="auto"]) - -AC_MSG_CHECKING([whether to build POSIX threads code]) -AC_MSG_RESULT([${_efl_enable_pthread}]) - -dnl check if the compiler supports pthreads - -case "$host_os" in - mingw*) - _efl_pthread_cflags="" - _efl_pthread_libs="-lpthreadGC2" - ;; - solaris*) - _efl_pthread_cflags="-mt" - _efl_pthread_libs="-mt" - ;; - *) - _efl_pthread_cflags="-pthread" - _efl_pthread_libs="-pthread" - ;; -esac - -_efl_have_pthread="no" - -if test "x${_efl_enable_pthread}" = "xyes" || test "x${_efl_enable_pthread}" = "xauto" ; then - - SAVE_CFLAGS=${CFLAGS} - CFLAGS="${CFLAGS} ${_efl_pthread_cflags}" - SAVE_LIBS=${LIBS} - LIBS="${LIBS} ${_efl_pthread_libs}" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[ -#include - ]], - [[ -pthread_t id; -id = pthread_self(); - ]])], - [_efl_have_pthread="yes"], - [_efl_have_pthread="no"]) - CFLAGS=${SAVE_CFLAGS} - LIBS=${SAVE_LIBS} - -fi - -AC_MSG_CHECKING([whether system support POSIX threads]) -AC_MSG_RESULT([${_efl_have_pthread}]) -if test "$x{_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread}" = "xno"; then - AC_MSG_ERROR([pthread support requested but not found.]) -fi - -EFL_PTHREAD_CFLAGS="" -EFL_PTHREAD_LIBS="" -if test "x${_efl_have_pthread}" = "xyes" ; then - EFL_PTHREAD_CFLAGS=${_efl_pthread_cflags} - EFL_PTHREAD_LIBS=${_efl_pthread_libs} -fi - -AC_SUBST(EFL_PTHREAD_CFLAGS) -AC_SUBST(EFL_PTHREAD_LIBS) - -if test "x${_efl_have_pthread}" = "xyes" ; then - AC_DEFINE(EFL_HAVE_PTHREAD, 1, [Define to mention that POSIX threads are supported]) -fi - -dnl check if the compiler supports pthreads spinlock - -_efl_have_pthread_spinlock="no" - -if test "x${_efl_have_pthread}" = "xyes" && test "x$1" = "xyes" ; then - - SAVE_CFLAGS=${CFLAGS} - CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}" - SAVE_LIBS=${LIBS} - LIBS="${LIBS} ${EFL_PTHREAD_LIBS}" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[ -#include - ]], - [[ -pthread_spinlock_t lock; -int res; -res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE); - ]])], - [_efl_have_pthread_spinlock="yes"], - [_efl_have_pthread_spinlock="no"]) - CFLAGS=${SAVE_CFLAGS} - LIBS=${SAVE_LIBS} - -fi - -AC_MSG_CHECKING([whether to build POSIX threads spinlock code]) -AC_MSG_RESULT([${_efl_have_pthread_spinlock}]) -if test "x${_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread_spinlock}" = "xno" && test "x$1" = "xyes" ; then - AC_MSG_WARN([pthread support requested but spinlocks are not supported]) -fi - -if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then - AC_DEFINE(EFL_HAVE_PTHREAD_SPINLOCK, 1, [Define to mention that POSIX threads spinlocks are supported]) -fi - -AS_IF([test "x$_efl_have_pthread" = "xyes"], [$2], [$3]) -AS_IF([test "x$_efl_have_pthread_spinlock" = "xyes"], [$4], [$5]) - -]) diff --git a/src/lib/ecore_evas/ecore_evas_cocoa.c b/src/lib/ecore_evas/ecore_evas_cocoa.c deleted file mode 100644 index e6fb541..0000000 --- a/src/lib/ecore_evas/ecore_evas_cocoa.c +++ /dev/null @@ -1,468 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef BUILD_ECORE_EVAS_COCOA -#import -#endif - -#include "Ecore.h" -#include "ecore_private.h" -#include "Ecore_Input.h" -#include "Ecore_Input_Evas.h" - -#include "ecore_evas_private.h" -#include "Ecore_Evas.h" - -#ifdef BUILD_ECORE_EVAS_COCOA -#include "Ecore_Cocoa.h" -#include "Evas_Engine_Quartz.h" - -// FIXME: this engine has lots of problems. only 1 window at a time, drawRect looks wrong, doesn't handle resizes and more - -static int _ecore_evas_init_count = 0; -static Ecore_Evas *ecore_evases = NULL; -static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { - NULL, NULL, NULL, NULL -}; -static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; -static Ecore_Poller *ecore_evas_event = NULL; - -static const char *ecore_evas_cocoa_default = "EFL Cocoa"; - -@interface EvasView : NSView -{ - CGContextRef ctx; -} -@end - -static EvasView * evas_view; -static NSWindow * main_window; - -@implementation EvasView - -- (id) init -{ - self = [super init]; - if (self != nil) - { - ctx = NULL; - } - return self; -} - -- (void)drawRect:(NSRect)rect -{ - if(ctx != NULL) - { - Ecore_Evas *ee; - - EINA_INLIST_FOREACH(ecore_evases, ee) - { - if (ee->visible) - evas_damage_rectangle_add(ee->evas, 0, 0, 400, 400); - } - return; - } - - ctx = [[NSGraphicsContext currentContext] graphicsPort]; - CGContextRetain(ctx); -} - -- (CGContextRef)context -{ - return ctx; -} - -@end - -static Ecore_Evas * -_ecore_evas_cocoa_match(void) -{ - return ecore_evases; -} - -static Eina_Bool -_ecore_evas_cocoa_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - - ee = _ecore_evas_cocoa_match(); - - if (!ee) return EINA_TRUE; - ee->prop.focused = 1; - - return EINA_FALSE; -} - -static Eina_Bool -_ecore_evas_cocoa_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - - ee = _ecore_evas_cocoa_match(); - - if (!ee) return EINA_TRUE; - ee->prop.focused = 0; - - return EINA_FALSE; -} - -static Eina_Bool -_ecore_evas_cocoa_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - /*Ecore_Cocoa_Event_Video_Resize *e; - Ecore_Evas *ee; - - e = event; - ee = _ecore_evas_cocoa_match(); - - if (!ee) return 1; // pass on event - evas_output_size_set(ee->evas, e->w, e->h); - - return 0;*/ -} - -static Eina_Bool -_ecore_evas_cocoa_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) -{ - Ecore_Evas *ee; - int w; - int h; - - ee = _ecore_evas_cocoa_match(); - - if (!ee) return EINA_TRUE; - evas_output_size_get(ee->evas, &w, &h); - evas_damage_rectangle_add(ee->evas, 0, 0, w, h); - - return EINA_FALSE; -} - -static int -_ecore_evas_idle_enter(void *data __UNUSED__) -{ - Ecore_Evas *ee; - double t1 = 0.; - double t2 = 0.; - - EINA_INLIST_FOREACH(ecore_evases, ee) - { - if (ee->visible) - evas_render(ee->evas); - else - evas_norender(ee->evas); - } - - return 1; -} - -static int -_ecore_evas_cocoa_event(void *data) -{ - ecore_cocoa_feed_events(); - - return 1; -} - -static int -_ecore_evas_cocoa_init(int w, int h) -{ - _ecore_evas_init_count++; - if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; - - ecore_event_evas_init(); - - ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); - ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, ecore_evas_event, NULL); - ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); - - ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL); - ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL); - ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL); - ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL); - - return _ecore_evas_init_count; -} - -static int -_ecore_evas_cocoa_shutdown(void) -{ - _ecore_evas_init_count--; - if (_ecore_evas_init_count == 0) - { - int i; - - while (ecore_evases) _ecore_evas_free(ecore_evases); - - for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) - ecore_event_handler_del(ecore_evas_event_handlers[i]); - ecore_event_evas_shutdown(); - ecore_idle_enterer_del(ecore_evas_idle_enterer); - ecore_evas_idle_enterer = NULL; - ecore_poller_del(ecore_evas_event); - ecore_evas_event = NULL; - - ecore_event_evas_shutdown(); - } - if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; - return _ecore_evas_init_count; -} - -static void -_ecore_evas_cocoa_free(Ecore_Evas *ee) -{ - ecore_evases = (Ecore_Evas *) eina_inlist_remove(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); - ecore_event_window_unregister(0); - _ecore_evas_cocoa_shutdown(); - ecore_cocoa_shutdown(); -} - -static void -_ecore_evas_resize(Ecore_Evas *ee, int w, int h) -{ - if ((w == ee->w) && (h == ee->h)) return; - ee->w = w; - ee->h = h; - - evas_output_size_set(ee->evas, ee->w, ee->h); - evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); - - if (ee->func.fn_resize) ee->func.fn_resize(ee); -} - -static void -_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) -{ - if ((w == ee->w) && (h == ee->h)) return; - ee->w = w; - ee->h = h; - - evas_output_size_set(ee->evas, ee->w, ee->h); - evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); - - if (ee->func.fn_resize) ee->func.fn_resize(ee); -} - -static void -_ecore_evas_object_cursor_del(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Ecore_Evas *ee; - - ee = data; - if (ee) - ee->prop.cursor.object = NULL; -} - -static void -_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - - if (!obj) - { - ee->prop.cursor.object = NULL; - ee->prop.cursor.layer = 0; - ee->prop.cursor.hot.x = 0; - ee->prop.cursor.hot.y = 0; - return; - } - - ee->prop.cursor.object = obj; - ee->prop.cursor.layer = layer; - ee->prop.cursor.hot.x = hot_x; - ee->prop.cursor.hot.y = hot_y; - - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); - evas_object_move(ee->prop.cursor.object, - x - ee->prop.cursor.hot.x, - y - ee->prop.cursor.hot.y); - - evas_object_pass_events_set(ee->prop.cursor.object, 1); - - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); - - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); -} - -static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = -{ - _ecore_evas_cocoa_free, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - _ecore_evas_resize, - _ecore_evas_move_resize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - _ecore_evas_object_cursor_set, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, //transparent - - NULL // render -}; -#endif - -EAPI Ecore_Evas * -ecore_evas_cocoa_new(const char* name, int w, int h) -{ -#ifdef BUILD_ECORE_EVAS_COCOA - Evas_Engine_Info_Quartz *einfo; - Ecore_Evas *ee; - int rmethod; - - if (!name) - name = ecore_evas_cocoa_default; - - rmethod = evas_render_method_lookup("quartz"); - if (!rmethod) return NULL; - - if (!ecore_cocoa_init(name)) return NULL; - - ee = calloc(1, sizeof(Ecore_Evas)); - if (!ee) - goto shutdown_ecore_cocoa; - - ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); - - _ecore_evas_cocoa_init(w, h); - - ecore_event_window_register(0, ee, ee->evas, - (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, - (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, - (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, - (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); - - ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; - - ee->driver = "quartz"; - if (name) ee->name = strdup(name); - if (!ee->name) - goto free_ee; - - if (w < 1) w = 1; - if (h < 1) h = 1; - ee->visible = 1; - ee->w = w; - ee->h = h; - - ee->prop.max.w = 0; - ee->prop.max.h = 0; - ee->prop.layer = 0; - ee->prop.focused = 1; - ee->prop.borderless = 1; - ee->prop.override = 1; - ee->prop.maximized = 1; - ee->prop.withdrawn = 0; - ee->prop.sticky = 0; - - // init evas here - ee->evas = evas_new(); - if (!ee->evas) - goto free_name; - evas_data_attach_set(ee->evas, ee); - evas_output_method_set(ee->evas, rmethod); - - // Set up the Cocoa runtime - [[NSAutoreleasePool alloc] init]; - [NSApplication sharedApplication]; - - // Register ourselves as a full-fledged Cocoa app, instead of a NSUIElement. - // This gives benefits like window focus and a dock icon! - ProcessSerialNumber psn = { 0, kCurrentProcess }; - TransformProcessType (&psn, kProcessTransformToForegroundApplication); - - [NSApp finishLaunching]; - - // Create our main window, and embed an EvasView in it - main_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,w,h) styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO screen:nil]; - /* FIXME: manage the case where main_window is NULL with a goto free_evas; */ - [main_window makeKeyAndOrderFront:NSApp]; - [main_window setTitle:[NSString stringWithUTF8String:name]]; - [main_window makeMainWindow]; - [main_window setAcceptsMouseMovedEvents:YES]; - [NSApp activateIgnoringOtherApps:YES]; - - evas_view = [[EvasView alloc] initWithFrame:NSMakeRect(0,0,w,h)]; - [[main_window contentView] addSubview:evas_view]; - - // drawRect: must be run at least once, to make sure we've set ctx - [evas_view display]; - - evas_output_size_set(ee->evas, w, h); - evas_output_viewport_set(ee->evas, 0, 0, w, h); - - einfo = (Evas_Engine_Info_Quartz*) evas_engine_info_get(ee->evas); - if (!einfo) - goto free_window; - - einfo->info.context = [[evas_view context] retain]; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) - { - ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); - } - - ecore_evases = (Ecore_Evas *) eina_inlist_prepend(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); - - evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); - evas_focus_in(ee->evas); - - return ee; - - free_window: - /* FIXME: free window here */ - free_evas: - free(ee->evas); - free_name: - free(ee->name); - free_ee: - _ecore_evas_cocoa_shutdown(); - free(ee); - shutdown_ecore_cocoa: - ecore_cocoa_shutdown(); - - return NULL; -#else - ERR("OUTCH name='%s' size=%dx%d!", name ? name : "", w, h); - return NULL; -#endif -} diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h old mode 100755 new mode 100644 diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c old mode 100755 new mode 100644 diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h old mode 100755 new mode 100644 diff --git a/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/src/lib/ecore_x/xlib/ecore_x_window_shape.c old mode 100755 new mode 100644 -- 2.7.4