static unsigned clock_program(struct prog_window *window, unsigned args, int *keypress)
{
  int c;
  if(keypress)
  {
    if(!*keypress)
    {
      c = getch();
      desktop_iconmov(c);
      desktop_iconnav(c);
      *keypress = -1;
    }
    else if(*keypress == 13)
      return WM_ICONSELECT;
  }
  

  if(_VIDEO_MODE == video && *(int*)window->function_status != dostime()->s)
  {
    running_window = 0;
    *(int*)window->function_status = dostime()->s;
    window->window_grid[0]->text = human_date();
    draw_window(window, 1, 3);
    window->window_grid[0]->text = 0;
  }

  return ~WM_WINPROGACT;

}


static struct prog_window *init_clock_window(void)
{
  struct prog_window *retval = new_window(_RES_X-150, _RES_Y-(2*(_FONT_HEIGHT+2)), 150, _FONT_HEIGHT+2, "Clock", 0, 1, "ICONS/CLOCK.ICO", &clock_program);

  struct window_element *element = window_text(retval, 5, 1, 0, _WINDOW_BASICTEXTCOLOR);
  retval->function_status = malloc(sizeof(int));
  retval->menus.menubar = desktop_menu;
  retval->initialized = 1;
  return retval;
}
