e_keyrouter: Fix key delivery in TOPMOST when focus client doesn't have surface
authorduna.oh <duna.oh@samsung.com>
Fri, 11 Apr 2025 01:20:57 +0000 (10:20 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 11 Apr 2025 10:06:10 +0000 (19:06 +0900)
This patch fixes the issue that no keyevent is sent to a app which keygrabs
with TOPMOST mode when a focus client doesn't have a surface.

Consider the following scenario,
Launchscreen client is on display (has focus but doesn't have surface),
At the same time QuickLaunch app is running and uses TOPMOST mode for keygrabbings.
Key events should be sent to QuickLaunch app.

Change-Id: I1c3e34ea63fbbb990eeed79abb142cb1ef747ea9

src/bin/inputmgr/e_keyrouter_events.c

index 1d72ab7a1d6d3c71c8a13322b04e219410cd5496..c93adc9718972127be33fb7de3f06e1fe0f2a641 100644 (file)
@@ -721,8 +721,8 @@ _e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev, E_Device *dev)
      }
    g_rec_mutex_unlock(&krt->grab_key_mutex);
 
-   // Top position grab must need a focus surface.
-   if (surface_focus)
+   // Top position grab must need a focus client.
+   if (ec_focus)
      {
         g_rec_mutex_lock(&krt->grab_key_mutex);
         Eina_List *top_ptr_list = krt->HardKeys[keycode].top_ptr;
@@ -730,7 +730,8 @@ _e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev, E_Device *dev)
           {
              if (key_node_data)
                {
-                  if ((EINA_FALSE == krt->isWindowStackChanged) && (surface_focus == key_node_data->surface))
+                  if ((EINA_FALSE == krt->isWindowStackChanged) &&
+                      (surface_focus && surface_focus == key_node_data->surface))
                     {
                        pid = e_keyrouter_util_get_pid(key_node_data->wc, key_node_data->surface);
                        cmd = e_keyrouter_util_cmd_get_from_pid(pid);
@@ -738,7 +739,7 @@ _e_keyrouter_send_key_events_press(int type, Ecore_Event_Key *ev, E_Device *dev)
 
                        _e_keyrouter_send_key_event(type, key_node_data->surface, NULL, ev, dev, key_node_data->focused,
                                                    TIZEN_KEYROUTER_MODE_TOPMOST);
-                       KLINF("TOPMOST (TOP_POSITION) : %s (%s:%d) => wl_surface (%p) (pid: %d) (pname: %s)",
+                       KLINF("TOPMOST (TOP & FOCUS) : %s (%s:%d) => wl_surface (%p) (pid: %d) (pname: %s)",
                                 ((ECORE_EVENT_KEY_DOWN == type) ? "Down" : "Up"), ev->keyname, ev->keycode,
                                 key_node_data->surface, pid, pname ?: "Unknown");