[metacity] reduce server grabs during window creation



commit 73194072192fb46c91ba7a47bab7376ab5656a9c
Author: Daniel Drake <drake endlessm com>
Date:   Mon Dec 30 13:01:28 2013 -0600

    reduce server grabs during window creation
    
    Remove some obvious server grabs from the window creation codepath,
    also ones that are taken at startup.
    
    During startup, there is no need to grab: we install the event handlers
    before querying for the already-existing windows, so there is no danger
    that we will 'lose' some window. We might try to create a window twice
    (if it comes back in the original query and then we get an event for it)
    but the code is already protected against such conditions.
    
    When windows are created later, we also do not need grabs, we just need
    appropriate error checking as the window may be destroyed at any time
    (or it may have already been destroyed).
    
    The stack tracker is unaffected here - as it listens to CreateNotify and
    DestroyNotify events and responds directly, the internal stack
    representation will always be consistent even if the window goes away while
    we are processing MapRequest or similar.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721345

 src/core/display.c |    4 ----
 src/core/window.c  |    6 ------
 2 files changed, 0 insertions(+), 10 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index d228979..e37171c 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -683,8 +683,6 @@ meta_display_open (void)
      the code */
   update_compositor (the_display, FALSE);
 
-  meta_display_grab (the_display);
-
   /* Now manage all existing windows */
   meta_screen_manage_all_windows (the_display->screen);
 
@@ -713,8 +711,6 @@ meta_display_open (void)
                                               timestamp);
     }
 
-  meta_display_ungrab (the_display);
-
   /* Done opening new display */
   the_display->display_opening = FALSE;
 
diff --git a/src/core/window.c b/src/core/window.c
index 3f8d461..eab59db 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -287,7 +287,6 @@ meta_window_new (MetaDisplay    *display,
   gulong event_mask;
   MetaMoveResizeFlags flags;
 
-  meta_display_grab (display);
   meta_error_trap_push (display); /* Push a trap over all of window
                                    * creation, to reduce XSync() calls
                                    */
@@ -296,7 +295,6 @@ meta_window_new (MetaDisplay    *display,
     {
       meta_verbose ("Failed to get attributes for window 0x%lx\n", xwindow);
       meta_error_trap_pop (display);
-      meta_display_ungrab (display);
       return NULL;
     }
 
@@ -308,7 +306,6 @@ meta_window_new (MetaDisplay    *display,
     {
       meta_verbose ("Not managing our own windows\n");
       meta_error_trap_pop (display);
-      meta_display_ungrab (display);
       return NULL;
     }
 
@@ -338,7 +335,6 @@ meta_window_new (MetaDisplay    *display,
         {
           meta_verbose ("Deciding not to manage unmapped or unviewable window 0x%lx\n", xwindow);
           meta_error_trap_pop (display);
-          meta_display_ungrab (display);
           return NULL;
         }
 
@@ -389,7 +385,6 @@ meta_window_new (MetaDisplay    *display,
       meta_verbose ("Window 0x%lx disappeared just as we tried to manage it\n",
                     xwindow);
       meta_error_trap_pop (display);
-      meta_display_ungrab (display);
       return NULL;
     }
 
@@ -858,7 +853,6 @@ meta_window_new (MetaDisplay    *display,
     unminimize_window_and_all_transient_parents (window);
 
   meta_error_trap_pop (display); /* pop the XSync()-reducing trap */
-  meta_display_ungrab (display);
 
   window->constructing = FALSE;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]