changing window size under PROGRAM control

David M. Laur dmlaur at phoenix.Princeton.EDU
Sat Jun 22 04:06:49 AEST 1991


In article <9106202215.AA06603 at nrc3d.nrc.uab.edu> jpg at NRC3D.NRC.UAB.EDU (Jill Gemmill) writes:
>	My reading of the documentation was that prefsize should be called
>before winopen() - which disallows any resizing; OR that prefsize should be
>called after the winopen(), followed by winconstraints().  That approach
>does not seem to work.
>	Can anyone think of way to do this without closing the window 
>down and opening another one of a different fixed size?
>

voici ...

/* -------------------------------------------------------- */

/*
 * resize a GL window
 * (if the window manager takes the hint)
 * to the specified new size (in pixels)
 *
 * note:
 *
 *    - this routine assumes you want the lower-left corner of
 *      the window to stay where it is, other logic is possible
 *
 *    - windows may not be bigger than the screen (WxH),
 *      although they may extend off the screen.
 *
 *    - if your image is bigger than the screen (WxH)
 *      you'll have to use a modified arg to lrectwrite;
 *      this is trivial on a VGX using pixmode to set a stride,
 *      but exceedingly painful on other IRIS's
 *
 *    - for some applications this routine builds a window
 *      which one pixel too big in x and y
 *
 *    - resizing the window generates a REDRAW event
 *
 *
 *  example call (request a 100x100 window):
 *
 *        winresize( winget(), 100, 100);
 */

void winresize ( int wid, int width, int height )
{
	long x,y,w,h, XM, YM;

	XM = getgdesc(GD_XPMAX);
	YM = getgdesc(GD_YPMAX);
	w = (width > XM) ? XM : width;
	h = (height > YM) ? YM : height;
	getorigin(&x, &y);
	winposition(x, x+w, y, y+h);
	prefsize(w, h);		/* re-disallow resize by user */
	winconstraints();
	/* warning: this will generate a REDRAW event for this window */
}

/* -------------------------------------------------------- */



More information about the Comp.sys.sgi mailing list