bugfix: potential/maybe fix of e checking for itself on startup

unknown if this fixes the issue as i can't reproduce it.
This commit is contained in:
Carsten Haitzler 2014-01-27 08:21:28 +09:00
parent fa33846fe4
commit 04265d3b9f
1 changed files with 18 additions and 6 deletions

View File

@ -134,35 +134,47 @@ e_hints_init(Ecore_Window root, Ecore_Window propwin)
twin = win; twin = win;
for (;; ) 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 (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 (ecore_x_netwm_name_get(twin, &name))
{ {
if (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")) if (strcmp(name, "Enlightenment"))
{ {
free(name); free(name);
break; break;
} }
nwins = ecore_x_window_prop_window_get(root,
ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
&twin, 1);
if (nwins < 1) break;
free(name); free(name);
} }
/* no name - not e - don't care */
else
break;
} }
else 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) if ((ecore_time_get() - ts) > 2.0)
{ {
e_error_message_show(_("A previous instance of Enlightenment is still active\n" e_error_message_show(_("A previous instance of Enlightenment is still active\n"
"on this screen. Aborting startup.\n")); "on this screen. Aborting startup.\n"));
exit(1); exit(1);
} }
/* get/check agan */
nwins = ecore_x_window_prop_window_get(root, nwins = ecore_x_window_prop_window_get(root,
ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
&twin, 1); &twin, 1);
if (nwins < 1) break;
if (twin != win) break;
} }
} }