devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2bc6754d395ca645ce29359dab3be757edb28064

commit 2bc6754d395ca645ce29359dab3be757edb28064
Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Sep 26 11:23:01 2019 -0400

    ecore-x: track whether ecore-x is internally "managing" the root window
    
    Summary:
    when ecore_x_window_manage is called, this is probably only for the case of
    managing the root window, i.e., running a window manager. store this state
    internally so that we can avoid calling additional XSelectInput later and
    fucking up the expected eventing
    
    Depends on D9899
    
    Reviewers: devilhorns
    
    Reviewed By: devilhorns
    
    Subscribers: devilhorns, cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D10012
---
 src/lib/ecore_x/ecore_x.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/lib/ecore_x/ecore_x.c b/src/lib/ecore_x/ecore_x.c
index 500ef19f65..8503addacd 100644
--- a/src/lib/ecore_x/ecore_x.c
+++ b/src/lib/ecore_x/ecore_x.c
@@ -779,7 +779,7 @@ ecore_x_init_from_display(Ecore_X_Display *display)
    eina_shutdown();
    return --_ecore_x_init_count;
 }
-
+static Eina_Bool _ecore_x_window_manage_succeeded = EINA_FALSE;
 int
 _ecore_x_shutdown(void)
 {
@@ -855,6 +855,7 @@ _ecore_x_shutdown(void)
    free(_ecore_x_event_handlers);
    _ecore_x_fd_handler_handle = NULL;
    _ecore_x_event_handlers = NULL;
+   _ecore_x_window_manage_succeeded = EINA_FALSE;
    _ecore_x_events_shutdown();
    _ecore_x_input_shutdown();
    _ecore_x_selection_shutdown();
@@ -1347,13 +1348,12 @@ ecore_x_window_root_first_get(void)
 
 static void _ecore_x_window_manage_error(void *data);
 
-static int _ecore_x_window_manage_failed = 0;
 static void
 _ecore_x_window_manage_error(void *data EINA_UNUSED)
 {
    if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) &&
        (ecore_x_error_code_get() == BadAccess))
-     _ecore_x_window_manage_failed = 1;
+     _ecore_x_window_manage_succeeded = EINA_FALSE;
 }
 
 EAPI Eina_Bool
@@ -1367,7 +1367,7 @@ ecore_x_window_manage(Ecore_X_Window win)
      return EINA_FALSE;
 
    ecore_x_sync();
-   _ecore_x_window_manage_failed = 0;
+   _ecore_x_window_manage_succeeded = EINA_TRUE;
    ecore_x_error_handler_set(_ecore_x_window_manage_error, NULL);
    XSelectInput(_ecore_x_disp, win,
                 EnterWindowMask |
@@ -1382,9 +1382,8 @@ ecore_x_window_manage(Ecore_X_Window win)
                 att.your_event_mask);
    ecore_x_sync();
    ecore_x_error_handler_set(NULL, NULL);
-   if (_ecore_x_window_manage_failed)
+   if (!_ecore_x_window_manage_succeeded)
      {
-        _ecore_x_window_manage_failed = 0;
         return EINA_FALSE;
      }
 

-- 


Reply via email to