2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Ecore.h>
|
2009-03-10 15:44:36 -07:00
|
|
|
#include <ecore_private.h>
|
2007-11-19 10:27:11 -08:00
|
|
|
|
|
|
|
#include "Ecore_IMF.h"
|
2007-11-22 03:55:35 -08:00
|
|
|
#include "ecore_imf_private.h"
|
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
EAPI int ECORE_IMF_EVENT_PREEDIT_START = 0;
|
|
|
|
EAPI int ECORE_IMF_EVENT_PREEDIT_END = 0;
|
|
|
|
EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0;
|
|
|
|
EAPI int ECORE_IMF_EVENT_COMMIT = 0;
|
2007-12-12 11:00:48 -08:00
|
|
|
EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0;
|
2007-11-19 10:27:11 -08:00
|
|
|
|
2009-12-21 09:32:19 -08:00
|
|
|
int _ecore_imf_log_dom = -1;
|
2009-10-09 22:28:43 -07:00
|
|
|
static int _ecore_imf_init_count = 0;
|
2013-04-13 01:01:56 -07:00
|
|
|
extern Ecore_IMF_Context *show_req_ctx;
|
2007-11-19 10:27:11 -08:00
|
|
|
|
|
|
|
EAPI int
|
|
|
|
ecore_imf_init(void)
|
|
|
|
{
|
2010-06-03 21:53:10 -07:00
|
|
|
if (++_ecore_imf_init_count != 1) return _ecore_imf_init_count;
|
2011-04-11 04:31:55 -07:00
|
|
|
|
2010-06-03 21:53:10 -07:00
|
|
|
if (!ecore_init()) return --_ecore_imf_init_count;
|
2010-10-07 15:31:46 -07:00
|
|
|
_ecore_imf_log_dom = eina_log_domain_register
|
2011-04-11 04:31:55 -07:00
|
|
|
("ecore_imf", ECORE_IMF_DEFAULT_LOG_COLOR);
|
2010-10-07 15:31:46 -07:00
|
|
|
if (_ecore_imf_log_dom < 0)
|
2009-12-21 09:32:19 -08:00
|
|
|
{
|
2010-06-03 21:45:53 -07:00
|
|
|
EINA_LOG_ERR("Impossible to create a log domain for the Ecore IMF module.");
|
|
|
|
ecore_shutdown();
|
|
|
|
return --_ecore_imf_init_count;
|
2009-12-21 09:32:19 -08:00
|
|
|
}
|
2007-11-19 10:27:11 -08:00
|
|
|
ecore_imf_module_init();
|
2011-04-11 04:31:55 -07:00
|
|
|
|
2007-11-19 10:27:11 -08:00
|
|
|
ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new();
|
|
|
|
ECORE_IMF_EVENT_PREEDIT_END = ecore_event_type_new();
|
|
|
|
ECORE_IMF_EVENT_PREEDIT_CHANGED = ecore_event_type_new();
|
|
|
|
ECORE_IMF_EVENT_COMMIT = ecore_event_type_new();
|
2007-12-12 11:00:48 -08:00
|
|
|
ECORE_IMF_EVENT_DELETE_SURROUNDING = ecore_event_type_new();
|
2007-11-19 10:27:11 -08:00
|
|
|
|
2009-10-09 22:28:43 -07:00
|
|
|
return _ecore_imf_init_count;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
ecore_imf_shutdown(void)
|
|
|
|
{
|
2010-06-03 21:53:10 -07:00
|
|
|
if (--_ecore_imf_init_count != 0) return _ecore_imf_init_count;
|
2007-11-19 10:27:11 -08:00
|
|
|
ecore_imf_module_shutdown();
|
2009-12-21 09:32:19 -08:00
|
|
|
eina_log_domain_unregister(_ecore_imf_log_dom);
|
|
|
|
_ecore_imf_log_dom = -1;
|
2010-06-03 21:53:10 -07:00
|
|
|
ecore_shutdown();
|
2009-10-09 22:28:43 -07:00
|
|
|
return _ecore_imf_init_count;
|
2007-11-19 10:27:11 -08:00
|
|
|
}
|
2013-04-13 01:01:56 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
ecore_imf_input_panel_hide(void)
|
|
|
|
{
|
|
|
|
if (show_req_ctx)
|
|
|
|
{
|
|
|
|
if (ecore_imf_context_input_panel_state_get(show_req_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE)
|
|
|
|
{
|
|
|
|
ecore_imf_context_input_panel_hide(show_req_ctx);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|