isf_control_get_recent_ime_geometry () returns wrong value when it is called in rotation callback
due to the wrong window rotation angle of window property.
Change-Id: I71808a4e7aa246f49a242e0841ea2f8f53070c4d
static Ecore_IMF_Context *imf_context = NULL;
static Elm_Genlist_Item_Class itci;
+static Evas_Object *win = NULL;
static void test_input_panel_geometry_get (void *data, Evas_Object *obj, void *event_info);
static void test_input_panel_show (void *data, Evas_Object *obj, void *event_info);
{
int x, y, w, h;
if (isf_control_get_recent_ime_geometry (&x, &y, &w, &h) == 0) {
- LOGD ("x=%d, y=%d, width=%d, height=%d\n", x, y, w, h);
+ LOGD ("x : %d, y : %d, width : %d, height : %d\n", x, y, w, h);
}
else {
LOGW ("Failed to get recent ime geometry\n");
}
+
+ int angle = elm_win_rotation_get (win);
+
+ if (isf_control_get_recent_ime_geometry_with_rotation_angle (angle, &x, &y, &w, &h) == 0) {
+ LOGD ("angle : %d, x : %d, y : %d, width : %d, height : %d\n", angle, x, y, w, h);
+ }
+ else {
+ LOGW ("Failed to get recent ime geometry with rotation angle\n");
+ }
}
static char *gli_label_get (void *data, Evas_Object *obj, const char *part)
return strdup (imcontrol_menu_its[j].name);
}
-static void test_api (void *data, Evas_Object *obj, void *event_info)
+static void _selected_cb (void *data, Evas_Object *obj, void *event_info)
{
int j = (int)(reinterpret_cast<long>(data));
Elm_Object_Item *it = (Elm_Object_Item *)event_info;
while (imcontrol_menu_its[i].name != NULL) {
elm_genlist_item_append (gl, &itci,
- (void *)i/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, test_api/* func */,
- (void *)i/* func data */);
+ (void *)i/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, _selected_cb /* func */,
+ (void *)i /* func data */);
i++;
}
return gl;
}
+static void
+win_rotation_changed_cb (void *data, Evas_Object *obj, void *event_info)
+{
+ struct appdata *ad = (struct appdata *)data;
+ int x, y, w, h;
+ if (ad == NULL || ad->win_main == NULL)
+ return;
+
+ int angle = elm_win_rotation_get (ad->win_main);
+
+ LOGD ("rotate. angle : %d\n", angle);
+
+ if (isf_control_get_recent_ime_geometry (&x, &y, &w, &h) == 0) {
+ LOGD ("x : %d, y : %d, width : %d, height : %d\n", x, y, w, h);
+ }
+ else {
+ LOGW ("Failed to get recent ime geometry\n");
+ }
+
+ if (isf_control_get_recent_ime_geometry_with_rotation_angle (angle, &x, &y, &w, &h) == 0) {
+ LOGD ("angle : %d, x : %d, y : %d, width : %d, height : %d\n", angle, x, y, w, h);
+ }
+ else {
+ LOGW ("Failed to get recent ime geometry with rotation angle\n");
+ }
+}
+
void imcontrolapi_bt (void *data, Evas_Object *obj, void *event_info)
{
ecore_imf_init ();
gl = _create_imcontrolapi_list (ad->naviframe);
+ win = ad->win_main;
+
Evas_Object *back_btn = create_naviframe_back_button (ad);
Elm_Object_Item *navi_it = elm_naviframe_item_push (ad->naviframe, _("IM Control"), back_btn, NULL, gl, NULL);
elm_naviframe_item_pop_cb_set (navi_it, _nf_back_event_cb, ad);
+
+ evas_object_smart_callback_add (ad->win_main, "rotation,changed", win_rotation_changed_cb, ad);
+ evas_object_smart_callback_add (ad->win_main, "wm,rotation,changed", win_rotation_changed_cb, ad);
}
/*
static bool slot_get_ise_info (const String &uuid, ISE_INFO &info);
static void slot_get_candidate_geometry (struct rectinfo &info);
static void slot_get_input_panel_geometry (struct rectinfo &info);
-static void slot_get_recent_ise_geometry (struct rectinfo &info);
+static void slot_get_recent_ise_geometry (int angle, struct rectinfo &info);
static void slot_set_keyboard_ise (const String &uuid);
static void slot_get_keyboard_ise (String &ise_name, String &ise_uuid);
static void slot_accept_connection (int fd);
/**
* @brief Get the recent input panel geometry slot function for PanelAgent.
*
+ * @param angle the rotation angle of application window.
* @param info The data is used to store input panel position and size.
*/
-static void slot_get_recent_ise_geometry (struct rectinfo &info)
+static void slot_get_recent_ise_geometry (int angle, struct rectinfo &info)
{
LOGD ("slot_get_recent_ise_geometry\n");
/* If we have geometry reported by ISE, use the geometry information */
- int angle = efl_get_app_window_angle ();
+ if (angle < 0) {
+ angle = efl_get_app_window_angle ();
+ }
+
if (angle == 0 || angle == 180) {
if (_portrait_recent_ise_geometry.valid) {
info = _portrait_recent_ise_geometry.geometry;
EXAPI int isf_control_get_recent_ime_geometry (int *x, int *y, int *w, int *h)
{
+ return isf_control_get_recent_ime_geometry_with_rotation_angle (-1, x, y, w, h);
+}
+
+EXAPI int isf_control_get_recent_ime_geometry_with_rotation_angle (int angle, int * x,int * y,int * w,int * h)
+{
int ime_x = -1, ime_y = -1, ime_w = -1, ime_h = -1;
IMControlClient imcontrol_client;
int ret = 0;
+ if ((angle != -1) && (angle % 90 != 0))
+ return -1;
+
if (!imcontrol_client.open_connection ())
return -1;
imcontrol_client.prepare ();
- if (!imcontrol_client.get_recent_ime_geometry (&ime_x, &ime_y, &ime_w, &ime_h))
+ if (!imcontrol_client.get_recent_ime_geometry (&ime_x, &ime_y, &ime_w, &ime_h, angle))
ret = -1;
imcontrol_client.close_connection ();
*/
EXAPI int isf_control_get_recent_ime_geometry (int *x, int *y, int *w, int *h);
+/**
+ * @brief Get the recent geometry of S/W keyboard with the rotation mode
+ *
+ * @remarks If the keyboard has never been shown, this function will return -1 since the framework can't know its size.
+ * The caller application needs to assume the default height.
+ *
+ * @param[in] angle the rotation angle of application window.
+ * @param[out] x Pointer to an integer in which to store the X coordinate of the IME that appeared recently.
+ * @param[out] y Pointer to an integer in which to store the Y coordinate of the IME that appeared recently.
+ * @param[out] w Pointer to an integer in which to store the width of the IME that appeared recently.
+ * @param[out] h Pointer to an integer in which to store the height of the IME that appeared recently.
+ *
+ * @return 0 if successfully, otherwise return -1;
+ */
+EXAPI int isf_control_get_recent_ime_geometry_with_rotation_angle (int angle, int *x, int *y, int *w, int *h);
#ifdef __cplusplus
}
#endif /* __cplusplus */
}
}
- bool get_recent_ime_geometry (int *x, int *y, int *w, int *h)
+ bool get_recent_ime_geometry (int *x, int *y, int *w, int *h, int angle)
{
int cmd;
uint32 tmp_x, tmp_y, tmp_w, tmp_h;
m_trans.put_command (ISM_TRANS_CMD_GET_RECENT_ISE_GEOMETRY);
+ m_trans.put_data (angle);
m_trans.write_to_socket (m_socket_imclient2panel);
if (!m_trans.read_from_socket (m_socket_imclient2panel, m_socket_timeout)) {
std::cerr << __func__ << " read_from_socket() may be timeout \n";
return m_impl->is_helper_ise_enabled (appid, enabled);
}
-bool IMControlClient::get_recent_ime_geometry (int *x, int *y, int *w, int *h)
+bool IMControlClient::get_recent_ime_geometry (int *x, int *y, int *w, int *h, int angle)
{
- return m_impl->get_recent_ime_geometry (x, y, w, h);
+ return m_impl->get_recent_ime_geometry (x, y, w, h, angle);
}
};
bool show_helper_ise_list (void);
bool show_helper_ise_selector (void);
bool is_helper_ise_enabled (const char* appid, int &enabled);
- bool get_recent_ime_geometry (int *x, int *y, int *w, int *h);
+ bool get_recent_ime_geometry (int *x, int *y, int *w, int *h, int angle = -1);
};
}
typedef Signal6<bool, String, String &, String &, int &, int &, String &>
PanelAgentSignalBoolString4int2;
+typedef Signal2<void, int, struct rectinfo &>
+ PanelAgentSignalIntRect;
+
enum ClientType {
UNKNOWN_CLIENT,
FRONTEND_CLIENT,
PanelAgentSignalVoid m_signal_candidate_will_hide_ack;
PanelAgentSignalInt2 m_signal_get_ise_state;
- PanelAgentSignalRect m_signal_get_recent_ise_geometry;
+ PanelAgentSignalIntRect m_signal_get_recent_ise_geometry;
public:
PanelAgentImpl ()
: m_should_exit (false),
{
SCIM_DEBUG_MAIN(4) << __func__ << "\n";
- struct rectinfo info = {0, 0, 0, 0};
- m_signal_get_recent_ise_geometry (info);
+ uint32 angle;
Transaction trans;
Socket client_socket (client_id);
trans.clear ();
trans.put_command (SCIM_TRANS_CMD_REPLY);
- trans.put_command (SCIM_TRANS_CMD_OK);
- trans.put_data (info.pos_x);
- trans.put_data (info.pos_y);
- trans.put_data (info.width);
- trans.put_data (info.height);
+
+ if (m_recv_trans.get_data (angle)) {
+ struct rectinfo info = {0, 0, 0, 0};
+ m_signal_get_recent_ise_geometry (angle, info);
+
+ trans.put_command (SCIM_TRANS_CMD_OK);
+ trans.put_data (info.pos_x);
+ trans.put_data (info.pos_y);
+ trans.put_data (info.width);
+ trans.put_data (info.height);
+ }
+ else {
+ trans.put_command (SCIM_TRANS_CMD_FAIL);
+ }
+
trans.write_to_socket (client_socket);
}
return m_signal_will_hide_ack.connect (slot);
}
- Connection signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot)
+ Connection signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot)
{
return m_signal_set_keyboard_mode.connect (slot);
}
return m_signal_get_ise_state.connect (slot);
}
- Connection signal_connect_get_recent_ise_geometry (PanelAgentSlotRect *slot)
+ Connection signal_connect_get_recent_ise_geometry (PanelAgentSlotIntRect *slot)
{
return m_signal_get_recent_ise_geometry.connect (slot);
}
}
Connection
-PanelAgent::signal_connect_set_active_ise_by_uuid (PanelAgentSlotStringBool *slot)
+PanelAgent::signal_connect_set_active_ise_by_uuid (PanelAgentSlotStringBool *slot)
{
return m_impl->signal_connect_set_active_ise_by_uuid (slot);
}
}
Connection
-PanelAgent::signal_connect_get_all_helper_ise_info (PanelAgentSlotBoolHelperInfo *slot)
+PanelAgent::signal_connect_get_all_helper_ise_info (PanelAgentSlotBoolHelperInfo *slot)
{
return m_impl->signal_connect_get_all_helper_ise_info (slot);
}
Connection
-PanelAgent::signal_connect_set_has_option_helper_ise_info (PanelAgentSlotStringBool *slot)
+PanelAgent::signal_connect_set_has_option_helper_ise_info (PanelAgentSlotStringBool *slot)
{
return m_impl->signal_connect_set_has_option_helper_ise_info (slot);
}
Connection
-PanelAgent::signal_connect_set_enable_helper_ise_info (PanelAgentSlotStringBool *slot)
+PanelAgent::signal_connect_set_enable_helper_ise_info (PanelAgentSlotStringBool *slot)
{
return m_impl->signal_connect_set_enable_helper_ise_info (slot);
}
}
Connection
-PanelAgent::signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot)
+PanelAgent::signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot)
{
return m_impl->signal_connect_set_keyboard_mode (slot);
}
}
Connection
-PanelAgent::signal_connect_get_recent_ise_geometry (PanelAgentSlotRect *slot)
+PanelAgent::signal_connect_get_recent_ise_geometry (PanelAgentSlotIntRect *slot)
{
return m_impl->signal_connect_get_recent_ise_geometry (slot);
}
typedef Slot6<bool, String, String &, String &, int &, int &, String &>
PanelAgentSlotBoolString4int2;
+typedef Slot2<void, int, struct rectinfo &>
+ PanelAgentSlotIntRect;
+
typedef struct DefaultIse
{
TOOLBAR_MODE_T type;
*
* slot prototype: void set_keyboard_mode (void);
*/
- Connection signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot);
+ Connection signal_connect_set_keyboard_mode (PanelAgentSlotInt *slot);
/**
* @brief Signal: Notifies the client finished handling WILL_HIDE event for candidate
/**
* @brief Signal: Get the recent input panel geometry information.
*
- * slot prototype: void get_recent_ise_geometry (rectinfo &info);
+ * slot prototype: void get_recent_ise_geometry (int angle, rectinfo &info);
*/
- Connection signal_connect_get_recent_ise_geometry (PanelAgentSlotRect *slot);
+ Connection signal_connect_get_recent_ise_geometry (PanelAgentSlotIntRect *slot);
};
/** @} */