discomfitor pushed a commit to branch enlightenment-0.21.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=84091de5155048f1ea8ba9e053f8fad4e79b26a8

commit 84091de5155048f1ea8ba9e053f8fad4e79b26a8
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Mar 17 14:00:24 2017 -0400

    block x11 focus eventing under xwayland
    
    ensure that focus changes come from the compositor and not from clients
---
 src/bin/e_comp_x.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
index 165aec8..d9c9532 100644
--- a/src/bin/e_comp_x.c
+++ b/src/bin/e_comp_x.c
@@ -122,7 +122,10 @@ _e_comp_x_focus_check(void)
      {
         focus_canvas_time = ecore_x_current_time_get();
         focus_time = 0;
-        e_grabinput_focus(e_comp->ee_win, E_FOCUS_METHOD_PASSIVE);
+        if (e_comp->comp_type == E_PIXMAP_TYPE_X)
+          e_grabinput_focus(e_comp->ee_win, E_FOCUS_METHOD_PASSIVE);
+        else
+          e_grabinput_focus(e_comp->root, E_FOCUS_METHOD_PASSIVE);
      }
 }
 
@@ -2888,6 +2891,22 @@ _e_comp_x_focus_in(void *data EINA_UNUSED, int type 
EINA_UNUSED, Ecore_X_Event_W
    E_Client *ec, *focused;
 
    ec = _e_comp_x_client_find_by_window(ev->win);
+
+   if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
+     {
+        focused = e_client_focused_get();
+        if (ec && focused)
+          {
+             if ((!ec->override) && (ec != focused))
+               {
+                  ecore_x_window_focus(e_client_util_win_get(focused));
+                  
ecore_x_icccm_take_focus_send(e_client_util_win_get(focused), 
ecore_x_current_time_get());
+               }
+          }
+        else
+          ecore_x_window_focus(e_comp->root);
+        return ECORE_CALLBACK_RENEW;
+     }
    if (!ec)
      {
         if ((ev->win == e_comp->ee_win) && (ev->time >= focus_canvas_time) && 
(!focus_time))
@@ -4623,7 +4642,7 @@ _e_comp_x_hook_client_focus_set_job(void *d EINA_UNUSED)
    focus_canvas_time = 0;
    if (!e_client_has_xwindow(ec))
      {
-        e_grabinput_focus(e_comp->ee_win, E_FOCUS_METHOD_PASSIVE);
+        e_grabinput_focus(e_comp->root, E_FOCUS_METHOD_PASSIVE);
         return;
      }
    _e_comp_x_focus_setdown(ec);
@@ -5609,7 +5628,8 @@ e_comp_x_init(void)
    E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_MAPPING_CHANGE, 
_e_comp_x_mapping_change, NULL);
 
    E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_IN, 
_e_comp_x_focus_in, NULL);
-   E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_OUT, 
_e_comp_x_focus_out, NULL);
+   if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
+     E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_FOCUS_OUT, 
_e_comp_x_focus_out, NULL);
 
    E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST,
                          _e_comp_x_move_resize_request, NULL);

-- 


Reply via email to