Fix wrong autoscroll issue in case global navigation bar exists 61/49761/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 19 Oct 2015 00:59:34 +0000 (09:59 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 20 Oct 2015 05:37:46 +0000 (14:37 +0900)
Change-Id: I751c80e04586adb95186b95305f2753e3e607241

ism/extras/efl_panel/isf_panel_efl.cpp

index 1a27878..021852c 100644 (file)
@@ -251,7 +251,9 @@ static Eina_Bool  panel_agent_handler                  (void *data, Ecore_Fd_Han
 static Eina_Bool  efl_create_control_window            (void);
 static Ecore_X_Window efl_get_app_window               (void);
 static Ecore_X_Window efl_get_quickpanel_window        (void);
+static Ecore_X_Window efl_get_global_navigation_window (void);
 #endif
+
 static void       change_keyboard_mode                 (TOOLBAR_MODE_T mode);
 static unsigned int get_ise_index                      (const String uuid);
 static bool       set_active_ise                       (const String &uuid, bool launch_ise);
@@ -916,13 +918,26 @@ static struct rectinfo get_ise_geometry ()
 
     struct rectinfo info = {0, 0, 0, 0};
 
+#if HAVE_ECOREX
+    int w = 0, h = 0;
+    Ecore_X_Window gnb_win = efl_get_global_navigation_window ();
+    if (gnb_win > 0)
+        ecore_x_window_size_get (gnb_win, &w, &h);
+#endif
+
     int win_w = _screen_width, win_h = _screen_height;
     int angle = (_ise_angle == -1) ? efl_get_app_window_angle () : _ise_angle;
 
+#if HAVE_ECOREX
+    /* The height of global navigation bar */
+    int gnb_height = h;
+
     if (angle == 90 || angle == 270) {
         win_w = _screen_height;
         win_h = _screen_width;
+        gnb_height = w;
     }
+#endif
 
     /* If we have geometry reported by ISE, use the geometry information */
     if (_ise_reported_geometry.valid && _ise_reported_geometry.angle == angle) {
@@ -958,7 +973,7 @@ static struct rectinfo get_ise_geometry ()
                 info.height = 0;
             } else {
                 if (_ise_state == WINDOW_STATE_SHOW) {
-                    info.pos_y = win_h - info.height;
+                    info.pos_y = win_h - info.height - gnb_height;
                 } else {
                     info.pos_y = (win_h > win_w) ? win_h : win_w;
                     info.width = 0;
@@ -1011,9 +1026,10 @@ static void set_keyboard_geometry_atom_info (Ecore_X_Window window, struct recti
                 ise_rect.height = _candidate_height;
             }
         } else if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
-                ise_rect.width  = _soft_candidate_width;
-                ise_rect.height = _soft_candidate_height;
+            ise_rect.width  = _soft_candidate_width;
+            ise_rect.height = _soft_candidate_height;
         }
+
         int angle = efl_get_app_window_angle ();
         if (angle == 90 || angle == 270)
             ise_rect.pos_y = _screen_width - ise_rect.height;
@@ -3707,6 +3723,39 @@ static Ecore_X_Window efl_get_clipboard_window (void)
     return clipboard_window;
 }
 
+static Ecore_X_Window efl_get_global_navigation_window (void)
+{
+    SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
+
+    /* Gets the XID of the global navigation window from the root window property */
+    int  ret = 0;
+    Atom type_return;
+    int  format_return;
+    unsigned long    nitems_return;
+    unsigned long    bytes_after_return;
+    unsigned char   *data = NULL;
+    Ecore_X_Window   gnb_window = 0;
+
+    ret = XGetWindowProperty ((Display *)ecore_x_display_get (),
+                              ecore_x_window_root_get (_control_window),
+                              ecore_x_atom_get ("GNB_WIN"),
+                              0, G_MAXLONG, False, XA_WINDOW, &type_return,
+                              &format_return, &nitems_return, &bytes_after_return,
+                              &data);
+
+    if (ret == Success) {
+        if ((type_return == XA_WINDOW) && (format_return == 32) && (data)) {
+            gnb_window = *(Window *)data;
+            if (data)
+                XFree (data);
+        }
+    } else {
+        std::cerr << "XGetWindowProperty () is failed!!!\n";
+    }
+
+    return gnb_window;
+}
+
 static Ecore_X_Window efl_get_quickpanel_window (void)
 {
     SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";