bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=841c8f477f47bcb21b347d62332f87adc2d6d7d8

commit 841c8f477f47bcb21b347d62332f87adc2d6d7d8
Author: Marcel Hollerbach <m...@marcel-hollerbach.de>
Date:   Sun Jan 9 15:33:18 2022 +0100

    focus: do not revert to another client when client is unfocused
    
    This was a nice idea to fix most focus bugs at once. However, due to the
    runtime of e many things can get "randomly" focused, for exmaple: volume
    control on the frame, internal dialogs, config value screens when
    grabbing for keys, widgets when they get created in a gadget. The list
    is quite long. However, fixing all those little bugs is hard and partly
    impossible as the behaviour is correct in the context of a toolkit, not
    in the context of a compositor.
    
    Long term we should split window-focus and canvas-focus from each other,
    then bugs like these would not be a problem anymore.
---
 src/bin/e_comp_object.c | 7 ++++---
 src/bin/e_comp_x.c      | 2 +-
 src/bin/e_desk.c        | 5 +++--
 src/bin/e_focus.c       | 5 +++--
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c
index 77720aa19..d960e4a80 100644
--- a/src/bin/e_comp_object.c
+++ b/src/bin/e_comp_object.c
@@ -1878,7 +1878,7 @@ _e_comp_intercept_focus(void *data, Evas_Object *obj, 
Eina_Bool focus)
    else
      {
         if (e_client_focused_get() == ec) {
-          e_client_revert_focus(ec);
+          e_client_focused_set(NULL);
         }
      }
    evas_object_focus_set(obj, focus);
@@ -2353,8 +2353,9 @@ _e_comp_smart_hide(Evas_Object *obj)
           edje_object_play_set(cw->frame_object, 0);
      }
    /* ensure focus-out */
-   if (cw->ec->focused)
-     evas_object_focus_set(cw->ec->frame, 0);
+   if (cw->ec->focused) {
+     e_client_revert_focus(cw->ec);
+   }
    e_comp_render_queue(); //force nocomp recheck
    e_comp_shape_queue();
 }
diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
index 2c742c616..8bc2c99d6 100644
--- a/src/bin/e_comp_x.c
+++ b/src/bin/e_comp_x.c
@@ -2884,7 +2884,7 @@ _e_comp_x_focus_out(void *data EINA_UNUSED, int type 
EINA_UNUSED, Ecore_X_Event_
         else if (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
           return ECORE_CALLBACK_PASS_ON;
      }
-   evas_object_focus_set(ec->frame, 0);
+   e_client_revert_focus(ec);
    return ECORE_CALLBACK_PASS_ON;
 }
 
diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c
index 0f3730541..6697e7a79 100644
--- a/src/bin/e_desk.c
+++ b/src/bin/e_desk.c
@@ -454,8 +454,9 @@ e_desk_last_focused_focus(E_Desk *desk)
           evas_object_raise(ecs->frame);
         return ecs;
      }
-   if (e_client_focused_get())
-     evas_object_focus_set(e_client_focused_get()->frame, 0);
+   if (e_client_focused_get()) {
+     e_client_revert_focus(e_client_focused_get());
+   }
    return NULL;
 }
 
diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c
index 537e48e88..0e59b7d0a 100644
--- a/src/bin/e_focus.c
+++ b/src/bin/e_focus.c
@@ -35,8 +35,9 @@ e_focus_event_mouse_out(E_Client *ec)
      {
         if (!ec->lock_focus_in)
           {
-             if (ec->focused)
-               evas_object_focus_set(ec->frame, 0);
+             if (ec->focused) {
+               e_client_revert_focus(ec);
+             }
           }
      }
    E_FREE_FUNC(ec->raise_timer, ecore_timer_del);

-- 


Reply via email to