- for (w_thr = get_win_before(w_test->id);
- w_test->start.y <= w_thr->start.y;
- w_thr = get_win_before(w_thr->id));
- uint16_t w_thr_bottom = w_thr->start.y + w_thr->frame_size.y;
- uint16_t free_width = (w_thr->start.x + w_thr->frame_size.x)
- - (w_test->start.x + w_test->frame_size.x);
- if ( w->frame_size.y < world.winDB.v_screen_size.y - w_thr_bottom
- && w->frame_size.x < free_width)
+ for (w_high = get_win_before(w_test->id); /* Walk down chain */
+ w_test->start.y <= w_high->start.y; /* until w_high starts */
+ w_high = get_win_before(w_high->id)); /* higher than w_test. */
+ next_free_y = w_high->start.y + w_high->frame_size.y + sep;
+ uint16_t first_free_x = w_test->start.x + w_test->frame_size.x +sep;
+ uint16_t last_free_x = w_high->start.x + w_high->frame_size.x;
+ if ( w->frame_size.y <= world.winDB.v_screen_size.y - next_free_y
+ && w->frame_size.x <= last_free_x - first_free_x)