#include "e_mod_main.h"
#include <text-server-protocol.h>
#include <input-method-server-protocol.h>
+#include <vconf.h>
+#include <vconf-keys.h>
#include "Eeze.h"
static Eina_Bool _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type, void *event);
static E_Input_Method *g_input_method = NULL;
static E_Text_Input *g_text_input = NULL;
+static struct wl_client *g_client = NULL;
static Eina_List *shutdown_list = NULL;
static Eina_Bool g_disable_show_panel = EINA_FALSE;
static Eeze_Udev_Watch *eeze_udev_watch_hander = NULL;
static Eina_List *handlers = NULL;
static uint32_t g_text_input_count = 1;
+static void _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method);
+static Eina_Bool _e_text_input_method_create_context(struct wl_client *client, E_Input_Method *input_method, E_Text_Input *text_input);
+
+static void
+_input_panel_hide(struct wl_client *client, struct wl_resource *resource)
+{
+ E_Text_Input *text_input = wl_resource_get_user_data(resource);
+ E_Input_Method *input_method = NULL;
+ Eina_Bool _context_created = EINA_FALSE;
+
+ if (!text_input)
+ {
+ wl_resource_post_error(resource,
+ WL_DISPLAY_ERROR_INVALID_OBJECT,
+ "No Text Input For Resource");
+ return;
+ }
+
+ text_input->input_panel_visibile = EINA_FALSE;
+
+ if (text_input->resource)
+ wl_text_input_send_input_panel_state(text_input->resource,
+ WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE);
+
+ e_input_panel_visibility_change(EINA_FALSE);
+
+ if (g_input_method && g_input_method->resource)
+ input_method = wl_resource_get_user_data(g_input_method->resource);
+
+ /*
+ If input_method->context is already deleted, create context struct again to send input_panel_hide event to Input Method(IME) correctly.
+ Because input_panel_hide event can be called after focus_out(deactivate) by application.
+ And Input Method(IME) should know the state of their own input_panel to manage their resource when the input_panel is hidden.
+ */
+ if (input_method && (!input_method->context || !input_method->context->resource))
+ _context_created = _e_text_input_method_create_context(client, input_method, text_input);
+
+ if (input_method && input_method->resource && input_method->context && input_method->context->resource)
+ wl_input_method_send_hide_input_panel(input_method->resource, input_method->context->resource);
+
+ if (_context_created)
+ _e_text_input_deactivate(text_input, input_method);
+}
+
+static void
+_keyboard_mode_changed_cb(keynode_t *key, void* data)
+{
+ int val = 0;
+ if (vconf_get_bool(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, &val) == 0 && val == 0)
+ g_disable_show_panel = EINA_FALSE;
+}
+
static void
_e_text_input_method_context_keyboard_grab_keyboard_state_update(E_Input_Method_Context *context, uint32_t keycode, Eina_Bool pressed)
{
"No Input Method Context For Resource");
return;
}
+
keyboard = wl_resource_create(client, &wl_keyboard_interface, 1, id);
if (!keyboard)
{
}
else
return EINA_TRUE;
- }
+}
static Eina_Bool
_e_mod_ecore_key_down_cb(void *data, int type, void *event)
is_number_key(ev->string))
return ECORE_CALLBACK_PASS_ON;
+ if (g_text_input && g_text_input->resource && g_client)
+ _input_panel_hide(g_client, g_text_input->resource);
+
g_disable_show_panel = EINA_TRUE;
- e_input_panel_visibility_change(EINA_FALSE);
return ECORE_CALLBACK_PASS_ON;
}
wl_input_method_send_deactivate(input_method->resource,
input_method->context->resource);
}
+
if (ecore_key_down_handler)
{
ecore_event_handler_del(ecore_key_down_handler);
text_input = wl_resource_get_user_data(resource);
g_text_input = text_input;
+ g_client = client;
/* FIXME: should get input_method object from seat. */
input_method = wl_resource_get_user_data(g_input_method->resource);
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Comp Data For Seat");
}
+
static void
_e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat)
{
g_text_input = NULL;
+ g_client = NULL;
E_Text_Input *text_input = wl_resource_get_user_data(resource);
E_Input_Method *input_method = NULL;
}
static Eina_Bool
-_e_text_input_method_create_context(struct wl_client *client EINA_UNUSED, E_Input_Method *input_method, E_Text_Input *text_input)
+_e_text_input_method_create_context(struct wl_client *client, E_Input_Method *input_method, E_Text_Input *text_input)
{
E_Input_Method_Context *context = NULL;
EINA_SAFETY_ON_NULL_RETURN_VAL(text_input, EINA_FALSE);
g_text_input = text_input;
+ g_client = client;
input_method->model = text_input;
text_input->input_methods = eina_list_append(text_input->input_methods, input_method);
}
static void
-_e_text_input_cb_input_panel_show(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
+_e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource *resource)
{
E_Text_Input *text_input = wl_resource_get_user_data(resource);
E_Input_Method *input_method = NULL;
}
static void
-_e_text_input_cb_input_panel_hide(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
+_e_text_input_cb_input_panel_hide(struct wl_client *client, struct wl_resource *resource)
{
- E_Text_Input *text_input = wl_resource_get_user_data(resource);
- E_Input_Method *input_method = NULL;
- Eina_Bool _context_created = EINA_FALSE;
-
- if (!text_input)
- {
- wl_resource_post_error(resource,
- WL_DISPLAY_ERROR_INVALID_OBJECT,
- "No Text Input For Resource");
- return;
- }
-
- text_input->input_panel_visibile = EINA_FALSE;
-
- if (text_input->resource)
- wl_text_input_send_input_panel_state(text_input->resource,
- WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE);
-
- e_input_panel_visibility_change(EINA_FALSE);
-
- if (g_input_method && g_input_method->resource)
- input_method = wl_resource_get_user_data(g_input_method->resource);
-
- /*
- If input_method->context is already deleted, create context struct again to send input_panel_hide event to Input Method(IME) correctly.
- Because input_panel_hide event can be called after focus_out(deactivate) by application.
- And Input Method(IME) should know the state of their own input_panel to manage their resource when the input_panel is hidden.
- */
- if (input_method && (!input_method->context || !input_method->context->resource))
- _context_created = _e_text_input_method_create_context(client, input_method, text_input);
-
- if (input_method && input_method->resource && input_method->context && input_method->context->resource)
- wl_input_method_send_hide_input_panel(input_method->resource, input_method->context->resource);
-
- if (_context_created)
- _e_text_input_deactivate(text_input, input_method);
+ _input_panel_hide(client, resource);
}
static void
E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_RESIZE, _e_text_input_method_context_cb_client_resize, NULL);
+ vconf_notify_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb, NULL);
+
eeze_udev_watch_hander = eeze_udev_watch_add(EEZE_UDEV_TYPE_KEYBOARD,
EEZE_UDEV_EVENT_REMOVE,
_e_mod_eeze_udev_watch_cb,
{
E_FREE_LIST(handlers, ecore_event_handler_del);
+ vconf_ignore_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb);
+
if (eeze_udev_watch_hander)
{
eeze_udev_watch_del(eeze_udev_watch_hander);