mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
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
This commit is contained in:
parent
69dfd07a7f
commit
10c1903c72
@ -918,8 +918,6 @@ meta_display_open (void)
|
||||
|
||||
enable_compositor (the_display);
|
||||
|
||||
meta_display_grab (the_display);
|
||||
|
||||
/* Now manage all existing windows */
|
||||
tmp = the_display->screens;
|
||||
while (tmp != NULL)
|
||||
@ -971,8 +969,6 @@ meta_display_open (void)
|
||||
|
||||
meta_idle_monitor_init_dbus ();
|
||||
|
||||
meta_display_ungrab (the_display);
|
||||
|
||||
/* Done opening new display */
|
||||
the_display->display_opening = FALSE;
|
||||
|
||||
|
@ -887,8 +887,6 @@ meta_screen_manage_all_windows (MetaScreen *screen)
|
||||
Window *children;
|
||||
int n_children, i;
|
||||
|
||||
meta_display_grab (screen->display);
|
||||
|
||||
if (screen->guard_window == None)
|
||||
screen->guard_window = create_guard_window (screen->display->xdisplay,
|
||||
screen);
|
||||
@ -907,8 +905,6 @@ meta_screen_manage_all_windows (MetaScreen *screen)
|
||||
|
||||
g_free (children);
|
||||
meta_stack_thaw (screen->stack);
|
||||
|
||||
meta_display_ungrab (screen->display);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -792,11 +792,14 @@ meta_window_new (MetaDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Grab server */
|
||||
meta_display_grab (display);
|
||||
meta_error_trap_push (display); /* Push a trap over all of window
|
||||
* creation, to reduce XSync() calls
|
||||
*/
|
||||
/*
|
||||
* This function executes without any server grabs held. This means that
|
||||
* the window could have already gone away, or could go away at any point,
|
||||
* so we must be careful with X error handling.
|
||||
*/
|
||||
|
||||
if (!XGetWindowAttributes (display->xdisplay, xwindow, &attrs))
|
||||
{
|
||||
@ -1437,7 +1440,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;
|
||||
|
||||
@ -1453,7 +1455,6 @@ meta_window_new (MetaDisplay *display,
|
||||
|
||||
error:
|
||||
meta_error_trap_pop (display);
|
||||
meta_display_ungrab (display);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user