e_mod_main: Send corrected x coord based on transform of input panel and client 04/310604/3
authorJunseok Kim <juns.kim@samsung.com>
Thu, 2 May 2024 12:36:00 +0000 (21:36 +0900)
committerJunseok Kim <juns.kim@samsung.com>
Thu, 2 May 2024 15:37:41 +0000 (00:37 +0900)
The coords of input panel was not consider the transform since using base output resolution.
However, It didn't matter that almost clients using base output resolution.

Multiple clients can now be displayed in multiple sizes without using the transform.
This caused a problem where the client created an entry in the wrong location if the untransformed geometry of the input panel was delivered as it is.

To fix this problem, modifiy to send the input panel geometry considering the transform of input panel and the client.

NOTE: If the same applies to the y coordinate, the y coordinate problem occurs in some C# apps.
Temporarily only the x coordinate was modified.

Change-Id: I1285b378b82320ad71f29135c1c4d79d9ba147f7

src/e_mod_main.c

index b3ccf78f5875d2b57e3a5ce3509cf5bec1048718..8eee01d551d16c78f602a6d981f66b66fc5158fe 100644 (file)
@@ -201,6 +201,12 @@ _e_text_input_send_input_panel_geometry(struct wl_resource *resource, int x, int
    int angle = 0;
    char geometry[128];
    int new_x = x;
+   int new_y = y;
+   int new_w = w;
+   int new_h = h;
+
+   E_Client *ips_ec = NULL;
+   Eina_List *l;
 
    if (client_surface_ec)
      {
@@ -208,19 +214,33 @@ _e_text_input_send_input_panel_geometry(struct wl_resource *resource, int x, int
                 client_surface_ec->e.state.rot.ang.curr :
                 client_surface_ec->e.state.rot.ang.next;
 
+        // find input panel
+        EINA_LIST_FOREACH(client_surface_ec->transients, l, ips_ec)
+          {
+             if (e_input_panel_client_find(ips_ec)) break;
+          }
+
         LOGI("curr : %d, next : %d, angle : %d\n", client_surface_ec->e.state.rot.ang.curr,
-           client_surface_ec->e.state.rot.ang.next, angle);
+             client_surface_ec->e.state.rot.ang.next, angle);
 
-        if (!(e_input_panel_floating_mode_get()))
+        if (ips_ec && !(e_input_panel_floating_mode_get()))
           {
-             int client_y, client_w, client_h;
-             e_client_base_output_resolution_desk_useful_geometry_get(client_surface_ec, &new_x, &client_y, &client_w, &client_h, EINA_TRUE);
+             if (e_client_transform_core_enable_get(ips_ec))
+               {
+                  e_client_transform_core_input_inv_transform(ips_ec, x, y, &new_x, &new_y);
+                  e_client_transform_core_input_inv_transform(ips_ec, w, h, &new_w, &new_h);
+                  LOGI("input panel using transform. (%d, %d, %dx%d) -> (%d, %d, %dx%d)", x, y, w, h, new_x, new_y, new_w, new_h);
 
-             if (angle == 0 || angle == 180)
-               new_x = (client_w - w) / 2;
-             else
-               new_x = (client_h - w) / 2;
+                  if (e_client_transform_core_enable_get(client_surface_ec))
+                    {
+                       e_client_transform_core_input_transform(client_surface_ec, new_x, new_y, &new_x, &new_y);
+                       e_client_transform_core_input_transform(client_surface_ec, new_w, new_h, &new_w, &new_h);
+                       LOGI("client_surface_ec using transform. (%d, %d, %dx%d) -> (%d, %d, %dx%d)", x, y, w, h, new_x, new_y, new_w, new_h);
+                    }
+               }
           }
+        else if (!ips_ec)
+          LOGI("couldn't find input panel client");
      }
 
    snprintf(geometry, sizeof(geometry), "%d,%d,%d,%d", new_x, y, w, h);