e_comp_wl: change focus variable in input thread 60/310760/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 7 May 2024 09:38:57 +0000 (18:38 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Wed, 8 May 2024 01:34:15 +0000 (10:34 +0900)
Change-Id: Ia6da22a1a1180757b577bb5d8b6d6fa412fd855f
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_comp_wl.c

index 249044c8bdd8e621ac9f9ef8ce8198f9a9e636d0..08edc574c53af2cf74b7a767e05851cea47fc59e 100644 (file)
@@ -3109,6 +3109,19 @@ _e_comp_wl_connected_client_create(struct wl_client *client, char *name, pid_t p
    _e_comp_wl_pid_hook_call(E_COMP_WL_PID_HOOK_CONNECTED_CLIENT_CREATE, pid);
 }
 
+static void
+_e_input_thread_client_cb_focus_set(void *data)
+{
+   struct wl_resource *surface = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN(data);
+   surface = *(struct wl_resource **)data;
+
+   INF("[input thread|%s] surface(%p)", __func__, surface);
+
+   e_comp_input_key->kbd.focus = surface;
+}
+
 static void
 _e_comp_wl_client_cb_focus_set(void *data EINA_UNUSED, E_Client *ec)
 {
@@ -3121,7 +3134,22 @@ _e_comp_wl_client_cb_focus_set(void *data EINA_UNUSED, E_Client *ec)
           _e_comp_wl_configure_send(ec, 0, 0);
      }
 
-   e_comp_input_key->kbd.focus = ec->comp_data->surface;
+   INF("[%s] surface(%p)", __func__, ec->comp_data->surface);
+   e_input_thread_safe_call(_e_input_thread_client_cb_focus_set, (void *)&ec->comp_data->surface, sizeof(struct wl_resource *));
+}
+
+static void
+_e_input_thread_client_cb_focus_unset(void *data)
+{
+   struct wl_resource *surface = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN(data);
+   surface = *(struct wl_resource **)data;
+
+   INF("[input thread|%s] surface(%p)", __func__, surface);
+
+   if (e_comp_input_key->kbd.focus == surface)
+     e_comp_input_key->kbd.focus = NULL;
 }
 
 static void
@@ -3138,8 +3166,8 @@ _e_comp_wl_client_cb_focus_unset(void *data EINA_UNUSED, E_Client *ec)
 
    _e_comp_wl_focus_check();
 
-   if (e_comp_input_key->kbd.focus == ec->comp_data->surface)
-     e_comp_input_key->kbd.focus = NULL;
+   INF("[%s] surface(%p)", __func__, ec->comp_data->surface);
+   e_input_thread_safe_call(_e_input_thread_client_cb_focus_unset, (void *)&ec->comp_data->surface, sizeof(struct wl_resource *));
 }
 
 static void