[Xfce4-commits] [xfce/xfwm4] 01/01: Clean-up compositor state in case of error

noreply at xfce.org noreply at xfce.org
Sat Feb 28 12:53:42 CET 2015


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit 631bdbe28eb2b8ae671f67a1bbb39eaaa9848957
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Sat Feb 28 12:36:48 2015 +0100

    Clean-up compositor state in case of error
    
    If the compositor fails to start because another one is detected, clean
    up the status so we don't end up with a blank screen.
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/compositor.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 6c6d3af..1533fa7 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3419,20 +3419,23 @@ compositorManageScreen (ScreenInfo *screen_info)
     DisplayInfo *display_info;
     XRenderPictureAttributes pa;
     XRenderPictFormat *visual_format;
+    gint xerror;
 
     g_return_val_if_fail (screen_info != NULL, FALSE);
     TRACE ("entering compositorManageScreen");
 
     display_info = screen_info->display_info;
-    screen_info->compositor_active = FALSE;
+    screen_info->compositor_active = TRUE;
 
     gdk_error_trap_push ();
     XCompositeRedirectSubwindows (display_info->dpy, screen_info->xroot, display_info->composite_mode);
     XSync (display_info->dpy, FALSE);
+    xerror = gdk_error_trap_pop ();
 
-    if (gdk_error_trap_pop ())
+    if (xerror == BadAccess)
     {
         g_warning ("Another compositing manager is running on screen %i", screen_info->screen);
+        compositorUnmanageScreen (screen_info);
         return FALSE;
     }
 
@@ -3449,6 +3452,7 @@ compositorManageScreen (ScreenInfo *screen_info)
     if (!visual_format)
     {
         g_warning ("Cannot find visual format on screen %i", screen_info->screen);
+        compositorUnmanageScreen (screen_info);
         return FALSE;
     }
 
@@ -3489,6 +3493,7 @@ compositorManageScreen (ScreenInfo *screen_info)
     if (screen_info->rootPicture == None)
     {
         g_warning ("Cannot create root picture on screen %i", screen_info->screen);
+        compositorUnmanageScreen (screen_info);
         return FALSE;
     }
 
@@ -3506,7 +3511,6 @@ compositorManageScreen (ScreenInfo *screen_info)
     screen_info->rootTile = None;
     screen_info->allDamage = None;
     screen_info->cwindows = NULL;
-    screen_info->compositor_active = TRUE;
     screen_info->wins_unredirected = 0;
     screen_info->compositor_timeout_id = 0;
     screen_info->zoomed = 0;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list