equal
deleted
inserted
replaced
306 * or the behaviour is undefined but function should never fail */ |
306 * or the behaviour is undefined but function should never fail */ |
307 Window **FindWindowZPosition(const Window *w) |
307 Window **FindWindowZPosition(const Window *w) |
308 { |
308 { |
309 Window **wz; |
309 Window **wz; |
310 |
310 |
311 for (wz = _z_windows;; wz++) { |
311 for (wz = _z_windows; wz != _last_z_window; wz++) { |
312 assert(wz < _last_z_window); |
|
313 if (*wz == w) return wz; |
312 if (*wz == w) return wz; |
314 } |
313 } |
|
314 |
|
315 DEBUG(misc, 3, "Window (class %d, number %d) is not open, probably removed by recursive calls", |
|
316 w->window_class, w->window_number); |
|
317 return NULL; |
315 } |
318 } |
316 |
319 |
317 void DeleteWindow(Window *w) |
320 void DeleteWindow(Window *w) |
318 { |
321 { |
319 Window *v; |
322 Window *v; |
340 w->parent = NULL; |
343 w->parent = NULL; |
341 |
344 |
342 /* Find the window in the z-array, and effectively remove it |
345 /* Find the window in the z-array, and effectively remove it |
343 * by moving all windows after it one to the left */ |
346 * by moving all windows after it one to the left */ |
344 wz = FindWindowZPosition(w); |
347 wz = FindWindowZPosition(w); |
|
348 if (wz == NULL) return; |
345 memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz); |
349 memmove(wz, wz + 1, (byte*)_last_z_window - (byte*)wz); |
346 _last_z_window--; |
350 _last_z_window--; |
347 } |
351 } |
348 |
352 |
349 Window *FindWindowById(WindowClass cls, WindowNumber number) |
353 Window *FindWindowById(WindowClass cls, WindowNumber number) |