/*
  9box, a windows repacker
  Copyright (C) 2001  Benjamin Drieu <bdrieu@april.org>

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/* $Id: wm.c,v 1.1 2002/04/23 23:42:36 benj Exp $ */

#include <X11/Xlib.h>
#include <X11/Xutil.h>

#include "dat.h"
#include "fns.h"


void
set_title(Box * box, char * name)
{
  char * tmp_name;
  asprintf(&tmp_name, "9box: %s", name);
  XStoreName(box->dpy, box->win, tmp_name);
  free(tmp_name);
}


void
set_constraints_from_window(Box * box, Window window)
{
  XSizeHints hints;
  long supplied_return;

  XGetWMNormalHints(box->dpy, window, &hints, &supplied_return);

  hints.min_width += button_height();

  XSetWMNormalHints(box->dpy, box->win, &hints);

  printf(">> Constraints\n");

/*    printf("> Window %p\n" */
/*  	 "Flags: %d\n" */
/*  	 "X: %d\n" */
/*  	 "Y: %d\n" */
/*  	 "Width: %d\n" */
/*  	 "Height: %d\n" */
/*  	 "Min. width: %d\n" */
/*  	 "Min. heighgt: %d\n" */
/*  	 "Max. width: %d\n" */
/*  	 "Max. height: %d\n" */
/*  	 "Width inc.: %d\n" */
/*  	 "Height inc.: %d\n", */
/*  	 box->boxed_windows[client]->client, */
/*  	 hints.flags, */
/*  	 hints.x, */
/*  	 hints.y, */
/*  	 hints.width, */
/*  	 hints.height, */
/*  	 hints.min_width, */
/*  	 hints.min_height, */
/*  	 hints.max_width, */
/*  	 hints.max_height, */
/*  	 hints.width_inc, */
/*  	 hints.height_inc); */
}
