Use angle information in IseContext 90/247290/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 28 Apr 2020 12:41:02 +0000 (21:41 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Mon, 9 Nov 2020 03:07:27 +0000 (12:07 +0900)
Change-Id: I2ddaaf1ff1e73f4d3b7c46e8f670f2e58c1920a3

src/sclconnection-isf.cpp
src/sclcoreui-efl.cpp
src/sclcoreui.cpp
src/sclcoreui.h

index e533359..05fecf2 100644 (file)
@@ -187,9 +187,10 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz
             }
             CSCLCoreUI* ui = impl->get_core_ui();
             if (ui) {
+                ui->set_screen_rotation_degree(ise_context.angle);
                 ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_WILL_SHOW);
             }
-            callback->on_ise_show(ic, impl->get_screen_rotation_degree(), ise_context);
+            callback->on_ise_show(ic, ise_context.angle, ise_context);
             if (ui) {
                 SclSize portrait;
                 SclSize landscape;
@@ -199,8 +200,9 @@ static void slot_ise_show(const scim::HelperAgent *agent, int ic, char *buf, siz
                 */
                 ui->update_keyboard_geometry(portrait, landscape);
                 ui->process_keyboard_ui_state_change(KEYBOARD_UI_STATE_DID_SHOW);
-            } else
+            } else {
                 LOGW("Failed to get core UI");
+            }
 
 #ifdef WEBSOCKET
             g_websocket.on_set_layout(ise_context.layout);
index d6da8dd..3bb22a3 100644 (file)
@@ -167,7 +167,8 @@ void CSCLCoreUIEFL::update_keyboard_geometry(SclSize portrait, SclSize landscape
     Evas_Object *main_window = NATIVE_WINDOW_CAST(m_main_window);
     Evas_Coord win_w = 0, win_h = 0;
     elm_win_screen_size_get(main_window, NULL, NULL, &win_w, &win_h);
-    int degree = elm_win_rotation_get(main_window);
+    int degree = m_rotation_degree;
+    LOGD("rotation : %d", degree);
     char geometry[128];
 
     snprintf(geometry, sizeof(geometry), "%d,%d,%d,%d", (win_w - portrait.width) / 2, win_h - portrait.height, portrait.width, portrait.height);
@@ -237,21 +238,12 @@ static void accessibility_changed_cb(keynode_t *key, void* data)
 static void win_rotation_changed_cb(void *data, Evas_Object *obj, void *event)
 {
     int degree = elm_win_rotation_get(obj);
-    LOGD("rotation angle : %d\n", degree);
-
-    ISCLCoreEventCallback *callback = NULL;
-    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
-    if (impl) {
-        callback = impl->get_core_event_callback();
-    }
+    LOGD("elm_win_rotation_get angle : %d\n", degree);
 
     CSCLCoreUIEFL *coreui = static_cast<CSCLCoreUIEFL*>(data);
     if (coreui) {
         coreui->set_screen_rotation_degree(degree);
     }
-    if (callback) {
-        callback->on_set_rotation_degree(degree);
-    }
 }
 #else
 static Eina_Bool _client_message_cb(void *data, int type, void *event)
@@ -313,7 +305,11 @@ int CSCLCoreUIEFL::get_screen_rotation_degree()
     int angle = 0;
 
 #ifdef WAYLAND
-    angle = elm_win_rotation_get(NATIVE_WINDOW_CAST(m_main_window));
+    if (m_rotation_degree == -1) {
+        m_rotation_degree = elm_win_rotation_get(NATIVE_WINDOW_CAST(m_main_window));
+    }
+    LOGD("m_rotation_degree : %d", m_rotation_degree);
+    angle = m_rotation_degree;
 #else
     if (m_rotation_degree == -1) {
         int  ret = 0;
@@ -504,7 +500,7 @@ sclboolean CSCLCoreUIEFL::create_main_window()
 
     vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, accessibility_changed_cb, NULL);
 
-    evas_object_smart_callback_add(main_window, "wm,rotation,changed", win_rotation_changed_cb, NULL);
+    evas_object_smart_callback_add(main_window, "wm,rotation,changed", win_rotation_changed_cb, this);
     evas_object_show(main_window);
 #else
     Ecore_Event_Handler *XClientMsgHandler =
@@ -840,6 +836,17 @@ void CSCLCoreUIEFL::destroy_option_window(sclwindow window)
 void CSCLCoreUIEFL::set_screen_rotation_degree(int degree)
 {
     m_rotation_degree = degree;
+
+    ISCLCoreEventCallback *callback = NULL;
+    CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
+    if (impl) {
+        callback = impl->get_core_event_callback();
+    }
+    if (callback) {
+        callback->on_set_rotation_degree(degree);
+    }
+
+    LOGD("rotation value set : %d", degree);
 }
 
 #ifdef WAYLAND
index 3bebc7f..e688166 100644 (file)
@@ -92,6 +92,13 @@ sclwindow CSCLCoreUI::get_main_window()
     return ret;
 }
 
+void CSCLCoreUI::set_screen_rotation_degree(int degree)
+{
+    if (m_impl) {
+        m_impl->set_screen_rotation_degree(degree);
+    }
+}
+
 int CSCLCoreUI::get_screen_rotation_degree()
 {
     int ret = 0;
@@ -159,4 +166,4 @@ void CSCLCoreUI::get_keyboard_size(SclSize *portrait, SclSize *landscape)
     if (m_impl) {
         m_impl->get_keyboard_size(portrait, landscape);
     }
-}
\ No newline at end of file
+}
index 2fa9f58..724c7e1 100644 (file)
@@ -67,6 +67,11 @@ public:
     virtual sclwindow get_main_window();
 
     /**
+     * @brief This API sets the rotation angle of the current screen
+     */
+    virtual void set_screen_rotation_degree(int degree);
+
+    /**
      * @brief This API returns the rotation angle of the current screen
      */
     virtual int get_screen_rotation_degree();