mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58:08 +01:00
fixed crash on restart bug
This commit is contained in:
@@ -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)
|
||||||
@@ -196,8 +181,35 @@ RestoreDesktop(WScreen *scr)
|
|||||||
}
|
}
|
||||||
core = next;
|
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);
|
XUngrabServer(dpy);
|
||||||
XSetInputFocus(dpy, PointerRoot, RevertToParent, CurrentTime);
|
XSetInputFocus(dpy, PointerRoot, RevertToParent, CurrentTime);
|
||||||
wColormapInstallForWindow(scr, NULL);
|
wColormapInstallForWindow(scr, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user