Modified to prevent setting invalid geometry of the floating IME 69/317469/1
authorInhong Han <inhong1.han@samsung.com>
Wed, 11 Sep 2024 00:02:41 +0000 (09:02 +0900)
committerInhong Han <inhong1.han@samsung.com>
Wed, 11 Sep 2024 00:02:41 +0000 (09:02 +0900)
Change-Id: If596d96d14e6aa5871d0f518404db67552fcda74

src/e_mod_input_panel.c

index df3d1999699a4279c3af005401bc7b480323a70f..42e40b55aca7ca8eac67219087e26572487980fd 100644 (file)
@@ -152,6 +152,27 @@ _e_input_panel_surface_get(E_Client *ec)
    return NULL;
 }
 
+static E_Input_Panel_Surface *
+_e_input_floating_panel_surface_get()
+{
+   E_Input_Panel_Surface *floating_ips = NULL;
+   E_Input_Panel_Surface *ips = NULL;
+   Eina_List *l;
+   Eina_List *l_next;
+
+   EINA_LIST_FOREACH_SAFE(g_input_panel->surfaces, l, l_next, ips)
+     {
+        if (!ips || !ips->ec) continue;
+        if (e_client_view_get(ips->ec) && ips->ec->vkbd.floating)
+          {
+             floating_ips = ips;
+             break;
+          }
+     }
+
+   return floating_ips;
+}
+
 static void
 _e_input_panel_start_drawing(E_Input_Panel_Surface *ips)
 {
@@ -1681,20 +1702,9 @@ e_input_panel_floating_position_set(int x, int y)
    int cur_angle;
    E_Client *floating_ec = NULL;
    E_Input_Panel_Surface *floating_ips = NULL;
-   E_Input_Panel_Surface *ips = NULL;
-   Eina_List *l;
-   Eina_List *l_next;
 
-   EINA_LIST_FOREACH_SAFE(g_input_panel->surfaces, l, l_next, ips)
-     {
-        if (!ips || !ips->ec) continue;
-        if (e_client_view_get(ips->ec) && ips->ec->vkbd.floating)
-          {
-             floating_ec = ips->ec;
-             floating_ips = ips;
-             break;
-          }
-     }
+   floating_ips = _e_input_floating_panel_surface_get();
+   floating_ec = floating_ips->ec;
 
    if (!floating_ec || !floating_ips)
      {
@@ -1878,9 +1888,6 @@ void e_input_panel_pending_position_reset(void)
 void e_input_panel_floating_position_align_set(int x, int y, int align)
 {
    E_Input_Panel_Surface *floating_ips = NULL;
-   E_Input_Panel_Surface *ips = NULL;
-   Eina_List *l;
-   Eina_List *l_next;
 
    if (g_floating_info)
      {
@@ -1890,22 +1897,16 @@ void e_input_panel_floating_position_align_set(int x, int y, int align)
         g_floating_info->align = (E_Input_Panel_Align)align;
      }
 
-   EINA_LIST_FOREACH_SAFE(g_input_panel->surfaces, l, l_next, ips)
-     {
-        if (!ips || !ips->ec) continue;
-        if (e_client_view_get(ips->ec) && ips->ec->vkbd.floating)
-          {
-             floating_ips = ips;
-             break;
-          }
-     }
-
+   floating_ips = _e_input_floating_panel_surface_get();
    if (floating_ips && floating_ips->showing)
      _e_input_panel_floating_position_align_set(floating_ips->ec);
 }
 
 void e_input_panel_floating_panel_move_resize(int x, int y, int w, int h)
 {
+   E_Input_Panel_Surface *floating_ips = NULL;
+   int angle = 0;
+
    LOGI("x : %d, y : %d, w : %d, h : %d", x, y, w, h);
 
    if (g_floating_info->align_position.x >= 0 || g_floating_info->align_position.y >= 0)
@@ -1914,7 +1915,20 @@ void e_input_panel_floating_panel_move_resize(int x, int y, int w, int h)
         g_floating_info->align_position.y = -1;
      }
 
-   g_floating_info->new_width = w;
-   g_floating_info->new_height = h;
+   floating_ips = _e_input_floating_panel_surface_get();
+   if (floating_ips && floating_ips->ec)
+     angle = floating_ips->ec->e.state.rot.ang.curr;
+
+   if (angle == 90 || angle == 270)
+     {
+        g_floating_info->new_width = h;
+        g_floating_info->new_height = w;
+     }
+   else
+     {
+        g_floating_info->new_width = w;
+        g_floating_info->new_height = h;
+     }
+
    e_input_panel_floating_position_set(x, y);
 }