1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

fixed crash on restart bug

This commit is contained in:
kojima
2000-04-08 23:53:22 +00:00
parent bdd5d5342b
commit 0b87b7fab9

View File

@@ -146,38 +146,23 @@ Shutdown(WShutdownMode mode)
/* static restoreWindows(WMBag *bag, WMBagIterator iter)
*----------------------------------------------------------------------
* RestoreDesktop--
* Puts the desktop in a usable state when exiting.
*
* Side effects:
* All frame windows are removed and windows are reparented
* back to root. Windows that are outside the screen are
* brought to a viable place.
*
*----------------------------------------------------------------------
*/
void
RestoreDesktop(WScreen *scr)
{ {
WMBagIterator iter; WCoreWindow *next;
WCoreWindow *core; WCoreWindow *core;
WWindow *wwin;
if (scr->helper_pid > 0) {
kill(scr->helper_pid, SIGTERM); if (iter == NULL) {
scr->helper_pid = 0; core = WMBagFirst(bag, &iter);
} else {
core = WMBagNext(bag, &iter);
} }
XGrabServer(dpy); if (core == NULL)
wDestroyInspectorPanels(); return;
/* reparent windows back to the root window, keeping the stacking order */ restoreWindows(bag, iter);
for (core = WMBagFirst(scr->stacking_list, &iter);
iter != NULL && core != NULL;
core = WMBagNext(scr->stacking_list, &iter)) {
WCoreWindow *next;
WWindow *wwin;
/* go to the end of the list */ /* go to the end of the list */
while (core->stacking->under) while (core->stacking->under)
@@ -198,6 +183,33 @@ RestoreDesktop(WScreen *scr)
} }
} }
/*
*----------------------------------------------------------------------
* RestoreDesktop--
* Puts the desktop in a usable state when exiting.
*
* Side effects:
* All frame windows are removed and windows are reparented
* back to root. Windows that are outside the screen are
* brought to a viable place.
*
*----------------------------------------------------------------------
*/
void
RestoreDesktop(WScreen *scr)
{
if (scr->helper_pid > 0) {
kill(scr->helper_pid, SIGTERM);
scr->helper_pid = 0;
}
XGrabServer(dpy);
wDestroyInspectorPanels();
/* reparent windows back to the root window, keeping the stacking order */
restoreWindows(scr->stacking_list, NULL);
XUngrabServer(dpy); XUngrabServer(dpy);
XSetInputFocus(dpy, PointerRoot, RevertToParent, CurrentTime); XSetInputFocus(dpy, PointerRoot, RevertToParent, CurrentTime);
wColormapInstallForWindow(scr, NULL); wColormapInstallForWindow(scr, NULL);