|
@@ -284,12 +284,27 @@ void CallWindowEventNP(Window *w, int ev
|
|
|
void SetWindowDirty(const Window *w)
|
|
|
{
|
|
|
if (w == NULL) return;
|
|
|
SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height);
|
|
|
}
|
|
|
|
|
|
/** Find the Window whose parent pointer points to this window
|
|
|
* @parent w Window to find child of
|
|
|
* @return return a Window pointer that is the child of w, or NULL otherwise */
|
|
|
static Window *FindChildWindow(const Window *w)
|
|
|
{
|
|
|
Window* const *wz;
|
|
|
|
|
|
FOR_ALL_WINDOWS(wz) {
|
|
|
Window *v = *wz;
|
|
|
if (v->parent == w) return v;
|
|
|
}
|
|
|
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
/** Find the z-value of a window. A window must already be open
|
|
|
* or the behaviour is undefined but function should never fail */
|
|
|
Window **FindWindowZPosition(const Window *w)
|
|
|
{
|
|
|
Window **wz;
|
|
|
|
|
@@ -298,15 +313,20 @@ Window **FindWindowZPosition(const Windo
|
|
|
if (*wz == w) return wz;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void DeleteWindow(Window *w)
|
|
|
{
|
|
|
Window *v;
|
|
|
Window **wz;
|
|
|
if (w == NULL) return;
|
|
|
|
|
|
/* Delete any children a window might have in a head-recursive manner */
|
|
|
v = FindChildWindow(w);
|
|
|
if (v != NULL) DeleteWindow(v);
|
|
|
|
|
|
if (_thd.place_mode != VHM_NONE &&
|
|
|
_thd.window_class == w->window_class &&
|
|
|
_thd.window_number == w->window_number) {
|
|
|
ResetObjectToPlace();
|
|
|
}
|
|
|
|
|
@@ -314,12 +334,13 @@ void DeleteWindow(Window *w)
|
|
|
if (w->viewport != NULL) DeleteWindowViewport(w);
|
|
|
|
|
|
SetWindowDirty(w);
|
|
|
free(w->widget);
|
|
|
w->widget = NULL;
|
|
|
w->widget_count = 0;
|
|
|
w->parent = NULL;
|
|
|
|
|
|
/* Find the window in the z-array, and effectively remove it
|
|
|
* by moving all windows after it one to the left */
|
|
|
wz = FindWindowZPosition(w);
|
|
|
memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz);
|
|
|
_last_z_window--;
|