forked from enlightenment/efl
* check the returned value of the _init() functions
* simplify a bit the init/shutdown functions SVN revision: 42995
This commit is contained in:
parent
1d869a9ab1
commit
4072d0b23d
|
@ -70,31 +70,39 @@ int _ecore_fps_debug = 0;
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_init(void)
|
ecore_init(void)
|
||||||
{
|
{
|
||||||
if (++_ecore_init_count == 1)
|
if (++_ecore_init_count != 1)
|
||||||
{
|
return _ecore_init_count;
|
||||||
|
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
if (strcmp(nl_langinfo(CODESET), "UTF-8"))
|
if (strcmp(nl_langinfo(CODESET), "UTF-8"))
|
||||||
{
|
{
|
||||||
printf("WARNING: not a utf8 locale!\n");
|
printf("WARNING: not a utf8 locale!\n");
|
||||||
}
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_EVIL
|
|
||||||
evil_init();
|
|
||||||
#endif
|
|
||||||
eina_init();
|
|
||||||
if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
|
|
||||||
if (_ecore_fps_debug) _ecore_fps_debug_init();
|
|
||||||
_ecore_signal_init();
|
|
||||||
_ecore_exe_init();
|
|
||||||
_ecore_thread_init();
|
|
||||||
_ecore_glib_init();
|
|
||||||
_ecore_loop_time = ecore_time_get();
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_EVIL
|
||||||
|
if (!evil_init())
|
||||||
|
return --_ecore_init_count;
|
||||||
|
#endif
|
||||||
|
if (!eina_init())
|
||||||
|
goto shutdown_evil;
|
||||||
|
if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1;
|
||||||
|
if (_ecore_fps_debug) _ecore_fps_debug_init();
|
||||||
|
_ecore_signal_init();
|
||||||
|
_ecore_exe_init();
|
||||||
|
_ecore_thread_init();
|
||||||
|
_ecore_glib_init();
|
||||||
|
_ecore_loop_time = ecore_time_get();
|
||||||
|
|
||||||
return _ecore_init_count;
|
return _ecore_init_count;
|
||||||
|
|
||||||
|
shutdown_evil:
|
||||||
|
#ifdef HAVE_EVIL
|
||||||
|
evil_shutdown();
|
||||||
|
#endif
|
||||||
|
return --_ecore_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,8 +118,8 @@ ecore_init(void)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_shutdown(void)
|
ecore_shutdown(void)
|
||||||
{
|
{
|
||||||
if (--_ecore_init_count)
|
if (--_ecore_init_count != 0)
|
||||||
return _ecore_init_count;
|
return _ecore_init_count;
|
||||||
|
|
||||||
if (_ecore_fps_debug) _ecore_fps_debug_shutdown();
|
if (_ecore_fps_debug) _ecore_fps_debug_shutdown();
|
||||||
_ecore_poller_shutdown();
|
_ecore_poller_shutdown();
|
||||||
|
|
|
@ -62,7 +62,7 @@ EAPI int ECORE_CON_EVENT_CLIENT_DATA = 0;
|
||||||
EAPI int ECORE_CON_EVENT_SERVER_DATA = 0;
|
EAPI int ECORE_CON_EVENT_SERVER_DATA = 0;
|
||||||
|
|
||||||
static Eina_List *servers = NULL;
|
static Eina_List *servers = NULL;
|
||||||
static int init_count = 0;
|
static int _ecore_con_init_count = 0;
|
||||||
|
|
||||||
#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
|
#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
|
||||||
#define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
|
#define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
|
||||||
|
@ -83,9 +83,12 @@ static int init_count = 0;
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_con_init(void)
|
ecore_con_init(void)
|
||||||
{
|
{
|
||||||
if (++init_count != 1) return init_count;
|
if (++_ecore_con_init_count != 1)
|
||||||
|
return _ecore_con_init_count;
|
||||||
|
|
||||||
|
if (!ecore_init())
|
||||||
|
return --_ecore_con_init_count;
|
||||||
|
|
||||||
ecore_init();
|
|
||||||
ECORE_CON_EVENT_CLIENT_ADD = ecore_event_type_new();
|
ECORE_CON_EVENT_CLIENT_ADD = ecore_event_type_new();
|
||||||
ECORE_CON_EVENT_CLIENT_DEL = ecore_event_type_new();
|
ECORE_CON_EVENT_CLIENT_DEL = ecore_event_type_new();
|
||||||
ECORE_CON_EVENT_SERVER_ADD = ecore_event_type_new();
|
ECORE_CON_EVENT_SERVER_ADD = ecore_event_type_new();
|
||||||
|
@ -98,7 +101,7 @@ ecore_con_init(void)
|
||||||
ecore_con_dns_init();
|
ecore_con_dns_init();
|
||||||
ecore_con_info_init();
|
ecore_con_info_init();
|
||||||
|
|
||||||
return init_count;
|
return _ecore_con_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +113,8 @@ ecore_con_init(void)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_con_shutdown(void)
|
ecore_con_shutdown(void)
|
||||||
{
|
{
|
||||||
if (--init_count != 0) return init_count;
|
if (--_ecore_con_init_count != 0)
|
||||||
|
return _ecore_con_init_count;
|
||||||
|
|
||||||
while (servers)
|
while (servers)
|
||||||
_ecore_con_server_free(eina_list_data_get(servers));
|
_ecore_con_server_free(eina_list_data_get(servers));
|
||||||
|
@ -121,7 +125,7 @@ ecore_con_shutdown(void)
|
||||||
|
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
|
|
||||||
return init_count;
|
return _ecore_con_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "ecore_con_private.h"
|
#include "ecore_con_private.h"
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
|
|
||||||
static int _init_count = 0;
|
static int _init_con_ssl_init_count = 0;
|
||||||
|
|
||||||
#if USE_GNUTLS
|
#if USE_GNUTLS
|
||||||
static int _client_connected = 0;
|
static int _client_connected = 0;
|
||||||
|
@ -69,19 +69,19 @@ SSL_SUFFIX(_ecore_con_ssl_client_write)(Ecore_Con_Client *cl, unsigned char *buf
|
||||||
Ecore_Con_Ssl_Error
|
Ecore_Con_Ssl_Error
|
||||||
ecore_con_ssl_init(void)
|
ecore_con_ssl_init(void)
|
||||||
{
|
{
|
||||||
if (!_init_count++)
|
if (!_init_con_ssl_init_count++)
|
||||||
SSL_SUFFIX(_ecore_con_ssl_init)();
|
SSL_SUFFIX(_ecore_con_ssl_init)();
|
||||||
|
|
||||||
return _init_count;
|
return _init_con_ssl_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ecore_Con_Ssl_Error
|
Ecore_Con_Ssl_Error
|
||||||
ecore_con_ssl_shutdown(void)
|
ecore_con_ssl_shutdown(void)
|
||||||
{
|
{
|
||||||
if (!--_init_count)
|
if (!--_init_con_ssl_init_count)
|
||||||
SSL_SUFFIX(_ecore_con_ssl_shutdown)();
|
SSL_SUFFIX(_ecore_con_ssl_shutdown)();
|
||||||
|
|
||||||
return _init_count;
|
return _init_con_ssl_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -658,8 +658,7 @@ ecore_directfb_init(const char *name __UNUSED__)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
_ecore_directfb_init_count++;
|
if (++_ecore_directfb_init_count != 1) return _ecore_directfb_init_count;
|
||||||
if (_ecore_directfb_init_count > 1) return _ecore_directfb_init_count;
|
|
||||||
|
|
||||||
DFBCHECK(DirectFBInit(NULL,NULL));
|
DFBCHECK(DirectFBInit(NULL,NULL));
|
||||||
DFBCHECK(DirectFBCreate(&_dfb));
|
DFBCHECK(DirectFBCreate(&_dfb));
|
||||||
|
@ -706,13 +705,8 @@ ecore_directfb_init(const char *name __UNUSED__)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_directfb_shutdown(void)
|
ecore_directfb_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_directfb_init_count--;
|
if (--_ecore_directfb_init_count != 0) return _ecore_directfb_init_count;
|
||||||
if (_ecore_directfb_init_count > 0) return _ecore_directfb_init_count;
|
|
||||||
if (_ecore_directfb_init_count < 0)
|
|
||||||
{
|
|
||||||
_ecore_directfb_init_count = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ecore_main_fd_handler_del(_window_event_fd_handler_handle);
|
ecore_main_fd_handler_del(_window_event_fd_handler_handle);
|
||||||
eina_hash_free(_ecore_directfb_key_symbols_hash);
|
eina_hash_free(_ecore_directfb_key_symbols_hash);
|
||||||
|
|
||||||
|
@ -725,5 +719,5 @@ ecore_directfb_shutdown(void)
|
||||||
DFBCHECK(_layer->Release(_layer));
|
DFBCHECK(_layer->Release(_layer));
|
||||||
DFBCHECK(_dfb->Release(_dfb));
|
DFBCHECK(_dfb->Release(_dfb));
|
||||||
|
|
||||||
return 1;
|
return _ecore_directfb_init_count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,73 +141,82 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
|
||||||
* Init the Evas system.
|
* Init the Evas system.
|
||||||
* @return greater than 0 on success, 0 on failure
|
* @return greater than 0 on success, 0 on failure
|
||||||
*
|
*
|
||||||
* Set up the Evas wrapper system.
|
* Set up the Evas wrapper system. Init Evas and Ecore libraries.
|
||||||
*/
|
*/
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_evas_init(void)
|
ecore_evas_init(void)
|
||||||
{
|
{
|
||||||
if (_ecore_evas_init_count == 0)
|
int fd;
|
||||||
|
|
||||||
|
if (++_ecore_evas_init_count != 1)
|
||||||
|
return _ecore_evas_init_count;
|
||||||
|
|
||||||
|
if (!evas_init())
|
||||||
|
return --_ecore_evas_init_count;
|
||||||
|
|
||||||
|
if (!ecore_init())
|
||||||
|
goto shutdown_evas;
|
||||||
|
|
||||||
|
_ecore_evas_log_dom = eina_log_domain_register("Ecore_Evas", ECORE_EVAS_DEFAULT_LOG_COLOR);
|
||||||
|
if(_ecore_evas_log_dom < 0)
|
||||||
{
|
{
|
||||||
int fd;
|
EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas.\n");
|
||||||
|
goto shutdown_ecore;
|
||||||
evas_init();
|
|
||||||
ecore_init();
|
|
||||||
|
|
||||||
_ecore_evas_log_dom = eina_log_domain_register("Ecore_Evas", ECORE_EVAS_DEFAULT_LOG_COLOR);
|
|
||||||
if(_ecore_evas_log_dom < 0)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas.\n");
|
|
||||||
ecore_shutdown();
|
|
||||||
evas_shutdown();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
fd = evas_async_events_fd_get();
|
|
||||||
if (fd > 0)
|
|
||||||
_ecore_evas_async_events_fd = ecore_main_fd_handler_add(fd,
|
|
||||||
ECORE_FD_READ,
|
|
||||||
_ecore_evas_async_events_fd_handler, NULL,
|
|
||||||
NULL, NULL);
|
|
||||||
}
|
}
|
||||||
return ++_ecore_evas_init_count;
|
|
||||||
|
fd = evas_async_events_fd_get();
|
||||||
|
if (fd > 0)
|
||||||
|
_ecore_evas_async_events_fd = ecore_main_fd_handler_add(fd,
|
||||||
|
ECORE_FD_READ,
|
||||||
|
_ecore_evas_async_events_fd_handler, NULL,
|
||||||
|
NULL, NULL);
|
||||||
|
return _ecore_evas_init_count;
|
||||||
|
|
||||||
|
shutdown_ecore:
|
||||||
|
ecore_shutdown();
|
||||||
|
shutdown_evas:
|
||||||
|
evas_shutdown();
|
||||||
|
|
||||||
|
return --_ecore_evas_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shut down the Evas system.
|
* Shut down the Evas system.
|
||||||
* @return 0 if ecore evas is fully shut down, or > 0 if it still needs to be shut down
|
* @return 0 if ecore evas is fully shut down, or > 0 if it still needs to be shut down
|
||||||
*
|
*
|
||||||
* This closes the Evas system down.
|
* This closes the Evas wrapper system down. Shut down Evas and Ecore libraries.
|
||||||
*/
|
*/
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_evas_shutdown(void)
|
ecore_evas_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_evas_init_count--;
|
if (--_ecore_evas_init_count != 0)
|
||||||
if (_ecore_evas_init_count == 0)
|
return _ecore_evas_init_count;
|
||||||
{
|
|
||||||
#ifdef BUILD_ECORE_EVAS_X11
|
#ifdef BUILD_ECORE_EVAS_X11
|
||||||
while (_ecore_evas_x_shutdown());
|
while (_ecore_evas_x_shutdown());
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_ECORE_EVAS_WIN32
|
#ifdef BUILD_ECORE_EVAS_WIN32
|
||||||
while (_ecore_evas_win32_shutdown());
|
while (_ecore_evas_win32_shutdown());
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_ECORE_EVAS_FB
|
#ifdef BUILD_ECORE_EVAS_FB
|
||||||
while (_ecore_evas_fb_shutdown());
|
while (_ecore_evas_fb_shutdown());
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
|
#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER
|
||||||
while (_ecore_evas_buffer_shutdown());
|
while (_ecore_evas_buffer_shutdown());
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
#ifdef BUILD_ECORE_EVAS_DIRECTFB
|
||||||
while (_ecore_evas_directfb_shutdown());
|
while (_ecore_evas_directfb_shutdown());
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
|
#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE
|
||||||
while (_ecore_evas_wince_shutdown());
|
while (_ecore_evas_wince_shutdown());
|
||||||
#endif
|
#endif
|
||||||
if (_ecore_evas_async_events_fd)
|
if (_ecore_evas_async_events_fd)
|
||||||
ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
|
ecore_main_fd_handler_del(_ecore_evas_async_events_fd);
|
||||||
eina_log_domain_unregister(_ecore_evas_log_dom);
|
|
||||||
ecore_shutdown();
|
eina_log_domain_unregister(_ecore_evas_log_dom);
|
||||||
evas_shutdown();
|
ecore_shutdown();
|
||||||
}
|
evas_shutdown();
|
||||||
if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
|
|
||||||
return _ecore_evas_init_count;
|
return _ecore_evas_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,18 +41,21 @@ static double _ecore_fb_double_click_time = 0.25;
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_fb_init(const char *name __UNUSED__)
|
ecore_fb_init(const char *name __UNUSED__)
|
||||||
{
|
{
|
||||||
if(!_ecore_fb_init_count)
|
if (++_ecore_fb_init_count != 1)
|
||||||
{
|
return _ecore_fb_init_count;
|
||||||
if(!ecore_fb_vt_init()) return 0;
|
|
||||||
ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new();
|
if (!ecore_fb_vt_init())
|
||||||
ECORE_FB_EVENT_KEY_UP = ecore_event_type_new();
|
return --_ecore_fb_init_count;
|
||||||
ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
|
||||||
ECORE_FB_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new();
|
||||||
ECORE_FB_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
ECORE_FB_EVENT_KEY_UP = ecore_event_type_new();
|
||||||
ECORE_FB_EVENT_MOUSE_WHEEL = ecore_event_type_new();
|
ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
||||||
_ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
|
ECORE_FB_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
||||||
}
|
ECORE_FB_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
||||||
return ++_ecore_fb_init_count;
|
ECORE_FB_EVENT_MOUSE_WHEEL = ecore_event_type_new();
|
||||||
|
_ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
|
||||||
|
|
||||||
|
return _ecore_fb_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,13 +67,12 @@ ecore_fb_init(const char *name __UNUSED__)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_fb_shutdown(void)
|
ecore_fb_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_fb_init_count--;
|
if (--_ecore_fb_init_count != 0)
|
||||||
if(!_ecore_fb_init_count)
|
return _ecore_fb_init_count;
|
||||||
{
|
|
||||||
ecore_fb_vt_shutdown();
|
ecore_fb_vt_shutdown();
|
||||||
return 0;
|
|
||||||
}
|
return _ecore_fb_init_count;
|
||||||
return _ecore_fb_init_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "ecore_file_private.h"
|
#include "ecore_file_private.h"
|
||||||
|
|
||||||
|
|
||||||
static int init = 0;
|
static int _ecore_file_init_count = 0;
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
/**
|
/**
|
||||||
|
@ -39,29 +39,33 @@ static int init = 0;
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_init()
|
ecore_file_init()
|
||||||
{
|
{
|
||||||
if (++init != 1) return init;
|
if (++_ecore_file_init_count != 1)
|
||||||
|
return _ecore_file_init_count;
|
||||||
|
|
||||||
// if (!
|
ecore_file_path_init();
|
||||||
ecore_file_monitor_init();
|
ecore_file_monitor_init();
|
||||||
// )
|
ecore_file_download_init();
|
||||||
// goto error;
|
|
||||||
// if (!
|
|
||||||
ecore_file_path_init();
|
|
||||||
// )
|
|
||||||
// goto error;
|
|
||||||
// if (!
|
|
||||||
ecore_file_download_init();
|
|
||||||
// )
|
|
||||||
// goto error;
|
|
||||||
return init;
|
|
||||||
|
|
||||||
//error:
|
/* FIXME: were the tests disabled for a good reason ? */
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (!ecore_file_monitor_init())
|
||||||
|
goto shutdown_ecore_file_path;
|
||||||
|
|
||||||
|
if (!ecore_file_download_init())
|
||||||
|
goto shutdown_ecore_file_monitor;
|
||||||
|
*/
|
||||||
|
|
||||||
|
return _ecore_file_init_count;
|
||||||
|
|
||||||
|
/*
|
||||||
|
shutdown_ecore_file_monitor:
|
||||||
ecore_file_monitor_shutdown();
|
ecore_file_monitor_shutdown();
|
||||||
|
shutdown_ecore_file_path:
|
||||||
ecore_file_path_shutdown();
|
ecore_file_path_shutdown();
|
||||||
ecore_file_download_shutdown();
|
|
||||||
|
|
||||||
return --init;
|
return --_ecore_file_init_count;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,13 +75,14 @@ ecore_file_init()
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_file_shutdown()
|
ecore_file_shutdown()
|
||||||
{
|
{
|
||||||
if (--init != 0) return init;
|
if (--_ecore_file_init_count != 0)
|
||||||
|
return _ecore_file_init_count;
|
||||||
|
|
||||||
|
ecore_file_download_shutdown();
|
||||||
ecore_file_monitor_shutdown();
|
ecore_file_monitor_shutdown();
|
||||||
ecore_file_path_shutdown();
|
ecore_file_path_shutdown();
|
||||||
ecore_file_download_shutdown();
|
|
||||||
|
|
||||||
return init;
|
return _ecore_file_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,24 +42,21 @@ static int _ecore_file_download_url_progress_cb(void *data, int type, void *even
|
||||||
#endif
|
#endif
|
||||||
static void _ecore_file_download_abort(Ecore_File_Download_Job *job);
|
static void _ecore_file_download_abort(Ecore_File_Download_Job *job);
|
||||||
|
|
||||||
static int init = 0;
|
|
||||||
static Ecore_Event_Handler *_url_complete_handler = NULL;
|
static Ecore_Event_Handler *_url_complete_handler = NULL;
|
||||||
static Ecore_Event_Handler *_url_progress_download = NULL;
|
static Ecore_Event_Handler *_url_progress_download = NULL;
|
||||||
static Eina_List *_job_list;
|
static Eina_List *_job_list;
|
||||||
|
|
||||||
EAPI int
|
int
|
||||||
ecore_file_download_init(void)
|
ecore_file_download_init(void)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
ecore_con_url_init();
|
if (!ecore_con_url_init())
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (init++ == 0)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
_url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL);
|
_url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL);
|
||||||
_url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
|
_url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
|
@ -67,31 +64,26 @@ ecore_file_download_init(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
void
|
||||||
ecore_file_download_shutdown(void)
|
ecore_file_download_shutdown(void)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (--init == 0)
|
if (_url_complete_handler)
|
||||||
{
|
ecore_event_handler_del(_url_complete_handler);
|
||||||
if (_url_complete_handler)
|
if (_url_progress_download)
|
||||||
ecore_event_handler_del(_url_complete_handler);
|
ecore_event_handler_del(_url_progress_download);
|
||||||
if (_url_progress_download)
|
_url_complete_handler = NULL;
|
||||||
ecore_event_handler_del(_url_progress_download);
|
_url_progress_download = NULL;
|
||||||
_url_complete_handler = NULL;
|
ecore_file_download_abort_all();
|
||||||
_url_progress_download = NULL;
|
|
||||||
ecore_file_download_abort_all();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ecore_con_url_shutdown();
|
ecore_con_url_shutdown();
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_file_download_abort_all(void)
|
ecore_file_download_abort_all(void)
|
||||||
{
|
{
|
||||||
Ecore_File_Download_Job *job;
|
Ecore_File_Download_Job *job;
|
||||||
|
|
||||||
EINA_LIST_FREE(_job_list, job)
|
EINA_LIST_FREE(_job_list, job)
|
||||||
_ecore_file_download_abort(job);
|
_ecore_file_download_abort(job);
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#include "ecore_file_private.h"
|
#include "ecore_file_private.h"
|
||||||
|
|
||||||
static int init = 0;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ECORE_FILE_MONITOR_TYPE_NONE,
|
ECORE_FILE_MONITOR_TYPE_NONE,
|
||||||
#ifdef HAVE_INOTIFY
|
#ifdef HAVE_INOTIFY
|
||||||
|
@ -25,27 +23,23 @@ static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
|
||||||
int
|
int
|
||||||
ecore_file_monitor_init(void)
|
ecore_file_monitor_init(void)
|
||||||
{
|
{
|
||||||
if (++init != 1) return init;
|
|
||||||
|
|
||||||
#ifdef HAVE_INOTIFY
|
#ifdef HAVE_INOTIFY
|
||||||
monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY;
|
monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY;
|
||||||
if (ecore_file_monitor_inotify_init())
|
if (ecore_file_monitor_inotify_init())
|
||||||
return init;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
monitor_type = ECORE_FILE_MONITOR_TYPE_POLL;
|
monitor_type = ECORE_FILE_MONITOR_TYPE_POLL;
|
||||||
if (ecore_file_monitor_poll_init())
|
if (ecore_file_monitor_poll_init())
|
||||||
return init;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
|
monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
|
||||||
return --init;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
ecore_file_monitor_shutdown(void)
|
ecore_file_monitor_shutdown(void)
|
||||||
{
|
{
|
||||||
if (--init != 0) return init;
|
|
||||||
|
|
||||||
switch (monitor_type)
|
switch (monitor_type)
|
||||||
{
|
{
|
||||||
case ECORE_FILE_MONITOR_TYPE_NONE:
|
case ECORE_FILE_MONITOR_TYPE_NONE:
|
||||||
|
@ -61,7 +55,6 @@ ecore_file_monitor_shutdown(void)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,28 +11,23 @@
|
||||||
|
|
||||||
#include "ecore_file_private.h"
|
#include "ecore_file_private.h"
|
||||||
|
|
||||||
static int init = 0;
|
|
||||||
static Eina_List *__ecore_file_path_bin = NULL;
|
static Eina_List *__ecore_file_path_bin = NULL;
|
||||||
|
|
||||||
static Eina_List *_ecore_file_path_from_env(const char *env);
|
static Eina_List *_ecore_file_path_from_env(const char *env);
|
||||||
|
|
||||||
int
|
void
|
||||||
ecore_file_path_init(void)
|
ecore_file_path_init(void)
|
||||||
{
|
{
|
||||||
if (++init != 1) return init;
|
|
||||||
__ecore_file_path_bin = _ecore_file_path_from_env("PATH");
|
__ecore_file_path_bin = _ecore_file_path_from_env("PATH");
|
||||||
return init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
ecore_file_path_shutdown(void)
|
ecore_file_path_shutdown(void)
|
||||||
{
|
{
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
if (--init != 0) return init;
|
|
||||||
EINA_LIST_FREE(__ecore_file_path_bin, dir)
|
EINA_LIST_FREE(__ecore_file_path_bin, dir)
|
||||||
free(dir);
|
free(dir);
|
||||||
return init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_List *
|
Eina_List *
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef ECORE_FILE_PRIVATE_H_
|
||||||
|
#define ECORE_FILE_PRIVATE_H_
|
||||||
|
|
||||||
#ifndef _FILE_OFFSET_BITS
|
#ifndef _FILE_OFFSET_BITS
|
||||||
# define _FILE_OFFSET_BITS 64
|
# define _FILE_OFFSET_BITS 64
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,8 +19,8 @@
|
||||||
#include "Ecore_File.h"
|
#include "Ecore_File.h"
|
||||||
|
|
||||||
/* ecore_file_monitor */
|
/* ecore_file_monitor */
|
||||||
int ecore_file_monitor_init(void);
|
int ecore_file_monitor_init(void);
|
||||||
int ecore_file_monitor_shutdown(void);
|
void ecore_file_monitor_shutdown(void);
|
||||||
|
|
||||||
#define ECORE_FILE_MONITOR(x) ((Ecore_File_Monitor *)(x))
|
#define ECORE_FILE_MONITOR(x) ((Ecore_File_Monitor *)(x))
|
||||||
|
|
||||||
|
@ -66,12 +69,14 @@ Ecore_File_Monitor *ecore_file_monitor_poll_add(const char *path,
|
||||||
void *data);
|
void *data);
|
||||||
void ecore_file_monitor_poll_del(Ecore_File_Monitor *ecore_file_monitor);
|
void ecore_file_monitor_poll_del(Ecore_File_Monitor *ecore_file_monitor);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ecore_file_path */
|
/* ecore_file_path */
|
||||||
int ecore_file_path_init(void);
|
void ecore_file_path_init(void);
|
||||||
int ecore_file_path_shutdown(void);
|
void ecore_file_path_shutdown(void);
|
||||||
|
|
||||||
/* ecore_file_download */
|
/* ecore_file_download */
|
||||||
int ecore_file_download_init(void);
|
int ecore_file_download_init(void);
|
||||||
int ecore_file_download_shutdown(void);
|
void ecore_file_download_shutdown(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,7 +18,7 @@ EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0;
|
||||||
EAPI int ECORE_IMF_EVENT_COMMIT = 0;
|
EAPI int ECORE_IMF_EVENT_COMMIT = 0;
|
||||||
EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0;
|
EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0;
|
||||||
|
|
||||||
static int init_count = 0;
|
static int _ecore_imf_init_count = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Ecore_IMF_Lib_Group Ecore Input Method Library Functions
|
* @defgroup Ecore_IMF_Lib_Group Ecore Input Method Library Functions
|
||||||
|
@ -36,9 +36,12 @@ static int init_count = 0;
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_imf_init(void)
|
ecore_imf_init(void)
|
||||||
{
|
{
|
||||||
if (++init_count != 1) return init_count;
|
if (++_ecore_imf_init_count != 1)
|
||||||
|
return _ecore_imf_init_count;
|
||||||
|
|
||||||
|
if (!ecore_init())
|
||||||
|
return --_ecore_imf_init_count;
|
||||||
|
|
||||||
ecore_init();
|
|
||||||
ecore_imf_module_init();
|
ecore_imf_module_init();
|
||||||
|
|
||||||
ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new();
|
ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new();
|
||||||
|
@ -47,7 +50,7 @@ ecore_imf_init(void)
|
||||||
ECORE_IMF_EVENT_COMMIT = ecore_event_type_new();
|
ECORE_IMF_EVENT_COMMIT = ecore_event_type_new();
|
||||||
ECORE_IMF_EVENT_DELETE_SURROUNDING = ecore_event_type_new();
|
ECORE_IMF_EVENT_DELETE_SURROUNDING = ecore_event_type_new();
|
||||||
|
|
||||||
return init_count;
|
return _ecore_imf_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,10 +62,11 @@ ecore_imf_init(void)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_imf_shutdown(void)
|
ecore_imf_shutdown(void)
|
||||||
{
|
{
|
||||||
if (--init_count != 0) return init_count;
|
if (--_ecore_imf_init_count != 0)
|
||||||
|
return _ecore_imf_init_count;
|
||||||
|
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
ecore_imf_module_shutdown();
|
ecore_imf_module_shutdown();
|
||||||
|
|
||||||
return init_count;
|
return _ecore_imf_init_count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,46 @@ EAPI int ECORE_EVENT_MOUSE_IN = 0;
|
||||||
EAPI int ECORE_EVENT_MOUSE_OUT = 0;
|
EAPI int ECORE_EVENT_MOUSE_OUT = 0;
|
||||||
|
|
||||||
static int _ecore_event_init_count = 0;
|
static int _ecore_event_init_count = 0;
|
||||||
|
static int _ecore_event_evas_init_count = 0;
|
||||||
|
|
||||||
static Ecore_Event_Handler *ecore_event_evas_handlers[8];
|
static Ecore_Event_Handler *ecore_event_evas_handlers[8];
|
||||||
static Eina_Hash *_window_hash = NULL;
|
static Eina_Hash *_window_hash = NULL;
|
||||||
|
|
||||||
static int _ecore_event_evas_init_count = 0;
|
EAPI int
|
||||||
|
ecore_event_init(void)
|
||||||
|
{
|
||||||
|
if (++_ecore_event_init_count != 1)
|
||||||
|
return _ecore_event_init_count;
|
||||||
|
|
||||||
|
ECORE_EVENT_KEY_DOWN = ecore_event_type_new();
|
||||||
|
ECORE_EVENT_KEY_UP = ecore_event_type_new();
|
||||||
|
ECORE_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
||||||
|
ECORE_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
||||||
|
ECORE_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
||||||
|
ECORE_EVENT_MOUSE_WHEEL = ecore_event_type_new();
|
||||||
|
ECORE_EVENT_MOUSE_IN = ecore_event_type_new();
|
||||||
|
ECORE_EVENT_MOUSE_OUT = ecore_event_type_new();
|
||||||
|
|
||||||
|
return _ecore_event_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
ecore_event_shutdown(void)
|
||||||
|
{
|
||||||
|
if (--_ecore_event_init_count != 0)
|
||||||
|
return _ecore_event_init_count;
|
||||||
|
|
||||||
|
ECORE_EVENT_KEY_DOWN = 0;
|
||||||
|
ECORE_EVENT_KEY_UP = 0;
|
||||||
|
ECORE_EVENT_MOUSE_BUTTON_DOWN = 0;
|
||||||
|
ECORE_EVENT_MOUSE_BUTTON_UP = 0;
|
||||||
|
ECORE_EVENT_MOUSE_MOVE = 0;
|
||||||
|
ECORE_EVENT_MOUSE_WHEEL = 0;
|
||||||
|
ECORE_EVENT_MOUSE_IN = 0;
|
||||||
|
ECORE_EVENT_MOUSE_OUT = 0;
|
||||||
|
|
||||||
|
return ++_ecore_event_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers)
|
ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers)
|
||||||
|
@ -267,60 +302,75 @@ ecore_event_evas_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *eve
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_event_evas_init(void)
|
ecore_event_evas_init(void)
|
||||||
{
|
{
|
||||||
if (!_ecore_event_evas_init_count)
|
if (++_ecore_event_evas_init_count != 1)
|
||||||
|
return _ecore_event_evas_init_count;
|
||||||
|
|
||||||
|
if (!ecore_init())
|
||||||
{
|
{
|
||||||
ecore_init();
|
return --_ecore_event_evas_init_count;
|
||||||
ecore_event_init();
|
|
||||||
|
|
||||||
ecore_event_evas_handlers[0] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
|
|
||||||
ecore_event_evas_key_down,
|
|
||||||
NULL);
|
|
||||||
ecore_event_evas_handlers[1] = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
|
|
||||||
ecore_event_evas_key_up,
|
|
||||||
NULL);
|
|
||||||
ecore_event_evas_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
|
||||||
ecore_event_evas_mouse_button_down,
|
|
||||||
NULL);
|
|
||||||
ecore_event_evas_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
||||||
ecore_event_evas_mouse_button_up,
|
|
||||||
NULL);
|
|
||||||
ecore_event_evas_handlers[4] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
|
|
||||||
ecore_event_evas_mouse_move,
|
|
||||||
NULL);
|
|
||||||
ecore_event_evas_handlers[5] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
|
|
||||||
ecore_event_evas_mouse_wheel,
|
|
||||||
NULL);
|
|
||||||
ecore_event_evas_handlers[6] = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
|
|
||||||
ecore_event_evas_mouse_in,
|
|
||||||
NULL);
|
|
||||||
ecore_event_evas_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
|
|
||||||
ecore_event_evas_mouse_out,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
_window_hash = eina_hash_pointer_new(free);
|
|
||||||
}
|
}
|
||||||
return ++_ecore_event_evas_init_count;
|
|
||||||
|
if (!ecore_event_init())
|
||||||
|
{
|
||||||
|
goto shutdown_ecore;
|
||||||
|
}
|
||||||
|
|
||||||
|
ecore_event_evas_handlers[0] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
|
||||||
|
ecore_event_evas_key_down,
|
||||||
|
NULL);
|
||||||
|
ecore_event_evas_handlers[1] = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
|
||||||
|
ecore_event_evas_key_up,
|
||||||
|
NULL);
|
||||||
|
ecore_event_evas_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
||||||
|
ecore_event_evas_mouse_button_down,
|
||||||
|
NULL);
|
||||||
|
ecore_event_evas_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
||||||
|
ecore_event_evas_mouse_button_up,
|
||||||
|
NULL);
|
||||||
|
ecore_event_evas_handlers[4] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
|
||||||
|
ecore_event_evas_mouse_move,
|
||||||
|
NULL);
|
||||||
|
ecore_event_evas_handlers[5] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL,
|
||||||
|
ecore_event_evas_mouse_wheel,
|
||||||
|
NULL);
|
||||||
|
ecore_event_evas_handlers[6] = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN,
|
||||||
|
ecore_event_evas_mouse_in,
|
||||||
|
NULL);
|
||||||
|
ecore_event_evas_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT,
|
||||||
|
ecore_event_evas_mouse_out,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
_window_hash = eina_hash_pointer_new(free);
|
||||||
|
|
||||||
|
return _ecore_event_evas_init_count;
|
||||||
|
|
||||||
|
shutdown_ecore:
|
||||||
|
ecore_shutdown();
|
||||||
|
|
||||||
|
return --_ecore_event_evas_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_event_evas_shutdown(void)
|
ecore_event_evas_shutdown(void)
|
||||||
{
|
{
|
||||||
if (_ecore_event_evas_init_count == 1)
|
int i;
|
||||||
|
|
||||||
|
if (--_ecore_event_evas_init_count != 0)
|
||||||
|
return _ecore_event_evas_init_count;
|
||||||
|
|
||||||
|
|
||||||
|
eina_hash_free(_window_hash);
|
||||||
|
_window_hash = NULL;
|
||||||
|
for (i = 0; i < sizeof(ecore_event_evas_handlers)/sizeof(Ecore_Event_Handler*); ++i)
|
||||||
{
|
{
|
||||||
int i;
|
ecore_event_handler_del(ecore_event_evas_handlers[i]);
|
||||||
|
ecore_event_evas_handlers[i] = NULL;
|
||||||
eina_hash_free(_window_hash);
|
|
||||||
_window_hash = NULL;
|
|
||||||
for (i = 0; i < sizeof(ecore_event_evas_handlers)/sizeof(Ecore_Event_Handler*); ++i)
|
|
||||||
{
|
|
||||||
ecore_event_handler_del(ecore_event_evas_handlers[i]);
|
|
||||||
ecore_event_evas_handlers[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ecore_event_shutdown();
|
|
||||||
ecore_shutdown();
|
|
||||||
}
|
}
|
||||||
return --_ecore_event_evas_init_count;
|
|
||||||
|
ecore_event_shutdown();
|
||||||
|
ecore_shutdown();
|
||||||
|
|
||||||
|
return _ecore_event_evas_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _Ecore_Event_Modifier_Match Ecore_Event_Modifier_Match;
|
typedef struct _Ecore_Event_Modifier_Match Ecore_Event_Modifier_Match;
|
||||||
|
@ -371,37 +421,3 @@ ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, i
|
||||||
|
|
||||||
return ECORE_NONE;
|
return ECORE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_event_init(void)
|
|
||||||
{
|
|
||||||
if (!_ecore_event_init_count)
|
|
||||||
{
|
|
||||||
ECORE_EVENT_KEY_DOWN = ecore_event_type_new();
|
|
||||||
ECORE_EVENT_KEY_UP = ecore_event_type_new();
|
|
||||||
ECORE_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
|
||||||
ECORE_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
|
||||||
ECORE_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
|
||||||
ECORE_EVENT_MOUSE_WHEEL = ecore_event_type_new();
|
|
||||||
ECORE_EVENT_MOUSE_IN = ecore_event_type_new();
|
|
||||||
ECORE_EVENT_MOUSE_OUT = ecore_event_type_new();
|
|
||||||
}
|
|
||||||
return ++_ecore_event_init_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_event_shutdown(void)
|
|
||||||
{
|
|
||||||
if (_ecore_event_init_count == 1)
|
|
||||||
{
|
|
||||||
ECORE_EVENT_KEY_DOWN = 0;
|
|
||||||
ECORE_EVENT_KEY_UP = 0;
|
|
||||||
ECORE_EVENT_MOUSE_BUTTON_DOWN = 0;
|
|
||||||
ECORE_EVENT_MOUSE_BUTTON_UP = 0;
|
|
||||||
ECORE_EVENT_MOUSE_MOVE = 0;
|
|
||||||
ECORE_EVENT_MOUSE_WHEEL = 0;
|
|
||||||
ECORE_EVENT_MOUSE_IN = 0;
|
|
||||||
ECORE_EVENT_MOUSE_OUT = 0;
|
|
||||||
}
|
|
||||||
return ++_ecore_event_init_count;
|
|
||||||
}
|
|
||||||
|
|
|
@ -240,7 +240,7 @@ EAPI int ECORE_IPC_EVENT_SERVER_DEL = 0;
|
||||||
EAPI int ECORE_IPC_EVENT_CLIENT_DATA = 0;
|
EAPI int ECORE_IPC_EVENT_CLIENT_DATA = 0;
|
||||||
EAPI int ECORE_IPC_EVENT_SERVER_DATA = 0;
|
EAPI int ECORE_IPC_EVENT_SERVER_DATA = 0;
|
||||||
|
|
||||||
static int init_count = 0;
|
static int _ecore_ipc_init_count = 0;
|
||||||
static Eina_List *servers = NULL;
|
static Eina_List *servers = NULL;
|
||||||
static Ecore_Event_Handler *handler[6];
|
static Ecore_Event_Handler *handler[6];
|
||||||
|
|
||||||
|
@ -261,9 +261,11 @@ ecore_ipc_init(void)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (++init_count != 1) return init_count;
|
if (++_ecore_ipc_init_count != 1)
|
||||||
|
return _ecore_ipc_init_count;
|
||||||
|
|
||||||
ecore_con_init();
|
if (!ecore_con_init())
|
||||||
|
return --_ecore_ipc_init_count;
|
||||||
|
|
||||||
ECORE_IPC_EVENT_CLIENT_ADD = ecore_event_type_new();
|
ECORE_IPC_EVENT_CLIENT_ADD = ecore_event_type_new();
|
||||||
ECORE_IPC_EVENT_CLIENT_DEL = ecore_event_type_new();
|
ECORE_IPC_EVENT_CLIENT_DEL = ecore_event_type_new();
|
||||||
|
@ -284,7 +286,7 @@ ecore_ipc_init(void)
|
||||||
_ecore_ipc_event_client_data, NULL);
|
_ecore_ipc_event_client_data, NULL);
|
||||||
handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
|
handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA,
|
||||||
_ecore_ipc_event_server_data, NULL);
|
_ecore_ipc_event_server_data, NULL);
|
||||||
return init_count;
|
return _ecore_ipc_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,7 +300,8 @@ ecore_ipc_shutdown(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (--init_count != 0) return init_count;
|
if (--_ecore_ipc_init_count != 0)
|
||||||
|
return _ecore_ipc_init_count;
|
||||||
|
|
||||||
while (servers) ecore_ipc_server_del(eina_list_data_get(servers));
|
while (servers) ecore_ipc_server_del(eina_list_data_get(servers));
|
||||||
|
|
||||||
|
@ -307,7 +310,7 @@ ecore_ipc_shutdown(void)
|
||||||
|
|
||||||
ecore_con_shutdown();
|
ecore_con_shutdown();
|
||||||
|
|
||||||
return init_count;
|
return _ecore_ipc_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,33 +17,35 @@ static int _ecore_job_event_handler(void *data, int type, void *ev);
|
||||||
static void _ecore_job_event_free(void *data, void *ev);
|
static void _ecore_job_event_free(void *data, void *ev);
|
||||||
|
|
||||||
static int ecore_event_job_type = 0;
|
static int ecore_event_job_type = 0;
|
||||||
static int _ecore_init_job_count = 0;
|
static int _ecore_job_init_count = 0;
|
||||||
static Ecore_Event_Handler* _ecore_job_handler = NULL;
|
static Ecore_Event_Handler* _ecore_job_handler = NULL;
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_job_init(void)
|
ecore_job_init(void)
|
||||||
{
|
{
|
||||||
if (++_ecore_init_job_count == 1)
|
if (++_ecore_job_init_count != 1)
|
||||||
{
|
return _ecore_job_init_count;
|
||||||
ecore_init();
|
|
||||||
ecore_event_job_type = ecore_event_type_new();
|
|
||||||
_ecore_job_handler = ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return _ecore_init_job_count;
|
if (!ecore_init())
|
||||||
|
return --_ecore_job_init_count;
|
||||||
|
|
||||||
|
ecore_event_job_type = ecore_event_type_new();
|
||||||
|
_ecore_job_handler = ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL);
|
||||||
|
|
||||||
|
return _ecore_job_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_job_shutdown(void)
|
ecore_job_shutdown(void)
|
||||||
{
|
{
|
||||||
if (--_ecore_init_job_count)
|
if (--_ecore_job_init_count != 0)
|
||||||
return _ecore_init_job_count;
|
return _ecore_job_init_count;
|
||||||
|
|
||||||
ecore_event_handler_del(_ecore_job_handler);
|
ecore_event_handler_del(_ecore_job_handler);
|
||||||
_ecore_job_handler = NULL;
|
_ecore_job_handler = NULL;
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
|
|
||||||
return _ecore_init_job_count;
|
return _ecore_job_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,17 +25,18 @@ static int old_flags;
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_quartz_init(const char *name __UNUSED__)
|
ecore_quartz_init(const char *name __UNUSED__)
|
||||||
{
|
{
|
||||||
if (!_ecore_quartz_init_count)
|
if (++_ecore_quartz_init_count != 1)
|
||||||
{
|
return _ecore_quartz_init_count;
|
||||||
ECORE_QUARTZ_EVENT_GOT_FOCUS = ecore_event_type_new();
|
|
||||||
ECORE_QUARTZ_EVENT_LOST_FOCUS = ecore_event_type_new();
|
|
||||||
ECORE_QUARTZ_EVENT_RESIZE = ecore_event_type_new();
|
|
||||||
ECORE_QUARTZ_EVENT_EXPOSE = ecore_event_type_new();
|
|
||||||
}
|
|
||||||
|
|
||||||
ecore_event_init();
|
if (!ecore_event_init())
|
||||||
|
return --_ecore_quartz_init_count;
|
||||||
|
|
||||||
return ++_ecore_quartz_init_count;
|
ECORE_QUARTZ_EVENT_GOT_FOCUS = ecore_event_type_new();
|
||||||
|
ECORE_QUARTZ_EVENT_LOST_FOCUS = ecore_event_type_new();
|
||||||
|
ECORE_QUARTZ_EVENT_RESIZE = ecore_event_type_new();
|
||||||
|
ECORE_QUARTZ_EVENT_EXPOSE = ecore_event_type_new();
|
||||||
|
|
||||||
|
return _ecore_quartz_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +48,8 @@ ecore_quartz_init(const char *name __UNUSED__)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_quartz_shutdown(void)
|
ecore_quartz_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_quartz_init_count--;
|
if (--_ecore_quartz_init_count != 0)
|
||||||
|
return _ecore_quartz_init_count;
|
||||||
|
|
||||||
ecore_event_shutdown();
|
ecore_event_shutdown();
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ AM_CPPFLAGS = \
|
||||||
-I$(top_builddir)/src/lib/ecore_input \
|
-I$(top_builddir)/src/lib/ecore_input \
|
||||||
@EFL_ECORE_SDL_BUILD@ \
|
@EFL_ECORE_SDL_BUILD@ \
|
||||||
@SDL_CFLAGS@ \
|
@SDL_CFLAGS@ \
|
||||||
|
@EVAS_CFLAGS@ \
|
||||||
@EINA_CFLAGS@
|
@EINA_CFLAGS@
|
||||||
|
|
||||||
if BUILD_ECORE_SDL
|
if BUILD_ECORE_SDL
|
||||||
|
|
|
@ -66,17 +66,20 @@ _ecore_sdl_pressed_node(const Ecore_SDL_Pressed *node,
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_sdl_init(const char *name __UNUSED__)
|
ecore_sdl_init(const char *name __UNUSED__)
|
||||||
{
|
{
|
||||||
if(!_ecore_sdl_init_count)
|
if(++_ecore_sdl_init_count != 1)
|
||||||
{
|
return _ecore_sdl_init_count;
|
||||||
ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new();
|
|
||||||
ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new();
|
|
||||||
ECORE_SDL_EVENT_RESIZE = ecore_event_type_new();
|
|
||||||
ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new();
|
|
||||||
|
|
||||||
SDL_EnableKeyRepeat(200, 100);
|
if (!ecore_event_init())
|
||||||
}
|
return --_ecore_sdl_init_count;
|
||||||
ecore_event_init();
|
|
||||||
return ++_ecore_sdl_init_count;
|
ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new();
|
||||||
|
ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new();
|
||||||
|
ECORE_SDL_EVENT_RESIZE = ecore_event_type_new();
|
||||||
|
ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new();
|
||||||
|
|
||||||
|
SDL_EnableKeyRepeat(200, 100);
|
||||||
|
|
||||||
|
return _ecore_sdl_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,8 +91,11 @@ ecore_sdl_init(const char *name __UNUSED__)
|
||||||
EAPI int
|
EAPI int
|
||||||
ecore_sdl_shutdown(void)
|
ecore_sdl_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_sdl_init_count--;
|
if (--_ecore_sdl_init_count != 0);
|
||||||
|
return _ecore_sdl_init_count;
|
||||||
|
|
||||||
ecore_event_shutdown();
|
ecore_event_shutdown();
|
||||||
|
|
||||||
return _ecore_sdl_init_count;
|
return _ecore_sdl_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,13 +193,12 @@ ecore_x_init(const char *name)
|
||||||
|
|
||||||
xcb_intern_atom_cookie_t atom_cookies[ECORE_X_ATOMS_COUNT];
|
xcb_intern_atom_cookie_t atom_cookies[ECORE_X_ATOMS_COUNT];
|
||||||
|
|
||||||
if (_ecore_xcb_init_count > 0)
|
if (--_ecore_xcb_init_count != 1)
|
||||||
{
|
return _ecore_xcb_init_count;
|
||||||
_ecore_xcb_init_count++;
|
|
||||||
return _ecore_xcb_init_count;
|
|
||||||
}
|
|
||||||
_ecore_xcb_conn = xcb_connect(name, &screen);
|
_ecore_xcb_conn = xcb_connect(name, &screen);
|
||||||
if (!_ecore_xcb_conn) return 0;
|
if (!_ecore_xcb_conn)
|
||||||
|
return --_ecore_xcb_init_count;
|
||||||
|
|
||||||
/* FIXME: no error code right now */
|
/* FIXME: no error code right now */
|
||||||
/* _ecore_xcb_error_handler_init(); */
|
/* _ecore_xcb_error_handler_init(); */
|
||||||
|
@ -268,7 +267,9 @@ ecore_x_init(const char *name)
|
||||||
#endif /* ECORE_XCB_XPRINT */
|
#endif /* ECORE_XCB_XPRINT */
|
||||||
|
|
||||||
/* We init some components (not related to XCB) */
|
/* We init some components (not related to XCB) */
|
||||||
ecore_event_init();
|
if (!ecore_event_init())
|
||||||
|
goto close_connection;
|
||||||
|
|
||||||
_ecore_x_reply_init();
|
_ecore_x_reply_init();
|
||||||
_ecore_x_dnd_init();
|
_ecore_x_dnd_init();
|
||||||
ecore_x_netwm_init();
|
ecore_x_netwm_init();
|
||||||
|
@ -411,42 +412,7 @@ ecore_x_init(const char *name)
|
||||||
|
|
||||||
_ecore_xcb_event_handlers = calloc(_ecore_xcb_event_handlers_num, sizeof(void *));
|
_ecore_xcb_event_handlers = calloc(_ecore_xcb_event_handlers_num, sizeof(void *));
|
||||||
if (!_ecore_xcb_event_handlers)
|
if (!_ecore_xcb_event_handlers)
|
||||||
{
|
goto finalize_extensions;
|
||||||
/* We get the replies of the QueryVersion request because we leave */
|
|
||||||
#ifdef ECORE_XCB_DAMAGE
|
|
||||||
_ecore_x_damage_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_DAMAGE */
|
|
||||||
#ifdef ECORE_XCB_COMPOSITE
|
|
||||||
_ecore_x_composite_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_COMPOSITE */
|
|
||||||
#ifdef ECORE_XCB_DPMS
|
|
||||||
_ecore_x_dpms_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_DPMS */
|
|
||||||
#ifdef ECORE_XCB_RANDR
|
|
||||||
_ecore_x_randr_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_RANDR */
|
|
||||||
#ifdef ECORE_XCB_SCREENSAVER
|
|
||||||
_ecore_x_screensaver_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_SCREENSAVER */
|
|
||||||
#ifdef ECORE_XCB_SHAPE
|
|
||||||
_ecore_x_shape_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_SHAPE */
|
|
||||||
#ifdef ECORE_XCB_SYNC
|
|
||||||
_ecore_x_sync_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_SYNC */
|
|
||||||
#ifdef ECORE_XCB_FIXES
|
|
||||||
_ecore_x_xfixes_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_FIXES */
|
|
||||||
#ifdef ECORE_XCB_XINERAMA
|
|
||||||
_ecore_x_xinerama_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_XINERAMA */
|
|
||||||
|
|
||||||
ecore_event_shutdown();
|
|
||||||
xcb_disconnect(_ecore_xcb_conn);
|
|
||||||
_ecore_xcb_fd_handler_handle = NULL;
|
|
||||||
_ecore_xcb_conn = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ECORE_XCB_CURSOR
|
#ifdef ECORE_XCB_CURSOR
|
||||||
_ecore_xcb_xcursor = XcursorSupportsARGB(_ecore_xcb_conn);
|
_ecore_xcb_xcursor = XcursorSupportsARGB(_ecore_xcb_conn);
|
||||||
|
@ -607,44 +573,8 @@ ecore_x_init(const char *name)
|
||||||
_ecore_xcb_fd_handler, _ecore_xcb_conn,
|
_ecore_xcb_fd_handler, _ecore_xcb_conn,
|
||||||
_ecore_xcb_fd_handler_buf, _ecore_xcb_conn);
|
_ecore_xcb_fd_handler_buf, _ecore_xcb_conn);
|
||||||
if (!_ecore_xcb_fd_handler_handle)
|
if (!_ecore_xcb_fd_handler_handle)
|
||||||
{
|
goto free_event_handlers;
|
||||||
/* We get the replies of the QueryVersion request because we leave */
|
|
||||||
#ifdef ECORE_XCB_DAMAGE
|
|
||||||
_ecore_x_damage_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_DAMAGE */
|
|
||||||
#ifdef ECORE_XCB_COMPOSITE
|
|
||||||
_ecore_x_composite_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_COMPOSITE */
|
|
||||||
#ifdef ECORE_XCB_DPMS
|
|
||||||
_ecore_x_dpms_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_DPMS */
|
|
||||||
#ifdef ECORE_XCB_RANDR
|
|
||||||
_ecore_x_randr_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_RANDR */
|
|
||||||
#ifdef ECORE_XCB_SCREENSAVER
|
|
||||||
_ecore_x_screensaver_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_SCREENSAVER */
|
|
||||||
#ifdef ECORE_XCB_SHAPE
|
|
||||||
_ecore_x_shape_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_SHAPE */
|
|
||||||
#ifdef ECORE_XCB_SYNC
|
|
||||||
_ecore_x_sync_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_SYNC */
|
|
||||||
#ifdef ECORE_XCB_FIXES
|
|
||||||
_ecore_x_xfixes_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_FIXES */
|
|
||||||
#ifdef ECORE_XCB_XINERAMA
|
|
||||||
_ecore_x_xinerama_init_finalize();
|
|
||||||
#endif /* ECORE_XCB_XINERAMA */
|
|
||||||
|
|
||||||
ecore_event_shutdown();
|
|
||||||
xcb_disconnect(_ecore_xcb_conn);
|
|
||||||
free(_ecore_xcb_event_handlers);
|
|
||||||
_ecore_xcb_fd_handler_handle = NULL;
|
|
||||||
_ecore_xcb_conn = NULL;
|
|
||||||
_ecore_xcb_event_handlers = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ecore_xcb_filter_handler = ecore_event_filter_add(_ecore_xcb_event_filter_start, _ecore_xcb_event_filter_filter, _ecore_xcb_event_filter_end, NULL);
|
_ecore_xcb_filter_handler = ecore_event_filter_add(_ecore_xcb_event_filter_start, _ecore_xcb_event_filter_filter, _ecore_xcb_event_filter_end, NULL);
|
||||||
|
|
||||||
/* This is just to be anal about naming conventions */
|
/* This is just to be anal about naming conventions */
|
||||||
|
@ -688,14 +618,57 @@ ecore_x_init(const char *name)
|
||||||
#endif /* ECORE_XCB_XINERAMA */
|
#endif /* ECORE_XCB_XINERAMA */
|
||||||
|
|
||||||
return _ecore_xcb_init_count;
|
return _ecore_xcb_init_count;
|
||||||
|
|
||||||
|
free_event_handlers:
|
||||||
|
free(_ecore_xcb_event_handlers);
|
||||||
|
_ecore_xcb_event_handlers = NULL;
|
||||||
|
finalize_extensions:
|
||||||
|
/* We get the replies of the QueryVersion request because we leave */
|
||||||
|
#ifdef ECORE_XCB_DAMAGE
|
||||||
|
_ecore_x_damage_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_DAMAGE */
|
||||||
|
#ifdef ECORE_XCB_COMPOSITE
|
||||||
|
_ecore_x_composite_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_COMPOSITE */
|
||||||
|
#ifdef ECORE_XCB_DPMS
|
||||||
|
_ecore_x_dpms_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_DPMS */
|
||||||
|
#ifdef ECORE_XCB_RANDR
|
||||||
|
_ecore_x_randr_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_RANDR */
|
||||||
|
#ifdef ECORE_XCB_SCREENSAVER
|
||||||
|
_ecore_x_screensaver_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_SCREENSAVER */
|
||||||
|
#ifdef ECORE_XCB_SHAPE
|
||||||
|
_ecore_x_shape_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_SHAPE */
|
||||||
|
#ifdef ECORE_XCB_SYNC
|
||||||
|
_ecore_x_sync_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_SYNC */
|
||||||
|
#ifdef ECORE_XCB_FIXES
|
||||||
|
_ecore_x_xfixes_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_FIXES */
|
||||||
|
#ifdef ECORE_XCB_XINERAMA
|
||||||
|
_ecore_x_xinerama_init_finalize();
|
||||||
|
#endif /* ECORE_XCB_XINERAMA */
|
||||||
|
ecore_event_shutdown();
|
||||||
|
close_connection:
|
||||||
|
_ecore_x_atom_init_finalize(atom_cookies);
|
||||||
|
xcb_disconnect(_ecore_xcb_conn);
|
||||||
|
_ecore_xcb_fd_handler_handle = NULL;
|
||||||
|
_ecore_xcb_conn = NULL;
|
||||||
|
|
||||||
|
return --_ecore_xcb_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_ecore_x_shutdown(int close_display)
|
_ecore_x_shutdown(int close_display)
|
||||||
{
|
{
|
||||||
_ecore_xcb_init_count--;
|
if (--_ecore_xcb_init_count != 0)
|
||||||
if (_ecore_xcb_init_count > 0) return _ecore_xcb_init_count;
|
return _ecore_xcb_init_count;
|
||||||
|
|
||||||
if (!_ecore_xcb_conn) return _ecore_xcb_init_count;
|
if (!_ecore_xcb_conn) return _ecore_xcb_init_count;
|
||||||
|
|
||||||
if (close_display)
|
if (close_display)
|
||||||
xcb_disconnect(_ecore_xcb_conn);
|
xcb_disconnect(_ecore_xcb_conn);
|
||||||
else
|
else
|
||||||
|
@ -712,7 +685,7 @@ _ecore_x_shutdown(int close_display)
|
||||||
_ecore_x_dnd_shutdown();
|
_ecore_x_dnd_shutdown();
|
||||||
ecore_x_netwm_shutdown();
|
ecore_x_netwm_shutdown();
|
||||||
_ecore_x_reply_shutdown();
|
_ecore_x_reply_shutdown();
|
||||||
if (_ecore_xcb_init_count < 0) _ecore_xcb_init_count = 0;
|
|
||||||
return _ecore_xcb_init_count;
|
return _ecore_xcb_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,15 +166,16 @@ ecore_x_init(const char *name)
|
||||||
int damage_err_base = 0;
|
int damage_err_base = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_ecore_x_init_count > 0)
|
if (++_ecore_x_init_count != 1)
|
||||||
{
|
return _ecore_x_init_count;
|
||||||
_ecore_x_init_count++;
|
|
||||||
return _ecore_x_init_count;
|
if (!ecore_event_init())
|
||||||
}
|
return --_ecore_x_init_count;
|
||||||
ecore_event_init();
|
|
||||||
|
|
||||||
_ecore_x_disp = XOpenDisplay((char *)name);
|
_ecore_x_disp = XOpenDisplay((char *)name);
|
||||||
if (!_ecore_x_disp) return 0;
|
if (!_ecore_x_disp)
|
||||||
|
goto shutdown_ecore_event;
|
||||||
|
|
||||||
_ecore_x_error_handler_init();
|
_ecore_x_error_handler_init();
|
||||||
_ecore_x_event_handlers_num = LASTEvent;
|
_ecore_x_event_handlers_num = LASTEvent;
|
||||||
|
|
||||||
|
@ -224,12 +225,8 @@ ecore_x_init(const char *name)
|
||||||
|
|
||||||
_ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *));
|
_ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *));
|
||||||
if (!_ecore_x_event_handlers)
|
if (!_ecore_x_event_handlers)
|
||||||
{
|
goto close_display;
|
||||||
XCloseDisplay(_ecore_x_disp);
|
|
||||||
_ecore_x_fd_handler_handle = NULL;
|
|
||||||
_ecore_x_disp = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#ifdef ECORE_XCURSOR
|
#ifdef ECORE_XCURSOR
|
||||||
_ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp);
|
_ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp);
|
||||||
#endif
|
#endif
|
||||||
|
@ -400,15 +397,7 @@ ecore_x_init(const char *name)
|
||||||
_ecore_x_fd_handler, _ecore_x_disp,
|
_ecore_x_fd_handler, _ecore_x_disp,
|
||||||
_ecore_x_fd_handler_buf, _ecore_x_disp);
|
_ecore_x_fd_handler_buf, _ecore_x_disp);
|
||||||
if (!_ecore_x_fd_handler_handle)
|
if (!_ecore_x_fd_handler_handle)
|
||||||
{
|
goto free_event_handlers;
|
||||||
XCloseDisplay(_ecore_x_disp);
|
|
||||||
free(_ecore_x_event_handlers);
|
|
||||||
_ecore_x_fd_handler_handle = NULL;
|
|
||||||
_ecore_x_disp = NULL;
|
|
||||||
_ecore_x_event_handlers = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_ecore_x_atoms_init();
|
_ecore_x_atoms_init();
|
||||||
|
|
||||||
|
@ -435,8 +424,6 @@ ecore_x_init(const char *name)
|
||||||
_ecore_x_composite_init();
|
_ecore_x_composite_init();
|
||||||
_ecore_x_dpms_init();
|
_ecore_x_dpms_init();
|
||||||
_ecore_x_randr_init();
|
_ecore_x_randr_init();
|
||||||
|
|
||||||
_ecore_x_init_count++;
|
|
||||||
|
|
||||||
_ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
|
_ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456);
|
||||||
|
|
||||||
|
@ -476,13 +463,26 @@ _im_create_error:
|
||||||
_im_create_end:
|
_im_create_end:
|
||||||
#endif
|
#endif
|
||||||
return _ecore_x_init_count;
|
return _ecore_x_init_count;
|
||||||
|
|
||||||
|
free_event_handlers:
|
||||||
|
free(_ecore_x_event_handlers);
|
||||||
|
_ecore_x_event_handlers = NULL;
|
||||||
|
close_display:
|
||||||
|
XCloseDisplay(_ecore_x_disp);
|
||||||
|
_ecore_x_fd_handler_handle = NULL;
|
||||||
|
_ecore_x_disp = NULL;
|
||||||
|
shutdown_ecore_event:
|
||||||
|
ecore_event_shutdown();
|
||||||
|
|
||||||
|
return --_ecore_x_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_ecore_x_shutdown(int close_display)
|
_ecore_x_shutdown(int close_display)
|
||||||
{
|
{
|
||||||
_ecore_x_init_count--;
|
if (--_ecore_x_init_count != 0)
|
||||||
if (_ecore_x_init_count > 0) return _ecore_x_init_count;
|
return _ecore_x_init_count;
|
||||||
|
|
||||||
if (!_ecore_x_disp) return _ecore_x_init_count;
|
if (!_ecore_x_disp) return _ecore_x_init_count;
|
||||||
|
|
||||||
#ifdef ENABLE_XIM
|
#ifdef ENABLE_XIM
|
||||||
|
@ -508,7 +508,7 @@ _ecore_x_shutdown(int close_display)
|
||||||
_ecore_x_dnd_shutdown();
|
_ecore_x_dnd_shutdown();
|
||||||
ecore_x_netwm_shutdown();
|
ecore_x_netwm_shutdown();
|
||||||
ecore_event_shutdown();
|
ecore_event_shutdown();
|
||||||
if (_ecore_x_init_count < 0) _ecore_x_init_count = 0;
|
|
||||||
return _ecore_x_init_count;
|
return _ecore_x_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue