{
String ime_setting_app = isf_pkg_get_setting_app (ime_appid);
- LOGD ("IME appid : %s, IME setting app id : %s", ime_appid.c_str (), ime_setting_app.c_str ());
+ LOGD ("IME appid(%s), IME setting app id(%s)", ime_appid.c_str (), ime_setting_app.c_str ());
if (ime_setting_app.length () > 0) {
app_control_launch (ime_setting_app.c_str ());
m_send_trans.write_to_socket(client_socket);
}
- void show_helper_option_window(int client, uint32 context, const String& uuid) {
+ void show_helper_option_window(int client, uint32 context, const String& uuid, uint32 caller_pid, uint32 ime_pid) {
LOGD ("client id:%d", client);
Socket client_socket(client);
continue;
} else if (cmd == ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW) {
- m_info_manager->show_ise_option_window(client_id);
+ uint32 caller_pid = 0;
+ if (!m_recv_trans.get_data(caller_pid)) {
+ LOGW ("Failed to get pid");
+ }
+
+ LOGI ("caller PID : %u", caller_pid);
+ m_info_manager->show_ise_option_window(client_id, caller_pid);
continue;
} else if (cmd == ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW) {
m_info_manager->resume_ise_option_window(client_id);
send_fail_reply (client_id);
}
} else if (cmd == ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW) {
+ uint32 caller_pid = 0;
+ if (!m_recv_trans.get_data(caller_pid)) {
+ LOGW ("Failed to get pid");
+ }
+
+ LOGI ("caller PID : %u", caller_pid);
if (m_info_manager->check_privilege_by_sockfd(client_id, IMEMANAGER_PRIVILEGE)) {
- m_info_manager->show_ise_option_window(client_id);
+ m_info_manager->show_ise_option_window(client_id, caller_pid);
}
else {
LOGW ("Access denied to show ise option window");
}
};
+static struct wl_input_method_manager *_im_manager = NULL;
+
/* private functions */
static void panel_slot_update_preedit_caret (int context,
static bool
_wsc_setup (struct weescim *wsc)
{
- Eina_Iterator *globals;
- struct wl_registry *registry;
- Ecore_Wl2_Global *global;
+ Eina_Iterator *globals = NULL;
+ struct wl_registry *registry = NULL;
+ Ecore_Wl2_Global *global = NULL;
if (!wsc) return false;
EINA_ITERATOR_FOREACH(globals, global) {
if (strcmp (global->interface, "wl_input_method") == 0)
wsc->im = (wl_input_method*)wl_registry_bind (registry, global->id, &wl_input_method_interface, 1);
+ else if (strcmp (global->interface, "wl_input_method_manager") == 0)
+ _im_manager = (wl_input_method_manager*)wl_registry_bind (registry, global->id, &wl_input_method_manager_interface, 1);
}
eina_iterator_free (globals);
wl_input_method_context_reshow_input_panel (ic->im_ctx);
}
+
+ void set_transient_for (uint32 caller_pid, uint32 ime_pid)
+ {
+ LOGI ("caller pid : %u, ime pid : %u", caller_pid, ime_pid);
+
+ if (_im_manager)
+ wl_input_method_manager_set_transient_for (_im_manager, caller_pid, ime_pid);
+ else
+ LOGW ("Failed to get input method manager interface");
+ }
};
extern "C" {
return -1;
imcontrol_client.prepare ();
- if (imcontrol_client.get_ise_setting_appid (ime_setting_appid)) {
- if (app_control_launch (ime_setting_appid.c_str(), APP_CONTROL_LAUNCH_MODE_GROUP)) {
- LOGI("Succeeded to launch IME setting app : %s", ime_setting_appid.c_str());
+ imcontrol_client.get_ise_setting_appid (ime_setting_appid);
+
+ if (!ime_setting_appid.empty ()) {
+ if (app_control_launch (ime_setting_appid.c_str (), APP_CONTROL_LAUNCH_MODE_GROUP)) {
+ LOGI("Succeeded to launch IME setting app : %s", ime_setting_appid.c_str ());
}
else {
- LOGE("Failed to launch IME setting app : %s", ime_setting_appid.c_str());
+ LOGE("Failed to launch IME setting app : %s", ime_setting_appid.c_str ());
ret = -1;
}
}
else {
- LOGD("No setting app ID");
+ LOGD("No setting app ID. Request to show option window in IME");
+ imcontrol_client.prepare ();
imcontrol_client.show_ise_option_window ();
- }
- if (!imcontrol_client.send ())
- ret = -1;
+ if (!imcontrol_client.send ()) {
+ LOGW("Failed to send show ise_option_window");
+ ret = -1;
+ }
+ }
imcontrol_client.close_connection ();
#define Uses_SCIM_HELPER_MODULE
#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include "scim.h"
#define MINIMUM_TIMEOUT 100
void show_ise_option_window (void) {
m_trans.put_command (ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW);
+ m_trans.put_data (getpid());
}
bool get_ise_setting_appid (String &ime_setting_appid) {
#include <sys/times.h>
#include <dlog.h>
#include <unistd.h>
+#include <sys/socket.h>
#include "scim_private.h"
#include "scim.h"
#include "scim_stl_map.h"
return false;
}
- bool show_helper_option_window (const String& uuid) {
+ int get_client_pid(int client_id)
+ {
+ Socket client_socket(client_id);
+
+ int sockfd = client_socket.get_id();
+ struct ucred ucred;
+ socklen_t len = sizeof(struct ucred);
+ if (getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == 0) {
+ LOGI("client pid : %u", ucred.pid);
+ }
+ else {
+ LOGW("Failed to get socket infomation");
+ return 0;
+ }
+
+ return ucred.pid;
+ }
+
+ bool show_helper_option_window (const String& uuid, int caller_pid) {
HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
if (it != m_helper_client_index.end ()) {
if (!m_signal_launch_option_application (uuid)) {
LOGD ("call show helper option");
- m_panel_agent_manager.show_helper_option_window (it->second.id, ctx, uuid);
+ int ime_pid = get_client_pid(it->second.id);
+ LOGD ("parent : %d, client : %d", caller_pid, ime_pid);
+ m_panel_agent_manager.show_helper_option_window (it->second.id, ctx, uuid, caller_pid, ime_pid);
+ m_panel_agent_manager.set_transient_for (caller_pid, ime_pid);
}
return true;
option = get_current_helper_option ();
}
//ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
- void show_ise_option_window (int client_id) {
+ void show_ise_option_window (int client_id, int caller_pid) {
SCIM_DEBUG_MAIN (4) << "InfoManager::show_ise_option_window ()\n";
String initial_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_INITIAL_ISE_UUID), String (""));
String default_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), String (""));
LOGD ("prepare to show ISE option window %d [%s] [%s]", client_id, initial_uuid.c_str (), default_uuid.c_str ());
if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
- show_helper_option_window (m_current_helper_uuid);
+ show_helper_option_window (m_current_helper_uuid, caller_pid);
}
}
}
//ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
-void InfoManager::show_ise_option_window (int client_id)
+void InfoManager::show_ise_option_window (int client_id, int caller_pid)
{
- m_impl->show_ise_option_window (client_id);
+ m_impl->show_ise_option_window (client_id, caller_pid);
}
//ISM_TRANS_CMD_GET_ISE_SETTING_APPID
void get_ise_setting_appid (int client_id, String &ime_setting_appid);
//ISM_TRANS_CMD_SHOW_ISE_OPTION_WINDOW
- void show_ise_option_window (int client_id);
+ void show_ise_option_window (int client_id, int caller_pid);
//ISM_TRANS_CMD_RESUME_ISE_OPTION_WINDOW
void resume_ise_option_window (int client_id);
{
}
-void PanelAgentBase::show_helper_option_window (int client, uint32 context, const String& uuid)
+void PanelAgentBase::show_helper_option_window (int client, uint32 context, const String& uuid, uint32 caller_pid, uint32 ime_pid)
{
}
{
}
+void PanelAgentBase::set_transient_for (uint32 caller_pid, uint32 ime_pid)
+{
+
+}
+
void PanelAgentBase::set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode)
{
}
*
* @return none.
*/
- virtual void show_helper_option_window (int client, uint32 context, const String& uuid);
+ virtual void show_helper_option_window (int client, uint32 context, const String& uuid, uint32 caller_pid, uint32 ime_pid);
/**
* @brief resume_helper_option_window.
*/
virtual void resume_helper_option_window (int client, uint32 context, const String& uuid);
+ virtual void set_transient_for (uint32 caller_pid, uint32 ime_pid);
+
/**
* @brief set_helper_keyboard_mode.
*
else
return m_socket;
}
+
+ PanelAgentPointer get_panel_wl_agent () {
+ return m_wayland;
+ }
};
PanelAgentManager::PanelAgentManager ()
_p->set_helper_caps_mode (id, context_id, uuid, mode);
}
-void PanelAgentManager::show_helper_option_window (int id, uint32 context_id, const String& uuid)
+void PanelAgentManager::show_helper_option_window (int id, uint32 context_id, const String& uuid, uint32 caller_pid, uint32 ime_pid)
{
PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
if (!_p.null ())
- _p->show_helper_option_window (id, context_id, uuid);
+ _p->show_helper_option_window (id, context_id, uuid, caller_pid, ime_pid);
}
void PanelAgentManager::resume_helper_option_window (int id, uint32 context_id, const String& uuid)
_p->resume_helper_option_window (id, context_id, uuid);
}
+void PanelAgentManager::set_transient_for (uint32 caller_pid, uint32 ime_pid)
+{
+ PanelAgentPointer _p = m_impl->get_panel_wl_agent ();
+
+ if (!_p.null ())
+ _p->set_transient_for (caller_pid, ime_pid);
+}
+
void PanelAgentManager::set_helper_keyboard_mode (int id, uint32 context_id, const String& uuid, uint32& mode)
{
PanelAgentPointer _p = m_impl->get_panel_agent_by_id (id);
*/
void trigger_property (int client, uint32 context, const String& property);
-
-
/**
* @brief Let all FrontEnds and Helpers reload configuration.
* @return true if the command was sent correctly.
void set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint);
void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
- void show_helper_option_window (int client, uint32 context, const String& uuid);
+ void show_helper_option_window (int client, uint32 context, const String& uuid, uint32 caller_pid, uint32 ime_pid);
void resume_helper_option_window (int client, uint32 context, const String& uuid);
+ void set_transient_for (uint32 caller_pid, uint32 ime_pid);
void set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode);
void set_helper_prediction_hint (int client, uint32 context, const String& uuid, String& prediction_hint);
void set_helper_prediction_hint_data (int id, uint32 context_id, const String& uuid, String& key, String& value);