/* wmdown.c (emx+gcc) -- Copyright (c) 1987-1993 by Eberhard Mattes */

#include <sys/winmgr.h>
#include "winmgr2.h"

void wm_down (wm_handle wh)
{
  int idx;
  wm_handle p;

  if (wh->used != WM_USED)
    return;
  idx = _wm_idx1 (wh);
  if (idx < 0 || idx == 0)
    return;
  _wm_idx[idx] = _wm_idx[idx-1]; _wm_idx[idx-1] = wh;
  _wm_hide1 ();                                      /* Hide lower windows */
  p = _wm_idx[idx];
  if (p->open && _wm_jam1 (wh, p))
    _wm_put1 (p);
}
