static Eina_Bool autocap_allow = EINA_FALSE;
static Eina_Bool desktop_mode = EINA_FALSE;
+static bool _x_key_event_is_valid = false;
+
static Display *__current_display = 0;
static int __current_alt_mask = Mod1Mask;
static int __current_meta_mask = 0;
_panel_client.send ();
_focused_ic = 0;
}
+ _x_key_event_is_valid = false;
}
/**
if (ic == NULL || ic->impl == NULL)
return ret;
+ if (type == ECORE_IMF_EVENT_KEY_DOWN || type == ECORE_IMF_EVENT_KEY_UP) {
+ if (hw_keyboard_num_get () == 0 && !_x_key_event_is_valid) {
+ std::cerr << " Hardware keyboard is not connected and key event is not valid!!!\n";
+ return EINA_TRUE;
+ }
+ }
+
KeyEvent key;
unsigned int timestamp;
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
if (!(ic && ic->impl))
return;
+ if (_focused_ic != ic)
+ return;
+
KeyEvent _key = key;
if (key.is_key_press () &&
ecore_imf_context_input_panel_layout_get (ic->ctx) == ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL) {
EcoreIMFContextISF *ic = find_ic (context);
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
+ if (!(ic && ic->impl))
+ return;
+ if (_focused_ic != ic)
+ return;
+
if (strlen (key.get_key_string ().c_str ()) >= 116)
return;
XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
}
}
+ _x_key_event_is_valid = true;
}
static void
uint32 magic;
uint32 magic_active;
int timeout;
+ uint32 focused_ic;
HelperAgentSignalVoid signal_exit;
HelperAgentSignalVoid signal_attach_input_context;
HelperAgentSignalInt signal_longpress_candidate;
public:
- HelperAgentImpl () : magic (0), magic_active (0), timeout (-1) { }
+ HelperAgentImpl () : magic (0), magic_active (0), timeout (-1), focused_ic ((uint32) -1) { }
};
HelperAgent::HelperAgent ()
case SCIM_TRANS_CMD_FOCUS_OUT:
{
m_impl->signal_focus_out (this, ic, ic_uuid);
+ m_impl->focused_ic = (uint32) -1;
break;
}
case SCIM_TRANS_CMD_FOCUS_IN:
{
m_impl->signal_focus_in (this, ic, ic_uuid);
+ m_impl->focused_ic = ic;
break;
}
case ISM_TRANS_CMD_SHOW_ISE_PANEL:
m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
m_impl->send.put_data (m_impl->magic_active);
m_impl->send.put_command (SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT);
- m_impl->send.put_data ((uint32)ic);
+ if (ic == -1) {
+ m_impl->send.put_data (m_impl->focused_ic);
+ } else {
+ m_impl->send.put_data ((uint32)ic);
+ }
m_impl->send.put_data (ic_uuid);
m_impl->send.put_data (key);
m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
m_impl->send.put_data (m_impl->magic_active);
m_impl->send.put_command (SCIM_TRANS_CMD_FORWARD_KEY_EVENT);
- m_impl->send.put_data ((uint32)ic);
+ if (ic == -1) {
+ m_impl->send.put_data (m_impl->focused_ic);
+ } else {
+ m_impl->send.put_data ((uint32)ic);
+ }
m_impl->send.put_data (ic_uuid);
m_impl->send.put_data (key);
m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
m_impl->send.put_data (m_impl->magic_active);
m_impl->send.put_command (SCIM_TRANS_CMD_COMMIT_STRING);
- m_impl->send.put_data ((uint32)ic);
+ if (ic == -1) {
+ m_impl->send.put_data (m_impl->focused_ic);
+ } else {
+ m_impl->send.put_data ((uint32)ic);
+ }
m_impl->send.put_data (ic_uuid);
m_impl->send.put_data (wstr);
m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);