[Xfce4-commits] <xfwm4:master> Increase timeout for other WM to exit with "--replace", add visual feedback while waiting.

Olivier Fourdan noreply at xfce.org
Tue Oct 18 09:10:01 CEST 2011


Updating branch refs/heads/master
         to 006f92a6d3308a9cde8decd3e47d75f3c5181f5e (commit)
       from 407a67dc68bcf3e10406f2d79bc7c1d649f098f5 (commit)

commit 006f92a6d3308a9cde8decd3e47d75f3c5181f5e
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Tue Oct 18 09:07:08 2011 +0200

    Increase timeout for other WM to exit with "--replace",
    add visual feedback while waiting.

 src/screen.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/screen.c b/src/screen.c
index 9851387..1642a5d 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -50,6 +50,10 @@
 #include "compositor.h"
 #include "ui_style.h"
 
+#ifndef WM_EXITING_TIMEOUT
+#define WM_EXITING_TIMEOUT 15 /*seconds */
+#endif
+
 gboolean
 myScreenCheckWMAtom (ScreenInfo *screen_info, Atom atom)
 {
@@ -109,8 +113,9 @@ myScreenSetWMAtom (ScreenInfo *screen_info, gboolean replace_wm)
     /* Waiting for previous window manager to exit */
     if (current_wm)
     {
+        g_print ("Waiting for current window manager on screen %d to exit", screen_info->screen);
         wait = 0;
-        timeout = 10 * G_USEC_PER_SEC;
+        timeout = WM_EXITING_TIMEOUT * G_USEC_PER_SEC;
         while (wait < timeout)
         {
             if (XCheckWindowEvent (display_info->dpy, current_wm, StructureNotifyMask, &event) && (event.type == DestroyNotify))
@@ -119,13 +124,19 @@ myScreenSetWMAtom (ScreenInfo *screen_info, gboolean replace_wm)
             }
             g_usleep(G_USEC_PER_SEC / 10);
             wait += G_USEC_PER_SEC / 10;
+            if (wait % G_USEC_PER_SEC == 0)
+            {
+              g_print (".");
+            }
         }
 
         if (wait >= timeout)
         {
+            g_print(" Failed\n");
             g_warning("Previous window manager on screen %d is not exiting", screen_info->screen);
             return FALSE;
         }
+        g_print(" Done\n");
     }
     return TRUE;
 }


More information about the Xfce4-commits mailing list