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:
@@ -146,38 +146,23 @@ Shutdown(WShutdownMode mode)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
* 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)
|
||||
static restoreWindows(WMBag *bag, WMBagIterator iter)
|
||||
{
|
||||
WMBagIterator iter;
|
||||
WCoreWindow *next;
|
||||
WCoreWindow *core;
|
||||
WWindow *wwin;
|
||||
|
||||
if (scr->helper_pid > 0) {
|
||||
kill(scr->helper_pid, SIGTERM);
|
||||
scr->helper_pid = 0;
|
||||
|
||||
if (iter == NULL) {
|
||||
core = WMBagFirst(bag, &iter);
|
||||
} else {
|
||||
core = WMBagNext(bag, &iter);
|
||||
}
|
||||
|
||||
XGrabServer(dpy);
|
||||
wDestroyInspectorPanels();
|
||||
if (core == NULL)
|
||||
return;
|
||||
|
||||
/* reparent windows back to the root window, keeping the stacking order */
|
||||
for (core = WMBagFirst(scr->stacking_list, &iter);
|
||||
iter != NULL && core != NULL;
|
||||
core = WMBagNext(scr->stacking_list, &iter)) {
|
||||
WCoreWindow *next;
|
||||
WWindow *wwin;
|
||||
restoreWindows(bag, iter);
|
||||
|
||||
/* go to the end of the list */
|
||||
while (core->stacking->under)
|
||||
@@ -196,8 +181,35 @@ RestoreDesktop(WScreen *scr)
|
||||
}
|
||||
core = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
* 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);
|
||||
XSetInputFocus(dpy, PointerRoot, RevertToParent, CurrentTime);
|
||||
wColormapInstallForWindow(scr, NULL);
|
||||
|
||||
Reference in New Issue
Block a user