compositor: Loop and retry to get compositor selection when replacing
There are unavoidable race conditions here when another process is replacing us. As a band aid, loop for 5 seconds. https://bugzilla.gnome.org/show_bug.cgi?id=653121
This commit is contained in:
parent
b533ad2669
commit
c18940a5a2
@ -11,6 +11,7 @@
|
|||||||
#include <meta/compositor-mutter.h>
|
#include <meta/compositor-mutter.h>
|
||||||
#include "xprops.h"
|
#include "xprops.h"
|
||||||
#include <meta/prefs.h>
|
#include <meta/prefs.h>
|
||||||
|
#include <meta/main.h>
|
||||||
#include <meta/meta-shadow-factory.h>
|
#include <meta/meta-shadow-factory.h>
|
||||||
#include "meta-window-actor-private.h"
|
#include "meta-window-actor-private.h"
|
||||||
#include "meta-window-group.h"
|
#include "meta-window-group.h"
|
||||||
@ -474,20 +475,37 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
|||||||
gint width, height;
|
gint width, height;
|
||||||
XWindowAttributes attr;
|
XWindowAttributes attr;
|
||||||
long event_mask;
|
long event_mask;
|
||||||
|
guint n_retries;
|
||||||
|
guint max_retries;
|
||||||
|
|
||||||
/* Check if the screen is already managed */
|
/* Check if the screen is already managed */
|
||||||
if (meta_screen_get_compositor_data (screen))
|
if (meta_screen_get_compositor_data (screen))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_error_trap_push_with_return (display);
|
if (meta_get_replace_current_wm ())
|
||||||
XCompositeRedirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
|
max_retries = 5;
|
||||||
XSync (xdisplay, FALSE);
|
else
|
||||||
|
max_retries = 1;
|
||||||
|
|
||||||
if (meta_error_trap_pop_with_return (display))
|
n_retries = 0;
|
||||||
|
|
||||||
|
/* We can race with an exiting process to claim compositing over the root window;
|
||||||
|
* There's really not a great way to deal with this, so we just sleep and retry.
|
||||||
|
*/
|
||||||
|
while (TRUE)
|
||||||
{
|
{
|
||||||
g_warning ("Another compositing manager is running on screen %i",
|
meta_error_trap_push_with_return (display);
|
||||||
screen_number);
|
XCompositeRedirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
|
||||||
return;
|
XSync (xdisplay, FALSE);
|
||||||
|
|
||||||
|
if (!meta_error_trap_pop_with_return (display))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (n_retries == max_retries)
|
||||||
|
g_error ("Another compositing manager is running on screen %i", screen_number);
|
||||||
|
|
||||||
|
n_retries++;
|
||||||
|
g_usleep (G_USEC_PER_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
info = g_new0 (MetaCompScreen, 1);
|
info = g_new0 (MetaCompScreen, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user