#include "e.h"
#include "e_mod_main.h"
#include "e_mod_input_method_manager.h"
+#include "e_device.h"
+#include "e_input_event.h"
+
#include <text-server-protocol.h>
#include <input-method-server-protocol.h>
#include <vconf.h>
#include <stdlib.h>
#include <system_info.h>
#include <xkbcommon/xkbcommon.h>
+#include <glib.h>
#ifdef LOG_TAG
#undef LOG_TAG
static Eina_List *shutdown_list = NULL;
static Eina_Bool g_disable_show_panel = EINA_FALSE;
static Eeze_Udev_Watch *eeze_udev_watch_handler = NULL;
-static Ecore_Event_Handler *ecore_key_down_handler = NULL;
+static E_Input_Event_Filter *e_input_key_down_filter = NULL;
static Eina_List *handlers = NULL;
static uint32_t g_text_input_count = 1;
-static Ecore_Timer *g_timer_will_hide = NULL;
+static gint g_timer_will_hide = 0;
static enum _E_Input_Panel_State g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
static E_Client *client_surface_ec = NULL;
static E_Text_Input *g_show_text_input = NULL;
wl_text_input_send_input_panel_geometry(resource, x, y, w, h);
}
-static Eina_Bool
-_will_hide_timer_handler(void *data)
+static gboolean
+_will_hide_timer_handler(gpointer data)
{
INF("TIMED OUT while waiting for WILL_HIDE_ACK : %d", g_input_panel_state);
if (g_input_panel_state == E_INPUT_PANEL_STATE_WILL_HIDE)
g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
}
- g_timer_will_hide = NULL;
+ g_timer_will_hide = 0;
+
+ return FALSE;
+}
- return ECORE_CALLBACK_CANCEL;
+static void _cancel_will_hide_timer()
+{
+ if (g_timer_will_hide > 0)
+ {
+ g_source_remove(g_timer_will_hide);
+ g_timer_will_hide = 0;
+ }
}
static void
if (text_input->resource)
wl_text_input_send_private_command(text_input->resource, 0, "CONFORMANT_RESET");
- if (g_timer_will_hide)
- {
- ecore_timer_del(g_timer_will_hide);
- g_timer_will_hide = NULL;
- }
+ _cancel_will_hide_timer();
zone = e_zone_current_get();
effect_run = e_input_panel_is_effect_running();
timeout = 0.0f;
else
timeout = WILL_HIDE_TIMER_INTERVAL;
- g_timer_will_hide = ecore_timer_add(timeout, _will_hide_timer_handler, NULL);
+
+ g_timer_will_hide = g_timeout_add(timeout*1000, _will_hide_timer_handler, NULL);
}
if (g_input_method && g_input_method->resource)
if (_context_created)
_e_text_input_deactivate(text_input, input_method, EINA_FALSE);
+ ecore_thread_main_loop_begin();
e_input_panel_wait_update_set(EINA_FALSE);
+ ecore_thread_main_loop_end();
/* When the input panel surface is hidden, the candidate will hide too */
g_show_state_candidate = EINA_FALSE;
if (context->kbd.state) xkb_state_unref(context->kbd.state);
context->kbd.keymap = xkb_map_ref(e_comp_wl->xkb.keymap);
context->kbd.state = xkb_state_new(e_comp_wl->xkb.keymap);
- E_LIST_HANDLER_APPEND(context->kbd.handlers, ECORE_EVENT_KEY_DOWN,
- _e_text_input_method_context_ecore_cb_key_down,
- context);
- E_LIST_HANDLER_APPEND(context->kbd.handlers, ECORE_EVENT_KEY_UP,
- _e_text_input_method_context_ecore_cb_key_up,
- context);
+
+ E_Input_Event_Source *input_event_source = e_input_event_source_get();
+ if (input_event_source)
+ {
+ _key_down_handler = e_input_event_handler_add(input_event_source, ECORE_EVENT_KEY_DOWN, _e_text_input_method_context_ecore_cb_key_down, context);
+ _key_up_handler = e_input_event_handler_add(input_event_source, ECORE_EVENT_KEY_UP, _e_text_input_method_context_ecore_cb_key_up, context);
+ }
e_comp_grab_input(0, 1);
}
{
E_FREE_LIST(context->kbd.handlers, ecore_event_handler_del);
+ E_Input_Event_Source *input_event_source = e_input_event_source_get();
+ if (input_event_source)
+ {
+ if (_key_down_handler)
+ e_input_event_handler_del(input_event_source, _key_down_handler);
+
+ if (_key_up_handler)
+ e_input_event_handler_del(input_event_source, _key_up_handler);
+
+ _key_down_handler = NULL;
+ _key_up_handler = NULL;
+ }
+
e_comp_ungrab_input(0, 1);
if (context->kbd.keymap)
e->same_screen = 1;
e->keycode = keycode;
- ecore_event_add(state ? ECORE_EVENT_KEY_DOWN : ECORE_EVENT_KEY_UP, e, _e_keyevent_free, NULL);
+ E_Input_Event_Source *input_event_source = e_input_event_source_get();
+ if (input_event_source)
+ e_input_event_add(input_event_source, state ? ECORE_EVENT_KEY_DOWN : ECORE_EVENT_KEY_UP, e, _e_keyevent_free, NULL);
}
static void
free(context);
}
-static Eina_Bool
+static gboolean
_e_mod_ecore_key_down_cb(void *data, int type, void *event)
{
Ecore_Event_Key *ev = (Ecore_Event_Key *)event;
if (g_disable_show_panel == EINA_TRUE)
return ECORE_CALLBACK_PASS_ON;
+ E_Device *dev = (E_Device *)ev->dev;
+
/* process remote controller key exceptionally */
- if (ecore_device_class_get(ev->dev) == ECORE_DEVICE_CLASS_KEYBOARD &&
- ecore_device_subclass_get(ev->dev) == ECORE_DEVICE_SUBCLASS_REMOCON)
+ if (e_device_class_get(dev) == ECORE_DEVICE_CLASS_KEYBOARD &&
+ e_device_subclass_get(dev) == ECORE_DEVICE_SUBCLASS_REMOCON)
return ECORE_CALLBACK_PASS_ON;
/* process up/down/left/right and some keys exceptionally */
}
}
- if (ecore_key_down_handler)
+ if (e_input_key_down_filter)
{
- ecore_event_handler_del(ecore_key_down_handler);
- ecore_key_down_handler = NULL;
+ E_Input_Event_Source *input_event_source = e_input_event_source_get();
+ e_input_event_filter_del(input_event_source, e_input_key_down_filter);
+ e_input_key_down_filter = NULL;
}
LOGI("Resetting input_method->input : %p, text_input : %p, %p %p",
if (input_method->resource)
{
- if (!ecore_key_down_handler)
- ecore_key_down_handler = ecore_event_handler_prepend(ECORE_EVENT_KEY_DOWN,
- _e_mod_ecore_key_down_cb,
- NULL);
+ E_Input_Event_Source *input_event_source = e_input_event_source_get();
+ if (!e_input_key_down_filter)
+ e_input_key_down_filter = e_input_event_filter_add(input_event_source, ECORE_EVENT_KEY_DOWN, _e_mod_ecore_key_down_cb, NULL);
context = create_input_method_context(client, input_method);
EINA_SAFETY_ON_NULL_GOTO(context, err);
const char *szWillHideAck = "WILL_HIDE_ACK";
if (strncmp(data, szWillHideAck, strlen(szWillHideAck)) == 0)
{
- if (g_timer_will_hide)
- {
- ecore_timer_del(g_timer_will_hide);
- g_timer_will_hide = NULL;
- }
+ _cancel_will_hide_timer();
+
INF("WILL_HIDE_ACK_RECVED, %d", g_input_panel_state);
if (g_input_panel_state == E_INPUT_PANEL_STATE_WILL_HIDE)
{
LOGE("fail to remove surface\n");
g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE;
- if (g_timer_will_hide)
- {
- ecore_timer_del(g_timer_will_hide);
- g_timer_will_hide = NULL;
- }
+ _cancel_will_hide_timer();
+
client_surface_ec = NULL;
LOGI("TRANSIENT_FOR::Reset transient_for_ec to NULL\n");
}
E_FREE_LIST(handlers, ecore_event_handler_del);
E_FREE_LIST(hooks_ec, e_client_hook_del);
- if (g_timer_will_hide)
- {
- ecore_timer_del(g_timer_will_hide);
- g_timer_will_hide = NULL;
- }
+ _cancel_will_hide_timer();
vconf_ignore_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb);