Support the Input Delegator self-termination 89/319489/2
authorInhong Han <inhong1.han@samsung.com>
Wed, 12 Feb 2025 00:40:01 +0000 (09:40 +0900)
committerInhong Han <inhong1.han@samsung.com>
Wed, 12 Feb 2025 04:03:22 +0000 (13:03 +0900)
Change-Id: I15c054f7a2a6eefd97b1342f3ae86f71969e9d67

src/e_mod_main.c

index 47b8094825c0bd54f235119fabb2dc07fc9b0d3b..458a81cb1285a2c5fb380375a977ea30ab0097ec 100644 (file)
@@ -145,6 +145,8 @@ static E_Text_Input *g_show_text_input = NULL;
 static struct wl_client *g_show_client = NULL;
 static Eina_Bool g_updated_geometry = EINA_FALSE;
 static Eina_Bool g_fullscreen_mode = EINA_FALSE;
+static E_Text_Input *g_fullscreen_text_input = NULL;
+static uint32_t g_input_hint = 0;
 static Ecore_Idler *g_vconf_idler = NULL;
 
 /* The candidate's show state that was requested by the application or IME */
@@ -1429,6 +1431,9 @@ _e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource *
                   angle += e_client_e_state_rot_angle_current_get(client_surface_ec);
                }
 
+             if (g_input_hint & WL_TEXT_INPUT_CONTENT_HINT_FULLSCREEN_MODE)
+               g_fullscreen_text_input = text_input;
+
              zwp_input_method_v1_send_show_input_panel(input_method->resource, input_method->context->resource, angle);
 
              /* we need to force update in order to release buffer
@@ -1508,6 +1513,8 @@ _e_text_input_cb_content_type_set(struct wl_client *client EINA_UNUSED, struct w
    else
      g_fullscreen_mode = EINA_FALSE;
 
+   g_input_hint = hint;
+
    EINA_LIST_FOREACH(text_input->input_methods, l, input_method)
      {
         if (!input_method || !input_method->context) continue;
@@ -1933,6 +1940,33 @@ _e_text_input_cb_input_panel_position_align_set(struct wl_client *client EINA_UN
      }
 }
 
+static void
+_e_text_input_terminate_fullscreen_input_panel(struct wl_client *client, struct wl_resource *resource)
+{
+   E_Text_Input *text_input = wl_resource_get_user_data(resource);
+   E_Input_Method *input_method = NULL;
+   Eina_Bool _context_created = EINA_FALSE;
+
+   CHECK_TEXT_INPUT(resource, text_input);
+
+   if (g_input_method && g_input_method->resource)
+     input_method = wl_resource_get_user_data(g_input_method->resource);
+
+   EINA_SAFETY_ON_NULL_RETURN(input_method);
+
+   if ((!input_method->context) || (!input_method->context->resource))
+     _context_created = _e_text_input_method_create_context(client, input_method, text_input, EINA_FALSE);
+
+   if (input_method->context && input_method->context->resource)
+     {
+        LOGI("Request to terminate the fullscreen input panel");
+        zwp_input_method_context_v1_send_client_destroyed(input_method->context->resource);
+     }
+
+   if (_context_created)
+     _e_text_input_deactivate(text_input, input_method, EINA_FALSE);
+}
+
 static void
 _e_text_input_cb_resource_destroy(struct wl_resource *resource)
 {
@@ -1953,6 +1987,12 @@ _e_text_input_cb_resource_destroy(struct wl_resource *resource)
         g_show_text_input = NULL;
      }
 
+   if (g_fullscreen_text_input == text_input)
+     {
+        _e_text_input_terminate_fullscreen_input_panel(g_client, resource);
+        g_fullscreen_text_input = NULL;
+     }
+
    if (g_text_input == text_input)
      {
         g_text_input = NULL;