}
static void
-_e_keyrouter_wl_key_send(Ecore_Event_Key *ev, E_Device *dev, enum wl_keyboard_key_state state, Eina_List *key_list, Eina_Bool focused, struct wl_client *client, struct wl_resource *surface)
+_e_keyrouter_wl_key_send_to_resource_list(Ecore_Event_Key *ev, E_Device *dev, enum wl_keyboard_key_state state, struct wl_client *client, struct wl_resource *surface)
{
struct wl_resource *res;
Eina_List *l;
uint32_t serial, keycode;
- struct wl_client *wc;
- E_Comp_Config *comp_conf = NULL;
E_Comp_Wl_Data *comp_wl;
keycode = (ev->keycode - 8);
comp_wl = e_comp_wl_get();
serial = wl_display_next_serial(comp_wl->wl.disp);
- comp_conf = e_comp_config_get();
-
- if (surface && !focused)
+ if (surface)
{
e_input_thread_request_boost();
e_keyrouter_wl_event_surface_send(surface, ev->keycode, TIZEN_KEYROUTER_MODE_NONE);
e_comp_wl_send_event_e_device(client, ev->timestamp, dev, serial);
}
- EINA_LIST_FOREACH(key_list, l, res)
+ g_rec_mutex_lock(&e_comp_input_key->kbd.resources_mutex);
+ EINA_LIST_FOREACH(e_comp_input_key->kbd.resources, l, res)
+ {
+ if (wl_resource_get_client(res) != client) continue;
+ TRACE_INPUT_BEGIN(_e_keyrouter_wl_key_send);
+ wl_keyboard_send_key(res, serial, ev->timestamp,
+ keycode, state);
+ TRACE_INPUT_END();
+ }
+ g_rec_mutex_unlock(&e_comp_input_key->kbd.resources_mutex);
+
+ if (e_config->key_input_ttrace_enable)
+ {
+ TRACE_INPUT_END();
+ ELOGF("INPUT", "wl_keyboard_send_key|E|", NULL);
+ }
+}
+
+static void
+_e_keyrouter_wl_key_send_to_focused_list(Ecore_Event_Key *ev, E_Device *dev, enum wl_keyboard_key_state state)
+{
+ struct wl_resource *res;
+ Eina_List *l;
+ uint32_t serial, keycode;
+ struct wl_client *wc;
+ E_Comp_Wl_Data *comp_wl;
+
+ keycode = (ev->keycode - 8);
+
+ comp_wl = e_comp_wl_get();
+ serial = wl_display_next_serial(comp_wl->wl.disp);
+
+ if (e_config->key_input_ttrace_enable)
+ {
+ TRACE_INPUT_BEGIN(wl_keyboard_send_key:%s:%s, (state ? "PRESS" : "RELEASE"), ev->keyname);
+ ELOGF("INPUT", "wl_keyboard_send_key:%s:%s|B|", NULL, (state ? "PRESS" : "RELEASE"), ev->keyname);
+ }
+
+ g_rec_mutex_lock(&e_comp_input_key->kbd.focused_mutex);
+ EINA_LIST_FOREACH(e_comp_input_key->kbd.focused, l, res)
{
wc = wl_resource_get_client(res);
- if (!focused && wc != client) continue;
+ if (!e_input_thread_mode_get())
+ {
+ e_comp_wl_send_event_device(wc, ev->timestamp, ev->dev, serial);
+ }
+ else
+ {
+ if (dev)
+ e_comp_wl_send_event_e_device(wc, ev->timestamp, dev, serial);
+ }
TRACE_INPUT_BEGIN(_e_keyrouter_wl_key_send);
- if (comp_conf && comp_conf->input_log_enable)
- INF("[Server] Routed Key %s (time: %d)\n", (state ? "Down" : "Up"), ev->timestamp);
-
wl_keyboard_send_key(res, serial, ev->timestamp,
keycode, state);
TRACE_INPUT_END();
}
+ g_rec_mutex_unlock(&e_comp_input_key->kbd.focused_mutex);
if (e_config->key_input_ttrace_enable)
{
{
E_Comp *comp;
E_Client *ec = NULL;
- struct wl_client *wc = NULL;
uint32_t keycode;
enum wl_keyboard_key_state state;
const char *seat_name = NULL;
E_Seat *seat;
E_Zone *zone = NULL;
+ E_Comp_Config *comp_conf = NULL;
if (ev->window != e_comp_ee_win_get())
{
if (pressed) state = WL_KEYBOARD_KEY_STATE_PRESSED;
else state = WL_KEYBOARD_KEY_STATE_RELEASED;
+ comp_conf = e_comp_config_get();
+ if (comp_conf && comp_conf->input_log_enable)
+ INF("[Server] Routed Key %s (time: %d)\n", (state ? "Down" : "Up"), ev->timestamp);
+
if (!focused)
{
- g_rec_mutex_lock(&e_comp_input_key->kbd.resources_mutex);
- _e_keyrouter_wl_key_send(ev, dev, state, e_comp_input_key->kbd.resources, EINA_FALSE, client, surface);
- g_rec_mutex_unlock(&e_comp_input_key->kbd.resources_mutex);
+ _e_keyrouter_wl_key_send_to_resource_list(ev, dev, state, client, surface);
return EINA_FALSE;
}
ec = e_zone_focused_client_get(zone);
ELOGF("KRT", "Key Send. seat:%s zone_id:%d", ec, seat_name, e_zone_id_get(zone));
- if (ec && ec->comp_data)
+ g_rec_mutex_lock(&e_comp_input_key->kbd.focused_mutex);
+ if (!e_comp_input_key->kbd.focused)
{
- struct wl_resource *surface = e_comp_wl_client_surface_get(ec);
- if (surface)
- {
- g_rec_mutex_lock(&e_comp_input_key->kbd.focused_mutex);
- if (e_comp_input_key->kbd.focused)
- {
- wc = wl_resource_get_client(surface);
- _e_keyrouter_wl_key_send(ev, dev, state, e_comp_input_key->kbd.focused, EINA_TRUE, wc, surface);
- }
- g_rec_mutex_unlock(&e_comp_input_key->kbd.focused_mutex);
- }
-
- /* update modifier state */
- e_comp_wl_input_keyboard_state_update(keycode, pressed);
+ g_rec_mutex_unlock(&e_comp_input_key->kbd.focused_mutex);
+ return EINA_FALSE;
}
+ g_rec_mutex_unlock(&e_comp_input_key->kbd.focused_mutex);
+ _e_keyrouter_wl_key_send_to_focused_list(ev, dev, state);
+
+ /* update modifier state */
+ e_comp_wl_input_keyboard_state_update(keycode, pressed);
}
return !!ec;
}