bugfix: potential/maybe fix of e checking for itself on startup
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 26 Jan 2014 23:21:28 +0000 (08:21 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sun, 26 Jan 2014 23:21:28 +0000 (08:21 +0900)
unknown if this fixes the issue as i can't reproduce it.

src/bin/e_hints.c

index d32c7f0..e0986ce 100644 (file)
@@ -134,35 +134,47 @@ e_hints_init(Ecore_Window root, Ecore_Window propwin)
         twin = win;
         for (;; )
           {
+             Ecore_X_Window selfwin = 0;
+             
+             /* check that supporting wm win points to itself to be valid */
+             nwins = ecore_x_window_prop_window_get(twin,
+                                                    ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
+                                                    &selfwin, 1);
              if (nwins < 1) break;
-             if (twin != win) break;
+             if (selfwin != twin) break;
+             /* check the wm is e */
              if (ecore_x_netwm_name_get(twin, &name))
                {
                   if (name)
                     {
+                       /* if it is NOT e - don't care here as all this code is dealing with e restarts */
                        if (strcmp(name, "Enlightenment"))
                          {
                             free(name);
                             break;
                          }
-                       nwins = ecore_x_window_prop_window_get(root,
-                                                              ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
-                                                              &twin, 1);
-                       if (nwins < 1) break;
                        free(name);
                     }
+                  /* no name - not e - don't care */
+                  else
+                    break;
                }
              else
-               if (ecore_x_error_code_get()) break; //some dead window
+               /* can't get name - obviously not e */
+               break;
+             /* have we been spinning too long? 2 sec */
              if ((ecore_time_get() - ts) > 2.0)
                {
                   e_error_message_show(_("A previous instance of Enlightenment is still active\n"
                                          "on this screen. Aborting startup.\n"));
                   exit(1);
                }
+             /* get/check agan */
              nwins = ecore_x_window_prop_window_get(root,
                                                     ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
                                                     &twin, 1);
+             if (nwins < 1) break;
+             if (twin != win) break;
           }
      }